diff options
author | Justin Klaassen <justinklaassen@google.com> | 2018-04-03 23:21:57 -0400 |
---|---|---|
committer | Justin Klaassen <justinklaassen@google.com> | 2018-04-03 23:21:57 -0400 |
commit | 4d01eeaffaa720e4458a118baa137a11614f00f7 (patch) | |
tree | 66751893566986236788e3c796a7cc5e90d05f52 /android/nfc | |
parent | a192cc2a132cb0ee8588e2df755563ec7008c179 (diff) | |
download | android-28-4d01eeaffaa720e4458a118baa137a11614f00f7.tar.gz |
Import Android SDK Platform P [4697573]
/google/data/ro/projects/android/fetch_artifact \
--bid 4697573 \
--target sdk_phone_armv7-win_sdk \
sdk-repo-linux-sources-4697573.zip
AndroidVersion.ApiLevel has been modified to appear as 28
Change-Id: If80578c3c657366cc9cf75f8db13d46e2dd4e077
Diffstat (limited to 'android/nfc')
-rw-r--r-- | android/nfc/NfcActivityManager.java | 4 | ||||
-rw-r--r-- | android/nfc/NfcAdapter.java | 30 | ||||
-rw-r--r-- | android/nfc/cardemulation/CardEmulation.java | 32 | ||||
-rw-r--r-- | android/nfc/cardemulation/NfcFCardEmulation.java | 24 |
4 files changed, 60 insertions, 30 deletions
diff --git a/android/nfc/NfcActivityManager.java b/android/nfc/NfcActivityManager.java index c7d4c65d..958063ae 100644 --- a/android/nfc/NfcActivityManager.java +++ b/android/nfc/NfcActivityManager.java @@ -393,7 +393,7 @@ public final class NfcActivityManager extends IAppCallback.Stub "either scheme file or scheme content"); continue; } - uri = ContentProvider.maybeAddUserId(uri, UserHandle.myUserId()); + uri = ContentProvider.maybeAddUserId(uri, activity.getUserId()); validUris.add(uri); } @@ -410,7 +410,7 @@ public final class NfcActivityManager extends IAppCallback.Stub } finally { Binder.restoreCallingIdentity(ident); } - return new BeamShareData(message, uris, new UserHandle(UserHandle.myUserId()), flags); + return new BeamShareData(message, uris, activity.getUser(), flags); } /** Callback from NFC service, usually on binder thread */ diff --git a/android/nfc/NfcAdapter.java b/android/nfc/NfcAdapter.java index debef631..c3f23a1c 100644 --- a/android/nfc/NfcAdapter.java +++ b/android/nfc/NfcAdapter.java @@ -147,6 +147,19 @@ public final class NfcAdapter { public static final String ACTION_TAG_DISCOVERED = "android.nfc.action.TAG_DISCOVERED"; /** + * Broadcast Action: Intent to notify an application that an transaction event has occurred + * on the Secure Element. + * + * <p>This intent will only be sent if the application has requested permission for + * {@link android.Manifest.permission#NFC_TRANSACTION_EVENT} and if the application has the + * necessary access to Secure Element which witnessed the particular event. + */ + @RequiresPermission(android.Manifest.permission.NFC_TRANSACTION_EVENT) + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_TRANSACTION_DETECTED = + "android.nfc.action.TRANSACTION_DETECTED"; + + /** * Broadcast to only the activity that handles ACTION_TAG_DISCOVERED * @hide */ @@ -197,6 +210,23 @@ public final class NfcAdapter { */ public static final String EXTRA_ADAPTER_STATE = "android.nfc.extra.ADAPTER_STATE"; + /** + * Mandatory byte[] extra field in {@link #ACTION_TRANSACTION_DETECTED} + */ + public static final String EXTRA_AID = "android.nfc.extra.AID"; + + /** + * Optional byte[] extra field in {@link #ACTION_TRANSACTION_DETECTED} + */ + public static final String EXTRA_DATA = "android.nfc.extra.DATA"; + + /** + * Mandatory String extra field in {@link #ACTION_TRANSACTION_DETECTED} + * Indicates the Secure Element on which the transaction occurred. + * eSE1...eSEn for Embedded Secure Elements, SIM1...SIMn for UICC, etc. + */ + public static final String EXTRA_SECURE_ELEMENT_NAME = "android.nfc.extra.SECURE_ELEMENT_NAME"; + public static final int STATE_OFF = 1; public static final int STATE_TURNING_ON = 2; public static final int STATE_ON = 3; diff --git a/android/nfc/cardemulation/CardEmulation.java b/android/nfc/cardemulation/CardEmulation.java index 6dd79939..15d02f2e 100644 --- a/android/nfc/cardemulation/CardEmulation.java +++ b/android/nfc/cardemulation/CardEmulation.java @@ -201,7 +201,7 @@ public final class CardEmulation { */ public boolean isDefaultServiceForCategory(ComponentName service, String category) { try { - return sService.isDefaultServiceForCategory(UserHandle.myUserId(), service, category); + return sService.isDefaultServiceForCategory(mContext.getUserId(), service, category); } catch (RemoteException e) { // Try one more time recoverService(); @@ -210,7 +210,7 @@ public final class CardEmulation { return false; } try { - return sService.isDefaultServiceForCategory(UserHandle.myUserId(), service, + return sService.isDefaultServiceForCategory(mContext.getUserId(), service, category); } catch (RemoteException ee) { Log.e(TAG, "Failed to recover CardEmulationService."); @@ -232,7 +232,7 @@ public final class CardEmulation { */ public boolean isDefaultServiceForAid(ComponentName service, String aid) { try { - return sService.isDefaultServiceForAid(UserHandle.myUserId(), service, aid); + return sService.isDefaultServiceForAid(mContext.getUserId(), service, aid); } catch (RemoteException e) { // Try one more time recoverService(); @@ -241,7 +241,7 @@ public final class CardEmulation { return false; } try { - return sService.isDefaultServiceForAid(UserHandle.myUserId(), service, aid); + return sService.isDefaultServiceForAid(mContext.getUserId(), service, aid); } catch (RemoteException ee) { Log.e(TAG, "Failed to reach CardEmulationService."); return false; @@ -326,7 +326,7 @@ public final class CardEmulation { List<String> aids) { AidGroup aidGroup = new AidGroup(aids, category); try { - return sService.registerAidGroupForService(UserHandle.myUserId(), service, aidGroup); + return sService.registerAidGroupForService(mContext.getUserId(), service, aidGroup); } catch (RemoteException e) { // Try one more time recoverService(); @@ -335,7 +335,7 @@ public final class CardEmulation { return false; } try { - return sService.registerAidGroupForService(UserHandle.myUserId(), service, + return sService.registerAidGroupForService(mContext.getUserId(), service, aidGroup); } catch (RemoteException ee) { Log.e(TAG, "Failed to reach CardEmulationService."); @@ -360,7 +360,7 @@ public final class CardEmulation { */ public List<String> getAidsForService(ComponentName service, String category) { try { - AidGroup group = sService.getAidGroupForService(UserHandle.myUserId(), service, + AidGroup group = sService.getAidGroupForService(mContext.getUserId(), service, category); return (group != null ? group.getAids() : null); } catch (RemoteException e) { @@ -370,7 +370,7 @@ public final class CardEmulation { return null; } try { - AidGroup group = sService.getAidGroupForService(UserHandle.myUserId(), service, + AidGroup group = sService.getAidGroupForService(mContext.getUserId(), service, category); return (group != null ? group.getAids() : null); } catch (RemoteException ee) { @@ -397,7 +397,7 @@ public final class CardEmulation { */ public boolean removeAidsForService(ComponentName service, String category) { try { - return sService.removeAidGroupForService(UserHandle.myUserId(), service, category); + return sService.removeAidGroupForService(mContext.getUserId(), service, category); } catch (RemoteException e) { // Try one more time recoverService(); @@ -406,7 +406,7 @@ public final class CardEmulation { return false; } try { - return sService.removeAidGroupForService(UserHandle.myUserId(), service, category); + return sService.removeAidGroupForService(mContext.getUserId(), service, category); } catch (RemoteException ee) { Log.e(TAG, "Failed to reach CardEmulationService."); return false; @@ -537,7 +537,7 @@ public final class CardEmulation { */ public boolean setDefaultServiceForCategory(ComponentName service, String category) { try { - return sService.setDefaultServiceForCategory(UserHandle.myUserId(), service, category); + return sService.setDefaultServiceForCategory(mContext.getUserId(), service, category); } catch (RemoteException e) { // Try one more time recoverService(); @@ -546,7 +546,7 @@ public final class CardEmulation { return false; } try { - return sService.setDefaultServiceForCategory(UserHandle.myUserId(), service, + return sService.setDefaultServiceForCategory(mContext.getUserId(), service, category); } catch (RemoteException ee) { Log.e(TAG, "Failed to reach CardEmulationService."); @@ -560,7 +560,7 @@ public final class CardEmulation { */ public boolean setDefaultForNextTap(ComponentName service) { try { - return sService.setDefaultForNextTap(UserHandle.myUserId(), service); + return sService.setDefaultForNextTap(mContext.getUserId(), service); } catch (RemoteException e) { // Try one more time recoverService(); @@ -569,7 +569,7 @@ public final class CardEmulation { return false; } try { - return sService.setDefaultForNextTap(UserHandle.myUserId(), service); + return sService.setDefaultForNextTap(mContext.getUserId(), service); } catch (RemoteException ee) { Log.e(TAG, "Failed to reach CardEmulationService."); return false; @@ -582,7 +582,7 @@ public final class CardEmulation { */ public List<ApduServiceInfo> getServices(String category) { try { - return sService.getServices(UserHandle.myUserId(), category); + return sService.getServices(mContext.getUserId(), category); } catch (RemoteException e) { // Try one more time recoverService(); @@ -591,7 +591,7 @@ public final class CardEmulation { return null; } try { - return sService.getServices(UserHandle.myUserId(), category); + return sService.getServices(mContext.getUserId(), category); } catch (RemoteException ee) { Log.e(TAG, "Failed to reach CardEmulationService."); return null; diff --git a/android/nfc/cardemulation/NfcFCardEmulation.java b/android/nfc/cardemulation/NfcFCardEmulation.java index f2b5ebc1..80e8579d 100644 --- a/android/nfc/cardemulation/NfcFCardEmulation.java +++ b/android/nfc/cardemulation/NfcFCardEmulation.java @@ -118,7 +118,7 @@ public final class NfcFCardEmulation { throw new NullPointerException("service is null"); } try { - return sService.getSystemCodeForService(UserHandle.myUserId(), service); + return sService.getSystemCodeForService(mContext.getUserId(), service); } catch (RemoteException e) { // Try one more time recoverService(); @@ -127,7 +127,7 @@ public final class NfcFCardEmulation { return null; } try { - return sService.getSystemCodeForService(UserHandle.myUserId(), service); + return sService.getSystemCodeForService(mContext.getUserId(), service); } catch (RemoteException ee) { Log.e(TAG, "Failed to reach CardEmulationService."); ee.rethrowAsRuntimeException(); @@ -164,7 +164,7 @@ public final class NfcFCardEmulation { throw new NullPointerException("service or systemCode is null"); } try { - return sService.registerSystemCodeForService(UserHandle.myUserId(), + return sService.registerSystemCodeForService(mContext.getUserId(), service, systemCode); } catch (RemoteException e) { // Try one more time @@ -174,7 +174,7 @@ public final class NfcFCardEmulation { return false; } try { - return sService.registerSystemCodeForService(UserHandle.myUserId(), + return sService.registerSystemCodeForService(mContext.getUserId(), service, systemCode); } catch (RemoteException ee) { Log.e(TAG, "Failed to reach CardEmulationService."); @@ -195,7 +195,7 @@ public final class NfcFCardEmulation { throw new NullPointerException("service is null"); } try { - return sService.removeSystemCodeForService(UserHandle.myUserId(), service); + return sService.removeSystemCodeForService(mContext.getUserId(), service); } catch (RemoteException e) { // Try one more time recoverService(); @@ -204,7 +204,7 @@ public final class NfcFCardEmulation { return false; } try { - return sService.removeSystemCodeForService(UserHandle.myUserId(), service); + return sService.removeSystemCodeForService(mContext.getUserId(), service); } catch (RemoteException ee) { Log.e(TAG, "Failed to reach CardEmulationService."); ee.rethrowAsRuntimeException(); @@ -230,7 +230,7 @@ public final class NfcFCardEmulation { throw new NullPointerException("service is null"); } try { - return sService.getNfcid2ForService(UserHandle.myUserId(), service); + return sService.getNfcid2ForService(mContext.getUserId(), service); } catch (RemoteException e) { // Try one more time recoverService(); @@ -239,7 +239,7 @@ public final class NfcFCardEmulation { return null; } try { - return sService.getNfcid2ForService(UserHandle.myUserId(), service); + return sService.getNfcid2ForService(mContext.getUserId(), service); } catch (RemoteException ee) { Log.e(TAG, "Failed to reach CardEmulationService."); ee.rethrowAsRuntimeException(); @@ -273,7 +273,7 @@ public final class NfcFCardEmulation { throw new NullPointerException("service or nfcid2 is null"); } try { - return sService.setNfcid2ForService(UserHandle.myUserId(), + return sService.setNfcid2ForService(mContext.getUserId(), service, nfcid2); } catch (RemoteException e) { // Try one more time @@ -283,7 +283,7 @@ public final class NfcFCardEmulation { return false; } try { - return sService.setNfcid2ForService(UserHandle.myUserId(), + return sService.setNfcid2ForService(mContext.getUserId(), service, nfcid2); } catch (RemoteException ee) { Log.e(TAG, "Failed to reach CardEmulationService."); @@ -381,7 +381,7 @@ public final class NfcFCardEmulation { */ public List<NfcFServiceInfo> getNfcFServices() { try { - return sService.getNfcFServices(UserHandle.myUserId()); + return sService.getNfcFServices(mContext.getUserId()); } catch (RemoteException e) { // Try one more time recoverService(); @@ -390,7 +390,7 @@ public final class NfcFCardEmulation { return null; } try { - return sService.getNfcFServices(UserHandle.myUserId()); + return sService.getNfcFServices(mContext.getUserId()); } catch (RemoteException ee) { Log.e(TAG, "Failed to reach CardEmulationService."); return null; |