diff options
author | Martijn Coenen <maco@google.com> | 2013-08-28 19:28:17 -0700 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2013-08-28 19:30:41 -0700 |
commit | 573a21ada2729346f53acdd2418a77d6911a7374 (patch) | |
tree | 19171fd32a11fb7c57b51fc8aac50a4e302a969b /src/com/android/settings/nfc | |
parent | 9506d857cbc87a3dcedc8c3599f1d45ac6fe995e (diff) | |
download | packages_apps_Settings-573a21ada2729346f53acdd2418a77d6911a7374.zip packages_apps_Settings-573a21ada2729346f53acdd2418a77d6911a7374.tar.gz packages_apps_Settings-573a21ada2729346f53acdd2418a77d6911a7374.tar.bz2 |
Update NFC payments to match new framework APIs.
Bug: 10262585
Change-Id: Id4167db50f8e5fe145441bdf73d151a61a8587ed
Diffstat (limited to 'src/com/android/settings/nfc')
-rw-r--r-- | src/com/android/settings/nfc/PaymentBackend.java | 13 | ||||
-rw-r--r-- | src/com/android/settings/nfc/PaymentDefaultDialog.java | 4 | ||||
-rw-r--r-- | src/com/android/settings/nfc/PaymentSettings.java | 7 |
3 files changed, 2 insertions, 22 deletions
diff --git a/src/com/android/settings/nfc/PaymentBackend.java b/src/com/android/settings/nfc/PaymentBackend.java index fc0f4a3..3c2c3ce 100644 --- a/src/com/android/settings/nfc/PaymentBackend.java +++ b/src/com/android/settings/nfc/PaymentBackend.java @@ -86,17 +86,4 @@ public class PaymentBackend { Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT, app != null ? app.flattenToString() : null); } - - public boolean isAutoPaymentMode() { - String mode = Settings.Secure.getString(mContext.getContentResolver(), - Settings.Secure.NFC_PAYMENT_MODE); - return (!CardEmulationManager.PAYMENT_MODE_MANUAL.equals(mode)); - } - - public void setAutoPaymentMode(boolean enable) { - Settings.Secure.putString(mContext.getContentResolver(), - Settings.Secure.NFC_PAYMENT_MODE, - enable ? CardEmulationManager.PAYMENT_MODE_AUTO - : CardEmulationManager.PAYMENT_MODE_MANUAL); - } }
\ No newline at end of file diff --git a/src/com/android/settings/nfc/PaymentDefaultDialog.java b/src/com/android/settings/nfc/PaymentDefaultDialog.java index 2dd465a..a6887a3 100644 --- a/src/com/android/settings/nfc/PaymentDefaultDialog.java +++ b/src/com/android/settings/nfc/PaymentDefaultDialog.java @@ -62,7 +62,6 @@ public final class PaymentDefaultDialog extends AlertActivity implements switch (which) { case BUTTON_POSITIVE: mBackend.setDefaultPaymentApp(mNewDefault); - mBackend.setAutoPaymentMode(true); setResult(RESULT_OK); break; case BUTTON_NEGATIVE: @@ -98,7 +97,6 @@ public final class PaymentDefaultDialog extends AlertActivity implements } // Get current mode and default component - boolean isAuto = mBackend.isAutoPaymentMode(); ComponentName defaultComponent = mBackend.getDefaultPaymentApp(); if (defaultComponent != null && defaultComponent.equals(component)) { Log.e(TAG, "Component " + component + " is already default."); @@ -128,7 +126,7 @@ public final class PaymentDefaultDialog extends AlertActivity implements // Compose dialog; get final AlertController.AlertParams p = mAlertParams; p.mTitle = getString(R.string.nfc_payment_set_default); - if (defaultAppInfo == null || !isAuto) { + if (defaultAppInfo == null) { p.mMessage = "Always use " + newAppInfo.loadLabel(pm) + " when you tap and pay?"; } else { p.mMessage = "Always use " + newAppInfo.loadLabel(pm) + " instead of " + diff --git a/src/com/android/settings/nfc/PaymentSettings.java b/src/com/android/settings/nfc/PaymentSettings.java index a1ed883..41bcc2c 100644 --- a/src/com/android/settings/nfc/PaymentSettings.java +++ b/src/com/android/settings/nfc/PaymentSettings.java @@ -48,8 +48,6 @@ public class PaymentSettings extends SettingsPreferenceFragment implements PreferenceManager manager = getPreferenceManager(); PreferenceScreen screen = manager.createPreferenceScreen(getActivity()); - boolean isAuto = mPaymentBackend.isAutoPaymentMode(); - // Get all payment services List<PaymentAppInfo> appInfos = mPaymentBackend.getPaymentAppInfos(); if (appInfos != null && appInfos.size() > 0) { @@ -58,7 +56,6 @@ public class PaymentSettings extends SettingsPreferenceFragment implements PaymentAppPreference preference = new PaymentAppPreference(getActivity(), appInfo, this); // If for some reason isAuto gets out of sync, clear out app default - appInfo.isDefault &= isAuto; preference.setIcon(appInfo.icon); preference.setTitle(appInfo.caption); screen.addPreference(preference); @@ -67,7 +64,7 @@ public class PaymentSettings extends SettingsPreferenceFragment implements PaymentAppInfo appInfo = new PaymentAppInfo(); appInfo.icon = null; appInfo.componentName = null; - appInfo.isDefault = !isAuto; + appInfo.isDefault = !(mPaymentBackend.getDefaultPaymentApp() != null); // Add "Ask every time" option PaymentAppPreference preference = new PaymentAppPreference(getActivity(), appInfo, this); @@ -85,10 +82,8 @@ public class PaymentSettings extends SettingsPreferenceFragment implements PaymentAppInfo appInfo = (PaymentAppInfo) v.getTag(); if (appInfo.componentName != null) { mPaymentBackend.setDefaultPaymentApp(appInfo.componentName); - mPaymentBackend.setAutoPaymentMode(true); } else { mPaymentBackend.setDefaultPaymentApp(null); - mPaymentBackend.setAutoPaymentMode(false); } refresh(); } |