Skip to content

Commit 2d5c59c

Browse files
Jiao YuanGerrit - the friendly Code Review server
authored andcommitted
Show every single permission only for platform permission group
Package installer stopped when tap email permissions, because email defines an additional permission, but package installer can not find its group,so it throws null point exception, so show every single permission only for platform permission group. Change-Id: Ib56b4b4b6fef2ec112321787d34c35c211652a60
1 parent be2a8bf commit 2d5c59c

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/com/android/packageinstaller/permission/ui/handheld/AppPermissionsFragment.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ private void loadPreferences() {
241241
}
242242
mExtraScreen.addPreference(preference);
243243
}
244-
if (AppPermissionGroup.isStrictOpEnable()) {
244+
if (AppPermissionGroup.isStrictOpEnable() && isPlatform) {
245245
try {
246246
PackageManager pm = context.getPackageManager();
247247
for (Permission permission : group.getPermissions()) {
@@ -357,9 +357,11 @@ public boolean onPreferenceChange(final Preference preference, Object newValue)
357357
LocationUtils.showLocationDialog(getContext(), mAppPermissions.getAppLabel());
358358
return false;
359359
}
360+
361+
final boolean isPlatform = group.getDeclaringPackage().equals(Utils.OS_PKG);
360362
if (newValue == Boolean.TRUE) {
361363
group.grantRuntimePermissions(false);
362-
if (AppPermissionGroup.isStrictOpEnable()) {
364+
if (AppPermissionGroup.isStrictOpEnable() && isPlatform) {
363365
updateEveryPermissionPreference(group);
364366
}
365367
} else {
@@ -375,7 +377,7 @@ public boolean onPreferenceChange(final Preference preference, Object newValue)
375377
public void onClick(DialogInterface dialog, int which) {
376378
((SwitchPreference) preference).setChecked(false);
377379
group.revokeRuntimePermissions(false);
378-
if (AppPermissionGroup.isStrictOpEnable()) {
380+
if (AppPermissionGroup.isStrictOpEnable() && isPlatform) {
379381
updateEveryPermissionPreference(group);
380382
}
381383
if (!grantedByDefault) {
@@ -387,7 +389,7 @@ public void onClick(DialogInterface dialog, int which) {
387389
return false;
388390
} else {
389391
group.revokeRuntimePermissions(false);
390-
if (AppPermissionGroup.isStrictOpEnable()) {
392+
if (AppPermissionGroup.isStrictOpEnable() && isPlatform) {
391393
updateEveryPermissionPreference(group);
392394
}
393395
}

0 commit comments

Comments
 (0)