Merge "VPN: change some strings in VPN notifications."
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 5e13282..34bc6bb 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2774,11 +2774,13 @@
     <string name="l2tp_ipsec_crt_vpn_description">Certificate based L2TP/IPSec VPN</string>
 
     <!-- Ticker text to show when VPN is active. -->
-    <string name="vpn_ticker">Activating <xliff:g id="app">%s</xliff:g> VPN...</string>
+    <string name="vpn_ticker"><xliff:g id="app" example="FooVPN client">%s</xliff:g> is activating VPN...</string>
     <!-- The title of the notification when VPN is active. -->
-    <string name="vpn_title"><xliff:g id="app">%s</xliff:g> VPN is active</string>
+    <string name="vpn_title">VPN is activated by <xliff:g id="app" example="FooVPN client">%s</xliff:g></string>
     <!-- The text of the notification when VPN is active. -->
-    <string name="vpn_text">VPN is connected to <xliff:g id="profile">%s</xliff:g>. Tap to manage the network.</string>
+    <string name="vpn_text">Tap to manage the network.</string>
+    <!-- The text of the notification when VPN is active with a session name. -->
+    <string name="vpn_text_long">Connected to <xliff:g id="session" example="office">%s</xliff:g>. Tap to manage the network.</string>
 
     <!-- Localized strings for WebView -->
     <!-- Label for button in a WebView that will open a chooser to choose a file to upload -->
diff --git a/services/java/com/android/server/connectivity/Vpn.java b/services/java/com/android/server/connectivity/Vpn.java
index ab85b14..941ab80 100644
--- a/services/java/com/android/server/connectivity/Vpn.java
+++ b/services/java/com/android/server/connectivity/Vpn.java
@@ -160,15 +160,6 @@
         return descriptor;
     }
 
-    public synchronized boolean onInterfaceRemoved(String name) {
-        if (name.equals(mInterfaceName) && nativeCheck(name) == 0) {
-            hideNotification();
-            mInterfaceName = null;
-            return true;
-        }
-        return false;
-    }
-
     // INetworkManagementEventObserver.Stub
     public void interfaceLinkStatusChanged(String name, boolean up) {
     }
@@ -186,7 +177,7 @@
         }
     }
 
-    private void showNotification(PackageManager pm, ApplicationInfo app, String session) {
+    private void showNotification(PackageManager pm, ApplicationInfo app, String sessionName) {
         NotificationManager nm = (NotificationManager)
                 mContext.getSystemService(Context.NOTIFICATION_SERVICE);
 
@@ -207,11 +198,6 @@
             // Load the label.
             String label = app.loadLabel(pm).toString();
 
-            // If session is null, use the application name instead.
-            if (session == null) {
-                session = label;
-            }
-
             // Build the intent.
             // TODO: move these into VpnBuilder.
             Intent intent = new Intent();
@@ -219,23 +205,24 @@
                     "com.android.vpndialogs.ManageDialog");
             intent.putExtra("packageName", mPackageName);
             intent.putExtra("interfaceName", mInterfaceName);
-            intent.putExtra("session", session);
+            intent.putExtra("session", sessionName);
             intent.putExtra("startTime", android.os.SystemClock.elapsedRealtime());
             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
 
             // Build the notification.
+            String text = (sessionName == null) ? mContext.getString(R.string.vpn_text) :
+                    mContext.getString(R.string.vpn_text_long, sessionName);
             long identity = Binder.clearCallingIdentity();
             Notification notification = new Notification.Builder(mContext)
                     .setSmallIcon(R.drawable.vpn_connected)
                     .setLargeIcon(bitmap)
                     .setTicker(mContext.getString(R.string.vpn_ticker, label))
                     .setContentTitle(mContext.getString(R.string.vpn_title, label))
-                    .setContentText(mContext.getString(R.string.vpn_text, session))
+                    .setContentText(text)
                     .setContentIntent(PendingIntent.getActivity(mContext, 0, intent, 0))
                     .setDefaults(Notification.DEFAULT_ALL)
                     .setOngoing(true)
                     .getNotification();
-
             nm.notify(R.drawable.vpn_connected, notification);
             Binder.restoreCallingIdentity(identity);
         }