diff options
author | Martijn Coenen <maco@google.com> | 2015-07-27 15:58:32 +0200 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2015-07-27 16:04:31 +0200 |
commit | 7ab4b7fd500c3c21b0329faa29e74eac4ef638af (patch) | |
tree | 83ef0a5677d83386c8f7354a59111461f8eca06d /packages | |
parent | 7fe86c4753e88058a7f1a1bf8d0302df9a64bd2e (diff) | |
download | frameworks_base-7ab4b7fd500c3c21b0329faa29e74eac4ef638af.zip frameworks_base-7ab4b7fd500c3c21b0329faa29e74eac4ef638af.tar.gz frameworks_base-7ab4b7fd500c3c21b0329faa29e74eac4ef638af.tar.bz2 |
Resource for setting default NFC payment component.
Bug: 22756856
Change-Id: If97e0faead995fb95893a128c1890b61bbe86ce5
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 41043eb..63f3948 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -1847,7 +1847,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; @@ -1979,6 +1979,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. |