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

Commit 3e07d437 authored by Brad Ebinger's avatar Brad Ebinger Committed by Gerrit Code Review
Browse files

Merge "Do not consider no service as home network"

parents 8f1097bf eac7347d
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -1432,8 +1432,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:
@@ -1442,7 +1448,7 @@ public class ImsPhone extends ImsPhoneBase {
                // only update if roaming status changed
                boolean newRoaming = getCurrentRoaming();
                if (mRoaming != newRoaming) {
                    updateRoamingState(newRoaming);
                    updateRoamingState(newRoaming, true);
                }
                break;

@@ -1804,12 +1810,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,
@@ -1820,7 +1830,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