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

Commit 16ed6a45 authored by Jeff Davidson's avatar Jeff Davidson
Browse files

Correctly propagate permissions when uninstalling updates.

In ag/733689, which was intended to fix this bug, the following lines
were removed:

// Propagate the permissions state as we do want to drop on the floor
// runtime permissions. The update permissions method below will take
// care of removing obsolete permissions and grant install permissions.
ps.getPermissionsState().copyFrom(disabledPs.getPermissionsState());

The intent with these lines seemed to be that we needed to copy
permissions from the application on /data, which is being uninstalled,
over to the copy on /system, which was disabled but is being
reenabled. However, it wasn't functional, because it incorrectly
copied from the copy on /system, not the copy on /data.

Restore this code, copying from newPs (the copy on /data) rather than
disbledPs (the copy on /system), and clarify the comment because we do
*not* want to drop runtime permissions on the floor.

Bug: 22665508
Change-Id: I6bae37e70b6df1043c9a2b49255b985707ba151a
parent db221acc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -12942,6 +12942,10 @@ public class PackageManagerService extends IPackageManager.Stub {
        synchronized (mPackages) {
            PackageSetting ps = mSettings.mPackages.get(newPkg.packageName);
            // Propagate the permissions state as we do not want to drop on the floor
            // runtime permissions. The update permissions method below will take
            // care of removing obsolete permissions and grant install permissions.
            ps.getPermissionsState().copyFrom(newPs.getPermissionsState());
            updatePermissionsLPw(newPkg.packageName, newPkg,
                    UPDATE_PERMISSIONS_ALL | UPDATE_PERMISSIONS_REPLACE_PKG);