diff options
author | Martijn Coenen <maco@google.com> | 2012-10-11 16:01:48 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-10-11 16:01:48 -0700 |
commit | 59f43aefee220afd41baa97ce2043017c171be73 (patch) | |
tree | 0c74968c6af7ff7ec96c50fa708b801dfbabdfb9 /src | |
parent | 1b4047043526e88bcecb32f640d83e0d9a851128 (diff) | |
parent | a949c74321b17f8ef1c93692064969f60815c7e4 (diff) | |
download | packages_apps_nfc-59f43aefee220afd41baa97ce2043017c171be73.zip packages_apps_nfc-59f43aefee220afd41baa97ce2043017c171be73.tar.gz packages_apps_nfc-59f43aefee220afd41baa97ce2043017c171be73.tar.bz2 |
am a949c743: Fast-fail SE open if it\'s activated in listen mode.
* commit 'a949c74321b17f8ef1c93692064969f60815c7e4':
Fast-fail SE open if it's activated in listen mode.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/nfc/DeviceHost.java | 10 | ||||
-rwxr-xr-x | src/com/android/nfc/NfcService.java | 34 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/com/android/nfc/DeviceHost.java b/src/com/android/nfc/DeviceHost.java index 487d2ad..e514bb6 100644 --- a/src/com/android/nfc/DeviceHost.java +++ b/src/com/android/nfc/DeviceHost.java @@ -49,6 +49,16 @@ public interface DeviceHost { public void onRemoteFieldDeactivated(); + /** + * Notifies that the SE has been activated in listen mode + */ + public void onSeListenActivated(); + + /** + * Notifies that the SE has been deactivated + */ + public void onSeListenDeactivated(); + public void onSeApduReceived(byte[] apdu); public void onSeEmvCardRemoval(); diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java index c344b49..0514160 100755 --- a/src/com/android/nfc/NfcService.java +++ b/src/com/android/nfc/NfcService.java @@ -113,6 +113,8 @@ public class NfcService implements DeviceHostListener { static final int MSG_SE_APDU_RECEIVED = 10; static final int MSG_SE_EMV_CARD_REMOVAL = 11; static final int MSG_SE_MIFARE_ACCESS = 12; + static final int MSG_SE_LISTEN_ACTIVATED = 13; + static final int MSG_SE_LISTEN_DEACTIVATED = 14; static final int TASK_ENABLE = 1; static final int TASK_DISABLE = 2; @@ -159,6 +161,11 @@ public class NfcService implements DeviceHostListener { public static final String EXTRA_MIFARE_BLOCK = "com.android.nfc_extras.extra.MIFARE_BLOCK"; + public static final String ACTION_SE_LISTEN_ACTIVATED = + "com.android.nfc_extras.action.SE_LISTEN_ACTIVATED"; + public static final String ACTION_SE_LISTEN_DEACTIVATED = + "com.android.nfc_extras.action.SE_LISTEN_DEACTIVATED"; + // NFC Execution Environment // fields below are protected by this private NativeNfcSecureElement mSecureElement; @@ -280,6 +287,17 @@ public class NfcService implements DeviceHostListener { } @Override + public void onSeListenActivated() { + sendMessage(NfcService.MSG_SE_LISTEN_ACTIVATED, null); + } + + @Override + public void onSeListenDeactivated() { + sendMessage(NfcService.MSG_SE_LISTEN_DEACTIVATED, null); + } + + + @Override public void onSeApduReceived(byte[] apdu) { sendMessage(NfcService.MSG_SE_APDU_RECEIVED, apdu); } @@ -1745,6 +1763,22 @@ public class NfcService implements DeviceHostListener { break; } + case MSG_SE_LISTEN_ACTIVATED: { + if (DBG) Log.d(TAG, "SE LISTEN MODE ACTIVATED"); + Intent listenModeActivated = new Intent(); + listenModeActivated.setAction(ACTION_SE_LISTEN_ACTIVATED); + sendSeBroadcast(listenModeActivated); + break; + } + + case MSG_SE_LISTEN_DEACTIVATED: { + if (DBG) Log.d(TAG, "SE LISTEN MODE DEACTIVATED"); + Intent listenModeDeactivated = new Intent(); + listenModeDeactivated.setAction(ACTION_SE_LISTEN_DEACTIVATED); + sendSeBroadcast(listenModeDeactivated); + break; + } + default: Log.e(TAG, "Unknown message received"); break; |