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

Commit 7ac507ca authored by Malcolm Chen's avatar Malcolm Chen
Browse files

Make DEFAULT_DATA_UNSELECTED soft reason for forbidden data connections.

When default data is not selected, still allow unmetered connections to
set up.

Bug: 142545047
Test: unittest
Change-Id: I22a3d9670c7bf856cf5ea658e51f0ec2fcdcac01
parent f8a66e1d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ public class DataConnectionReasons {
        // Soft failure reasons. Normally the reasons from users or policy settings.
        DATA_DISABLED(false),               // Data is disabled by the user or policy.
        ROAMING_DISABLED(false),            // Data roaming is disabled by the user.
        DEFAULT_DATA_UNSELECTED(false),     // Default data not selected.

        // Belows are all hard failure reasons.
        NOT_ATTACHED(true),
@@ -111,7 +112,6 @@ public class DataConnectionReasons {
        PS_RESTRICTED(true),
        UNDESIRED_POWER_STATE(true),
        INTERNAL_DATA_DISABLED(true),
        DEFAULT_DATA_UNSELECTED(true),
        RADIO_DISABLED_BY_CARRIER(true),
        APN_NOT_CONNECTABLE(true),
        ON_IWLAN(true),
+27 −1
Original line number Diff line number Diff line
@@ -619,6 +619,33 @@ public class DcTrackerTest extends TelephonyTest {
        }
    }

    // Test the unmetered APN setup when data is disabled.
    @Test
    @SmallTest
    public void testTrySetupDataUnmeteredDefaultNotSelected() throws Exception {
        initApns(PhoneConstants.APN_TYPE_FOTA, new String[]{PhoneConstants.APN_TYPE_ALL});
        doReturn(SubscriptionManager.INVALID_SUBSCRIPTION_ID).when(mIsub).getDefaultDataSubId();

        mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_APN_TYPES_STRINGS,
                new String[]{PhoneConstants.APN_TYPE_DEFAULT});

        logd("Sending EVENT_RECORDS_LOADED");
        mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_RECORDS_LOADED, null));
        waitForMs(200);

        logd("Sending EVENT_DATA_CONNECTION_ATTACHED");
        mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_DATA_CONNECTION_ATTACHED, null));
        waitForMs(200);

        mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_TRY_SETUP_DATA, mApnContext));
        waitForMs(200);

        verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(
                eq(AccessNetworkType.EUTRAN), any(DataProfile.class),
                eq(false), eq(false), eq(DataService.REQUEST_REASON_NORMAL), any(),
                any(Message.class));
    }

    // Test the normal data call setup scenario.
    @Test
    @MediumTest
@@ -775,7 +802,6 @@ public class DcTrackerTest extends TelephonyTest {
        assertEquals(DctConstants.State.CONNECTED, mDct.getState(PhoneConstants.APN_TYPE_IMS));
    }


    @Test
    @MediumTest
    public void testTrySetupDataMmsAllowedDataDisabled() throws Exception {