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

Commit 402cd637 authored by Brad Ebinger's avatar Brad Ebinger Committed by android-build-merger
Browse files

Merge "Do not consider no service as home network" am: 3e07d437 am: ace15a5c

am: 4cc03e9d

Change-Id: I856fa68ed74bdafd2bf7359e5eeb924239288e5f
parents afc106fc 4cc03e9d
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -1433,8 +1433,14 @@ public class ImsPhone extends ImsPhoneBase {
                ServiceState newServiceState = (ServiceState) ar.result;
                // only update if roaming status changed
                if (mRoaming != newServiceState.getRoaming()) {
                    if (DBG) logd("Roaming state changed");
                    updateRoamingState(newServiceState.getRoaming());
                    if (DBG) logd("Roaming state changed - " + mRoaming);
                    // Update WFC mode only if voice or data is in service.
                    // The STATE_IN_SERVICE is checked to prevent wifi calling mode change
                    // when phone moves from roaming to no service.
                    boolean isInService =
                            (newServiceState.getVoiceRegState() == ServiceState.STATE_IN_SERVICE ||
                            newServiceState.getDataRegState() == ServiceState.STATE_IN_SERVICE);
                    updateRoamingState(newServiceState.getRoaming(), isInService);
                }
                break;
            case EVENT_VOICE_CALL_ENDED:
@@ -1443,7 +1449,7 @@ public class ImsPhone extends ImsPhoneBase {
                // only update if roaming status changed
                boolean newRoaming = getCurrentRoaming();
                if (mRoaming != newRoaming) {
                    updateRoamingState(newRoaming);
                    updateRoamingState(newRoaming, true);
                }
                break;

@@ -1805,12 +1811,16 @@ public class ImsPhone extends ImsPhoneBase {
        return mCT.getVtDataUsage(perUidStats);
    }

    private void updateRoamingState(boolean newRoaming) {
    private void updateRoamingState(boolean newRoaming, boolean isInService) {
        if (mCT.getState() == PhoneConstants.State.IDLE) {
            if (DBG) logd("updateRoamingState now: " + newRoaming);
            mRoaming = newRoaming;
            if (isInService) {
                ImsManager imsManager = ImsManager.getInstance(mContext, mPhoneId);
                imsManager.setWfcMode(imsManager.getWfcMode(newRoaming), newRoaming);
            } else {
                if (DBG) Rlog.d(LOG_TAG, "updateRoamingState service state is OUT_OF_SERVICE");
            }
        } else {
            if (DBG) logd("updateRoamingState postponed: " + newRoaming);
            mCT.registerForVoiceCallEnded(this,
@@ -1821,7 +1831,7 @@ public class ImsPhone extends ImsPhoneBase {
    private boolean getCurrentRoaming() {
        TelephonyManager tm = (TelephonyManager) mContext
                .getSystemService(Context.TELEPHONY_SERVICE);
        return tm.isNetworkRoaming();
        return tm.isNetworkRoaming(getSubId());
    }

    @Override