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

Commit b06e5783 authored by Nathan Harold's avatar Nathan Harold
Browse files

Call setN1Mode via Phone rather than CommandsInterface

Update the ImsNrSaModeHandler to control the N1Mode via the
Phone object (which will implicitly call the GsmCdmaPhone object)
instead of going directly to the commands interface. This will
ensure that the desired value of N1 is properly combined in
a single location and avoid some unlikely edge cases that would
cause it to be out of sync.

Bug: 319936478
Test: Telephony Sanity (voice, data, sms) on T-Mobile
Test: Manual verification of new+old code paths
Change-Id: Ie8c9f249e40c157d10c853caa28fe258aec6ef29
parent 58bbae5b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ public class ImsNrSaModeHandler extends Handler{

    private void setNrSaMode(boolean onOrOff) {
        if (mIsNrSaSupported) {
            mPhone.getDefaultPhone().mCi.setN1ModeEnabled(onOrOff, null);
            mPhone.getDefaultPhone().setN1ModeEnabled(onOrOff, null);
            Log.i(TAG, "setNrSaMode : " + onOrOff);

            setNrSaDisabledForWfc(!onOrOff);
+12 −1
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@ import android.testing.TestableLooper;
import android.util.ArraySet;

import com.android.internal.telephony.Call;
import com.android.internal.telephony.GsmCdmaPhone;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyTest;

import org.junit.After;
@@ -66,6 +69,8 @@ public final class ImsNrSaModeHandlerTest extends TelephonyTest{
    private CarrierConfigManager.CarrierConfigChangeListener mCarrierConfigChangeListener;
    private Handler mPreciseCallStateHandler;

    private Phone mPassthroughPhone;

    @Mock private ImsPhoneCall mForegroundCall;
    @Mock private ImsPhoneCall mBackgroundCall;
    private Call.State mActiveState = ImsPhoneCall.State.ACTIVE;
@@ -90,7 +95,13 @@ public final class ImsNrSaModeHandlerTest extends TelephonyTest{
        doReturn(mAnyInt).when(mImsPhone).getSubId();
        doReturn(mContextFixture.getCarrierConfigBundle()).when(mCarrierConfigManager)
                .getConfigForSubId(anyInt(), any());
        doReturn(mPhone).when(mImsPhone).getDefaultPhone();

        mPassthroughPhone = new GsmCdmaPhone(
                mContext, mSimulatedCommands, mNotifier, true, 0,
                PhoneConstants.PHONE_TYPE_GSM, mTelephonyComponentFactory,
                (c, p) -> mImsManager, mFeatureFlags);

        doReturn(mPassthroughPhone).when(mImsPhone).getDefaultPhone();

        doReturn(mForegroundCall).when(mImsPhone).getForegroundCall();
        doReturn(mBackgroundCall).when(mImsPhone).getBackgroundCall();