Commit e5660b24 authored by Nihar Thakkar's avatar Nihar Thakkar

Grant runtime permissions to Account Manager by default

parent 209929d3
...@@ -147,6 +147,12 @@ final class DefaultPermissionGrantPolicy { ...@@ -147,6 +147,12 @@ final class DefaultPermissionGrantPolicy {
STORAGE_PERMISSIONS.add(Manifest.permission.READ_EXTERNAL_STORAGE); STORAGE_PERMISSIONS.add(Manifest.permission.READ_EXTERNAL_STORAGE);
STORAGE_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE); STORAGE_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
} }
private static final Set<String> TASKS_PERMISSIONS = new ArraySet<>();
static {
TASKS_PERMISSIONS.add("org.dmfs.permission.READ_TASKS");
TASKS_PERMISSIONS.add("org.dmfs.permission.WRITE_TASKS");
}
private static final int MSG_READ_DEFAULT_PERMISSION_EXCEPTIONS = 1; private static final int MSG_READ_DEFAULT_PERMISSION_EXCEPTIONS = 1;
...@@ -701,6 +707,17 @@ final class DefaultPermissionGrantPolicy { ...@@ -701,6 +707,17 @@ final class DefaultPermissionGrantPolicy {
&& doesPackageSupportRuntimePermissions(storageManagerPckg)) { && doesPackageSupportRuntimePermissions(storageManagerPckg)) {
grantRuntimePermissionsLPw(storageManagerPckg, STORAGE_PERMISSIONS, true, userId); grantRuntimePermissionsLPw(storageManagerPckg, STORAGE_PERMISSIONS, true, userId);
} }
// Account Manager
PackageParser.Package accountManagerPackage = getSystemPackageLPr("foundation.e.accountmanager");
if (accountManagerPackage != null
&& doesPackageSupportRuntimePermissions(accountManagerPackage)) {
grantRuntimePermissionsLPw(accountManagerPackage, CONTACTS_PERMISSIONS, userId);
grantRuntimePermissionsLPw(accountManagerPackage, CALENDAR_PERMISSIONS, userId);
grantRuntimePermissionsLPw(accountManagerPackage, LOCATION_PERMISSIONS, userId);
grantRuntimePermissionsLPw(accountManagerPackage, TASKS_PERMISSIONS, userId);
}
mService.mSettings.onDefaultRuntimePermissionsGrantedLPr(userId); mService.mSettings.onDefaultRuntimePermissionsGrantedLPr(userId);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment