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

Commit 33a31fb2 authored by Alisher Alikhodjaev's avatar Alisher Alikhodjaev
Browse files

Add Technology Type info for the active secure element list

Bug: 364120337
Test: atest -c CtsNfcTestCases
Change-Id: I52fcddd1e64a45300a8456427ec716ac8091e1f6
parent 2be55aa2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ package android.nfc {
  @FlaggedApi("android.nfc.nfc_oem_extension") public final class NfcOemExtension {
    method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void clearPreference();
    method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public int forceRoutingTableCommit();
    method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull public java.util.List<java.lang.String> getActiveNfceeList();
    method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull public java.util.Map<java.lang.String,java.lang.Integer> getActiveNfceeList();
    method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public android.nfc.RoutingStatus getRoutingStatus();
    method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public java.util.List<android.nfc.NfcRoutingTableEntry> getRoutingTable();
    method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean hasUserEnabledNfc();
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ interface INfcAdapter
    void clearPreference();
    void setScreenState();
    void checkFirmware();
    List<String> fetchActiveNfceeList();
    Map fetchActiveNfceeList();
    void triggerInitialization();
    boolean getSettingStatus();
    boolean isTagPresent();
+51 −4
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.os.Binder;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.se.omapi.Reader;
import android.util.Log;

import java.lang.annotation.Retention;
@@ -147,6 +148,48 @@ public final class NfcOemExtension {
    @Retention(RetentionPolicy.SOURCE)
    public @interface ControllerMode{}

    /**
     * Technology Type for {@link #getActiveNfceeList()}.
     * @hide
     */
    @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
    public static final int NFCEE_TECH_NONE = 0;

    /**
     * Technology Type for {@link #getActiveNfceeList()}.
     * @hide
     */
    @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
    public static final int NFCEE_TECH_A = 1;

    /**
     * Technology Type for {@link #getActiveNfceeList()}.
     * @hide
     */
    @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
    public static final int NFCEE_TECH_B = 1 << 1;

    /**
     * Technology Type for {@link #getActiveNfceeList()}.
     * @hide
     */
    @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
    public static final int NFCEE_TECH_F = 1 << 2;

    /**
     * Nfc technology flags for {@link #getActiveNfceeList()}.
     *
     * @hide
     */
    @IntDef(flag = true, value = {
        NFCEE_TECH_NONE,
        NFCEE_TECH_A,
        NFCEE_TECH_B,
        NFCEE_TECH_F,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface NfceeTechnology {}

    /**
     * Event that Host Card Emulation is activated.
     */
@@ -571,14 +614,18 @@ public final class NfcOemExtension {
    /**
     * Get the Active NFCEE (NFC Execution Environment) List
     *
     * @return List of activated secure elements on success
     *         which can contain "eSE" and "UICC", otherwise empty list.
     * @see Reader#getName() for the list of possible NFCEE names.
     *
     * @return Map< String, @NfceeTechnology Integer >
     *         A HashMap where keys are activated secure elements and
     *         the values are bitmap of technologies supported by each secure element
     *         on success keys can contain "eSE" and "UICC", otherwise empty map.
     */
    @NonNull
    @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
    public List<String> getActiveNfceeList() {
    public Map<String, Integer> getActiveNfceeList() {
        return NfcAdapter.callServiceReturn(() ->
            NfcAdapter.sService.fetchActiveNfceeList(), new ArrayList<String>());
            NfcAdapter.sService.fetchActiveNfceeList(), new HashMap<String, Integer>());
    }

    /**