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

Commit 61e83f04 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5656475 from e95807a1 to qt-release

Change-Id: Iaaf6418f487373c6c21a28aa3ba380be906ef24b
parents 3c1df8de e95807a1
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -408,6 +408,9 @@ public class DataEnabledSettings {
    }

    public synchronized boolean isDataEnabled(int apnType) {
        if (isProvisioning()) {
            return isProvisioningDataEnabled();
        } else {
            boolean userDataEnabled = isUserDataEnabled();
            // Check if we should temporarily enable data in certain conditions.
            boolean isDataEnabledOverridden = mDataEnabledOverride
@@ -416,6 +419,7 @@ public class DataEnabledSettings {
            return (mInternalDataEnabled && mPolicyDataEnabled && mCarrierDataEnabled
                    && (userDataEnabled || isDataEnabledOverridden));
        }
    }

    private void log(String s) {
        Rlog.d(LOG_TAG, "[" + mPhone.getPhoneId() + "]" + s);
+29 −22
Original line number Diff line number Diff line
@@ -1313,7 +1313,7 @@ public class DcTracker extends Handler {
            reasons.add(DataDisallowedReasonType.IN_ECBM);
        }

        if (!attachedState && !mAutoAttachEnabled.get() && requestType != REQUEST_TYPE_HANDOVER) {
        if (!attachedState && !shouldAutoAttach() && requestType != REQUEST_TYPE_HANDOVER) {
            reasons.add(DataDisallowedReasonType.NOT_ATTACHED);
        }
        if (!recordsLoaded) {
@@ -1481,6 +1481,9 @@ public class DcTracker extends Handler {
                apnContext.setState(DctConstants.State.IDLE);
            }
            int radioTech = getDataRat();
            if (radioTech == ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN) {
                radioTech = getVoiceRat();
            }
            log("service state=" + mPhone.getServiceState());
            apnContext.setConcurrentVoiceAndDataAllowed(mPhone.getServiceStateTracker()
                    .isConcurrentVoiceAndDataAllowed());
@@ -1754,8 +1757,8 @@ public class DcTracker extends Handler {
        }

        for (ApnSetting dunSetting : dunCandidates) {
            if (!ServiceState.bitmaskHasTech(dunSetting.getNetworkTypeBitmask(),
                    ServiceState.rilRadioTechnologyToNetworkType(bearer))) {
            if (!ServiceState.networkBitmaskHasAccessNetworkType(dunSetting.getNetworkTypeBitmask(),
                    ServiceState.rilRadioTechnologyToAccessNetworkType(bearer))) {
                continue;
            }
            retDunSettings.add(dunSetting);
@@ -2197,10 +2200,6 @@ public class DcTracker extends Handler {
        }
    }

    public boolean getAutoAttachEnabled() {
        return mAutoAttachEnabled.get();
    }

    private void onRecordsLoadedOrSubIdChanged() {
        if (DBG) log("onRecordsLoadedOrSubIdChanged: createAllApnList");
        if (mTransportType == AccessNetworkConstants.TRANSPORT_TYPE_WWAN) {
@@ -3270,8 +3269,9 @@ public class DcTracker extends Handler {
                        + mPreferredApn.getOperatorNumeric() + ":" + mPreferredApn);
            }
            if (mPreferredApn.getOperatorNumeric().equals(operator)) {
                if (ServiceState.bitmaskHasTech(mPreferredApn.getNetworkTypeBitmask(),
                        ServiceState.rilRadioTechnologyToNetworkType(radioTech))) {
                if (ServiceState.networkBitmaskHasAccessNetworkType(
                        mPreferredApn.getNetworkTypeBitmask(),
                        ServiceState.rilRadioTechnologyToAccessNetworkType(radioTech))) {
                    apnList.add(mPreferredApn);
                    apnList = sortApnListByPreferred(apnList);
                    if (DBG) log("buildWaitingApns: X added preferred apnList=" + apnList);
@@ -3291,8 +3291,8 @@ public class DcTracker extends Handler {
        if (DBG) log("buildWaitingApns: mAllApnSettings=" + mAllApnSettings);
        for (ApnSetting apn : mAllApnSettings) {
            if (apn.canHandleType(requestedApnTypeBitmask)) {
                if (ServiceState.bitmaskHasTech(apn.getNetworkTypeBitmask(),
                        ServiceState.rilRadioTechnologyToNetworkType(radioTech))) {
                if (ServiceState.networkBitmaskHasAccessNetworkType(apn.getNetworkTypeBitmask(),
                        ServiceState.rilRadioTechnologyToAccessNetworkType(radioTech))) {
                    if (VDBG) log("buildWaitingApns: adding apn=" + apn);
                    apnList.add(apn);
                } else {
@@ -3861,7 +3861,7 @@ public class DcTracker extends Handler {
        log("update(): Active DDS, register for all events now!");
        onUpdateIcc();

        updateAutoAttachOnCreation();
        mAutoAttachEnabled.set(false);

        mPhone.updateCurrentCarrierInProvider();
    }
@@ -3872,20 +3872,17 @@ public class DcTracker extends Handler {
     * 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.
     */
    public void updateAutoAttachOnCreation() {
    @VisibleForTesting
    public boolean shouldAutoAttach() {
        if (mAutoAttachEnabled.get()) return true;

        PhoneSwitcher phoneSwitcher = PhoneSwitcher.getInstance();
        ServiceState serviceState = mPhone.getServiceState();
        if (PhoneSwitcher.getInstance() == null || serviceState == null) {
            mAutoAttachEnabled.set(false);
            return;
        }

        // If it's non DDS phone, and voice is registered on 2G or 3G network, we set
        // mAutoAttachEnabled to true.
        mAutoAttachEnabled.set(mPhone.getPhoneId() != phoneSwitcher.getPreferredDataPhoneId()
        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);
                && serviceState.getVoiceNetworkType() != NETWORK_TYPE_NR;
    }

    private void notifyAllDataDisconnected() {
@@ -4827,4 +4824,14 @@ public class DcTracker extends Handler {
        }
        return ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN;
    }

    private int getVoiceRat() {
        ServiceState ss = mPhone.getServiceState();
        NetworkRegistrationInfo nrs = ss.getNetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_CS, mTransportType);
        if (nrs != null) {
            return ServiceState.networkTypeToRilRadioTechnology(nrs.getAccessNetworkTechnology());
        }
        return ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN;
    }
}
+0 −7
Original line number Diff line number Diff line
@@ -228,13 +228,6 @@ public class TelephonyNetworkFactory extends NetworkFactory {

    // apply or revoke requests if our active-ness changes
    private void onActivePhoneSwitch() {
        // For non DDS phone, mAutoAttachOnCreation 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. And doing so will trigger PS attach
        // if possible.
        mPhone.getDcTracker(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                .updateAutoAttachOnCreation();

        for (HashMap.Entry<NetworkRequest, Integer> entry : mNetworkRequests.entrySet()) {
            NetworkRequest networkRequest = entry.getKey();
            boolean applied = entry.getValue() != AccessNetworkConstants.TRANSPORT_TYPE_INVALID;
+2 −2
Original line number Diff line number Diff line
@@ -967,10 +967,10 @@ public class DcTrackerTest extends TelephonyTest {

        verifyDataConnected(FAKE_APN1);

        assertTrue(mDct.getAutoAttachEnabled());
        assertTrue(mDct.shouldAutoAttach());
        mDct.update();
        // The auto attach flag should be reset after update
        assertFalse(mDct.getAutoAttachEnabled());
        assertFalse(mDct.shouldAutoAttach());

        verify(mSST, times(1)).registerForDataConnectionDetached(
                eq(AccessNetworkConstants.TRANSPORT_TYPE_WWAN), eq(mDct),