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

Commit c5bfcf33 authored by Sanket Padawe's avatar Sanket Padawe Committed by Android (Google) Code Review
Browse files

Merge "Register for EVENT_RESTRICTED_STATE_CHANGED irrespective of phone type." into oc-dev

parents 0489acf3 a18eb875
Loading
Loading
Loading
Loading
+3 −14
Original line number Diff line number Diff line
@@ -176,7 +176,6 @@ public class ServiceStateTracker extends Handler {
    protected static final int EVENT_POLL_SIGNAL_STRENGTH              = 10;
    protected static final int EVENT_NITZ_TIME                         = 11;
    protected static final int EVENT_SIGNAL_STRENGTH_UPDATE            = 12;
    protected static final int EVENT_RADIO_AVAILABLE                   = 13;
    protected static final int EVENT_POLL_STATE_NETWORK_SELECTION_MODE = 14;
    protected static final int EVENT_GET_LOC_DONE                      = 15;
    protected static final int EVENT_SIM_RECORDS_LOADED                = 16;
@@ -542,6 +541,7 @@ public class ServiceStateTracker extends Handler {
        mSubscriptionManager = SubscriptionManager.from(phone.getContext());
        mSubscriptionManager
                .addOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
        mRestrictedState = new RestrictedState();

        mCi.registerForImsNetworkStateChanged(this, EVENT_IMS_STATE_CHANGED, null);

@@ -587,6 +587,7 @@ public class ServiceStateTracker extends Handler {

        mPhone.notifyOtaspChanged(TelephonyManager.OTASP_UNINITIALIZED);

        mCi.setOnRestrictedStateChanged(this, EVENT_RESTRICTED_STATE_CHANGED, null);
        updatePhoneType();

        mCSST = new CarrierServiceStateTracker(phone, this);
@@ -608,7 +609,6 @@ public class ServiceStateTracker extends Handler {
        mLastCellInfoListTime = 0;
        mLastCellInfoList = null;
        mSignalStrength = new SignalStrength();
        mRestrictedState = new RestrictedState();
        mStartedGprsRegCheck = false;
        mReportedGprsNoReg = false;
        mMdn = null;
@@ -633,13 +633,7 @@ public class ServiceStateTracker extends Handler {

            mCellLoc = new GsmCellLocation();
            mNewCellLoc = new GsmCellLocation();
            mCi.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
            mCi.setOnRestrictedStateChanged(this, EVENT_RESTRICTED_STATE_CHANGED, null);
        } else {
            //clear GSM regsitrations first
            mCi.unregisterForAvailable(this);
            mCi.unSetOnRestrictedStateChanged(this);

            if (mPhone.isPhoneTypeCdmaLte()) {
                mPhone.registerForSimRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
            }
@@ -1107,11 +1101,6 @@ public class ServiceStateTracker extends Handler {
                break;

            // GSM
            case EVENT_RADIO_AVAILABLE:
                //this is unnecessary
                //setPowerStateToDesired();
                break;

            case EVENT_SIM_READY:
                // Reset the mPreviousSubId so we treat a SIM power bounce
                // as a first boot.  See b/19194287
+6 −0
Original line number Diff line number Diff line
@@ -2115,4 +2115,10 @@ public class SimulatedCommands extends BaseCommands
                    new AsyncResult(null, restrictedState, null));
        }
    }

    @Override
    public void setOnRestrictedStateChanged(Handler h, int what, Object obj) {
        super.setOnRestrictedStateChanged(h, what, obj);
        SimulatedCommandsVerifier.getInstance().setOnRestrictedStateChanged(h, what, obj);
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;


public class GsmCdmaCallTrackerTest extends TelephonyTest {
    private static final int VOICE_CALL_STARTED_EVENT = 0;
    private static final int VOICE_CALL_ENDED_EVENT = 1;
@@ -309,6 +308,8 @@ public class GsmCdmaCallTrackerTest extends TelephonyTest {
        assertEquals(GsmCdmaCall.State.HOLDING, mCTUT.mBackgroundCall.getState());
    }

    @FlakyTest
    @Ignore
    @Test
    @MediumTest
    public void testMOCallPickUpHangUpResumeBackGround() {
+8 −1
Original line number Diff line number Diff line
@@ -902,7 +902,14 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        doReturn(true).when(mPhone).isPhoneTypeGsm();
        doReturn(IccCardApplicationStatus.AppState.APPSTATE_READY).when(
                mUiccCardApplication3gpp).getState();
        spySst.updatePhoneType();

        ArgumentCaptor<Integer> intArgumentCaptor = ArgumentCaptor.forClass(Integer.class);
        verify(mSimulatedCommandsVerifier).setOnRestrictedStateChanged(any(Handler.class),
                intArgumentCaptor.capture(), eq(null));
        // Since spy() creates a copy of sst object we need to call
        // setOnRestrictedStateChanged() explicitly.
        mSimulatedCommands.setOnRestrictedStateChanged(spySst,
                intArgumentCaptor.getValue().intValue(), null);

        // Combination of restricted state and expected notification type.
        final int CS_ALL[] = {RILConstants.RIL_RESTRICTED_STATE_CS_ALL,