Merge "Fix NullPointerException, TelephonyManager.getServiceState is null"
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();