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

Commit 2ae195ae authored by Mengjun Leng's avatar Mengjun Leng
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: 822072
Change-Id: I10c58a58c5b79dd2d7ea081a71f3752dd9928868
parent edb7f451
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -214,4 +214,6 @@
    <!-- Default for Settings.Global.GUEST_USER_ENABLED -->
    <bool name="def_guest_user_enabled">true</bool>

    <!-- Default for Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED -->
    <integer name="def_captive_portal_detection_enabled" translatable="false">1</integer>
</resources>
+11 −1
Original line number Diff line number Diff line
@@ -1356,6 +1356,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
        if (upgradeVersion == 88) {
            if (mUserHandle == UserHandle.USER_OWNER) {
                db.beginTransaction();
                SQLiteStatement stmt = null;
                try {
                    String[] settingsToMove = {
                            Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD,
@@ -1375,7 +1376,6 @@ public 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,
@@ -1391,9 +1391,16 @@ public 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;
@@ -2756,6 +2763,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {

            loadBooleanSetting(stmt, Settings.Global.GUEST_USER_ENABLED,
                    R.bool.def_guest_user_enabled);

            loadIntegerSetting(stmt, Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED,
                    R.integer.def_captive_portal_detection_enabled);
            // --- New global settings start here
        } finally {
            if (stmt != null) stmt.close();