美文网首页
Android R 移除通讯录权限检测

Android R 移除通讯录权限检测

作者: gale_小米 | 来源:发表于2021-12-15 14:14 被阅读0次

    客制需求:移除通讯录应用并且需要移除权限管理器里面的通讯录权限;

    定位权限管理进程 com.android.permissioncontroller

    Index: Utils.java
    ===================================================================
    --- Utils.java  (revision 11950)
    +++ Utils.java  (working copy)
    @@ -166,11 +166,11 @@
     
         static {
             PLATFORM_PERMISSIONS = new ArrayMap<>();
    -
    +        /*
             PLATFORM_PERMISSIONS.put(Manifest.permission.READ_CONTACTS, CONTACTS);
             PLATFORM_PERMISSIONS.put(Manifest.permission.WRITE_CONTACTS, CONTACTS);
             PLATFORM_PERMISSIONS.put(Manifest.permission.GET_ACCOUNTS, CONTACTS);
    -
    +        */
             PLATFORM_PERMISSIONS.put(Manifest.permission.READ_CALENDAR, CALENDAR);
             PLATFORM_PERMISSIONS.put(Manifest.permission.WRITE_CALENDAR, CALENDAR);
     
    @@ -231,7 +231,7 @@
             ONE_TIME_PERMISSION_GROUPS.add(MICROPHONE);
     
             PERM_GROUP_REQUEST_RES = new ArrayMap<>();
    -        PERM_GROUP_REQUEST_RES.put(CONTACTS, R.string.permgrouprequest_contacts);
    +        // PERM_GROUP_REQUEST_RES.put(CONTACTS, R.string.permgrouprequest_contacts);
             PERM_GROUP_REQUEST_RES.put(LOCATION, R.string.permgrouprequest_location);
             PERM_GROUP_REQUEST_RES.put(CALENDAR, R.string.permgrouprequest_calendar);
             PERM_GROUP_REQUEST_RES.put(SMS, R.string.permgrouprequest_sms);
    @@ -696,8 +696,8 @@
                 return false;
             }
             return Manifest.permission_group.SMS.equals(group)
    -                || Manifest.permission_group.PHONE.equals(group)
    -                || Manifest.permission_group.CONTACTS.equals(group);
    +                || Manifest.permission_group.PHONE.equals(group);
    +                // || Manifest.permission_group.CONTACTS.equals(group);
         }
     
         public static boolean isPermissionIndividuallyControlled(Context context, String permission) {
    @@ -704,9 +704,9 @@
             if (!context.getPackageManager().arePermissionsIndividuallyControlled()) {
                 return false;
             }
    -        return Manifest.permission.READ_CONTACTS.equals(permission)
    -                || Manifest.permission.WRITE_CONTACTS.equals(permission)
    -                || Manifest.permission.SEND_SMS.equals(permission)
    +        // Manifest.permission.READ_CONTACTS.equals(permission)
    +                // ||  Manifest.permission.WRITE_CONTACTS.equals(permission)
    +        return Manifest.permission.SEND_SMS.equals(permission)
                     || Manifest.permission.RECEIVE_SMS.equals(permission)
                     || Manifest.permission.READ_SMS.equals(permission)
                     || Manifest.permission.RECEIVE_MMS.equals(permission)
    @@ -844,8 +844,8 @@
                     return context.getString(R.string.permission_description_summary_call_log);
                 case CAMERA:
                     return context.getString(R.string.permission_description_summary_camera);
    -            case CONTACTS:
    -                return context.getString(R.string.permission_description_summary_contacts);
    +            // case CONTACTS:
    +                // return context.getString(R.string.permission_description_summary_contacts);
                 case LOCATION:
                     return context.getString(R.string.permission_description_summary_location);
                 case MICROPHONE:
    

    相关文章

      网友评论

          本文标题:Android R 移除通讯录权限检测

          本文链接:https://www.haomeiwen.com/subject/liqpfrtx.html