Merge "Remove "storage type" preference from Settings"
diff --git a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
index efeb8a0..85ec799 100644
--- a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
+++ b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java
@@ -489,7 +489,6 @@
         if (overrideNetworkType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE
                 || overrideNetworkType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA) {
             dataNetworkTypeName = "NR NSA";
-            voiceNetworkTypeName = "NR NSA";
         }
 
         boolean show4GForLTE = false;
diff --git a/src/com/android/settings/network/ApnEditor.java b/src/com/android/settings/network/ApnEditor.java
index ac23b21..111ee8b 100644
--- a/src/com/android/settings/network/ApnEditor.java
+++ b/src/com/android/settings/network/ApnEditor.java
@@ -754,6 +754,9 @@
                         telephonyManager = telephonyManagerForSubId;
                     }
                     mMvnoMatchData.setText(telephonyManager.getGroupIdLevel1());
+                } else {
+                    // mvno type 'none' case. At this time, mvnoIndex should be 0.
+                    mMvnoMatchData.setText("");
                 }
             }
 
@@ -805,6 +808,7 @@
             }
             mMvnoType.setValue((String) newValue);
             mMvnoType.setSummary(mvno);
+            mMvnoMatchData.setSummary(checkNull(mMvnoMatchData.getText()));
         } else if (KEY_PASSWORD.equals(key)) {
             mPassword.setSummary(starify(newValue != null ? String.valueOf(newValue) : ""));
         } else if (KEY_CARRIER_ENABLED.equals(key)) {
diff --git a/src/com/android/settings/network/telephony/TelephonyStatusControlSession.java b/src/com/android/settings/network/telephony/TelephonyStatusControlSession.java
index 12c9bee..3716f1f 100644
--- a/src/com/android/settings/network/telephony/TelephonyStatusControlSession.java
+++ b/src/com/android/settings/network/telephony/TelephonyStatusControlSession.java
@@ -22,6 +22,7 @@
 import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.utils.ThreadUtils;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
@@ -37,7 +38,7 @@
     private static final String LOG_TAG = "TelephonyStatusControlSS";
 
     private Collection<AbstractPreferenceController> mControllers;
-    private Future<Boolean> mResult;
+    private Collection<Future<Boolean>> mResult = new ArrayList<>();
 
     /**
      * Buider of session
@@ -67,9 +68,9 @@
 
     private TelephonyStatusControlSession(Collection<AbstractPreferenceController> controllers) {
         mControllers = controllers;
-        mResult = ThreadUtils.postOnBackgroundThread(() ->
-            setupAvailabilityStatus(controllers)
-        );
+        controllers.forEach(prefCtrl -> mResult
+                .add(ThreadUtils.postOnBackgroundThread(() -> setupAvailabilityStatus(prefCtrl))));
+
     }
 
     /**
@@ -79,25 +80,24 @@
      */
     public void close() {
         //check the background thread is finished then unset the status of availability.
-        try {
-            mResult.get();
-        } catch (ExecutionException | InterruptedException exception) {
-            Log.e(LOG_TAG, "setup availability status failed!", exception);
+
+        for (Future<Boolean> result : mResult) {
+            try {
+                result.get();
+            } catch (ExecutionException | InterruptedException exception) {
+                Log.e(LOG_TAG, "setup availability status failed!", exception);
+            }
         }
         unsetAvailabilityStatus(mControllers);
     }
 
-    private Boolean setupAvailabilityStatus(
-            Collection<AbstractPreferenceController> controllerLists) {
+    private Boolean setupAvailabilityStatus(AbstractPreferenceController controller) {
         try {
-            controllerLists.stream()
-                    .filter(controller -> controller instanceof TelephonyAvailabilityHandler)
-                    .map(TelephonyAvailabilityHandler.class::cast)
-                    .forEach(controller -> {
-                        int status = ((BasePreferenceController) controller)
-                                .getAvailabilityStatus();
-                        controller.setAvailabilityStatus(status);
-                    });
+            if (controller instanceof TelephonyAvailabilityHandler) {
+                int status = ((BasePreferenceController) controller)
+                        .getAvailabilityStatus();
+                ((TelephonyAvailabilityHandler) controller).setAvailabilityStatus(status);
+            }
             return true;
         } catch (Exception exception) {
             Log.e(LOG_TAG, "Setup availability status failed!", exception);
diff --git a/tests/robotests/src/com/android/settings/datetime/timezone/model/TimeZoneDataTest.java b/tests/robotests/src/com/android/settings/datetime/timezone/model/TimeZoneDataTest.java
index 6322b57..1acbcda 100644
--- a/tests/robotests/src/com/android/settings/datetime/timezone/model/TimeZoneDataTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/timezone/model/TimeZoneDataTest.java
@@ -21,6 +21,8 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import static java.util.Collections.emptyList;
+
 import com.android.i18n.timezone.CountryTimeZones;
 import com.android.i18n.timezone.CountryTimeZones.TimeZoneMapping;
 import com.android.i18n.timezone.CountryZonesFinder;
@@ -49,7 +51,7 @@
     public void testRegionsWithTimeZone() {
         TimeZoneData timeZoneData = new TimeZoneData(mCountryZonesFinder);
         CountryTimeZones countryTimeZones = mock(CountryTimeZones.class);
-        when(countryTimeZones.getTimeZoneMappings()).thenReturn(Collections.emptyList());
+        when(countryTimeZones.getTimeZoneMappings()).thenReturn(emptyList());
         when(mCountryZonesFinder.lookupCountryTimeZones("US")).thenReturn(countryTimeZones);
         assertThat(timeZoneData.lookupCountryTimeZones("US").getCountryTimeZones())
                 .isSameAs(countryTimeZones);
@@ -57,7 +59,7 @@
 
     @Test
     public void testGetRegionIds() {
-        when(mCountryZonesFinder.lookupAllCountryIsoCodes()).thenReturn(Collections.emptyList());
+        when(mCountryZonesFinder.lookupAllCountryIsoCodes()).thenReturn(emptyList());
         TimeZoneData timeZoneData = new TimeZoneData(mCountryZonesFinder);
         assertThat(timeZoneData.getRegionIds()).isEmpty();
 
@@ -73,13 +75,16 @@
         CountryTimeZones US = mock(CountryTimeZones.class);
         when(US.getCountryIso()).thenReturn("us");
         when(US.getTimeZoneMappings()).thenReturn(Arrays.asList(
-           TimeZoneMapping.createForTests("Unknown/Secret_City", true, null /* notUsedAfter */),
-           TimeZoneMapping.createForTests("Unknown/Secret_City2", false, null /* notUsedAfter */)
+                TimeZoneMapping.createForTests(
+                        "Unknown/Secret_City", true, null /* notUsedAfter */, emptyList()),
+                TimeZoneMapping.createForTests(
+                        "Unknown/Secret_City2", false, null /* notUsedAfter */, emptyList())
         ));
         CountryTimeZones GB = mock(CountryTimeZones.class);
         when(GB.getCountryIso()).thenReturn("gb");
         when(GB.getTimeZoneMappings()).thenReturn(Collections.singletonList(
-            TimeZoneMapping.createForTests("Unknown/Secret_City", true, null /* notUsedAfter */)
+                TimeZoneMapping.createForTests(
+                        "Unknown/Secret_City", true, null /* notUsedAfter */, emptyList())
         ));
         when(mCountryZonesFinder.lookupCountryTimeZonesForZoneId("Unknown/Secret_City"))
                 .thenReturn(Arrays.asList(US, GB));