polish the notification of the default carrier app
Based on the feedbacks from UX review
- modified notificaiton icon
- modified notification content text
- modified notification app name
- modified notification color
Test: Manual
Bug: 36002256
Change-Id: Icf13ea41fc88fb7b15f2b1c29fd3551fd3351819
diff --git a/packages/CarrierDefaultApp/AndroidManifest.xml b/packages/CarrierDefaultApp/AndroidManifest.xml
index d910920..0c3cc17 100644
--- a/packages/CarrierDefaultApp/AndroidManifest.xml
+++ b/packages/CarrierDefaultApp/AndroidManifest.xml
@@ -27,6 +27,7 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
+ <uses-permission android:name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME" />
<application android:label="@string/app_name" >
<receiver android:name="com.android.carrierdefaultapp.CarrierDefaultBroadcastReceiver">
diff --git a/packages/CarrierDefaultApp/res/drawable/ic_sim_card.xml b/packages/CarrierDefaultApp/res/drawable/ic_sim_card.xml
index 5896757..dc54fe2 100644
--- a/packages/CarrierDefaultApp/res/drawable/ic_sim_card.xml
+++ b/packages/CarrierDefaultApp/res/drawable/ic_sim_card.xml
@@ -14,13 +14,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="@dimen/glif_icon_size"
- android:height="@dimen/glif_icon_size"
- android:viewportWidth="48"
- android:viewportHeight="48">
- <path
- android:fillColor="?android:attr/colorPrimary"
- android:pathData="M39.98,8c0,-2.21 -1.77,-4 -3.98,-4L20,4L8,16v24c0,2.21 1.79,4 4,4h24.02c2.21,0 3.98,-1.79 3.98,-4l-0.02,-32zM18,38h-4v-4h4v4zM34,38h-4v-4h4v4zM18,30h-4v-8h4v8zM26,38h-4v-8h4v8zM26,26h-4v-4h4v4zM34,30h-4v-8h4v8z" />
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+<path
+ android:fillColor="#757575"
+ android:pathData="M18,2h-8L4.02,8 4,20c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,4c0,-1.1 -0.9,-2 -2,-2zM13,17h-2v-2h2v2zM13,13h-2L11,8h2v5z"/>
</vector>
\ No newline at end of file
diff --git a/packages/CarrierDefaultApp/res/values/strings.xml b/packages/CarrierDefaultApp/res/values/strings.xml
index 838ff39..fe5669d 100644
--- a/packages/CarrierDefaultApp/res/values/strings.xml
+++ b/packages/CarrierDefaultApp/res/values/strings.xml
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">CarrierDefaultApp</string>
- <string name="portal_notification_id">Activate your service</string>
- <string name="no_data_notification_id">No data service</string>
- <string name="portal_notification_detail">Tap to activate your service</string>
- <string name="no_data_notification_detail">No Service, please contact your service provider</string>
+ <string name="android_system_label">Android System</string>
+ <string name="portal_notification_id">Mobile data has run out</string>
+ <string name="no_data_notification_id">No Mobile data service</string>
+ <string name="portal_notification_detail">Tap to add funds to your %s SIM</string>
+ <string name="no_data_notification_detail">Please contact your service provider %s</string>
<string name="progress_dialogue_network_connection">Connecting to captive portal...</string>
<string name="alert_dialogue_network_timeout">Network timeout, would you like to retry?</string>
<string name="alert_dialogue_network_timeout_title">Network unavailable</string>
diff --git a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CarrierActionUtils.java b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CarrierActionUtils.java
index db4890f..d9bd2fc 100644
--- a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CarrierActionUtils.java
+++ b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CarrierActionUtils.java
@@ -21,6 +21,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
+import android.os.Bundle;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -146,18 +147,25 @@
private static Notification getNotification(Context context, int titleId, int textId,
PendingIntent pendingIntent) {
- Resources resources = context.getResources();
+ final TelephonyManager telephonyMgr = context.getSystemService(TelephonyManager.class);
+ final Resources resources = context.getResources();
+ final Bundle extras = Bundle.forPair(Notification.EXTRA_SUBSTITUTE_APP_NAME,
+ resources.getString(R.string.android_system_label));
Notification.Builder builder = new Notification.Builder(context)
.setContentTitle(resources.getString(titleId))
- .setContentText(resources.getString(textId))
+ .setContentText(String.format(resources.getString(textId),
+ telephonyMgr.getNetworkOperatorName()))
.setSmallIcon(R.drawable.ic_sim_card)
+ .setColor(context.getColor(
+ com.android.internal.R.color.system_notification_accent_color))
.setOngoing(true)
.setPriority(Notification.PRIORITY_HIGH)
.setDefaults(Notification.DEFAULT_ALL)
.setVisibility(Notification.VISIBILITY_PUBLIC)
.setLocalOnly(true)
.setWhen(System.currentTimeMillis())
- .setShowWhen(false);
+ .setShowWhen(false)
+ .setExtras(extras);
if (pendingIntent != null) {
builder.setContentIntent(pendingIntent);