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

Commit 7bef7390 authored by Mike Lockwood's avatar Mike Lockwood Committed by Mike Lockwood
Browse files

SettingsProvider: Add support for overriding lockscreen.disabled default value

parent 4b797dd8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1835,6 +1835,12 @@ public final class Settings {
         */
        public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";

        /**
         * Whether the lockscreen should be completely disabled.
         * @hide
         */
        public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled";

        /**
         * URI for the low battery sound file.
         * @hide
+1 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@
    <integer name="def_lockscreen_sounds_enabled">1</integer>
    <string name="def_lock_sound" translatable="false">/system/media/audio/ui/Lock.ogg</string>
    <string name="def_unlock_sound" translatable="false">/system/media/audio/ui/Unlock.ogg</string>
    <bool name="def_lockscreen_disabled">false</bool>

    <!-- Notifications use ringer volume -->
    <bool name="def_notifications_use_ring_volume">true</bool>
+24 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
    // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
    // is properly propagated through your change.  Not doing so will result in a loss of user
    // settings.
    private static final int DATABASE_VERSION = 75;
    private static final int DATABASE_VERSION = 76;

    private Context mContext;

@@ -1006,6 +1006,29 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            }
            upgradeVersion = 75;
        }
        if (upgradeVersion == 75) {
            db.beginTransaction();
            SQLiteStatement stmt = null;
            Cursor c = null;
            try {
                c = db.query("secure", new String[] {"_id", "value"},
                        "name='lockscreen.disabled'",
                        null, null, null, null);
                // only set default if it has not yet been set
                if (c == null || c.getCount() == 0) {
                    stmt = db.compileStatement("INSERT INTO system(name,value)"
                            + " VALUES(?,?);");
                    loadBooleanSetting(stmt, Settings.System.LOCKSCREEN_DISABLED,
                            R.bool.def_lockscreen_disabled);
                }
                db.setTransactionSuccessful();
            } finally {
                db.endTransaction();
                if (c != null) c.close();
                if (stmt != null) stmt.close();
            }
            upgradeVersion = 76;
        }

        // *** Remember to update DATABASE_VERSION above!