Fix strings.
* Changes
+ Remove "Up time:" from ongoing event display.
+ Add hint in disconnected notification.
diff --git a/packages/VpnServices/res/values/strings.xml b/packages/VpnServices/res/values/strings.xml
index e42c1e8..074655e 100755
--- a/packages/VpnServices/res/values/strings.xml
+++ b/packages/VpnServices/res/values/strings.xml
@@ -3,9 +3,8 @@
<!-- Title for the VPN Services activity. -->
<string name="app_label">VPN Services</string>
- <string name="vpn_notification_title">%s VPN %s</string>
- <string name="vpn_notification_connected">connected</string>
- <string name="vpn_notification_disconnected">disconnected</string>
- <string name="vpn_notification_connected_message">Up time: %s</string>
+ <string name="vpn_notification_title_connected">%s VPN connected</string>
+ <string name="vpn_notification_title_disconnected">%s VPN disconnected</string>
+ <string name="vpn_notification_hint_disconnected">Touch to reconnect to a VPN.</string>
</resources>
diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnService.java b/packages/VpnServices/src/com/android/server/vpn/VpnService.java
index 6e5d46b..a60788a 100644
--- a/packages/VpnServices/src/com/android/server/vpn/VpnService.java
+++ b/packages/VpnServices/src/com/android/server/vpn/VpnService.java
@@ -490,16 +490,15 @@
}
private String getNotificationTitle(boolean connected) {
- String connectedOrNot = connected
- ? mContext.getString(R.string.vpn_notification_connected)
+ String formatString = connected
+ ? mContext.getString(
+ R.string.vpn_notification_title_connected)
: mContext.getString(
- R.string.vpn_notification_disconnected);
- return String.format(
- mContext.getString(R.string.vpn_notification_title),
- mProfile.getName(), connectedOrNot);
+ R.string.vpn_notification_title_disconnected);
+ return String.format(formatString, mProfile.getName());
}
- private String getTimeFormat(long duration) {
+ private String getFormattedTime(long duration) {
long hours = duration / 3600;
StringBuilder sb = new StringBuilder();
if (hours > 0) sb.append(hours).append(':');
@@ -511,11 +510,10 @@
private String getNotificationMessage(boolean connected) {
if (connected) {
long time = (System.currentTimeMillis() - mStartTime) / 1000;
- return String.format(mContext.getString(
- R.string.vpn_notification_connected_message),
- getTimeFormat(time));
+ return getFormattedTime(time);
} else {
- return "";
+ return mContext.getString(
+ R.string.vpn_notification_hint_disconnected);
}
}
}