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
This commit is contained in:
Todd Kennedy
2017-06-07 14:46:02 -07:00
parent 4e4769c120
commit 96a7326d90

View File

@@ -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) {