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

Commit 26cf0b1c authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fixed that out of service in latest service state" am: 2c542468 am: 4f1541a5

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

Change-Id: I554689e079943a130385b102882f8b18b1920d5d
parents 780e8a95 4f1541a5
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -583,13 +583,14 @@ public class GsmCdmaPhone extends Phone {
    public ServiceState getServiceState() {
    public ServiceState getServiceState() {
        if (mSST == null || mSST.mSS.getState() != ServiceState.STATE_IN_SERVICE) {
        if (mSST == null || mSST.mSS.getState() != ServiceState.STATE_IN_SERVICE) {
            if (mImsPhone != null) {
            if (mImsPhone != null) {
                return mergeServiceStates((mSST == null) ? new ServiceState() : mSST.mSS,
                return mergeServiceStates((mSST == null)
                                ? new ServiceState() : mSST.getServiceState(),
                        mImsPhone.getServiceState());
                        mImsPhone.getServiceState());
            }
            }
        }
        }


        if (mSST != null) {
        if (mSST != null) {
            return mSST.mSS;
            return mSST.getServiceState();
        } else {
        } else {
            // avoid potential NPE in EmergencyCallHelper during Phone switch
            // avoid potential NPE in EmergencyCallHelper during Phone switch
            return new ServiceState();
            return new ServiceState();
+1 −1
Original line number Original line Diff line number Diff line
@@ -514,7 +514,7 @@ public class ImsPhone extends ImsPhoneBase {
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @Override
    @Override
    public ServiceState getServiceState() {
    public ServiceState getServiceState() {
        return mSS;
        return new ServiceState(mSS);
    }
    }


    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
+3 −0
Original line number Original line Diff line number Diff line
@@ -168,6 +168,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
    public void testGetServiceState() {
    public void testGetServiceState() {
        ServiceState serviceState = new ServiceState();
        ServiceState serviceState = new ServiceState();
        mSST.mSS = serviceState;
        mSST.mSS = serviceState;
        doReturn(serviceState).when(mSST).getServiceState();
        assertEquals(serviceState, mPhoneUT.getServiceState());
        assertEquals(serviceState, mPhoneUT.getServiceState());
    }
    }


@@ -238,6 +239,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
        serviceState.setIwlanPreferred(true);
        serviceState.setIwlanPreferred(true);


        mSST.mSS = serviceState;
        mSST.mSS = serviceState;
        doReturn(serviceState).when(mSST).getServiceState();
        mPhoneUT.mSST = mSST;
        mPhoneUT.mSST = mSST;


        ServiceState mergedServiceState = mPhoneUT.getServiceState();
        ServiceState mergedServiceState = mPhoneUT.getServiceState();
@@ -320,6 +322,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
        serviceState.setIwlanPreferred(true);
        serviceState.setIwlanPreferred(true);


        mSST.mSS = serviceState;
        mSST.mSS = serviceState;
        doReturn(serviceState).when(mSST).getServiceState();
        mPhoneUT.mSST = mSST;
        mPhoneUT.mSST = mSST;


        ServiceState mergedServiceState = mPhoneUT.getServiceState();
        ServiceState mergedServiceState = mPhoneUT.getServiceState();