Update NFC payments to match new framework APIs.

Bug: 10262585
Change-Id: Id4167db50f8e5fe145441bdf73d151a61a8587ed
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5fb7fe2..1cc6bfc 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4659,7 +4659,7 @@
     <string name="global_font_change_title">Change font size</string>
 
     <!-- NFC payment settings --><skip/>
-    <string name="nfc_payment_settings_title">Tap and Pay</string>
+    <string name="nfc_payment_settings_title">Payments</string>
     <!-- Option to tell Android to ask the user which payment app to use every time
          a payment terminal is tapped -->
     <string name="nfc_payment_ask">Ask every time</string>
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 @@
                 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 @@
         switch (which) {
             case BUTTON_POSITIVE:
                 mBackend.setDefaultPaymentApp(mNewDefault);
-                mBackend.setAutoPaymentMode(true);
                 setResult(RESULT_OK);
                 break;
             case BUTTON_NEGATIVE:
@@ -98,7 +97,6 @@
         }
 
         // 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 @@
         // 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 @@
         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 @@
                 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 @@
                 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 @@
             PaymentAppInfo appInfo = (PaymentAppInfo) v.getTag();
             if (appInfo.componentName != null) {
                 mPaymentBackend.setDefaultPaymentApp(appInfo.componentName);
-                mPaymentBackend.setAutoPaymentMode(true);
             } else {
                 mPaymentBackend.setDefaultPaymentApp(null);
-                mPaymentBackend.setAutoPaymentMode(false);
             }
             refresh();
         }