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
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 @@
// 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 @@
}
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 @@
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();