summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/nfc
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2015-06-05 11:36:50 +0200
committerMartijn Coenen <maco@google.com>2015-06-05 11:36:50 +0200
commit6d5cac594620bd270f263fedfb8a23d6d916b014 (patch)
tree49c8ff3752fec68a0e3be30a17d1c5c64c28bfee /src/com/android/settings/nfc
parentfb32790adc9ed647ad4e77c9613a860f9b76e855 (diff)
downloadpackages_apps_Settings-6d5cac594620bd270f263fedfb8a23d6d916b014.zip
packages_apps_Settings-6d5cac594620bd270f263fedfb8a23d6d916b014.tar.gz
packages_apps_Settings-6d5cac594620bd270f263fedfb8a23d6d916b014.tar.bz2
NFC: don't use dynamic resources.
Also fixed talk-back for the default payment app selection. Bug: 21343778 Bug: 21588534 Change-Id: I2886b73edae507c7861351bac4610dbf3bebe027
Diffstat (limited to 'src/com/android/settings/nfc')
-rw-r--r--src/com/android/settings/nfc/NfcPaymentPreference.java2
-rw-r--r--src/com/android/settings/nfc/PaymentBackend.java58
2 files changed, 7 insertions, 53 deletions
diff --git a/src/com/android/settings/nfc/NfcPaymentPreference.java b/src/com/android/settings/nfc/NfcPaymentPreference.java
index e24a651..3ad64fa 100644
--- a/src/com/android/settings/nfc/NfcPaymentPreference.java
+++ b/src/com/android/settings/nfc/NfcPaymentPreference.java
@@ -174,11 +174,13 @@ public class NfcPaymentPreference extends DialogPreference implements
}
holder.imageView.setImageDrawable(appInfo.banner);
holder.imageView.setTag(appInfo);
+ holder.imageView.setContentDescription(appInfo.label);
holder.imageView.setOnClickListener(this);
// Prevent checked callback getting called on recycled views
holder.radioButton.setOnCheckedChangeListener(null);
holder.radioButton.setChecked(appInfo.isDefault);
+ holder.radioButton.setContentDescription(appInfo.label);
holder.radioButton.setOnCheckedChangeListener(this);
holder.radioButton.setTag(appInfo);
return convertView;
diff --git a/src/com/android/settings/nfc/PaymentBackend.java b/src/com/android/settings/nfc/PaymentBackend.java
index 52e3f7e..8f82f5c 100644
--- a/src/com/android/settings/nfc/PaymentBackend.java
+++ b/src/com/android/settings/nfc/PaymentBackend.java
@@ -17,7 +17,8 @@
package com.android.settings.nfc;
import android.app.Activity;
-import android.content.*;
+import android.content.ComponentName;
+import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
@@ -71,14 +72,10 @@ public class PaymentBackend {
public void onPause() {
mSettingsPackageMonitor.unregister();
- mContext.unregisterReceiver(mReceiver);
}
public void onResume() {
mSettingsPackageMonitor.register(mContext, mContext.getMainLooper(), false);
- // Register broadcast receiver for dynamic resource updates
- IntentFilter filter = new IntentFilter(CardEmulation.ACTION_REQUEST_SERVICE_RESOURCES);
- mContext.registerReceiver(mReceiver, filter);
}
public void refresh() {
@@ -112,14 +109,8 @@ public class PaymentBackend {
} else {
appInfo.settingsComponent = null;
}
- if (service.hasDynamicResources()) {
- appInfo.description = "";
- appInfo.banner = null;
- sendBroadcastForResources(appInfo);
- } else {
- appInfo.description = service.getDescription();
- appInfo.banner = service.loadBanner(pm);
- }
+ appInfo.description = service.getDescription();
+ appInfo.banner = service.loadBanner(pm);
appInfos.add(appInfo);
}
mAppInfos = appInfos;
@@ -162,14 +153,6 @@ public class PaymentBackend {
}
}
- void sendBroadcastForResources(PaymentAppInfo appInfo) {
- Intent broadcastIntent = new Intent(CardEmulation.ACTION_REQUEST_SERVICE_RESOURCES);
- broadcastIntent.setPackage(appInfo.componentName.getPackageName());
- broadcastIntent.putExtra(CardEmulation.EXTRA_SERVICE_COMPONENT, appInfo.componentName);
- mContext.sendOrderedBroadcastAsUser(broadcastIntent, UserHandle.CURRENT,
- null, mReceiver, null, Activity.RESULT_OK, null, null);
- }
-
boolean isForegroundMode() {
try {
return Settings.Secure.getInt(mContext.getContentResolver(),
@@ -201,37 +184,6 @@ public class PaymentBackend {
refresh();
}
- private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- Bundle results = getResultExtras(false);
- if (results != null) {
- String desc = results.getString(CardEmulation.EXTRA_DESCRIPTION);
- int resId = results.getInt(CardEmulation.EXTRA_BANNER_RES_ID, -1);
- // Find corresponding component
- PaymentAppInfo matchingAppInfo = null;
- for (PaymentAppInfo appInfo : mAppInfos) {
- if (appInfo.componentName.equals(
- intent.getParcelableExtra(CardEmulation.EXTRA_SERVICE_COMPONENT))) {
- matchingAppInfo = appInfo;
- }
- }
- if (matchingAppInfo != null && (desc != null || resId != -1)) {
- if (desc != null) {
- matchingAppInfo.description = desc;
- }
- if (resId != -1) {
- matchingAppInfo.banner = loadDrawableForPackage(
- matchingAppInfo.componentName.getPackageName(), resId);
- }
- makeCallbacks();
- }
- } else {
- Log.e(TAG, "Didn't find results extra.");
- }
-
- }
- };
private final Handler mHandler = new Handler() {
@Override
public void dispatchMessage(Message msg) {
@@ -260,4 +212,4 @@ public class PaymentBackend {
mHandler.obtainMessage().sendToTarget();
}
}
-} \ No newline at end of file
+}