summaryrefslogtreecommitdiff
path: root/packages/CarrierDefaultApp/src
diff options
context:
space:
mode:
authorfionaxu <fionaxu@google.com>2017-09-01 13:39:55 -0700
committerChen Xu <fionaxu@google.com>2017-09-01 21:08:05 +0000
commit7569cc2e0644c562587a7dd486789a3fe488adb0 (patch)
tree9a1ea2f083a03a20fbb3316ae3fa5598e5ed7184 /packages/CarrierDefaultApp/src
parent04d69537eac37602a69a8529e805a25664904c57 (diff)
use simOperator name in the notification
today we are using getNetworkOperator for carrier's name in the notification which might be misleading in cases users romaing on different network. as today there is no reliable way to get carrier's name, we will use getSimOperator and if that returns empty string, fallback to networkOperatorName. In the long term, we can use better wording if simOperatorName is unknown. Bug:65251050 Test: Manual Change-Id: I6ffc37f8cc8e686d2e884283be2006cf704e8c64
Diffstat (limited to 'packages/CarrierDefaultApp/src')
-rw-r--r--packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CarrierActionUtils.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CarrierActionUtils.java b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CarrierActionUtils.java
index a2bf964ec05f..33cb596415d5 100644
--- a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CarrierActionUtils.java
+++ b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CarrierActionUtils.java
@@ -27,6 +27,7 @@ import android.content.res.Resources;
import android.os.Bundle;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
+import android.text.TextUtils;
import android.util.Log;
import com.android.internal.telephony.PhoneConstants;
import com.android.carrierdefaultapp.R;
@@ -199,13 +200,19 @@ public class CarrierActionUtils {
PendingIntent pendingIntent) {
final TelephonyManager telephonyMgr = context.getSystemService(TelephonyManager.class);
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,
resources.getString(R.string.android_system_label));
createNotificationChannels(context);
Notification.Builder builder = new Notification.Builder(context)
.setContentTitle(resources.getString(titleId))
- .setContentText(String.format(resources.getString(textId),
- telephonyMgr.getNetworkOperatorName()))
+ .setContentText(String.format(resources.getString(textId), spn))
.setSmallIcon(R.drawable.ic_sim_card)
.setColor(context.getColor(
com.android.internal.R.color.system_notification_accent_color))