summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Paul Hu <paulhu@google.com> 2020-12-11 10:49:04 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2020-12-11 10:49:04 +0000
commit5503eaee007a2617be5578f3eeb34db5a43fe0e7 (patch)
tree3b550dd2c8db0e5957400bba66e6cb24f6db05c0
parent1826155ca18642dd5fdc2c69e370a1ed53c0bf30 (diff)
parent8804e022853eb95a046cb061219810353c71bbe0 (diff)
Merge "Replace PackageManager @hide APIs" am: 18cf9c197a am: 8804e02285
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1523340 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I018004ee98ac6b9fada57972ca2affeb94ef4956
-rw-r--r--services/core/java/com/android/server/ConnectivityService.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index a42c86474460..d86744268662 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -5579,11 +5579,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
}
private boolean checkUnsupportedStartingFrom(int version, String callingPackageName) {
- final PackageManager pm = mContext.getPackageManager();
- final int userId = UserHandle.getCallingUserId();
+ final UserHandle user = UserHandle.getUserHandleForUid(Binder.getCallingUid());
+ final PackageManager pm =
+ mContext.createContextAsUser(user, 0 /* flags */).getPackageManager();
try {
- final int callingVersion = pm.getApplicationInfoAsUser(
- callingPackageName, 0 /* flags */, userId).targetSdkVersion;
+ final int callingVersion = pm.getApplicationInfo(
+ callingPackageName, 0 /* flags */).targetSdkVersion;
if (callingVersion < version) return false;
} catch (PackageManager.NameNotFoundException e) { }
return true;