diff options
author | Adnan Begovic <adnan@cyngn.com> | 2016-01-14 15:51:13 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-01-14 17:06:38 -0800 |
commit | eff6b9cc468200e3225f85da207bda4f6a6af91b (patch) | |
tree | 7e2b403680a912a24835d9394bf22eb22731cc02 /packages/SettingsProvider | |
parent | 8a74e97271805f2503cd8fef21e85e1a83d08b34 (diff) | |
download | frameworks_base-eff6b9cc468200e3225f85da207bda4f6a6af91b.zip frameworks_base-eff6b9cc468200e3225f85da207bda4f6a6af91b.tar.gz frameworks_base-eff6b9cc468200e3225f85da207bda4f6a6af91b.tar.bz2 |
SettingsProvider: Force aosp upgrade path from 12.1.
TICKET: CYNGNOS-1596
Change-Id: I6168befe8826b0476d9a357b95c730d143b8b815
Diffstat (limited to 'packages/SettingsProvider')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 8c941f6..c361c70 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -2001,7 +2001,22 @@ public class SettingsProvider extends ContentProvider { final int newVersion = SETTINGS_VERSION; // If up do date - done. + // + // CYANOGENMOD + // We moved our settings out to another settings provider (CMSettingsProvider) + // however, we still have a problem of being a few versions ahead of AOSP. + // We could approach this in the manner we have previously, and bump the version + // to replay the defaults for specific os upgrade changes and have that maintenance + // overhead forever OR we can take the approach below: + // + // Logic as follows: + // Until version 125 of this "DATABASE" + // 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) { + forceReplayAOSPDefaults(mUserId); + } return; } @@ -2140,6 +2155,42 @@ public class SettingsProvider extends ContentProvider { // Return the current version. return currentVersion; } + + private void forceReplayAOSPDefaults(int userId) { + // v119: Reset zen + ringer mode. + if (userId == UserHandle.USER_OWNER) { + final SettingsState globalSettings = getGlobalSettingsLocked(); + globalSettings.updateSettingLocked(Settings.Global.ZEN_MODE, + Integer.toString(Settings.Global.ZEN_MODE_OFF), + SettingsState.SYSTEM_PACKAGE_NAME); + globalSettings.updateSettingLocked(Settings.Global.MODE_RINGER, + Integer.toString(AudioManager.RINGER_MODE_NORMAL), + SettingsState.SYSTEM_PACKAGE_NAME); + } + + // v120: Add double tap to wake setting. + SettingsState secureSettings = getSecureSettingsLocked(userId); + secureSettings.insertSettingLocked(Settings.Secure.DOUBLE_TAP_TO_WAKE, + getContext().getResources().getBoolean( + R.bool.def_double_tap_to_wake) ? "1" : "0", + SettingsState.SYSTEM_PACKAGE_NAME); + + // Version 122: allow OEMs to set a default payment component in resources. + // Note that we only write the default if no default has been set; + // if there is, we just leave the default at whatever it currently is. + String defaultComponent = (getContext().getResources().getString( + R.string.def_nfc_payment_component)); + Setting currentSetting = secureSettings.getSettingLocked( + Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT); + if (defaultComponent != null && !defaultComponent.isEmpty() && + currentSetting == null) { + secureSettings.insertSettingLocked( + Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT, + defaultComponent, + SettingsState.SYSTEM_PACKAGE_NAME); + } + } + } } } |