diff options
author | Martijn Coenen <maco@google.com> | 2015-07-29 07:54:29 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-29 07:54:29 +0000 |
commit | 50184147fc35d5d441ae24661531819cc6cc025f (patch) | |
tree | 9e057f20c7c78ce1feb2eaef1ced612274132e41 /packages | |
parent | a7b4d6dc1017bcb2e6144fa5eb9d2ed07093ffa8 (diff) | |
parent | 7ab4b7fd500c3c21b0329faa29e74eac4ef638af (diff) | |
download | frameworks_base-50184147fc35d5d441ae24661531819cc6cc025f.zip frameworks_base-50184147fc35d5d441ae24661531819cc6cc025f.tar.gz frameworks_base-50184147fc35d5d441ae24661531819cc6cc025f.tar.bz2 |
Merge "Resource for setting default NFC payment component." into mnc-dev
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SettingsProvider/res/values/defaults.xml | 2 | ||||
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 3f0d71c..1cd2908 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -210,4 +210,6 @@ <!-- Default state of tap to wake --> <bool name="def_double_tap_to_wake">true</bool> + <!-- Default for Settings.Secure.NFC_PAYMENT_COMPONENT --> + <string name="def_nfc_payment_component"></string> </resources> diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 8d9f3fd..2a68252 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -1867,7 +1867,7 @@ public class SettingsProvider extends ContentProvider { } private final class UpgradeController { - private static final int SETTINGS_VERSION = 121; + private static final int SETTINGS_VERSION = 122; private final int mUserId; @@ -1999,6 +1999,24 @@ public class SettingsProvider extends ContentProvider { // here; SettingsState knows how to handle pre-version 120 files. currentVersion = 121; + if (currentVersion == 121) { + // 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. + final SettingsState secureSettings = getSecureSettingsLocked(userId); + 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); + } + currentVersion = 122; + } // vXXX: Add new settings above this point. // Return the current version. |