diff options
author | Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> | 2016-01-28 20:45:12 +0100 |
---|---|---|
committer | Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> | 2016-01-28 20:45:12 +0100 |
commit | cb3133edef468c755b18d822c6873d6eeffe5183 (patch) | |
tree | bf7d9e43195283f8dc5da95498c5fda7146578e2 /packages/SettingsProvider | |
parent | a3edd3be2ce0504cb485573b34cc32d60fecfe7a (diff) | |
parent | 141e0295436eeb0d0bd0cf00be58ffc9486fc2b4 (diff) | |
download | frameworks_base-cb3133edef468c755b18d822c6873d6eeffe5183.zip frameworks_base-cb3133edef468c755b18d822c6873d6eeffe5183.tar.gz frameworks_base-cb3133edef468c755b18d822c6873d6eeffe5183.tar.bz2 |
Merge branch 'cm-13.0' of https://github.com/CyanogenMod/android_frameworks_base into replicant-6.0
Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Diffstat (limited to 'packages/SettingsProvider')
3 files changed, 29 insertions, 2 deletions
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index afcd05e..210a096 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -185,6 +185,9 @@ >0 is milliseconds of screen-off time after which battery sounds will not play --> <integer name="def_low_battery_sound_timeout">0</integer> + <!-- Default for Settings.System.VIBRATE_WHEN_RINGING enabled --> + <bool name="def_vibrate_when_ringing_enabled">false</bool> + <!-- Initial value for the Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS setting, which is a comma separated list of packages that no longer need confirmation for immersive mode. diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index c70c8e3..fe7c986 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -2515,7 +2515,11 @@ class DatabaseHelper extends SQLiteOpenHelper { try { stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" + " VALUES(?,?);"); - loadSetting(stmt, Settings.System.VIBRATE_WHEN_RINGING, vibrateWhenRinging ? 1 : 0); + if (mContext.getResources().getBoolean(R.bool.def_vibrate_when_ringing_enabled)) { + loadSetting(stmt, Settings.System.VIBRATE_WHEN_RINGING, 1); + } else { + loadSetting(stmt, Settings.System.VIBRATE_WHEN_RINGING, vibrateWhenRinging ? 1 : 0); + } } finally { if (stmt != null) stmt.close(); } diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index c361c70..f55cead 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -27,6 +27,7 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; @@ -51,6 +52,7 @@ import android.os.Process; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; +import android.preference.PreferenceManager; import android.provider.Settings; import android.text.TextUtils; import android.util.ArrayMap; @@ -127,6 +129,8 @@ public class SettingsProvider extends ContentProvider { private static final String TABLE_BOOKMARKS = "bookmarks"; private static final String TABLE_ANDROID_METADATA = "android_metadata"; + private static final String HAS_REPLAYED_DEFAULTS_FROM_L = "has_replayed_defaults_from_L"; + // The set of removed legacy tables. private static final Set<String> REMOVED_LEGACY_TABLES = new ArraySet<>(); static { @@ -1983,6 +1987,9 @@ public class SettingsProvider extends ContentProvider { private final class UpgradeController { private static final int SETTINGS_VERSION = 122; + /** + * This is the 12.1 database version (DO NOT INCREMENT) + */ private static final int CM_SETTINGS_DB_VERSION = 125; private final int mUserId; @@ -2014,8 +2021,9 @@ public class SettingsProvider extends ContentProvider { // force replay AOSP defaults as they get introduced // once 125 is hit, we never have to maintain this again. if ((oldVersion == newVersion || oldVersion == CM_SETTINGS_DB_VERSION)) { - if (oldVersion == CM_SETTINGS_DB_VERSION) { + if (oldVersion == CM_SETTINGS_DB_VERSION && !hasReplayedDefaultsFromL()) { forceReplayAOSPDefaults(mUserId); + setDefaultsReplayedFromLFlag(); } return; } @@ -2056,6 +2064,18 @@ public class SettingsProvider extends ContentProvider { systemSettings.setVersionLocked(newVersion); } + private boolean hasReplayedDefaultsFromL() { + SharedPreferences sharedPreferences = PreferenceManager + .getDefaultSharedPreferences(getContext()); + return sharedPreferences.getBoolean(HAS_REPLAYED_DEFAULTS_FROM_L, false); + } + + private void setDefaultsReplayedFromLFlag() { + SharedPreferences sharedPreferences = PreferenceManager + .getDefaultSharedPreferences(getContext()); + sharedPreferences.edit().putBoolean(HAS_REPLAYED_DEFAULTS_FROM_L, true).apply(); + } + private SettingsState getGlobalSettingsLocked() { return getSettingsLocked(SETTINGS_TYPE_GLOBAL, UserHandle.USER_OWNER); } |