Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2cf3aec authored by Svetoslav's avatar Svetoslav
Browse files

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
parent 84bf5822
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -7397,9 +7397,11 @@ public class PackageManagerService extends IPackageManager.Stub {
        if (replace) {
        if (replace) {
            ps.installPermissionsFixed = false;
            ps.installPermissionsFixed = false;
            if (!ps.isSharedUser()) {
                origPermissions = new PermissionsState(permissionsState);
                origPermissions = new PermissionsState(permissionsState);
                permissionsState.reset();
                permissionsState.reset();
            }
            }
        }
        permissionsState.setGlobalGids(mGlobalGids);
        permissionsState.setGlobalGids(mGlobalGids);
+4 −0
Original line number Original line Diff line number Diff line
@@ -74,4 +74,8 @@ final class PackageSetting extends PackageSettingBase {
    public boolean isSystem() {
    public boolean isSystem() {
        return (pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0;
        return (pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0;
    }
    }

    public boolean isSharedUser() {
        return sharedUser != null;
    }
}
}