diff options
author | Chia-chi Yeh <chiachi@android.com> | 2011-06-15 11:31:34 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-06-15 11:31:34 -0700 |
commit | f71e5469441286c6f466043e64a7f6492557cbd9 (patch) | |
tree | a321952a568d7986f017599ee98f571a7215b9ba | |
parent | 7b5998578c762efc523a2ebf4166cc9059250346 (diff) | |
parent | f8905fd13da0bfd6049daebc1cf4f8af286a04de (diff) | |
download | frameworks_base-f71e5469441286c6f466043e64a7f6492557cbd9.zip frameworks_base-f71e5469441286c6f466043e64a7f6492557cbd9.tar.gz frameworks_base-f71e5469441286c6f466043e64a7f6492557cbd9.tar.bz2 |
Merge "VPN: change some strings in VPN notifications."
-rwxr-xr-x | core/res/res/values/strings.xml | 8 | ||||
-rw-r--r-- | services/java/com/android/server/connectivity/Vpn.java | 23 |
2 files changed, 10 insertions, 21 deletions
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 @@ public class Vpn extends INetworkManagementEventObserver.Stub { 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 @@ public class Vpn extends INetworkManagementEventObserver.Stub { } } - 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 @@ public class Vpn extends INetworkManagementEventObserver.Stub { // 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 @@ public class Vpn extends INetworkManagementEventObserver.Stub { "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); } |