Skip to content

Commit 20e7bcc

Browse files
Puneet MishraGerrit Code Review
authored andcommitted
frameworks/base: Support for third party NFC features
Integration of below modifications are necessary to support third party NFC software: * a new interface in INfcAdapter.aidl allowing vendor specific extensions and features * a new size for MIFARE Classic tags * a modified constructor to distinguish MIFARE Classic tags from NfcA tags * allowing extensions to AidGroup and changing the protection of the instance variables to package protected Change-Id: Ic11dc68c4ea83262c705ec50b75b5808aa064f82 (integrated from commit 57a001b7851c97d41f042dda643f9a87aa6306e5)
1 parent cb48836 commit 20e7bcc

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

core/java/android/nfc/INfcAdapter.aidl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/*
2+
* Copyright (c) 2015, The Linux Foundation. All rights reserved.
3+
* Not a Contribution.
4+
*
25
* Copyright (C) 2010 The Android Open Source Project
36
*
47
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,6 +31,7 @@ import android.nfc.INfcTag;
2831
import android.nfc.INfcCardEmulation;
2932
import android.nfc.INfcUnlockHandler;
3033
import android.os.Bundle;
34+
import android.os.IBinder;
3135

3236
/**
3337
* @hide
@@ -37,6 +41,7 @@ interface INfcAdapter
3741
INfcTag getNfcTagInterface();
3842
INfcCardEmulation getNfcCardEmulationInterface();
3943
INfcAdapterExtras getNfcAdapterExtrasInterface(in String pkg);
44+
IBinder getNfcAdapterVendorInterface(in String vendor);
4045

4146
int getState();
4247
boolean disable(boolean saveState);

core/java/android/nfc/cardemulation/AidGroup.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/*
22
* Copyright (C) 2015 The Android Open Source Project
33
*
4+
* Copyright (c) 2015, The Linux Foundation. All rights reserved.
5+
* Not a Contribution.
6+
*
47
* Licensed under the Apache License, Version 2.0 (the "License");
58
* you may not use this file except in compliance with the License.
69
* You may obtain a copy of the License at
@@ -37,17 +40,17 @@
3740
*
3841
* @hide
3942
*/
40-
public final class AidGroup implements Parcelable {
43+
public class AidGroup implements Parcelable {
4144
/**
4245
* The maximum number of AIDs that can be present in any one group.
4346
*/
4447
public static final int MAX_NUM_AIDS = 256;
4548

4649
static final String TAG = "AidGroup";
4750

48-
final List<String> aids;
49-
final String category;
50-
final String description;
51+
protected List<String> aids;
52+
protected String category;
53+
protected String description;
5154

5255
/**
5356
* Creates a new AidGroup object.

core/java/android/nfc/tech/MifareClassic.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/*
2+
* Copyright (C) 2015 NXP Semiconductors
3+
* The original Work has been changed by NXP Semiconductors.
24
* Copyright (C) 2010 The Android Open Source Project
35
*
46
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -173,6 +175,10 @@ public MifareClassic(Tag tag) throws RemoteException {
173175
mType = TYPE_CLASSIC;
174176
mSize = SIZE_4K;
175177
break;
178+
case 0x19:
179+
mType = TYPE_CLASSIC;
180+
mSize = SIZE_2K;
181+
break;
176182
case 0x28:
177183
mType = TYPE_CLASSIC;
178184
mSize = SIZE_1K;

core/java/android/nfc/tech/NfcA.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/*
2+
* Copyright (C) 2015 NXP Semiconductors
3+
* The original Work has been changed by NXP Semiconductors.
24
* Copyright (C) 2010 The Android Open Source Project
35
*
46
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -66,8 +68,15 @@ public static NfcA get(Tag tag) {
6668
/** @hide */
6769
public NfcA(Tag tag) throws RemoteException {
6870
super(tag, TagTechnology.NFC_A);
69-
Bundle extras = tag.getTechExtras(TagTechnology.NFC_A);
70-
mSak = extras.getShort(EXTRA_SAK);
71+
Bundle extras;
72+
mSak = 0;
73+
if(tag.hasTech(TagTechnology.MIFARE_CLASSIC))
74+
{
75+
extras = tag.getTechExtras(TagTechnology.MIFARE_CLASSIC);
76+
mSak = extras.getShort(EXTRA_SAK);
77+
}
78+
extras = tag.getTechExtras(TagTechnology.NFC_A);
79+
mSak |= extras.getShort(EXTRA_SAK);
7180
mAtqa = extras.getByteArray(EXTRA_ATQA);
7281
}
7382

0 commit comments

Comments
 (0)