当前位置: 首页 > news >正文

Android 各个版本授予应用信息权限及单次弹窗确认权限

依次添加需要的权限,进行默认打开应用信息的权限开关;

以下是不同版本提供的不同的授权方法进行授权:

O版本:

/frameworks/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java

grantRuntimePermissionsLPw ()方法

    //*/ grant custom apk all permissions
            PackageParser.Package customApk = getPackageLPr("com.nrpptt.application");
            grantRuntimePermissionsLPw(customApk, STORAGE_PERMISSIONS, userId);
            grantRuntimePermissionsLPw(customApk, CAMERA_PERMISSIONS, userId);
            grantRuntimePermissionsLPw(customApk, MICROPHONE_PERMISSIONS, userId);
            grantRuntimePermissionsLPw(customApk, CONTACTS_PERMISSIONS, userId);
            grantRuntimePermissionsLPw(customApk, LOCATION_PERMISSIONS, userId);
        grantRuntimePermissionsLPw(customApk, PHONE_PERMISSIONS, userId);
        //*/

P版本:

/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java

grantRuntimePermissions()方法

   //*/allow soundrecorder permissions
         grantRuntimePermissions(getSystemPackage("com.android.soundrecorder");, STORAGE_PERMISSIONS, userId);
         grantRuntimePermissions(getSystemPackage("com.android.soundrecorder");, MICROPHONE_PERMISSIONS, userId);

grantRuntimePermissions(getSystemPackage("com.android.soundrecorder");, CAMERA_PERMISSIONS, userId);

...................................
     //*/

Q版本:

/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java

grantPermissionsToSystemPackage()方法

//*/

grantPermissionsToSystemPackage("com.veclink.vecsipsimple", userId,
                        CONTACTS_PERMISSIONS, MICROPHONE_PERMISSIONS,
                        PHONE_PERMISSIONS, SMS_PERMISSIONS, CAMERA_PERMISSIONS,
                        STORAGE_PERMISSIONS,ALWAYS_LOCATION_PERMISSIONS);

        //*/


        //*/add permision
        grantPermissionsToSystemPackage("com.iflytek.inputmethod", userId,
ALWAYS_LOCATION_PERMISSIONS,PHONE_PERMISSIONS,CONTACTS_PERMISSIONS,SMS_PERMISSIONS,MICROPHONE_PERMISSIONS,STORAGE_PERMISSIONS,CAMERA_PERMISSIONS);      
        //*/
        //*/add permision
        grantPermissionsToSystemPackage("com.shenyaocn.android.usbcamera", userId,
ALWAYS_LOCATION_PERMISSIONS,PHONE_PERMISSIONS,CONTACTS_PERMISSIONS,SMS_PERMISSIONS,MICROPHONE_PERMISSIONS,STORAGE_PERMISSIONS,CAMERA_PERMISSIONS);      
        //*/

R版本:

/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java

grantPermissionsToPackage()方法

grantPermissionsToSystemPackage()方法

//*/

grantPermissionsToPackage(pm, "com.veclink.vecsipsimple", userId, false, true,
                CAMERA_PERMISSIONS, ALWAYS_LOCATION_PERMISSIONS, MICROPHONE_PERMISSIONS,
                STORAGE_PERMISSIONS, PHONE_PERMISSIONS, SMS_PERMISSIONS);
        //*/

//*/

grantPermissionsToSystemPackage(pm, "com.corget", userId,
ALWAYS_LOCATION_PERMISSIONS,PHONE_PERMISSIONS,CONTACTS_PERMISSIONS,SMS_PERMISSIONS,MICROPHONE_PERMISSIONS,STORAGE_PERMISSIONS,CAMERA_PERMISSIONS);      
        //*/

S版本:

/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java

grantPermissionsToSystemPackage()


    private void grantDefaultSystemHandlerPermissions(PackageManagerWrapper pm, int userId) {
        Log.i(TAG, "Granting permissions to default platform handlers for user " + userId);

//*/grant all permissions in appinfo or single dialog : NOTIFICATION_PERMISSIONS
        grantPermissionsToSystemPackage(pm,"com.iflytek.speechcloud", userId,
ALWAYS_LOCATION_PERMISSIONS,PHONE_PERMISSIONS,CONTACTS_PERMISSIONS,SMS_PERMISSIONS,MICROPHONE_PERMISSIONS,STORAGE_PERMISSIONS,CAMERA_PERMISSIONS,CALENDAR_PERMISSIONS,SENSORS_PERMISSIONS,NEARBY_DEVICES_PERMISSIONS);
        //*/

 

T版本:

/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java

grantPermissionsToSystemPackage()方法

 //*/add permision
        grantPermissionsToSystemPackage(pm,"com.shli.interphone", userId,
ALWAYS_LOCATION_PERMISSIONS,PHONE_PERMISSIONS,CONTACTS_PERMISSIONS,SMS_PERMISSIONS,MICROPHONE_PERMISSIONS,STORAGE_PERMISSIONS,CAMERA_PERMISSIONS
,NEARBY_DEVICES_PERMISSIONS,CALENDAR_PERMISSIONS,NOTIFICATION_PERMISSIONS,SENSORS_PERMISSIONS);
        //*/
        //*/add permision
        grantPermissionsToSystemPackage(pm,"cn.com.ctsi.android.ctchat", userId,
ALWAYS_LOCATION_PERMISSIONS,PHONE_PERMISSIONS,CONTACTS_PERMISSIONS,SMS_PERMISSIONS,MICROPHONE_PERMISSIONS,STORAGE_PERMISSIONS,CAMERA_PERMISSIONS
,NEARBY_DEVICES_PERMISSIONS,CALENDAR_PERMISSIONS,NOTIFICATION_PERMISSIONS,SENSORS_PERMISSIONS);
        //*/ 


http://www.mrgr.cn/news/70464.html

相关文章:

  • Kafka参数了解
  • 【深度学习目标检测|YOLO算法5-2-1】YOLO家族进化史:从YOLOv1到YOLOv11的架构创新、性能优化与行业应用全解析...
  • 地区级的可视化地图不设计,进来看看超炫的样式吧
  • 一个简单ASP.NET购物车设计
  • linux命令详解,ssh服务+远程拷贝
  • 【大数据学习 | kafka高级部分】kafka的kraft集群
  • 每日算法练习
  • 海南华志亿星电子商务有限公司是真的吗?
  • 如何加密源代码?十条策略教你源代码防泄漏
  • 三种读取配置文件的方式
  • 基于卷积神经网络的桃子叶片病虫害识别与防治系统,vgg16,resnet,swintransformer,模型融合(pytorch框架,python代码)
  • Linux网络的基本设置
  • 为什么白帽SEO比黑帽SEO更值得坚持?
  • 大顶堆的基本操作
  • vivado+modelsim: xxx is not a function name
  • 吃透红利!AI绘画变现方法汇总|变现方式:哪一种最适合你?方法加实践,小白也能上手赚钱!
  • 创新体验触手可及 紫光展锐携手影目科技推出AI眼镜开放平台
  • 软件测试基础二十一(接口测试 数据库相关)
  • 解决编译 fast-lio-lc 算法时遇到的error方法
  • 2023年09月中国电子学会青少年软件编程(Python)等级考试试卷(三级)答案 + 解析
  • 过程自动化的新黄金标准:Ethernet-APL
  • 多点支撑:滚珠导轨的均匀分布优势!
  • QT栅格布局的妙用
  • 【reflex】Python一种更直观和高效的方式来管理事件流模块
  • TCP最后一次握⼿连接阶段,如果ACK包丢失会怎样?
  • qt QWidgetAction详解