Upper-case incoming AIDs.
This fixes scenarios where different services register the same AID in a different case, and we don't see any conflict. Bug: 16517161 Change-Id: I610b585ce7d57b4e32c21004a1d4c50e1133986a
This commit is contained in:
@@ -15,10 +15,6 @@ import android.util.Log;
|
||||
/**
|
||||
* The AidGroup class represents a group of Application Identifiers (AIDs).
|
||||
*
|
||||
* <p>An instance of this object can be used with
|
||||
* {@link CardEmulation#registerAidsForService(android.content.ComponentName, String, java.util.List)}
|
||||
* to tell the OS which AIDs are handled by your HCE- or SE-based service.
|
||||
*
|
||||
* <p>The format of AIDs is defined in the ISO/IEC 7816-4 specification. This class
|
||||
* requires the AIDs to be input as a hexadecimal string, with an even amount of
|
||||
* hexadecimal characters, e.g. "F014811481".
|
||||
@@ -60,7 +56,10 @@ public final class AidGroup implements Parcelable {
|
||||
} else {
|
||||
this.category = CardEmulation.CATEGORY_OTHER;
|
||||
}
|
||||
this.aids = aids;
|
||||
this.aids = new ArrayList<String>(aids.size());
|
||||
for (String aid : aids) {
|
||||
this.aids.add(aid.toUpperCase());
|
||||
}
|
||||
this.description = null;
|
||||
}
|
||||
|
||||
@@ -144,7 +143,7 @@ public final class AidGroup implements Parcelable {
|
||||
if (inGroup) {
|
||||
String aid = parser.getAttributeValue(null, "value");
|
||||
if (aid != null) {
|
||||
aids.add(aid);
|
||||
aids.add(aid.toUpperCase());
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "Ignoring <aid> tag while not in group");
|
||||
|
||||
@@ -311,7 +311,7 @@ public final class ApduServiceInfo implements Parcelable {
|
||||
public String getCategoryForAid(String aid) {
|
||||
ArrayList<AidGroup> groups = getAidGroups();
|
||||
for (AidGroup group : groups) {
|
||||
if (group.aids.contains(aid)) {
|
||||
if (group.aids.contains(aid.toUpperCase())) {
|
||||
return group.category;
|
||||
}
|
||||
}
|
||||
@@ -425,7 +425,7 @@ public final class ApduServiceInfo implements Parcelable {
|
||||
public ApduServiceInfo createFromParcel(Parcel source) {
|
||||
ResolveInfo info = ResolveInfo.CREATOR.createFromParcel(source);
|
||||
String description = source.readString();
|
||||
boolean onHost = (source.readInt() != 0) ? true : false;
|
||||
boolean onHost = source.readInt() != 0;
|
||||
ArrayList<AidGroup> staticAidGroups = new ArrayList<AidGroup>();
|
||||
int numStaticGroups = source.readInt();
|
||||
if (numStaticGroups > 0) {
|
||||
@@ -436,7 +436,7 @@ public final class ApduServiceInfo implements Parcelable {
|
||||
if (numDynamicGroups > 0) {
|
||||
source.readTypedList(dynamicAidGroups, AidGroup.CREATOR);
|
||||
}
|
||||
boolean requiresUnlock = (source.readInt() != 0) ? true : false;
|
||||
boolean requiresUnlock = source.readInt() != 0;
|
||||
int bannerResource = source.readInt();
|
||||
int uid = source.readInt();
|
||||
return new ApduServiceInfo(info, onHost, description, staticAidGroups,
|
||||
|
||||
Reference in New Issue
Block a user