display the phone number from the correct subId
Bug: 141275509
Test: Verified with FN and AT&T SIM
Change-Id: I7d4f9fa7f2e8a11afad74840a22559c0bab40c9b
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index f2ff074..27749e4 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -638,8 +638,16 @@
// Navigate to "Network Selection Settings" which list all subscriptions.
PendingIntent contentIntent = PendingIntent.getActivity(mContext, 0,
new Intent(ACTION_MOBILE_NETWORK_LIST), 0);
- String line1Num = mTelephonyManager.getLine1Number(subId);
-
+ // Display phone number from the other sub
+ String line1Num = null;
+ SubscriptionManager subMgr = (SubscriptionManager) mContext.getSystemService(
+ Context.TELEPHONY_SUBSCRIPTION_SERVICE);
+ List<SubscriptionInfo> subList = subMgr.getActiveSubscriptionInfoList(false);
+ for (SubscriptionInfo sub : subList) {
+ if (sub.getSubscriptionId() != subId) {
+ line1Num = mTelephonyManager.getLine1Number(sub.getSubscriptionId());
+ }
+ }
final CharSequence contentText = TextUtils.isEmpty(line1Num) ?
String.format(mContext.getText(
R.string.limited_sim_function_notification_message).toString(), carrierName) :