diff options
author | Chris Wren <cwren@android.com> | 2014-03-19 16:16:48 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2014-03-19 16:18:27 -0400 |
commit | 5242cf3b38b29e4676a70091d38b51af5e5467e1 (patch) | |
tree | e85051b200922c49aeb8595dec2c9d62ff4be7ff /packages/SettingsProvider | |
parent | a1e4bf9b6c817f9b1558faabb949bbe516f3a187 (diff) | |
download | frameworks_base-5242cf3b38b29e4676a70091d38b51af5e5467e1.zip frameworks_base-5242cf3b38b29e4676a70091d38b51af5e5467e1.tar.gz frameworks_base-5242cf3b38b29e4676a70091d38b51af5e5467e1.tar.bz2 |
set the sysui settings on create, as well as on update.
also update the database to catch any v100 devices that missed the settings due to this bug.
Bug: 13547456
Change-Id: Ib7ad18541f359efb328d3d59c526514c5a6303b9
Diffstat (limited to 'packages/SettingsProvider')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index 55d7def..58086c4 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -69,7 +69,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 = 100; + private static final int DATABASE_VERSION = 101; private Context mContext; private int mUserHandle; @@ -1591,6 +1591,28 @@ public class DatabaseHelper extends SQLiteOpenHelper { } upgradeVersion = 100; } + if (upgradeVersion == 100) { + // Catch devices that were initialized to version 100 and missed these in onCreate() + if (mUserHandle == UserHandle.USER_OWNER) { + db.beginTransaction(); + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT OR IGNORE INTO global(name,value)" + + " VALUES(?,?);"); + loadIntegerSetting(stmt, Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS, + R.integer.def_lock_screen_show_notifications); + + loadIntegerSetting(stmt, Global.HEADS_UP_NOTIFICATIONS_ENABLED, + R.integer.def_heads_up_enabled); + + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + if (stmt != null) stmt.close(); + } + } + upgradeVersion = 101; + } // *** Remember to update DATABASE_VERSION above! @@ -2314,6 +2336,12 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadIntegerSetting(stmt, Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, R.integer.def_wifi_scan_always_available); + loadIntegerSetting(stmt, Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS, + R.integer.def_lock_screen_show_notifications); + + loadIntegerSetting(stmt, Global.HEADS_UP_NOTIFICATIONS_ENABLED, + R.integer.def_heads_up_enabled); + // --- New global settings start here } finally { if (stmt != null) stmt.close(); |