diff options
author | Jack Yu <jackcwyu@google.com> | 2022-01-13 16:27:22 +0800 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-02-14 23:13:16 +0000 |
commit | 6f71ab3759f6e83c1fc95cfbad74349f01f847a9 (patch) | |
tree | 4e8235f5004916d93512fcb950c2163ac6496d49 /src | |
parent | a0c57c701648fe4a38af05245592b5787e668978 (diff) | |
download | Nfc-6f71ab3759f6e83c1fc95cfbad74349f01f847a9.tar.gz |
Do not set default contactless application without user interaction
Keep the default contactless apllication "not set" if user does not
select one from the Settings page.
Bug: 212610736
Test: Manual
Merged-In: I8e1d67528eca037f4f88380a96f8c542965a1981
Change-Id: I8e1d67528eca037f4f88380a96f8c542965a1981
(cherry picked from commit 09fd7c094b6aa6abeddb78da96a851eaed3abe0c)
(cherry picked from commit 81c5d8738f4e59dba0a976150e8866242677d012)
Merged-In:I8e1d67528eca037f4f88380a96f8c542965a1981
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/nfc/cardemulation/CardEmulationManager.java | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/src/com/android/nfc/cardemulation/CardEmulationManager.java b/src/com/android/nfc/cardemulation/CardEmulationManager.java index f6353942..a122920d 100644 --- a/src/com/android/nfc/cardemulation/CardEmulationManager.java +++ b/src/com/android/nfc/cardemulation/CardEmulationManager.java @@ -262,30 +262,9 @@ public class CardEmulationManager implements RegisteredServicesCache.Callback, getDefaultServiceForCategory(userId, CardEmulation.CATEGORY_PAYMENT, true); if (DBG) Log.d(TAG, "Current default: " + defaultPaymentService); if (defaultPaymentService == null) { - // A payment service may have been removed, leaving only one; - // in that case, automatically set that app as default. - int numPaymentServices = 0; - ComponentName lastFoundPaymentService = null; - for (ApduServiceInfo service : services) { - if (service.hasCategory(CardEmulation.CATEGORY_PAYMENT)) { - numPaymentServices++; - lastFoundPaymentService = service.getComponent(); - } - } - if (numPaymentServices > 1) { - // More than one service left, leave default unset - if (DBG) Log.d(TAG, "No default set, more than one service left."); - setDefaultServiceForCategoryChecked(userId, null, CardEmulation.CATEGORY_PAYMENT); - } else if (numPaymentServices == 1) { - // Make single found payment service the default - if (DBG) Log.d(TAG, "No default set, making single service default."); - setDefaultServiceForCategoryChecked(userId, lastFoundPaymentService, - CardEmulation.CATEGORY_PAYMENT); - } else { - // No payment services left, leave default at null - if (DBG) Log.d(TAG, "No default set, last payment service removed."); - setDefaultServiceForCategoryChecked(userId, null, CardEmulation.CATEGORY_PAYMENT); - } + // A payment service may have been removed, set default payment selection to "not set". + if (DBG) Log.d(TAG, "No default set, last payment service removed."); + setDefaultServiceForCategoryChecked(userId, null, CardEmulation.CATEGORY_PAYMENT); } } |