From 6047c1dc6835f50cfde286465c79183554f3bf4a Mon Sep 17 00:00:00 2001 From: Jeff Davidson Date: Mon, 11 Aug 2014 14:07:27 -0700 Subject: [PATCH] Less intrusive VPN dialog and other UX tweaks. -The ability to launch VPNs is now sticky; once approved by the user, further approvals are not needed UNLESS the connection is revoked in Quick Settings. -The old persistent notification has been removed in favor of the new Quick Settings UI. -The name of the VPN app is now pulled from the label of the VPN service rather than the app itself, if one is set. Bug: 12878887 Bug: 16578022 Change-Id: I102a14c05db26ee3aef030cda971e5165f078a91 --- 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 0814e0fc4b..b2fc3be27d 100644 --- a/core/java/android/net/IConnectivityManager.aidl +++ b/core/java/android/net/IConnectivityManager.aidl @@ -108,6 +108,8 @@ interface IConnectivityManager boolean prepareVpn(String oldPackage, String newPackage); + void setVpnPackageAuthorization(boolean authorized); + ParcelFileDescriptor establishVpn(in VpnConfig config); VpnConfig getVpnConfig(); diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 67c01e50bb..1d3daab228 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -2662,6 +2662,20 @@ public class ConnectivityService extends IConnectivityManager.Stub { } } + /** + * Set whether the current VPN package has the ability to launch VPNs without + * user intervention. This method is used by system UIs and not available + * in ConnectivityManager. Permissions are checked in Vpn class. + * @hide + */ + @Override + public void setVpnPackageAuthorization(boolean authorized) { + int user = UserHandle.getUserId(Binder.getCallingUid()); + synchronized(mVpns) { + mVpns.get(user).setPackageAuthorization(authorized); + } + } + /** * Configure a TUN interface and return its file descriptor. Parameters * are encoded and opaque to this class. This method is used by VpnBuilder