Loading core/java/android/nfc/cardemulation/ApduServiceInfo.java +25 −0 Original line number Original line Diff line number Diff line Loading @@ -253,6 +253,20 @@ public final class ApduServiceInfo implements Parcelable { Log.e(TAG, "Ignoring invalid or duplicate aid: " + aid); Log.e(TAG, "Ignoring invalid or duplicate aid: " + aid); } } a.recycle(); a.recycle(); } else if (eventType == XmlPullParser.START_TAG && tagName.equals("aid-suffix-filter") && 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 suffix aid = 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) { } catch (NameNotFoundException e) { Loading Loading @@ -297,6 +311,17 @@ public final class ApduServiceInfo implements Parcelable { return prefixAids; return prefixAids; } } public List<String> getSubsetAids() { final ArrayList<String> subsetAids = new ArrayList<String>(); for (AidGroup group : getAidGroups()) { for (String aid : group.aids) { if (aid.endsWith("#")) { subsetAids.add(aid); } } } return subsetAids; } /** /** * Returns the registered AID group for this category. * Returns the registered AID group for this category. */ */ Loading core/java/android/nfc/cardemulation/CardEmulation.java +7 −5 Original line number Original line Diff line number Diff line Loading @@ -606,6 +606,8 @@ public final class CardEmulation { * <li>Consist of only hex characters * <li>Consist of only hex characters * <li>Additionally, we allow an asterisk at the end, to indicate * <li>Additionally, we allow an asterisk at the end, to indicate * a prefix * a prefix * <li>Additinally we allow an (#) at symbol at the end, to indicate * a subset * </ul> * </ul> * * * @hide * @hide Loading @@ -614,20 +616,20 @@ public final class CardEmulation { if (aid == null) if (aid == null) return false; return false; // If a prefix AID, the total length must be odd (even # of AID chars + '*') // If a prefix/subset AID, the total length must be odd (even # of AID chars + '*') if (aid.endsWith("*") && ((aid.length() % 2) == 0)) { if ((aid.endsWith("*") || aid.endsWith("#")) && ((aid.length() % 2) == 0)) { Log.e(TAG, "AID " + aid + " is not a valid AID."); Log.e(TAG, "AID " + aid + " is not a valid AID."); return false; return false; } } // If not a prefix AID, the total length must be even (even # of AID chars) // If not a prefix/subset AID, the total length must be even (even # of AID chars) if (!aid.endsWith("*") && ((aid.length() % 2) != 0)) { if ((!(aid.endsWith("*") || aid.endsWith("#"))) && ((aid.length() % 2) != 0)) { Log.e(TAG, "AID " + aid + " is not a valid AID."); Log.e(TAG, "AID " + aid + " is not a valid AID."); return false; return false; } } // Verify hex characters // Verify hex characters if (!aid.matches("[0-9A-Fa-f]{10,32}\\*?")) { if (!aid.matches("[0-9A-Fa-f]{10,32}\\*?\\#?")) { Log.e(TAG, "AID " + aid + " is not a valid AID."); Log.e(TAG, "AID " + aid + " is not a valid AID."); return false; return false; } } Loading Loading
core/java/android/nfc/cardemulation/ApduServiceInfo.java +25 −0 Original line number Original line Diff line number Diff line Loading @@ -253,6 +253,20 @@ public final class ApduServiceInfo implements Parcelable { Log.e(TAG, "Ignoring invalid or duplicate aid: " + aid); Log.e(TAG, "Ignoring invalid or duplicate aid: " + aid); } } a.recycle(); a.recycle(); } else if (eventType == XmlPullParser.START_TAG && tagName.equals("aid-suffix-filter") && 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 suffix aid = 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) { } catch (NameNotFoundException e) { Loading Loading @@ -297,6 +311,17 @@ public final class ApduServiceInfo implements Parcelable { return prefixAids; return prefixAids; } } public List<String> getSubsetAids() { final ArrayList<String> subsetAids = new ArrayList<String>(); for (AidGroup group : getAidGroups()) { for (String aid : group.aids) { if (aid.endsWith("#")) { subsetAids.add(aid); } } } return subsetAids; } /** /** * Returns the registered AID group for this category. * Returns the registered AID group for this category. */ */ Loading
core/java/android/nfc/cardemulation/CardEmulation.java +7 −5 Original line number Original line Diff line number Diff line Loading @@ -606,6 +606,8 @@ public final class CardEmulation { * <li>Consist of only hex characters * <li>Consist of only hex characters * <li>Additionally, we allow an asterisk at the end, to indicate * <li>Additionally, we allow an asterisk at the end, to indicate * a prefix * a prefix * <li>Additinally we allow an (#) at symbol at the end, to indicate * a subset * </ul> * </ul> * * * @hide * @hide Loading @@ -614,20 +616,20 @@ public final class CardEmulation { if (aid == null) if (aid == null) return false; return false; // If a prefix AID, the total length must be odd (even # of AID chars + '*') // If a prefix/subset AID, the total length must be odd (even # of AID chars + '*') if (aid.endsWith("*") && ((aid.length() % 2) == 0)) { if ((aid.endsWith("*") || aid.endsWith("#")) && ((aid.length() % 2) == 0)) { Log.e(TAG, "AID " + aid + " is not a valid AID."); Log.e(TAG, "AID " + aid + " is not a valid AID."); return false; return false; } } // If not a prefix AID, the total length must be even (even # of AID chars) // If not a prefix/subset AID, the total length must be even (even # of AID chars) if (!aid.endsWith("*") && ((aid.length() % 2) != 0)) { if ((!(aid.endsWith("*") || aid.endsWith("#"))) && ((aid.length() % 2) != 0)) { Log.e(TAG, "AID " + aid + " is not a valid AID."); Log.e(TAG, "AID " + aid + " is not a valid AID."); return false; return false; } } // Verify hex characters // Verify hex characters if (!aid.matches("[0-9A-Fa-f]{10,32}\\*?")) { if (!aid.matches("[0-9A-Fa-f]{10,32}\\*?\\#?")) { Log.e(TAG, "AID " + aid + " is not a valid AID."); Log.e(TAG, "AID " + aid + " is not a valid AID."); return false; return false; } } Loading