LineageSettingsProvider: Migrate keyboard/button backlight to 0.0f -> 1.0f range
Change-Id: I42123b2cc2acde35c5db9087f478be5adc63b3ec
This commit is contained in:
@@ -250,8 +250,8 @@
|
||||
|
||||
<!-- Button and keyboard backlight -->
|
||||
<bool name="config_deviceHasVariableButtonBrightness">false</bool>
|
||||
<integer name="config_buttonBrightnessSettingDefault">255</dimen>
|
||||
<integer name="config_keyboardBrightnessSettingDefault">255</dimen>
|
||||
<dimen name="config_buttonBrightnessSettingDefaultFloat">1.0</dimen>
|
||||
<dimen name="config_keyboardBrightnessSettingDefaultFloat">1.0</dimen>
|
||||
|
||||
<!-- Whether to cleanup fingerprints upon connection to the daemon and when
|
||||
user switches -->
|
||||
|
||||
@@ -173,8 +173,8 @@
|
||||
|
||||
<!-- Button and keyboard backlight -->
|
||||
<java-symbol type="bool" name="config_deviceHasVariableButtonBrightness" />
|
||||
<java-symbol type="integer" name="config_buttonBrightnessSettingDefault" />
|
||||
<java-symbol type="integer" name="config_keyboardBrightnessSettingDefault" />
|
||||
<java-symbol type="dimen" name="config_buttonBrightnessSettingDefaultFloat" />
|
||||
<java-symbol type="dimen" name="config_keyboardBrightnessSettingDefaultFloat" />
|
||||
|
||||
<!-- Whether to cleanup fingerprints upon connection to the daemon and when
|
||||
user switches -->
|
||||
|
||||
@@ -48,7 +48,7 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
|
||||
private static final boolean LOCAL_LOGV = false;
|
||||
|
||||
private static final String DATABASE_NAME = "lineagesettings.db";
|
||||
private static final int DATABASE_VERSION = 13;
|
||||
private static final int DATABASE_VERSION = 14;
|
||||
|
||||
private static final String DATABASE_NAME_OLD = "cmsettings.db";
|
||||
|
||||
@@ -446,6 +446,32 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
|
||||
}
|
||||
upgradeVersion = 13;
|
||||
}
|
||||
|
||||
if (upgradeVersion < 14) {
|
||||
// Update button/keyboard brightness range
|
||||
if (mUserHandle == UserHandle.USER_OWNER) {
|
||||
for (String key : new String[] {
|
||||
LineageSettings.Secure.BUTTON_BRIGHTNESS,
|
||||
LineageSettings.Secure.KEYBOARD_BRIGHTNESS,
|
||||
}) {
|
||||
db.beginTransaction();
|
||||
SQLiteStatement stmt = null;
|
||||
try {
|
||||
stmt = db.compileStatement(
|
||||
"UPDATE secure SET value=round(value / 255.0, 2) WHERE name=?");
|
||||
stmt.bindString(1, key);
|
||||
stmt.execute();
|
||||
db.setTransactionSuccessful();
|
||||
} catch (SQLiteDoneException ex) {
|
||||
// key is not set
|
||||
} finally {
|
||||
if (stmt != null) stmt.close();
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
upgradeVersion = 14;
|
||||
}
|
||||
// *** Remember to update DATABASE_VERSION above!
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user