summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
author Paul Hu <paulhu@google.com> 2020-11-11 05:58:01 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2020-11-11 05:58:01 +0000
commitf67921a470ac35c1d541ad1a38256e2947e148eb (patch)
tree77a0b02f08e67b399eb0d49ab0a1bd8cef98142a /services
parent2c2b8ff2c3c92096b6b0ad11c431f86d6d485b3b (diff)
parentbe8e7530da69a8da033977792b7d209ff580947e (diff)
Merge "Replace AppGlobals @hide APIs" am: feb3a2ee1b am: be8e7530da
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1470942 Change-Id: Ie883a4bf8866b0ae7d3781d79eca62f71c28635f
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/connectivity/Vpn.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 2c29106c5cd3..411828c63fcc 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -33,7 +33,6 @@ import android.Manifest;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
-import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.Notification;
import android.app.NotificationManager;
@@ -1333,16 +1332,17 @@ public class Vpn {
// Restricted users are not allowed to create VPNs, they are tied to Owner
enforceNotRestrictedUser();
- ResolveInfo info = AppGlobals.getPackageManager().resolveService(intent,
- null, 0, mUserId);
+ final PackageManager packageManager = mUserIdContext.getPackageManager();
+ if (packageManager == null) {
+ throw new UnsupportedOperationException("Cannot get PackageManager.");
+ }
+ final ResolveInfo info = packageManager.resolveService(intent, 0 /* flags */);
if (info == null) {
throw new SecurityException("Cannot find " + config.user);
}
if (!BIND_VPN_SERVICE.equals(info.serviceInfo.permission)) {
throw new SecurityException(config.user + " does not require " + BIND_VPN_SERVICE);
}
- } catch (RemoteException e) {
- throw new SecurityException("Cannot find " + config.user);
} finally {
Binder.restoreCallingIdentity(token);
}