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

Commit be4d8e7f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Disable DUN APN while roaming for certain carriers"

parents c7ce0531 78e52aa7
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -1825,6 +1825,19 @@ public class DcTracker extends Handler {
        ArrayList<ApnSetting> dunCandidates = new ArrayList<ApnSetting>();
        ArrayList<ApnSetting> dunCandidates = new ArrayList<ApnSetting>();
        ArrayList<ApnSetting> retDunSettings = new ArrayList<ApnSetting>();
        ArrayList<ApnSetting> retDunSettings = new ArrayList<ApnSetting>();


        if (mPhone.getServiceState().getRoaming()) {
            CarrierConfigManager configManager = (CarrierConfigManager) mPhone.getContext()
                    .getSystemService(Context.CARRIER_CONFIG_SERVICE);
            if (configManager != null) {
                PersistableBundle b = configManager.getConfigForSubId(mPhone.getSubId());
                if (b != null) {
                    if (b.getBoolean(CarrierConfigManager.KEY_DISABLE_DUN_APN_WHILE_ROAMING)) {
                        return new ArrayList<>();
                    }
                }
            }
        }

        // Places to look for tether APN in order: TETHER_DUN_APN setting (to be deprecated soon),
        // Places to look for tether APN in order: TETHER_DUN_APN setting (to be deprecated soon),
        // APN database
        // APN database
        String apnData = Settings.Global.getString(mResolver, Settings.Global.TETHER_DUN_APN);
        String apnData = Settings.Global.getString(mResolver, Settings.Global.TETHER_DUN_APN);
+20 −0
Original line number Original line Diff line number Diff line
@@ -1380,6 +1380,26 @@ public class DcTrackerTest extends TelephonyTest {
        assertTrue(dunApnExpected.equals(dunApns.get(0)));
        assertTrue(dunApnExpected.equals(dunApns.get(0)));
    }
    }


    @Test
    @SmallTest
    public void testFetchDunApnWhileRoaming() {
        doReturn(true).when(mServiceState).getRoaming();
        mBundle.putBoolean(CarrierConfigManager.KEY_DISABLE_DUN_APN_WHILE_ROAMING, true);

        sendInitializationEvents();

        String dunApnString = "[ApnSettingV3]HOT mobile PC,pc.hotm,,,,,,,,,440,10,,DUN,,,true,"
                + "0,,,,,,,,";

        Settings.Global.putString(mContext.getContentResolver(),
                Settings.Global.TETHER_DUN_APN, dunApnString);
        // Expect empty DUN APN list
        assertEquals(0, mDct.fetchDunApns().size());

        Settings.Global.putString(mContext.getContentResolver(),
                Settings.Global.TETHER_DUN_APN, null);
    }

    // Test oos
    // Test oos
    @Test
    @Test
    @SmallTest
    @SmallTest