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

Commit 71ddb009 authored by Nikita Ioffe's avatar Nikita Ioffe
Browse files

Allow holders of INSTALL_PACKAGE_UPDATES permission to update APEXes

Test: atest CtsStagedInstallHostTestCases
Bug: 190802380
Change-Id: I061a8d1dcec147b1479eb1ce62e2f60093880d7e
parent 33fae67f
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -626,7 +626,14 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
        }
        }


        boolean isApex = (params.installFlags & PackageManager.INSTALL_APEX) != 0;
        boolean isApex = (params.installFlags & PackageManager.INSTALL_APEX) != 0;
        if (params.isStaged || isApex) {
        if (isApex) {
            if (mContext.checkCallingOrSelfPermission(Manifest.permission.INSTALL_PACKAGE_UPDATES)
                    == PackageManager.PERMISSION_DENIED
                    && mContext.checkCallingOrSelfPermission(Manifest.permission.INSTALL_PACKAGES)
                    == PackageManager.PERMISSION_DENIED) {
                throw new SecurityException("Not allowed to perform APEX updates");
            }
        } else if (params.isStaged) {
            mContext.enforceCallingOrSelfPermission(Manifest.permission.INSTALL_PACKAGES, TAG);
            mContext.enforceCallingOrSelfPermission(Manifest.permission.INSTALL_PACKAGES, TAG);
        }
        }