diff options
author | Jeff Davidson <jpd@google.com> | 2014-08-11 14:07:27 -0700 |
---|---|---|
committer | Jeff Davidson <jpd@google.com> | 2014-08-20 16:55:28 -0700 |
commit | 05542603dd4f1e0ea47a3dca01de3999a9a329a9 (patch) | |
tree | 69b8c0c2c2cec2e11b633c9232f7e97ad144b085 /core/java/com | |
parent | 23ad2790ed45d56eeb5d03c66531cb9b5811d6fe (diff) | |
download | frameworks_base-05542603dd4f1e0ea47a3dca01de3999a9a329a9.zip frameworks_base-05542603dd4f1e0ea47a3dca01de3999a9a329a9.tar.gz frameworks_base-05542603dd4f1e0ea47a3dca01de3999a9a329a9.tar.bz2 |
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
Diffstat (limited to 'core/java/com')
-rw-r--r-- | core/java/com/android/internal/net/LegacyVpnInfo.java | 3 | ||||
-rw-r--r-- | core/java/com/android/internal/net/VpnConfig.java | 29 |
2 files changed, 19 insertions, 13 deletions
diff --git a/core/java/com/android/internal/net/LegacyVpnInfo.java b/core/java/com/android/internal/net/LegacyVpnInfo.java index d6f6d0b..f812ad6 100644 --- a/core/java/com/android/internal/net/LegacyVpnInfo.java +++ b/core/java/com/android/internal/net/LegacyVpnInfo.java @@ -40,7 +40,6 @@ public class LegacyVpnInfo implements Parcelable { public String key; public int state = -1; - public PendingIntent intent; @Override public int describeContents() { @@ -51,7 +50,6 @@ public class LegacyVpnInfo implements Parcelable { public void writeToParcel(Parcel out, int flags) { out.writeString(key); out.writeInt(state); - out.writeParcelable(intent, flags); } public static final Parcelable.Creator<LegacyVpnInfo> CREATOR = @@ -61,7 +59,6 @@ public class LegacyVpnInfo implements Parcelable { LegacyVpnInfo info = new LegacyVpnInfo(); info.key = in.readString(); info.state = in.readInt(); - info.intent = in.readParcelable(null); return info; } diff --git a/core/java/com/android/internal/net/VpnConfig.java b/core/java/com/android/internal/net/VpnConfig.java index 0099269..aa66d7d 100644 --- a/core/java/com/android/internal/net/VpnConfig.java +++ b/core/java/com/android/internal/net/VpnConfig.java @@ -20,17 +20,19 @@ import android.app.PendingIntent; import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.pm.ResolveInfo; import android.content.res.Resources; +import android.net.LinkAddress; +import android.net.RouteInfo; import android.os.Parcel; import android.os.Parcelable; -import android.os.UserHandle; -import android.net.RouteInfo; -import android.net.LinkAddress; import java.net.Inet4Address; import java.net.InetAddress; -import java.util.List; import java.util.ArrayList; +import java.util.List; /** * A simple container used to carry information in VpnBuilder, VpnDialogs, @@ -55,12 +57,19 @@ public class VpnConfig implements Parcelable { return intent; } - public static PendingIntent getIntentForStatusPanel(Context context) { - Intent intent = new Intent(); - intent.setClassName(DIALOGS_PACKAGE, DIALOGS_PACKAGE + ".ManageDialog"); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY | - Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); - return PendingIntent.getActivityAsUser(context, 0, intent, 0, null, UserHandle.CURRENT); + public static CharSequence getVpnLabel(Context context, String packageName) + throws NameNotFoundException { + PackageManager pm = context.getPackageManager(); + Intent intent = new Intent(SERVICE_INTERFACE); + intent.setPackage(packageName); + List<ResolveInfo> services = pm.queryIntentServices(intent, 0 /* flags */); + if (services != null && services.size() == 1) { + // This app contains exactly one VPN service. Call loadLabel, which will attempt to + // load the service's label, and fall back to the app label if none is present. + return services.get(0).loadLabel(pm); + } else { + return pm.getApplicationInfo(packageName, 0).loadLabel(pm); + } } public String user; |