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

Commit cc6404f5 authored by Li Wei's avatar Li Wei Committed by Gerrit - the friendly Code Review server
Browse files

Support for configuring captive portal detection enabled by user

1. Add an item into default configuration so that user can overlay it
2. Enable captive portal detection by default.

CRs-Fixed: 1068686
Change-Id: I10c58a58c5b79dd2d7ea081a71f3752dd9928868
parent 263b211a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -293,4 +293,6 @@
        containing the IDs of all enabled input methods, each ID separated by ':'.
    -->
    <string name="def_enable_input_methods" translatable="false"></string>
    <!-- Default for Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED -->
    <integer name="def_captive_portal_detection_enabled" translatable="false">1</integer>
</resources>
+10 −2
Original line number Diff line number Diff line
@@ -1407,6 +1407,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
        if (upgradeVersion == 88) {
            if (mUserHandle == UserHandle.USER_SYSTEM) {
                db.beginTransaction();
                SQLiteStatement stmt = null;
                try {
                    String[] settingsToMove = {
                            Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD,
@@ -1426,7 +1427,6 @@ class DatabaseHelper extends SQLiteOpenHelper {
                            Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES,
                            Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS,
                            Settings.Global.CONNECTIVITY_CHANGE_DELAY,
                            Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED,
                            Settings.Global.CAPTIVE_PORTAL_SERVER,
                            Settings.Global.NSD_ON,
                            Settings.Global.SET_INSTALL_LOCATION,
@@ -1442,9 +1442,16 @@ class DatabaseHelper extends SQLiteOpenHelper {
                            Settings.Global.DEFAULT_DNS_SERVER,
                    };
                    moveSettingsToNewTable(db, TABLE_SECURE, TABLE_GLOBAL, settingsToMove, true);

                    stmt = db.compileStatement("INSERT OR REPLACE INTO global(name,value)"
                            + " VALUES(?,?);");
                    loadIntegerSetting(stmt, Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED,
                            R.integer.def_captive_portal_detection_enabled);
                    stmt.close();
                    db.setTransactionSuccessful();
                } finally {
                    db.endTransaction();
                    if (stmt != null) stmt.close();
                }
            }
            upgradeVersion = 89;
@@ -2747,7 +2754,6 @@ class DatabaseHelper extends SQLiteOpenHelper {

            loadSetting(stmt, Settings.Global.ENHANCED_4G_MODE_ENABLED,
                    ImsConfig.FeatureValueConstants.ON);

            /*
             * IMPORTANT: Do not add any more upgrade steps here as the global,
             * secure, and system settings are no longer stored in a database
@@ -2755,6 +2761,8 @@ class DatabaseHelper extends SQLiteOpenHelper {
             *
             * See: SettingsProvider.UpgradeController#onUpgradeLocked
             */
            loadIntegerSetting(stmt, Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED,
                    R.integer.def_captive_portal_detection_enabled);
        } finally {
            if (stmt != null) stmt.close();
        }