From 5b834a82082c1e7c938d81ade2f28a08d59195a6 Mon Sep 17 00:00:00 2001 From: fionaxu Date: Mon, 6 Mar 2017 14:03:45 -0800 Subject: [PATCH] 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 --- packages/CarrierDefaultApp/AndroidManifest.xml | 1 + .../res/drawable/ic_sim_card.xml | 15 +++++++-------- packages/CarrierDefaultApp/res/values/strings.xml | 9 +++++---- .../carrierdefaultapp/CarrierActionUtils.java | 14 +++++++++++--- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/packages/CarrierDefaultApp/AndroidManifest.xml b/packages/CarrierDefaultApp/AndroidManifest.xml index d9109202f916a..0c3cc17d8e598 100644 --- a/packages/CarrierDefaultApp/AndroidManifest.xml +++ b/packages/CarrierDefaultApp/AndroidManifest.xml @@ -27,6 +27,7 @@ + diff --git a/packages/CarrierDefaultApp/res/drawable/ic_sim_card.xml b/packages/CarrierDefaultApp/res/drawable/ic_sim_card.xml index 589675755e072..dc54fe2a3fac4 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. --> - - + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + \ No newline at end of file diff --git a/packages/CarrierDefaultApp/res/values/strings.xml b/packages/CarrierDefaultApp/res/values/strings.xml index 838ff39f52312..fe5669d790778 100644 --- a/packages/CarrierDefaultApp/res/values/strings.xml +++ b/packages/CarrierDefaultApp/res/values/strings.xml @@ -1,10 +1,11 @@ CarrierDefaultApp - Activate your service - No data service - Tap to activate your service - No Service, please contact your service provider + Android System + Mobile data has run out + No Mobile data service + Tap to add funds to your %s SIM + Please contact your service provider %s Connecting to captive portal... Network timeout, would you like to retry? Network unavailable diff --git a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CarrierActionUtils.java b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CarrierActionUtils.java index db4890fc0187b..d9bd2fcc0acb0 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.app.PendingIntent; 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 @@ public class CarrierActionUtils { 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);