diff options
author | Robin Lee <rgl@google.com> | 2015-05-19 10:14:55 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-19 10:14:59 +0000 |
commit | 3e5484d452cdf9f98e3c0e1abfe4a7297753cb5e (patch) | |
tree | e89913b42bd61f9ffdaf8648c3f5117e843ffc8d /core/java/android/net | |
parent | c6767354c5c2e32648c7404b73878a8ae66dd3c8 (diff) | |
parent | 3b3dd942ec6a0beaccd1cef0723d72786435d8f3 (diff) | |
download | frameworks_base-3e5484d452cdf9f98e3c0e1abfe4a7297753cb5e.zip frameworks_base-3e5484d452cdf9f98e3c0e1abfe4a7297753cb5e.tar.gz frameworks_base-3e5484d452cdf9f98e3c0e1abfe4a7297753cb5e.tar.bz2 |
Merge "Support cross-user VPN calls (with permission)" into mnc-dev
Diffstat (limited to 'core/java/android/net')
-rw-r--r-- | core/java/android/net/IConnectivityManager.aidl | 6 | ||||
-rw-r--r-- | core/java/android/net/VpnService.java | 9 |
2 files changed, 8 insertions, 7 deletions
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl index 77200a5..c1b4a1f 100644 --- a/core/java/android/net/IConnectivityManager.aidl +++ b/core/java/android/net/IConnectivityManager.aidl @@ -106,13 +106,13 @@ interface IConnectivityManager ProxyInfo getDefaultProxy(); - boolean prepareVpn(String oldPackage, String newPackage); + boolean prepareVpn(String oldPackage, String newPackage, int userId); - void setVpnPackageAuthorization(boolean authorized); + void setVpnPackageAuthorization(String packageName, int userId, boolean authorized); ParcelFileDescriptor establishVpn(in VpnConfig config); - VpnConfig getVpnConfig(); + VpnConfig getVpnConfig(int userId); void startLegacyVpn(in VpnProfile profile); diff --git a/core/java/android/net/VpnService.java b/core/java/android/net/VpnService.java index a0e65eb..2bb48b3 100644 --- a/core/java/android/net/VpnService.java +++ b/core/java/android/net/VpnService.java @@ -156,7 +156,7 @@ public class VpnService extends Service { */ public static Intent prepare(Context context) { try { - if (getService().prepareVpn(context.getPackageName(), null)) { + if (getService().prepareVpn(context.getPackageName(), null, UserHandle.myUserId())) { return null; } } catch (RemoteException e) { @@ -182,10 +182,11 @@ public class VpnService extends Service { String packageName = context.getPackageName(); try { // Only prepare if we're not already prepared. - if (!cm.prepareVpn(packageName, null)) { - cm.prepareVpn(null, packageName); + int userId = UserHandle.myUserId(); + if (!cm.prepareVpn(packageName, null, userId)) { + cm.prepareVpn(null, packageName, userId); } - cm.setVpnPackageAuthorization(true); + cm.setVpnPackageAuthorization(packageName, userId, true); } catch (RemoteException e) { // ignore } |