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

Commit 0da37c6e authored by Ling Ma's avatar Ling Ma Committed by Android (Google) Code Review
Browse files

Merge "Init data reg state with the current state" into main

parents 2abe6407 bc0d1aa2
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -191,8 +191,7 @@ public class AutoDataSwitchController extends Handler {
        /** The phone */
        @NonNull private final Phone mPhone;
        /** Data registration state of the phone */
        @RegistrationState private int mDataRegState = NetworkRegistrationInfo
                .REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING;
        @RegistrationState private int mDataRegState;
        /** Current Telephony display info of the phone */
        @NonNull private TelephonyDisplayInfo mDisplayInfo;
        /** Signal strength of the phone */
@@ -201,6 +200,10 @@ public class AutoDataSwitchController extends Handler {
        private boolean mListeningForEvents;
        private PhoneSignalStatus(@NonNull Phone phone) {
            this.mPhone = phone;
            this.mDataRegState = phone.getServiceState().getNetworkRegistrationInfo(
                            NetworkRegistrationInfo.DOMAIN_PS,
                            AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                    .getRegistrationState();
            this.mDisplayInfo = phone.getDisplayInfoController().getTelephonyDisplayInfo();
            this.mSignalStrength = phone.getSignalStrength();
        }
+11 −0
Original line number Diff line number Diff line
@@ -106,6 +106,17 @@ public class AutoDataSwitchControllerTest extends TelephonyTest {

        mPhones = new Phone[]{mPhone, mPhone2};
        for (Phone phone : mPhones) {
            ServiceState ss = new ServiceState();

            ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
                    .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                    .setRegistrationState(
                            NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING)
                    .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
                    .setIsNonTerrestrialNetwork(mIsNonTerrestrialNetwork)
                    .build());

            doReturn(ss).when(phone).getServiceState();
            doReturn(mSST).when(phone).getServiceStateTracker();
            doReturn(mDisplayInfoController).when(phone).getDisplayInfoController();
            doReturn(mSignalStrengthController).when(phone).getSignalStrengthController();
+11 −0
Original line number Diff line number Diff line
@@ -1936,6 +1936,17 @@ public class PhoneSwitcherTest extends TelephonyTest {
        }

        replaceInstance(PhoneFactory.class, "sPhones", null, mPhones);
        for (Phone phone : mPhones) {
            ServiceState ss = new ServiceState();

            ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
                    .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                    .setRegistrationState(
                            NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING)
                    .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
                    .build());
            doReturn(ss).when(phone).getServiceState();
        }
    }

    private void initializeCommandInterfacesMock() {