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
This commit is contained in:
Robin Lee
2015-07-07 12:28:13 -07:00
parent 169f662203
commit 35ca2e7768
2 changed files with 4 additions and 4 deletions

View File

@@ -114,7 +114,7 @@ interface IConnectivityManager
void startLegacyVpn(in VpnProfile profile); void startLegacyVpn(in VpnProfile profile);
LegacyVpnInfo getLegacyVpnInfo(); LegacyVpnInfo getLegacyVpnInfo(int userId);
VpnInfo[] getAllVpnInfo(); VpnInfo[] getAllVpnInfo();

View File

@@ -3112,11 +3112,11 @@ public class ConnectivityService extends IConnectivityManager.Stub
* are checked in Vpn class. * are checked in Vpn class.
*/ */
@Override @Override
public LegacyVpnInfo getLegacyVpnInfo() { public LegacyVpnInfo getLegacyVpnInfo(int userId) {
enforceCrossUserPermission(userId);
throwIfLockdownEnabled(); throwIfLockdownEnabled();
int user = UserHandle.getUserId(Binder.getCallingUid());
synchronized(mVpns) { synchronized(mVpns) {
return mVpns.get(user).getLegacyVpnInfo(); return mVpns.get(userId).getLegacyVpnInfo();
} }
} }