VPN: change some strings in VPN notifications.
Also remove a small piece of dead code. Change-Id: Idd10f3d72a92228951278bf360d08ba9bede02d2
This commit is contained in:
@@ -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 -->
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user