Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 564c8848 authored by SongFerng Wang's avatar SongFerng Wang Committed by Android (Google) Code Review
Browse files

Merge "Gray out the network mode UI before the carrier config is ready" into tm-dev

parents 591c2c3b b76feffe
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -87,7 +87,8 @@ public class EnabledNetworkModePreferenceController extends
        final PersistableBundle carrierConfig = mCarrierConfigCache.getConfigForSubId(subId);
        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
            visible = false;
        } else if (carrierConfig == null) {
        } else if (carrierConfig == null
                || !CarrierConfigManager.isConfigForIdentifiedCarrier(carrierConfig)) {
            visible = false;
        } else if (carrierConfig.getBoolean(
                CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL)
+9 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ public class EnabledNetworkModePreferenceControllerTest {
        mPersistableBundle = new PersistableBundle();
        doReturn(mPersistableBundle).when(mCarrierConfigCache).getConfig();
        doReturn(mPersistableBundle).when(mCarrierConfigCache).getConfigForSubId(SUB_ID);
        mPersistableBundle.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true);
        mPreference = new ListPreference(mContext);
        mController = new EnabledNetworkModePreferenceController(mContext, KEY);
        mockAllowedNetworkTypes(ALLOWED_ALL_NETWORK_TYPE);
@@ -145,6 +146,14 @@ public class EnabledNetworkModePreferenceControllerTest {
        assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
    }

    @UiThreadTest
    @Test
    public void getAvailabilityStatus_carrierConfigNotReady_returnUnavailable() {
        mPersistableBundle.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, false);

        assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
    }

    @UiThreadTest
    @Test
    public void getAvailabilityStatus_notWorldPhone_returnAvailable() {