DO NOT MERGE Fix voicemail SIM card name unknown after unlock PIN.
Cherry-picked from https://android-review.googlesource.com/#/c/217420/
Reproduce Steps:
1. Power on mobile with PIN.
2. Unlock PIN and receive a voicemail message.
Solution:
Voicemail message is received before SIM loaded, so SPN cannot
be shown on the voicemail. To fix, after SIM loaded, refresh
voicemail notification.
Change-Id: I133ccab84da0e025a98e8edb7320f1aa879660e0
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 0a583a0..54dfb60 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -41,6 +41,7 @@
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
+import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -125,6 +126,27 @@
mNotificationComponent = notificationComponent != null
? ComponentName.unflattenFromString(notificationComponent) : null;
+
+ mSubscriptionManager.addOnSubscriptionsChangedListener(
+ new OnSubscriptionsChangedListener() {
+ @Override
+ public void onSubscriptionsChanged() {
+ updateActivePhonesMwi();
+ }
+ });
+ }
+
+ public void updateActivePhonesMwi() {
+ List<SubscriptionInfo> subInfos = mSubscriptionManager.getActiveSubscriptionInfoList();
+
+ if (subInfos == null) {
+ return;
+ }
+
+ for (int i = 0; i < subInfos.size(); i++) {
+ int subId = subInfos.get(i).getSubscriptionId();
+ refreshMwi(subId);
+ }
}
/**