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

Commit 5e22d3b1 authored by Ling Ma's avatar Ling Ma
Browse files

Check user settings only for data during call

During the phone call, we should stick with the voice phone regardless whether data can be established on it. This is consistent with pre-U behavior.

Without this change, if EMC is happening on nDDS, but data is currently OOS, then we don't switch to the nDDS. However, if later on the EMC nDDS is in roaming, then we don't have another chance to resurrect data service on this nDDS.

Fix: 293221772
Test: use data during voice call using command to reproduce scenario
Change-Id: I15f05ec2f4878c4f0b501caa36582fb35b55e2d3
parent e2068578
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1387,7 +1387,7 @@ public class PhoneSwitcher extends Handler {
        return defaultDataPhone != null // check user enabled data
                && defaultDataPhone.isUserDataEnabled()
                && voicePhone != null // check user enabled voice during call feature
                && voicePhone.isDataAllowed();
                && voicePhone.getDataSettingsManager().isDataEnabled();
    }

    protected void transitionToEmergencyPhone() {
+8 −7
Original line number Diff line number Diff line
@@ -631,7 +631,7 @@ public class PhoneSwitcherTest extends TelephonyTest {
        // A higher priority event occurring E.g. Phone1 has active IMS call on LTE.
        doReturn(mImsPhone).when(mPhone).getImsPhone();
        doReturn(true).when(mPhone).isUserDataEnabled();
        doReturn(true).when(mPhone).isDataAllowed();
        doReturn(true).when(mDataSettingsManager).isDataEnabled();
        mockImsRegTech(0, REGISTRATION_TECH_LTE);
        notifyPhoneAsInCall(mPhone);

@@ -852,7 +852,7 @@ public class PhoneSwitcherTest extends TelephonyTest {
        // Phone2 has active IMS call on LTE. And data of DEFAULT apn is enabled. This should
        // trigger data switch.
        doReturn(mImsPhone).when(mPhone2).getImsPhone();
        doReturn(true).when(mPhone2).isDataAllowed();
        doReturn(true).when(mDataSettingsManager2).isDataEnabled();
        mockImsRegTech(1, REGISTRATION_TECH_LTE);
        notifyPhoneAsInCall(mImsPhone);

@@ -881,7 +881,7 @@ public class PhoneSwitcherTest extends TelephonyTest {
        // Phone2 has active IMS call on LTE. And data of DEFAULT apn is enabled. This should
        // trigger data switch.
        doReturn(mImsPhone).when(mPhone2).getImsPhone();
        doReturn(true).when(mPhone2).isDataAllowed();
        doReturn(true).when(mDataSettingsManager2).isDataEnabled();
        mockImsRegTech(1, REGISTRATION_TECH_LTE);
        notifyPhoneAsInDial(mImsPhone);

@@ -909,7 +909,7 @@ public class PhoneSwitcherTest extends TelephonyTest {
        // Phone2 has active IMS call on LTE. And data of DEFAULT apn is enabled. This should
        // trigger data switch.
        doReturn(mImsPhone).when(mPhone2).getImsPhone();
        doReturn(true).when(mPhone2).isDataAllowed();
        doReturn(true).when(mDataSettingsManager2).isDataEnabled();
        mockImsRegTech(1, REGISTRATION_TECH_LTE);
        notifyPhoneAsInIncomingCall(mImsPhone);

@@ -936,7 +936,7 @@ public class PhoneSwitcherTest extends TelephonyTest {

        // Phone2 has active call, but data is turned off. So no data switching should happen.
        doReturn(mImsPhone).when(mPhone2).getImsPhone();
        doReturn(true).when(mPhone2).isDataAllowed();
        doReturn(true).when(mDataSettingsManager2).isDataEnabled();
        mockImsRegTech(1, REGISTRATION_TECH_IWLAN);
        notifyPhoneAsInCall(mImsPhone);

@@ -965,7 +965,7 @@ public class PhoneSwitcherTest extends TelephonyTest {
        // not trigger data switch.
        doReturn(mImsPhone).when(mPhone2).getImsPhone();
        doReturn(true).when(mPhone).isUserDataEnabled();
        doReturn(true).when(mPhone2).isDataAllowed();
        doReturn(true).when(mDataSettingsManager2).isDataEnabled();
        mockImsRegTech(1, REGISTRATION_TECH_CROSS_SIM);
        notifyPhoneAsInCall(mImsPhone);

@@ -1657,6 +1657,7 @@ public class PhoneSwitcherTest extends TelephonyTest {

        // 2.2 Auto switch feature is enabled
        doReturn(true).when(mPhone2).isDataAllowed();
        doReturn(true).when(mDataSettingsManager2).isDataEnabled();

        // 3.1 No default network
        doReturn(null).when(mConnectivityManager).getNetworkCapabilities(any());
@@ -1730,7 +1731,7 @@ public class PhoneSwitcherTest extends TelephonyTest {
    private void notifyDataEnabled(boolean dataEnabled) {
        doReturn(true).when(mPhone).isUserDataEnabled();
        doReturn(dataEnabled).when(mDataSettingsManager).isDataEnabled();
        doReturn(dataEnabled).when(mPhone2).isDataAllowed();
        doReturn(dataEnabled).when(mDataSettingsManager2).isDataEnabled();
        mDataSettingsManagerCallbacks.get(0).onDataEnabledChanged(dataEnabled, 123 , "");
        if (mDataSettingsManagerCallbacks.size() > 1) {
            mDataSettingsManagerCallbacks.get(1).onDataEnabledChanged(dataEnabled, 123, "");