Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 826a73b8 authored by Martijn Coenen's avatar Martijn Coenen
Browse files

AID prefix registration.

Bug: 16517161
Change-Id: I4e008b84fd1372b17a98437ec8a6b71c33d7cd05
parent 3e0c8d3d
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -36,4 +36,5 @@ interface INfcCardEmulation
    List<ApduServiceInfo> getServices(int userHandle, in String category);
    List<ApduServiceInfo> getServices(int userHandle, in String category);
    boolean setPreferredService(in ComponentName service);
    boolean setPreferredService(in ComponentName service);
    boolean unsetPreferredService();
    boolean unsetPreferredService();
    boolean supportsAidPrefixRegistration();
}
}
+14 −0
Original line number Original line Diff line number Diff line
@@ -224,6 +224,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 &&
                        "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) {
        } catch (NameNotFoundException e) {
+15 −2
Original line number Original line Diff line number Diff line
@@ -515,9 +515,22 @@ public final class CardEmulation {
     * @return whether AID prefix registering is supported on this device.
     * @return whether AID prefix registering is supported on this device.
     */
     */
    public boolean supportsAidPrefixRegistration() {
    public boolean supportsAidPrefixRegistration() {
        // TODO
        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;
                return false;
            }
            }
        }
    }


    /**
    /**
     * @hide
     * @hide
+1 −1

File changed.

Contains only whitespace changes.