Do not clear a shared user's permissions on an app install.

When regranting permissions for an app during an install if
that app is in a shared user we should not clear the permissions
as the permissions for the shared user are additive and go away
when apps requesting them are uninstalled.

bug:20050689

Change-Id: I82aa70669fc25a45e7020a1545b093db5525f5cf
This commit is contained in:
Svetoslav
2015-04-02 16:51:55 -07:00
parent 84bf582208
commit d2cf3aec60
2 changed files with 8 additions and 2 deletions

View File

@@ -7397,8 +7397,10 @@ public class PackageManagerService extends IPackageManager.Stub {
if (replace) {
ps.installPermissionsFixed = false;
origPermissions = new PermissionsState(permissionsState);
permissionsState.reset();
if (!ps.isSharedUser()) {
origPermissions = new PermissionsState(permissionsState);
permissionsState.reset();
}
}
permissionsState.setGlobalGids(mGlobalGids);

View File

@@ -74,4 +74,8 @@ final class PackageSetting extends PackageSettingBase {
public boolean isSystem() {
return (pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0;
}
public boolean isSharedUser() {
return sharedUser != null;
}
}