Merge "[Settings] subscription UI should be closed when SIM is removed" am: b3efa585f2

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1425488

Change-Id: I3ced24e5b1d9f382e6041c38414d8247c2e2abe4
diff --git a/src/com/android/settings/network/telephony/MobileNetworkActivity.java b/src/com/android/settings/network/telephony/MobileNetworkActivity.java
index 7f7dc3a..a792824 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkActivity.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkActivity.java
@@ -158,6 +158,11 @@
 
         // Remove the dialog if the subscription associated with this activity changes.
         if (info == null) {
+            // Close the activity when subscription removed
+            if ((oldSubIndex != SUB_ID_NULL)
+                    && (!isFinishing()) && (!isDestroyed())) {
+                finish();
+            }
             return;
         }
         int subIndex = info.getSubscriptionId();