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

Commit d0c84ab6 authored by Brad Lassey's avatar Brad Lassey Committed by Android (Google) Code Review
Browse files

Merge "Offhost NFC services shouldn't be able to register non-autotransact...

Merge "Offhost NFC services shouldn't be able to register non-autotransact polling loop filters" into main
parents b282d4d6 465b413d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -4477,8 +4477,8 @@
    </declare-styleable>
    <!-- Specify one or more <code>polling-loop-filter</code> elements inside a
         <code>host-apdu-service</code> to indicate polling loop frames that
         your service can handle. -->
         <code>host-apdu-service</code> or <code>offhost-apdu-service</code> to indicate polling
         loop frames that your service can handle. -->
    <!-- @FlaggedApi("android.nfc.nfc_read_polling_loop") -->
    <declare-styleable name="PollingLoopFilter">
        <!-- The polling loop frame. This attribute is mandatory. -->
@@ -4490,8 +4490,8 @@
    </declare-styleable>
    <!-- Specify one or more <code>polling-loop-pattern-filter</code> elements inside a
         <code>host-apdu-service</code> to indicate polling loop frames that
         your service can handle. -->
         <code>host-apdu-service</code> or <code>offhost-apdu-service</code>  to indicate polling
         loop frames that your service can handle. -->
    <!-- @FlaggedApi("android.nfc.nfc_read_polling_loop") -->
    <declare-styleable name="PollingLoopPatternFilter">
        <!-- The patter to match polling loop frames to, must to be compatible with
+18 −4
Original line number Diff line number Diff line
@@ -410,7 +410,12 @@ public final class ApduServiceInfo implements Parcelable {
                    boolean autoTransact = a.getBoolean(
                            com.android.internal.R.styleable.PollingLoopFilter_autoTransact,
                            false);
                    if (!mOnHost && !autoTransact) {
                        Log.e(TAG, "Ignoring polling-loop-filter " + plf
                                + " for offhost service that isn't autoTranact");
                    } else {
                        mAutoTransact.put(plf, autoTransact);
                    }
                    a.recycle();
                } else if (eventType == XmlPullParser.START_TAG
                        && "polling-loop-pattern-filter".equals(tagName) && currentGroup == null) {
@@ -422,7 +427,12 @@ public final class ApduServiceInfo implements Parcelable {
                    boolean autoTransact = a.getBoolean(
                            com.android.internal.R.styleable.PollingLoopFilter_autoTransact,
                            false);
                    if (!mOnHost && !autoTransact) {
                        Log.e(TAG, "Ignoring polling-loop-filter " + plf
                                + " for offhost service that isn't autoTranact");
                    } else {
                        mAutoTransactPatterns.put(Pattern.compile(plf), autoTransact);
                    }
                    a.recycle();
                }
            }
@@ -729,8 +739,10 @@ public final class ApduServiceInfo implements Parcelable {
    @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP)
    public void addPollingLoopFilter(@NonNull String pollingLoopFilter,
            boolean autoTransact) {
        if (!mOnHost && !autoTransact) {
            return;
        }
        mAutoTransact.put(pollingLoopFilter, autoTransact);

    }

    /**
@@ -755,8 +767,10 @@ public final class ApduServiceInfo implements Parcelable {
    @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP)
    public void addPollingLoopPatternFilter(@NonNull String pollingLoopPatternFilter,
            boolean autoTransact) {
        if (!mOnHost && !autoTransact) {
            return;
        }
        mAutoTransactPatterns.put(Pattern.compile(pollingLoopPatternFilter), autoTransact);

    }

    /**