Loading core/res/res/values/strings.xml +5 −3 Original line number Original line Diff line number Diff line Loading @@ -2774,11 +2774,13 @@ <string name="l2tp_ipsec_crt_vpn_description">Certificate based L2TP/IPSec VPN</string> <string name="l2tp_ipsec_crt_vpn_description">Certificate based L2TP/IPSec VPN</string> <!-- Ticker text to show when VPN is active. --> <!-- 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. --> <!-- 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. --> <!-- 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 --> <!-- Localized strings for WebView --> <!-- Label for button in a WebView that will open a chooser to choose a file to upload --> <!-- Label for button in a WebView that will open a chooser to choose a file to upload --> Loading services/java/com/android/server/connectivity/Vpn.java +5 −18 Original line number Original line Diff line number Diff line Loading @@ -160,15 +160,6 @@ public class Vpn extends INetworkManagementEventObserver.Stub { return descriptor; return descriptor; } } public synchronized boolean onInterfaceRemoved(String name) { if (name.equals(mInterfaceName) && nativeCheck(name) == 0) { hideNotification(); mInterfaceName = null; return true; } return false; } // INetworkManagementEventObserver.Stub // INetworkManagementEventObserver.Stub public void interfaceLinkStatusChanged(String name, boolean up) { public void interfaceLinkStatusChanged(String name, boolean up) { } } Loading @@ -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) NotificationManager nm = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); mContext.getSystemService(Context.NOTIFICATION_SERVICE); Loading @@ -207,11 +198,6 @@ public class Vpn extends INetworkManagementEventObserver.Stub { // Load the label. // Load the label. String label = app.loadLabel(pm).toString(); String label = app.loadLabel(pm).toString(); // If session is null, use the application name instead. if (session == null) { session = label; } // Build the intent. // Build the intent. // TODO: move these into VpnBuilder. // TODO: move these into VpnBuilder. Intent intent = new Intent(); Intent intent = new Intent(); Loading @@ -219,23 +205,24 @@ public class Vpn extends INetworkManagementEventObserver.Stub { "com.android.vpndialogs.ManageDialog"); "com.android.vpndialogs.ManageDialog"); intent.putExtra("packageName", mPackageName); intent.putExtra("packageName", mPackageName); intent.putExtra("interfaceName", mInterfaceName); intent.putExtra("interfaceName", mInterfaceName); intent.putExtra("session", session); intent.putExtra("session", sessionName); intent.putExtra("startTime", android.os.SystemClock.elapsedRealtime()); intent.putExtra("startTime", android.os.SystemClock.elapsedRealtime()); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); // Build the notification. // 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(); long identity = Binder.clearCallingIdentity(); Notification notification = new Notification.Builder(mContext) Notification notification = new Notification.Builder(mContext) .setSmallIcon(R.drawable.vpn_connected) .setSmallIcon(R.drawable.vpn_connected) .setLargeIcon(bitmap) .setLargeIcon(bitmap) .setTicker(mContext.getString(R.string.vpn_ticker, label)) .setTicker(mContext.getString(R.string.vpn_ticker, label)) .setContentTitle(mContext.getString(R.string.vpn_title, 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)) .setContentIntent(PendingIntent.getActivity(mContext, 0, intent, 0)) .setDefaults(Notification.DEFAULT_ALL) .setDefaults(Notification.DEFAULT_ALL) .setOngoing(true) .setOngoing(true) .getNotification(); .getNotification(); nm.notify(R.drawable.vpn_connected, notification); nm.notify(R.drawable.vpn_connected, notification); Binder.restoreCallingIdentity(identity); Binder.restoreCallingIdentity(identity); } } Loading Loading
core/res/res/values/strings.xml +5 −3 Original line number Original line Diff line number Diff line Loading @@ -2774,11 +2774,13 @@ <string name="l2tp_ipsec_crt_vpn_description">Certificate based L2TP/IPSec VPN</string> <string name="l2tp_ipsec_crt_vpn_description">Certificate based L2TP/IPSec VPN</string> <!-- Ticker text to show when VPN is active. --> <!-- 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. --> <!-- 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. --> <!-- 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 --> <!-- Localized strings for WebView --> <!-- Label for button in a WebView that will open a chooser to choose a file to upload --> <!-- Label for button in a WebView that will open a chooser to choose a file to upload --> Loading
services/java/com/android/server/connectivity/Vpn.java +5 −18 Original line number Original line Diff line number Diff line Loading @@ -160,15 +160,6 @@ public class Vpn extends INetworkManagementEventObserver.Stub { return descriptor; return descriptor; } } public synchronized boolean onInterfaceRemoved(String name) { if (name.equals(mInterfaceName) && nativeCheck(name) == 0) { hideNotification(); mInterfaceName = null; return true; } return false; } // INetworkManagementEventObserver.Stub // INetworkManagementEventObserver.Stub public void interfaceLinkStatusChanged(String name, boolean up) { public void interfaceLinkStatusChanged(String name, boolean up) { } } Loading @@ -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) NotificationManager nm = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); mContext.getSystemService(Context.NOTIFICATION_SERVICE); Loading @@ -207,11 +198,6 @@ public class Vpn extends INetworkManagementEventObserver.Stub { // Load the label. // Load the label. String label = app.loadLabel(pm).toString(); String label = app.loadLabel(pm).toString(); // If session is null, use the application name instead. if (session == null) { session = label; } // Build the intent. // Build the intent. // TODO: move these into VpnBuilder. // TODO: move these into VpnBuilder. Intent intent = new Intent(); Intent intent = new Intent(); Loading @@ -219,23 +205,24 @@ public class Vpn extends INetworkManagementEventObserver.Stub { "com.android.vpndialogs.ManageDialog"); "com.android.vpndialogs.ManageDialog"); intent.putExtra("packageName", mPackageName); intent.putExtra("packageName", mPackageName); intent.putExtra("interfaceName", mInterfaceName); intent.putExtra("interfaceName", mInterfaceName); intent.putExtra("session", session); intent.putExtra("session", sessionName); intent.putExtra("startTime", android.os.SystemClock.elapsedRealtime()); intent.putExtra("startTime", android.os.SystemClock.elapsedRealtime()); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); // Build the notification. // 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(); long identity = Binder.clearCallingIdentity(); Notification notification = new Notification.Builder(mContext) Notification notification = new Notification.Builder(mContext) .setSmallIcon(R.drawable.vpn_connected) .setSmallIcon(R.drawable.vpn_connected) .setLargeIcon(bitmap) .setLargeIcon(bitmap) .setTicker(mContext.getString(R.string.vpn_ticker, label)) .setTicker(mContext.getString(R.string.vpn_ticker, label)) .setContentTitle(mContext.getString(R.string.vpn_title, 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)) .setContentIntent(PendingIntent.getActivity(mContext, 0, intent, 0)) .setDefaults(Notification.DEFAULT_ALL) .setDefaults(Notification.DEFAULT_ALL) .setOngoing(true) .setOngoing(true) .getNotification(); .getNotification(); nm.notify(R.drawable.vpn_connected, notification); nm.notify(R.drawable.vpn_connected, notification); Binder.restoreCallingIdentity(identity); Binder.restoreCallingIdentity(identity); } } Loading