赋予应用权限

--- a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java

+++ b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java

@@ -611,6 +611,22 @@ final class DefaultPermissionGrantPolicy {

                }

            }

+            PackageParser.Package megasPackage = getSystemPackageLPr("com.your.packagename");

+            if (megasPackage != null && doesPackageSupportRuntimePermissions(megasPackage)) {

+                grantRuntimePermissionsLPw(megasPackage, CALENDAR_PERMISSIONS, userId);

+                grantRuntimePermissionsLPw(megasPackage, CAMERA_PERMISSIONS, userId);

+                grantRuntimePermissionsLPw(megasPackage, CONTACTS_PERMISSIONS, userId);

+                grantRuntimePermissionsLPw(megasPackage, LOCATION_PERMISSIONS, userId);

+                grantRuntimePermissionsLPw(megasPackage, MICROPHONE_PERMISSIONS, userId);

+                grantRuntimePermissionsLPw(megasPackage, PHONE_PERMISSIONS, userId);

+                grantRuntimePermissionsLPw(megasPackage, SENSORS_PERMISSIONS, userId);

+                grantRuntimePermissionsLPw(megasPackage, SMS_PERMISSIONS, userId);

+                grantRuntimePermissionsLPw(megasPackage, STORAGE_PERMISSIONS, userId);

+            }

+

+

            mService.mSettings.onDefaultRuntimePermissionsGrantedLPr(userId);

        }

    }

你可能感兴趣的:(赋予应用权限)