Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b834a82 authored by fionaxu's avatar fionaxu
Browse files

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
parent e091985b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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">
+7 −8
Original line number Diff line number Diff line
@@ -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">
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
<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: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
+5 −4
Original line number Diff line number Diff line
<?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>
+11 −3
Original line number Diff line number Diff line
@@ -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);