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

Commit ec9ab708 authored by Sarah Chin's avatar Sarah Chin Committed by Automerger Merge Worker
Browse files

Merge "Notify subscriptions loaded after radio unavailable" into sc-dev am: a5d87aa4

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/15339923

Change-Id: I0f491568fb0f9dea1b5527f5e5a8ca5b4e0b8e60
parents eb47a91b a5d87aa4
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -341,17 +341,19 @@ public class MultiSimSettingController extends Handler {
    }

    /**
     * Upon initialization, update defaults and mobile data enabling.
     * Upon initialization or radio available, update defaults and mobile data enabling.
     * Should only be triggered once.
     */
    private void onAllSubscriptionsLoaded() {
        if (DBG) log("onAllSubscriptionsLoaded");
        if (DBG) log("onAllSubscriptionsLoaded: mSubInfoInitialized=" + mSubInfoInitialized);
        if (!mSubInfoInitialized) {
            mSubInfoInitialized = true;
            for (Phone phone : PhoneFactory.getPhones()) {
                phone.mCi.registerForRadioStateChanged(this, EVENT_RADIO_STATE_CHANGED, null);
            }
            reEvaluateAll();
        }
    }

    /**
     * Make sure default values are cleaned or updated.
@@ -445,11 +447,16 @@ public class MultiSimSettingController extends Handler {
    }

    /**
     * Wait for subInfo initialization (after boot up) and carrier config load for all active
     * subscriptions before re-evaluate multi SIM settings.
     * Wait for subInfo initialization (after boot up or radio unavailable) and carrier config load
     * for all active subscriptions before re-evaluate multi SIM settings.
     */
    private boolean isReadyToReevaluate() {
        return mSubInfoInitialized && isCarrierConfigLoadedForAllSub();
        boolean carrierConfigsLoaded = isCarrierConfigLoadedForAllSub();
        if (DBG) {
            log("isReadyToReevaluate: subInfoInitialized=" + mSubInfoInitialized
                    + ", carrierConfigsLoaded=" + carrierConfigsLoaded);
        }
        return mSubInfoInitialized && carrierConfigsLoaded;
    }

    private void reEvaluateAll() {
+1 −1
Original line number Diff line number Diff line
@@ -792,8 +792,8 @@ public class SubscriptionInfoUpdater extends Handler {
            if (DBG) logd("SubInfo Initialized");
            sIsSubInfoInitialized = true;
            mSubscriptionController.notifySubInfoReady();
            MultiSimSettingController.getInstance().notifyAllSubscriptionLoaded();
        }
        MultiSimSettingController.getInstance().notifyAllSubscriptionLoaded();
    }

    /**
+8 −0
Original line number Diff line number Diff line
@@ -210,6 +210,14 @@ public class MultiSimSettingControllerTest extends TelephonyTest {
        mMultiSimSettingControllerUT.notifyCarrierConfigChanged(1, 2);
        processAllMessages();

        // Ensure all subscription loaded only updates state once
        clearInvocations(mSubControllerMock);
        mMultiSimSettingControllerUT.notifyAllSubscriptionLoaded();
        processAllMessages();
        verify(mSubControllerMock, never()).setDefaultDataSubId(anyInt());
        verify(mSubControllerMock, never()).setDefaultVoiceSubId(anyInt());
        verify(mSubControllerMock, never()).setDefaultSmsSubId(anyInt());

        // Notify radio unavailable.
        replaceInstance(BaseCommands.class, "mState", mSimulatedCommands,
                TelephonyManager.RADIO_POWER_UNAVAILABLE);