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

Commit 459bd6f7 authored by Nathan Harold's avatar Nathan Harold Committed by Yvonne Lin
Browse files

Re-Add a flag to Enable Carrier N1 Mode Control

Add a new flag to control Carrier N1 Mode, so that
it can be defaulted to off. Some OEMs may not have
had sufficient opportunity to update all other
configs in all other software that must correctly
reflect the carrier SA mode support. In the event
that those configs are not updated, enabling this
feature will cause functional regressions. Thus,
disabling this feature by default.

Bug: 328848947
Test: atest GsmCdmaPhoneTest
Test: manually verified on Pixel
Change-Id: Ic3d490422ea7973a21a59b5363232f8b8c06f872
(cherry picked from commit 650660f9)
parent 98dea6c7
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
package: "com.android.internal.telephony.flags"

flag {
    name: "enable_carrier_config_n1_control"
    name: "enable_carrier_config_n1_control_attempt2"
    namespace: "telephony"
    description: "enabling this flag allows KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY to control N1 mode enablement"
    bug:"302033535"
    bug:"328848947"

    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
+2 −2
Original line number Diff line number Diff line
@@ -2443,7 +2443,7 @@ public class GsmCdmaPhone extends Phone {
     */
    @Override
    public void setN1ModeEnabled(boolean enable, @Nullable Message result) {
        if (mFeatureFlags.enableCarrierConfigN1Control()) {
        if (mFeatureFlags.enableCarrierConfigN1ControlAttempt2()) {
            // This might be called by IMS on another thread, so to avoid the requirement to
            // lock, post it through the handler.
            post(() -> {
@@ -2484,7 +2484,7 @@ public class GsmCdmaPhone extends Phone {

    /** Only called on the handler thread. */
    private void updateCarrierN1ModeSupported(@NonNull PersistableBundle b) {
        if (!mFeatureFlags.enableCarrierConfigN1Control()) return;
        if (!mFeatureFlags.enableCarrierConfigN1ControlAttempt2()) return;

        if (!CarrierConfigManager.isConfigForIdentifiedCarrier(b)) return;

+6 −6
Original line number Diff line number Diff line
@@ -1519,7 +1519,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

    @Test
    public void testNrCapabilityChanged_firstRequest_incompleteCarrierConfig_changeNeeded() {
        when(mFeatureFlags.enableCarrierConfigN1Control()).thenReturn(true);
        when(mFeatureFlags.enableCarrierConfigN1ControlAttempt2()).thenReturn(true);

        mPhoneUT.mCi = mMockCi;
        PersistableBundle bundle = mContextFixture.getCarrierConfigBundle();
@@ -1550,7 +1550,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

    @Test
    public void testNrCapabilityChanged_firstRequest_noChangeNeeded() {
        when(mFeatureFlags.enableCarrierConfigN1Control()).thenReturn(true);
        when(mFeatureFlags.enableCarrierConfigN1ControlAttempt2()).thenReturn(true);

        mPhoneUT.mCi = mMockCi;
        PersistableBundle bundle = mContextFixture.getCarrierConfigBundle();
@@ -1574,7 +1574,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

    @Test
    public void testNrCapabilityChanged_firstRequest_needsChange() {
        when(mFeatureFlags.enableCarrierConfigN1Control()).thenReturn(true);
        when(mFeatureFlags.enableCarrierConfigN1ControlAttempt2()).thenReturn(true);

        mPhoneUT.mCi = mMockCi;
        PersistableBundle bundle = mContextFixture.getCarrierConfigBundle();
@@ -1598,7 +1598,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

    @Test
    public void testNrCapabilityChanged_CarrierConfigChanges() {
        when(mFeatureFlags.enableCarrierConfigN1Control()).thenReturn(true);
        when(mFeatureFlags.enableCarrierConfigN1ControlAttempt2()).thenReturn(true);

        // Initialize the inner cache and set the modem to N1 mode = enabled/true
        testNrCapabilityChanged_firstRequest_needsChange();
@@ -1620,7 +1620,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

    @Test
    public void testNrCapabilityChanged_CarrierConfigChanges_ErrorResponse() {
        when(mFeatureFlags.enableCarrierConfigN1Control()).thenReturn(true);
        when(mFeatureFlags.enableCarrierConfigN1ControlAttempt2()).thenReturn(true);

        mPhoneUT.mCi = mMockCi;
        for (int i = 0; i < 2; i++) {
@@ -1646,7 +1646,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

    @Test
    public void testNrCapabilityChanged_firstRequest_ImsChanges() {
        when(mFeatureFlags.enableCarrierConfigN1Control()).thenReturn(true);
        when(mFeatureFlags.enableCarrierConfigN1ControlAttempt2()).thenReturn(true);

        mPhoneUT.mCi = mMockCi;
        Message passthroughMessage = mTestHandler.obtainMessage(0xC0FFEE);