diff options
| author | 2020-03-11 07:10:57 +0000 | |
|---|---|---|
| committer | 2020-03-11 07:10:57 +0000 | |
| commit | d9b135377153eca38ed62ecbc3d3a7ddbe3552cf (patch) | |
| tree | 272e23cdaf471e809bf8d6905a1728639d5b24e2 | |
| parent | 528e9bdc2a222320e9b82f8282dee864ab35b7cb (diff) | |
| parent | d70879e5bb43b14a21a54dd6f60f3b797fb906fe (diff) | |
Merge "Update preferred payment related APIs"
| -rw-r--r-- | api/current.txt | 2 | ||||
| -rw-r--r-- | core/java/android/nfc/NfcAdapter.java | 16 | ||||
| -rw-r--r-- | core/java/android/nfc/cardemulation/CardEmulation.java | 27 |
3 files changed, 32 insertions, 13 deletions
diff --git a/api/current.txt b/api/current.txt index 85771fe5fb1a..0f37db2b586f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -31171,7 +31171,7 @@ package android.nfc.cardemulation { method public boolean categoryAllowsForegroundPreference(String); method @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public java.util.List<java.lang.String> getAidsForPreferredPaymentService(); method public java.util.List<java.lang.String> getAidsForService(android.content.ComponentName, String); - method @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public String getDescriptionForPreferredPaymentService(); + method @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public CharSequence getDescriptionForPreferredPaymentService(); method public static android.nfc.cardemulation.CardEmulation getInstance(android.nfc.NfcAdapter); method @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public String getRouteDestinationForPreferredPaymentService(); method public int getSelectionModeForCategory(String); diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java index d320f61a3657..c61f10f50c93 100644 --- a/core/java/android/nfc/NfcAdapter.java +++ b/core/java/android/nfc/NfcAdapter.java @@ -245,13 +245,25 @@ public final class NfcAdapter { /** * Mandatory String extra field in {@link #ACTION_PREFERRED_PAYMENT_CHANGED} - * Indicates the condition when trigger this event. + * Indicates the condition when trigger this event. Possible values are: + * {@link #PREFERRED_PAYMENT_LOADED}, + * {@link #PREFERRED_PAYMENT_CHANGED}, + * {@link #PREFERRED_PAYMENT_UPDATED}, */ public static final String EXTRA_PREFERRED_PAYMENT_CHANGED_REASON = "android.nfc.extra.PREFERRED_PAYMENT_CHANGED_REASON"; - + /** + * Nfc is enabled and the preferred payment aids are registered. + */ public static final int PREFERRED_PAYMENT_LOADED = 1; + /** + * User selected another payment application as the preferred payment. + */ public static final int PREFERRED_PAYMENT_CHANGED = 2; + /** + * Current preferred payment has issued an update (registered/unregistered new aids or has been + * updated itself). + */ public static final int PREFERRED_PAYMENT_UPDATED = 3; public static final int STATE_OFF = 1; diff --git a/core/java/android/nfc/cardemulation/CardEmulation.java b/core/java/android/nfc/cardemulation/CardEmulation.java index f1c74a6331c4..7bf82e84927f 100644 --- a/core/java/android/nfc/cardemulation/CardEmulation.java +++ b/core/java/android/nfc/cardemulation/CardEmulation.java @@ -672,7 +672,7 @@ public final class CardEmulation { recoverService(); if (sService == null) { Log.e(TAG, "Failed to recover CardEmulationService."); - return null; + throw e.rethrowFromSystemServer(); } try { ApduServiceInfo serviceInfo = @@ -680,7 +680,7 @@ public final class CardEmulation { return (serviceInfo != null ? serviceInfo.getAids() : null); } catch (RemoteException ee) { Log.e(TAG, "Failed to recover CardEmulationService."); - return null; + throw e.rethrowFromSystemServer(); } } } @@ -690,9 +690,16 @@ public final class CardEmulation { * * @return The route destination secure element name of the preferred payment service. * HCE payment: "Host" - * OffHost payment: prefix SIM or prefix eSE string. - * "OffHost" if the payment service does not specify secure element - * name. + * OffHost payment: 1. String with prefix SIM or prefix eSE string. + * Ref: GSMA TS.26 - NFC Handset Requirements + * TS26_NFC_REQ_069: For UICC, Secure Element Name SHALL be + * SIM[smartcard slot] + * (e.g. SIM/SIM1, SIM2… SIMn). + * TS26_NFC_REQ_070: For embedded SE, Secure Element Name SHALL be + * eSE[number] + * (e.g. eSE/eSE1, eSE2, etc.). + * 2. "OffHost" if the payment service does not specify secure element + * name. */ @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) @Nullable @@ -711,7 +718,7 @@ public final class CardEmulation { recoverService(); if (sService == null) { Log.e(TAG, "Failed to recover CardEmulationService."); - return null; + throw e.rethrowFromSystemServer(); } try { ApduServiceInfo serviceInfo = @@ -727,7 +734,7 @@ public final class CardEmulation { } catch (RemoteException ee) { Log.e(TAG, "Failed to recover CardEmulationService."); - return null; + throw e.rethrowFromSystemServer(); } } } @@ -739,7 +746,7 @@ public final class CardEmulation { */ @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) @Nullable - public String getDescriptionForPreferredPaymentService() { + public CharSequence getDescriptionForPreferredPaymentService() { try { ApduServiceInfo serviceInfo = sService.getPreferredPaymentService(mContext.getUserId()); return (serviceInfo != null ? serviceInfo.getDescription() : null); @@ -747,7 +754,7 @@ public final class CardEmulation { recoverService(); if (sService == null) { Log.e(TAG, "Failed to recover CardEmulationService."); - return null; + throw e.rethrowFromSystemServer(); } try { ApduServiceInfo serviceInfo = @@ -755,7 +762,7 @@ public final class CardEmulation { return (serviceInfo != null ? serviceInfo.getDescription() : null); } catch (RemoteException ee) { Log.e(TAG, "Failed to recover CardEmulationService."); - return null; + throw e.rethrowFromSystemServer(); } } } |