diff options
author | Mike Lockwood <lockwood@android.com> | 2011-10-20 16:51:53 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@google.com> | 2012-02-10 10:51:23 -0800 |
commit | 7bef73900b075fc0a9078d418964ca8e7210d565 (patch) | |
tree | 47c75cbf1727e1fe8dbb827b0a4bf54cb8944ed1 /packages/SettingsProvider | |
parent | 4b797dd8c1d059510b12957acc3bd0b236308bb3 (diff) | |
download | frameworks_base-7bef73900b075fc0a9078d418964ca8e7210d565.zip frameworks_base-7bef73900b075fc0a9078d418964ca8e7210d565.tar.gz frameworks_base-7bef73900b075fc0a9078d418964ca8e7210d565.tar.bz2 |
SettingsProvider: Add support for overriding lockscreen.disabled default value
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'packages/SettingsProvider')
-rw-r--r-- | packages/SettingsProvider/res/values/defaults.xml | 1 | ||||
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 25 |
2 files changed, 25 insertions, 1 deletions
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 6081d6f..379e180 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -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> diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index d08a03f..381f821 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -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! |