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

Commit ffe062ff authored by Brad Lassey's avatar Brad Lassey Committed by Roshan
Browse files

Add Test method to inject HCE data

Bug: 304449836
Test: Creating test method
Flag: TEST_ONLY
Merged-In: I0dc8c6223c1ae034d504910c4491073c8aa7fedb
Change-Id: I0dc8c6223c1ae034d504910c4491073c8aa7fedb
parent 61e4a474
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ interface INfcAdapter

    void notifyPollingLoop(in PollingFrame frame);
    void notifyHceDeactivated();
    void notifyTestHceData(in int technology, in byte[] data);
    int sendVendorNciMessage(int mt, int gid, int oid, in byte[] payload);
    void registerVendorExtensionCallback(in INfcVendorNciCallback callbacks);
    void unregisterVendorExtensionCallback(in INfcVendorNciCallback callbacks);
+27 −0
Original line number Diff line number Diff line
@@ -2856,6 +2856,33 @@ public final class NfcAdapter {
        }
    }

   /**
     * Notifies the system of new HCE data for tests.
     *
     * @hide
     */
    @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP)
    public void notifyTestHceData(int technology, byte[] data) {
        try {
            if (sService == null) {
                attemptDeadServiceRecovery(null);
            }
            sService.notifyTestHceData(technology, data);
        } catch (RemoteException e) {
            attemptDeadServiceRecovery(e);
            // Try one more time
            if (sService == null) {
                Log.e(TAG, "Failed to recover NFC Service.");
                return;
            }
            try {
                sService.notifyTestHceData(technology, data);
            } catch (RemoteException e2) {
                Log.e(TAG, "Failed to recover NFC Service.");
            }
        }
    }

   /**
     * Notifies the system of a an HCE session being deactivated.
     *     *