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

Commit 84d77efa authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by android-build-merger
Browse files

Merge "Allow data auto attach during voice call." am: e74f6e81

am: 47a085d9

Change-Id: I627601b3a4c1905bde8528633913cbdf680677c6
parents 18262a88 47a085d9
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -2879,7 +2879,18 @@ public class ServiceStateTracker extends Handler {
            // Checking the Concurrent Service Supported flag first for all phone types.
            return true;
        } else if (mPhone.isPhoneTypeGsm()) {
            return (mSS.getRilDataRadioTechnology() >= ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
            int radioTechnology = mSS.getRilDataRadioTechnology();
            // There are cases where we we would setup data connection even data is not yet
            // attached. In these cases we check voice rat.
            if (radioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN
                    && mSS.getDataRegState() != ServiceState.STATE_IN_SERVICE) {
                radioTechnology = mSS.getRilVoiceRadioTechnology();
            }
            // Concurrent voice and data is not allowed for 2G technologies. It's allowed in other
            // rats e.g. UMTS, LTE, etc.
            return radioTechnology != ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN
                    && ServiceState.rilRadioTechnologyToAccessNetworkType(radioTechnology)
                        != AccessNetworkType.GERAN;
        } else {
            return false;
        }
+15 −11
Original line number Diff line number Diff line
@@ -3882,23 +3882,27 @@ public class DcTracker extends Handler {
        mPhone.updateCurrentCarrierInProvider();
    }

    /**
     * For non DDS phone, mAutoAttachEnabled should be true because it may be detached
     * automatically from network only because it's idle for too long. In this case, we should
     * try setting up data call even if it's not attached for 2G or 3G networks. And doing so will
     * trigger PS attach if possible.
     */
    @VisibleForTesting
    public boolean shouldAutoAttach() {
        if (mAutoAttachEnabled.get()) return true;

        PhoneSwitcher phoneSwitcher = PhoneSwitcher.getInstance();
        ServiceState serviceState = mPhone.getServiceState();
        return phoneSwitcher != null && serviceState != null
                && mPhone.getPhoneId() != phoneSwitcher.getPreferredDataPhoneId()
                && serviceState.getVoiceRegState() == ServiceState.STATE_IN_SERVICE
                && serviceState.getVoiceNetworkType() != NETWORK_TYPE_LTE
                && serviceState.getVoiceNetworkType() != NETWORK_TYPE_NR;

        if (phoneSwitcher == null || serviceState == null) return false;

        // If voice is also not in service, don't auto attach.
        if (serviceState.getVoiceRegState() != ServiceState.STATE_IN_SERVICE) return false;

        // If voice is on LTE or NR, don't auto attach as for LTE / NR data would be attached.
        if (serviceState.getVoiceNetworkType() == NETWORK_TYPE_LTE
                || serviceState.getVoiceNetworkType() == NETWORK_TYPE_NR) return false;

        // If phone is non default phone, modem may have detached from data for optimization.
        // If phone is in voice call, for DSDS case DDS switch may be limited so we do try our
        // best to setup data connection and allow auto-attach.
        return (mPhone.getPhoneId() != phoneSwitcher.getPreferredDataPhoneId()
                || mPhone.getState() != PhoneConstants.State.IDLE);
    }

    private void notifyAllDataDisconnected() {