summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorjunyulai <junyulai@google.com>2021-03-19 20:23:45 +0800
committerjunyulai <junyulai@google.com>2021-03-22 18:14:37 +0800
commit2b57c52b03911297772dd9cb8ce3180a8c25c56b (patch)
tree8f3fb014f163a197ba672f50857ee29d1452c867 /services
parentefbd8b39615a3f539798bf71aa509332bae11e27 (diff)
Remove reference of getActiveLinkproperties
For callers who access the hidden API, replaced with public APIs. Test: atest FrameworksNetTests Bug: 182963397 Merged-In: Ic0e895c77cf3efb78ddc333c4f3b1016cebcfe17 Change-Id: Ic0e895c77cf3efb78ddc333c4f3b1016cebcfe17 (cherry-picked from ag/13929756)
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/VpnManagerService.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/VpnManagerService.java b/services/core/java/com/android/server/VpnManagerService.java
index 56aabc208027..d756c1ffd00f 100644
--- a/services/core/java/com/android/server/VpnManagerService.java
+++ b/services/core/java/com/android/server/VpnManagerService.java
@@ -352,7 +352,10 @@ public class VpnManagerService extends IVpnManager.Stub {
@Override
public void startLegacyVpn(VpnProfile profile) {
int user = UserHandle.getUserId(mDeps.getCallingUid());
- final LinkProperties egress = mCm.getActiveLinkProperties();
+ // Note that if the caller is not system (uid >= Process.FIRST_APPLICATION_UID),
+ // the code might not work well since getActiveNetwork might return null if the uid is
+ // blocked by NetworkPolicyManagerService.
+ final LinkProperties egress = mCm.getLinkProperties(mCm.getActiveNetwork());
if (egress == null) {
throw new IllegalStateException("Missing active network connection");
}