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

Commit 96a7326d authored by Todd Kennedy's avatar Todd Kennedy
Browse files

expand who can uninstall an instant app

More than just those with the ACCESS_INSTANT_APP
permission should be able to uninstall instant apps.
Any uid that can see instant apps [that includes
the shell and some others] should be able to
uninstall them.

Change-Id: Iea24e5a1cdb369bdf29e7cf5db7977db63faedfc
Fixes: 62406346
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
parent 4e4769c1
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -3516,7 +3516,7 @@ public class PackageManagerService extends IPackageManager.Stub
     *     and {@code 0}</li>
     * <li>The calling application has the permission
     *     {@link android.Manifest.permission#ACCESS_INSTANT_APPS}</li>
     * <li>[TODO] The calling application is the default launcher on the
     * <li>The calling application is the default launcher on the
     *     system partition.</li>
     * </ol>
     */
@@ -18430,8 +18430,7 @@ public class PackageManagerService extends IPackageManager.Stub
        final int callingUid = Binder.getCallingUid();
        mContext.enforceCallingOrSelfPermission(
                android.Manifest.permission.DELETE_PACKAGES, null);
        final int hasAccessInstantApps = mContext.checkCallingOrSelfPermission(
                android.Manifest.permission.ACCESS_INSTANT_APPS);
        final boolean canViewInstantApps = canViewInstantApps(callingUid, userId);
        Preconditions.checkNotNull(versionedPackage);
        Preconditions.checkNotNull(observer);
        Preconditions.checkArgumentInRange(versionedPackage.getVersionCode(),
@@ -18502,7 +18501,7 @@ public class PackageManagerService extends IPackageManager.Stub
                    final boolean targetIsInstantApp =
                            ps.getInstantApp(UserHandle.getUserId(callingUid));
                    doDeletePackage = !targetIsInstantApp
                            || hasAccessInstantApps == PackageManager.PERMISSION_GRANTED;
                            || canViewInstantApps;
                }
                if (doDeletePackage) {
                    if (!deleteAllUsers) {