Merge "AID prefix registration." into lmp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7e25a504d4
@@ -36,4 +36,5 @@ interface INfcCardEmulation
|
||||
List<ApduServiceInfo> getServices(int userHandle, in String category);
|
||||
boolean setPreferredService(in ComponentName service);
|
||||
boolean unsetPreferredService();
|
||||
boolean supportsAidPrefixRegistration();
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public final class AidGroup implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of AIDs in this group
|
||||
* @return the list of AIDs in this group
|
||||
*/
|
||||
public List<String> getAids() {
|
||||
return aids;
|
||||
|
||||
@@ -224,6 +224,20 @@ public final class ApduServiceInfo implements Parcelable {
|
||||
Log.e(TAG, "Ignoring invalid or duplicate aid: " + aid);
|
||||
}
|
||||
a.recycle();
|
||||
} else if (eventType == XmlPullParser.START_TAG &&
|
||||
"aid-prefix-filter".equals(tagName) && currentGroup != null) {
|
||||
final TypedArray a = res.obtainAttributes(attrs,
|
||||
com.android.internal.R.styleable.AidFilter);
|
||||
String aid = a.getString(com.android.internal.R.styleable.AidFilter_name).
|
||||
toUpperCase();
|
||||
// Add wildcard char to indicate prefix
|
||||
aid.concat("*");
|
||||
if (CardEmulation.isValidAid(aid) && !currentGroup.aids.contains(aid)) {
|
||||
currentGroup.aids.add(aid);
|
||||
} else {
|
||||
Log.e(TAG, "Ignoring invalid or duplicate aid: " + aid);
|
||||
}
|
||||
a.recycle();
|
||||
}
|
||||
}
|
||||
} catch (NameNotFoundException e) {
|
||||
|
||||
@@ -515,8 +515,21 @@ public final class CardEmulation {
|
||||
* @return whether AID prefix registering is supported on this device.
|
||||
*/
|
||||
public boolean supportsAidPrefixRegistration() {
|
||||
// TODO
|
||||
return false;
|
||||
try {
|
||||
return sService.supportsAidPrefixRegistration();
|
||||
} catch (RemoteException e) {
|
||||
recoverService();
|
||||
if (sService == null) {
|
||||
Log.e(TAG, "Failed to recover CardEmulationService.");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return sService.supportsAidPrefixRegistration();
|
||||
} catch (RemoteException ee) {
|
||||
Log.e(TAG, "Failed to reach CardEmulationService.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user