Legacy VPN calls to require a userID
This way, system applications with INTERACT_ACROSS_USERS permission will
be able to fetch the information they need.
Pre-requisite for bug 21499103
Change-Id: I7e759d5039ae6e85abc6435049016b1dcaabc834
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index 29557bb..58035a2 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -114,7 +114,7 @@
void startLegacyVpn(in VpnProfile profile);
- LegacyVpnInfo getLegacyVpnInfo();
+ LegacyVpnInfo getLegacyVpnInfo(int userId);
VpnInfo[] getAllVpnInfo();
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 7f124dc..5044ba9 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -3112,11 +3112,11 @@
* are checked in Vpn class.
*/
@Override
- public LegacyVpnInfo getLegacyVpnInfo() {
+ public LegacyVpnInfo getLegacyVpnInfo(int userId) {
+ enforceCrossUserPermission(userId);
throwIfLockdownEnabled();
- int user = UserHandle.getUserId(Binder.getCallingUid());
synchronized(mVpns) {
- return mVpns.get(user).getLegacyVpnInfo();
+ return mVpns.get(userId).getLegacyVpnInfo();
}
}