diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 65c2ab72c829..62f8a971c276 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -21326,14 +21326,14 @@ private void installPlay(int targetUserId, int callerUserId) { // as this is not possible later if changing that setting is blocked // It will appear as "set by admin" - final ApplicationInfo storeAi = mIPackageManager.getApplicationInfo( + final int storeUid = mIPackageManager.getPackageUid( PackageId.PLAY_STORE_NAME, /* flags= */ 0, targetUserId); - mInjector.getAppOpsManager().setMode(AppOpsManager.OP_REQUEST_INSTALL_PACKAGES, storeAi.uid, + mInjector.getAppOpsManager().setMode(AppOpsManager.OP_REQUEST_INSTALL_PACKAGES, storeUid, PackageId.PLAY_STORE_NAME, MODE_ALLOWED); Slogf.d(LOG_TAG, "Granting USER_TRUSTED_SOURCE to Play Store"); - mInjector.getAppOpsManager().setMode(AppOpsManager.OP_USER_TRUSTED_SOURCE, storeAi.uid, + mInjector.getAppOpsManager().setMode(AppOpsManager.OP_USER_TRUSTED_SOURCE, storeUid, PackageId.PLAY_STORE_NAME, MODE_ALLOWED); } catch (RemoteException e) { // Does not happen, same process