From 17d601ea441b5e5f6bbad36fbec9a6523f1deebb Mon Sep 17 00:00:00 2001 From: Hai Zhang Date: Thu, 28 May 2020 21:35:15 +0000 Subject: [PATCH] Revert "Don't kill apps for OP_REQUEST_INSTALL_PACKAGES on targetSdk < 26." This reverts commit f488724013a026a1c2f49ef03f2ecd23571ceae2. Reason for revert: b/150819885#comment36 Fixes: 150819885 Test: atest CtsNoPermissionTestCases25 Change-Id: I393b639a8b825b4de471bdd1502da07005292735 --- .../android/server/StorageManagerService.java | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java index b48b303af2a63..ee0f71b9e9824 100644 --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -83,7 +83,6 @@ import android.content.res.ObbInfo; import android.database.ContentObserver; import android.net.Uri; import android.os.Binder; -import android.os.Build; import android.os.DropBoxManager; import android.os.Environment; import android.os.Handler; @@ -4663,10 +4662,6 @@ class StorageManagerService extends IStorageManager.Stub } public void onAppOpsChanged(int code, int uid, @Nullable String packageName, int mode) { - if (packageName == null) { - // This happens :( - return; - } final long token = Binder.clearCallingIdentity(); try { if (mIsFuseEnabled) { @@ -4674,20 +4669,7 @@ class StorageManagerService extends IStorageManager.Stub switch(code) { case OP_REQUEST_INSTALL_PACKAGES: // Always kill regardless of op change, to remount apps /storage - try { - ApplicationInfo ai = mIPackageManager.getApplicationInfo( - packageName, - 0, UserHandle.getUserId(uid)); - if (ai.targetSdkVersion >= Build.VERSION_CODES.O) { - killAppForOpChange(code, uid, packageName); - } else { - // Apps targeting <26 didn't need this app op to install - // packages - they only need the manifest permission, instead. - // So, there's also no need to kill them. - } - } catch (RemoteException e) { - // Ignore, this is an in-process call - } + killAppForOpChange(code, uid, packageName); return; case OP_MANAGE_EXTERNAL_STORAGE: if (mode != MODE_ALLOWED) {