Loading packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CarrierActionUtils.java +9 −2 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.content.res.Resources; import android.os.Bundle; import android.os.Bundle; import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; import android.util.Log; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.PhoneConstants; import com.android.carrierdefaultapp.R; import com.android.carrierdefaultapp.R; Loading Loading @@ -199,13 +200,19 @@ public class CarrierActionUtils { PendingIntent pendingIntent) { PendingIntent pendingIntent) { final TelephonyManager telephonyMgr = context.getSystemService(TelephonyManager.class); final TelephonyManager telephonyMgr = context.getSystemService(TelephonyManager.class); final Resources resources = context.getResources(); final Resources resources = context.getResources(); String spn = telephonyMgr.getSimOperatorName(); if (TextUtils.isEmpty(spn)) { // There is no consistent way to get the current carrier name as MNOs didn't // bother to set EF_SPN. in the long term, we should display a generic wording if // spn from subscription is not set. spn = telephonyMgr.getNetworkOperatorName(); } final Bundle extras = Bundle.forPair(Notification.EXTRA_SUBSTITUTE_APP_NAME, final Bundle extras = Bundle.forPair(Notification.EXTRA_SUBSTITUTE_APP_NAME, resources.getString(R.string.android_system_label)); resources.getString(R.string.android_system_label)); createNotificationChannels(context); createNotificationChannels(context); Notification.Builder builder = new Notification.Builder(context) Notification.Builder builder = new Notification.Builder(context) .setContentTitle(resources.getString(titleId)) .setContentTitle(resources.getString(titleId)) .setContentText(String.format(resources.getString(textId), .setContentText(String.format(resources.getString(textId), spn)) telephonyMgr.getNetworkOperatorName())) .setSmallIcon(R.drawable.ic_sim_card) .setSmallIcon(R.drawable.ic_sim_card) .setColor(context.getColor( .setColor(context.getColor( com.android.internal.R.color.system_notification_accent_color)) com.android.internal.R.color.system_notification_accent_color)) Loading Loading
packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CarrierActionUtils.java +9 −2 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.content.res.Resources; import android.os.Bundle; import android.os.Bundle; import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; import android.util.Log; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.PhoneConstants; import com.android.carrierdefaultapp.R; import com.android.carrierdefaultapp.R; Loading Loading @@ -199,13 +200,19 @@ public class CarrierActionUtils { PendingIntent pendingIntent) { PendingIntent pendingIntent) { final TelephonyManager telephonyMgr = context.getSystemService(TelephonyManager.class); final TelephonyManager telephonyMgr = context.getSystemService(TelephonyManager.class); final Resources resources = context.getResources(); final Resources resources = context.getResources(); String spn = telephonyMgr.getSimOperatorName(); if (TextUtils.isEmpty(spn)) { // There is no consistent way to get the current carrier name as MNOs didn't // bother to set EF_SPN. in the long term, we should display a generic wording if // spn from subscription is not set. spn = telephonyMgr.getNetworkOperatorName(); } final Bundle extras = Bundle.forPair(Notification.EXTRA_SUBSTITUTE_APP_NAME, final Bundle extras = Bundle.forPair(Notification.EXTRA_SUBSTITUTE_APP_NAME, resources.getString(R.string.android_system_label)); resources.getString(R.string.android_system_label)); createNotificationChannels(context); createNotificationChannels(context); Notification.Builder builder = new Notification.Builder(context) Notification.Builder builder = new Notification.Builder(context) .setContentTitle(resources.getString(titleId)) .setContentTitle(resources.getString(titleId)) .setContentText(String.format(resources.getString(textId), .setContentText(String.format(resources.getString(textId), spn)) telephonyMgr.getNetworkOperatorName())) .setSmallIcon(R.drawable.ic_sim_card) .setSmallIcon(R.drawable.ic_sim_card) .setColor(context.getColor( .setColor(context.getColor( com.android.internal.R.color.system_notification_accent_color)) com.android.internal.R.color.system_notification_accent_color)) Loading