CMSettingsProvider: Split default load, don't load global for non-owner.
Any "CALL" into the CMSettingsProvider on a new user triggers the load default settings mechanism which may lead to attempting to load "global" settings for non owner which is impossible. Change-Id: Ic8535e3c211aeaccfd3d72c3f9b11eef4d9087b8
This commit is contained in:
parent
5acf08c9cf
commit
be9f6b8f47
@ -206,10 +206,15 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
|
||||
* @param db The {@link SQLiteDatabase} to insert into.
|
||||
*/
|
||||
private void loadSettings(SQLiteDatabase db) {
|
||||
// System
|
||||
loadIntegerSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.QS_QUICK_PULLDOWN,
|
||||
R.integer.def_qs_quick_pulldown);
|
||||
loadSystemSettings(db);
|
||||
loadSecureSettings(db);
|
||||
// The global table only exists for the 'owner' user
|
||||
if (mUserHandle == UserHandle.USER_OWNER) {
|
||||
loadGlobalSettings(db);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSecureSettings(SQLiteDatabase db) {
|
||||
// Secure
|
||||
loadBooleanSetting(db, CMTableNames.TABLE_SECURE, CMSettings.Secure.ADVANCED_MODE,
|
||||
R.bool.def_advanced_mode);
|
||||
@ -231,7 +236,22 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
|
||||
|
||||
loadBooleanSetting(db, CMTableNames.TABLE_SECURE, CMSettings.Secure.STATS_COLLECTION,
|
||||
R.bool.def_stats_collection);
|
||||
}
|
||||
|
||||
private void loadSystemSettings(SQLiteDatabase db) {
|
||||
// System
|
||||
loadIntegerSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.QS_QUICK_PULLDOWN,
|
||||
R.integer.def_qs_quick_pulldown);
|
||||
|
||||
loadIntegerSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.NOTIFICATION_LIGHT_BRIGHTNESS_LEVEL,
|
||||
R.integer.def_notification_brightness_level);
|
||||
|
||||
loadBooleanSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.NOTIFICATION_LIGHT_MULTIPLE_LEDS_ENABLE,
|
||||
R.bool.def_notification_multiple_leds);
|
||||
}
|
||||
|
||||
private void loadGlobalSettings(SQLiteDatabase db) {
|
||||
// Global
|
||||
loadBooleanSetting(db, CMTableNames.TABLE_GLOBAL,
|
||||
CMSettings.Global.POWER_NOTIFICATIONS_ENABLED,
|
||||
R.bool.def_power_notifications_enabled);
|
||||
@ -243,12 +263,6 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
|
||||
loadStringSetting(db, CMTableNames.TABLE_GLOBAL,
|
||||
CMSettings.Global.POWER_NOTIFICATIONS_RINGTONE,
|
||||
R.string.def_power_notifications_ringtone);
|
||||
|
||||
loadIntegerSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.NOTIFICATION_LIGHT_BRIGHTNESS_LEVEL,
|
||||
R.integer.def_notification_brightness_level);
|
||||
|
||||
loadBooleanSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.NOTIFICATION_LIGHT_MULTIPLE_LEDS_ENABLE,
|
||||
R.bool.def_notification_multiple_leds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user