am cd108cbe: Merge "AID prefix registration." into lmp-dev

* commit 'cd108cbe643d824437e8a629aa258a62ad237b39':
  AID prefix registration.
This commit is contained in:
Martijn Coenen
2014-09-16 15:04:53 +00:00
committed by Android Git Automerger
4 changed files with 31 additions and 3 deletions

View File

@@ -36,4 +36,5 @@ interface INfcCardEmulation
List<ApduServiceInfo> getServices(int userHandle, in String category);
boolean setPreferredService(in ComponentName service);
boolean unsetPreferredService();
boolean supportsAidPrefixRegistration();
}

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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;
}
}
}
/**