From 94f3c8c66d4330b3be137fa2d6cdb86b52b9e54a Mon Sep 17 00:00:00 2001 From: Chad Brubaker Date: Tue, 16 Jul 2013 18:59:12 -0700 Subject: [PATCH] Support multiple Vpn ManageDialogs Move away from storing the configs in the Intent to prevent issues with PendingIntents and multiple configs. The Dialog now queries ConnectivityService for the configuration to display in the management dialog. Change-Id: I0e0ef52db840152914d117a24f776d8106e836ff --- core/java/android/net/IConnectivityManager.aidl | 2 ++ .../com/android/server/ConnectivityService.java | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl index d537b32ff1..0a476eb88f 100644 --- a/core/java/android/net/IConnectivityManager.aidl +++ b/core/java/android/net/IConnectivityManager.aidl @@ -124,6 +124,8 @@ interface IConnectivityManager ParcelFileDescriptor establishVpn(in VpnConfig config); + VpnConfig getVpnConfig(); + void startLegacyVpn(in VpnProfile profile); LegacyVpnInfo getLegacyVpnInfo(); diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 476a6fdffb..3a4b7e382f 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -3425,6 +3425,20 @@ public class ConnectivityService extends IConnectivityManager.Stub { } } + /** + * Returns the information of the ongoing VPN. This method is used by VpnDialogs and + * not available in ConnectivityManager. + * Permissions are checked in Vpn class. + * @hide + */ + @Override + public VpnConfig getVpnConfig() { + int user = UserHandle.getUserId(Binder.getCallingUid()); + synchronized(mVpns) { + return mVpns.get(user).getVpnConfig(); + } + } + /** * Callback for VPN subsystem. Currently VPN is not adapted to the service * through NetworkStateTracker since it works differently. For example, it