summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/nfc/NativeNfcManager.java12
-rwxr-xr-xsrc/com/android/nfc/NfcService.java55
2 files changed, 66 insertions, 1 deletions
diff --git a/src/com/android/nfc/NativeNfcManager.java b/src/com/android/nfc/NativeNfcManager.java
index 3f0f532..10ff1ff 100755
--- a/src/com/android/nfc/NativeNfcManager.java
+++ b/src/com/android/nfc/NativeNfcManager.java
@@ -146,4 +146,16 @@ public class NativeNfcManager {
private void notifySeFieldDeactivated() {
mNfcService.sendMessage(NfcService.MSG_SE_FIELD_DEACTIVATED, null);
}
+
+ private void notifySeApduReceived(byte[] apdu) {
+ mNfcService.sendMessage(NfcService.MSG_SE_APDU_RECEIVED, apdu);
+ }
+
+ private void notifySeEmvCardRemoval() {
+ mNfcService.sendMessage(NfcService.MSG_SE_EMV_CARD_REMOVAL, null);
+ }
+
+ private void notifySeMifareAccess(byte[] block) {
+ mNfcService.sendMessage(NfcService.MSG_SE_MIFARE_ACCESS, block);
+ }
}
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index ca76ebc..9dd117f 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -221,6 +221,9 @@ public class NfcService extends Application {
static final int MSG_MOCK_NDEF = 7;
static final int MSG_SE_FIELD_ACTIVATED = 8;
static final int MSG_SE_FIELD_DEACTIVATED = 9;
+ 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;
// Copied from com.android.nfc_extras to avoid library dependency
// Must keep in sync with com.android.nfc_extras
@@ -234,6 +237,19 @@ public class NfcService extends Application {
"com.android.nfc_extras.action.AID_SELECTED";
public static final String EXTRA_AID = "com.android.nfc_extras.extra.AID";
+ public static final String ACTION_APDU_RECEIVED =
+ "com.android.nfc_extras.action.APDU_RECEIVED";
+ public static final String EXTRA_APDU_BYTES =
+ "com.android.nfc_extras.extra.APDU_BYTES";
+
+ public static final String ACTION_EMV_CARD_REMOVAL =
+ "com.android.nfc_extras.action.EMV_CARD_REMOVAL";
+
+ public static final String ACTION_MIFARE_ACCESS_DETECTED =
+ "com.android.nfc_extras.action.MIFARE_ACCESS_DETECTED";
+ public static final String EXTRA_MIFARE_BLOCK =
+ "com.android.nfc_extras.extra.MIFARE_BLOCK";
+
// Locked on mNfcAdapter
PendingIntent mDispatchOverrideIntent;
IntentFilter[] mDispatchOverrideFilters;
@@ -2457,10 +2473,47 @@ public class NfcService extends Application {
Intent aidIntent = new Intent();
aidIntent.setAction(ACTION_AID_SELECTED);
aidIntent.putExtra(EXTRA_AID, aid);
- if (DBG) Log.d(TAG, "Broadcasting ACTION_AID_SELECTED");
+ if (DBG) Log.d(TAG, "Broadcasting " + ACTION_AID_SELECTED);
mContext.sendBroadcast(aidIntent, NFCEE_ADMIN_PERM);
break;
+ case MSG_SE_EMV_CARD_REMOVAL:
+ if (DBG) Log.d(TAG, "Card Removal message");
+ /* Send broadcast */
+ Intent cardRemovalIntent = new Intent();
+ cardRemovalIntent.setAction(ACTION_EMV_CARD_REMOVAL);
+ if (DBG) Log.d(TAG, "Broadcasting " + ACTION_EMV_CARD_REMOVAL);
+ mContext.sendBroadcast(cardRemovalIntent, NFCEE_ADMIN_PERM);
+ break;
+
+ case MSG_SE_APDU_RECEIVED:
+ if (DBG) Log.d(TAG, "APDU Received message");
+ byte[] apduBytes = (byte[]) msg.obj;
+ /* Send broadcast */
+ Intent apduReceivedIntent = new Intent();
+ apduReceivedIntent.setAction(ACTION_APDU_RECEIVED);
+ if (apduBytes != null && apduBytes.length > 0) {
+ apduReceivedIntent.putExtra(EXTRA_APDU_BYTES, apduBytes);
+ }
+ if (DBG) Log.d(TAG, "Broadcasting " + ACTION_APDU_RECEIVED);
+ mContext.sendBroadcast(apduReceivedIntent, NFCEE_ADMIN_PERM);
+ break;
+
+ case MSG_SE_MIFARE_ACCESS:
+ if (DBG) Log.d(TAG, "MIFARE access message");
+ /* Send broadcast */
+ byte[] mifareCmd = (byte[]) msg.obj;
+ Intent mifareAccessIntent = new Intent();
+ mifareAccessIntent.setAction(ACTION_MIFARE_ACCESS_DETECTED);
+ if (mifareCmd != null && mifareCmd.length > 1) {
+ int mifareBlock = mifareCmd[1] & 0xff;
+ if (DBG) Log.d(TAG, "Mifare Block=" + mifareBlock);
+ mifareAccessIntent.putExtra(EXTRA_MIFARE_BLOCK, mifareBlock);
+ }
+ if (DBG) Log.d(TAG, "Broadcasting " + ACTION_MIFARE_ACCESS_DETECTED);
+ mContext.sendBroadcast(mifareAccessIntent, NFCEE_ADMIN_PERM);
+ break;
+
case MSG_LLCP_LINK_ACTIVATION:
NativeP2pDevice device = (NativeP2pDevice) msg.obj;