Merge "Fix to dismiss network selection notification when disable sim." into main
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 11887bb..518003f 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -832,7 +832,8 @@
Phone phone = SubscriptionManager.isValidPhoneId(phoneId) ?
PhoneFactory.getPhone(phoneId) : PhoneFactory.getDefaultPhone();
if (TelephonyCapabilities.supportsNetworkSelection(phone)) {
- if (SubscriptionManager.isValidSubscriptionId(subId)) {
+ if (SubscriptionManager.isValidSubscriptionId(subId)
+ && mSubscriptionManager.isActiveSubId(subId)) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
String selectedNetworkOperatorName =
sp.getString(Phone.NETWORK_SELECTION_NAME_KEY + subId, "");
diff --git a/tests/src/com/android/phone/NotificationMgrTest.java b/tests/src/com/android/phone/NotificationMgrTest.java
index e009446..98c6a4a 100644
--- a/tests/src/com/android/phone/NotificationMgrTest.java
+++ b/tests/src/com/android/phone/NotificationMgrTest.java
@@ -631,6 +631,7 @@
MOBILE_NETWORK_SELECTION_PACKAGE);
when(mApp.getString(R.string.mobile_network_settings_class)).thenReturn(
MOBILE_NETWORK_SELECTION_CLASS);
+ when(mSubscriptionManager.isActiveSubId(anyInt())).thenReturn(true);
}
private void moveTimeForward(long seconds) {