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

Commit dbca60be authored by Jack Yu's avatar Jack Yu Committed by Raj Mojumder
Browse files

Update Multi-OffHost related API definition

Test: build pass
Bug: 128831640
Change-Id: Ia0a8ec38b0c4e60df18f727b0f5a7fdba84fe9e1
parent bc17e4b3
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -29116,7 +29116,6 @@ package android.nfc {
    method @Deprecated public void enableForegroundNdefPush(android.app.Activity, android.nfc.NdefMessage);
    method @Deprecated public void enableForegroundNdefPush(android.app.Activity, android.nfc.NdefMessage);
    method public void enableReaderMode(android.app.Activity, android.nfc.NfcAdapter.ReaderCallback, int, android.os.Bundle);
    method public void enableReaderMode(android.app.Activity, android.nfc.NfcAdapter.ReaderCallback, int, android.os.Bundle);
    method public static android.nfc.NfcAdapter getDefaultAdapter(android.content.Context);
    method public static android.nfc.NfcAdapter getDefaultAdapter(android.content.Context);
    method @NonNull public java.util.List<java.lang.String> getSupportedOffHostSecureElements();
    method public boolean ignore(android.nfc.Tag, int, android.nfc.NfcAdapter.OnTagRemovedListener, android.os.Handler);
    method public boolean ignore(android.nfc.Tag, int, android.nfc.NfcAdapter.OnTagRemovedListener, android.os.Handler);
    method @Deprecated public boolean invokeBeam(android.app.Activity);
    method @Deprecated public boolean invokeBeam(android.app.Activity);
    method public boolean isEnabled();
    method public boolean isEnabled();
@@ -29209,10 +29208,10 @@ package android.nfc.cardemulation {
    method public boolean isDefaultServiceForCategory(android.content.ComponentName, String);
    method public boolean isDefaultServiceForCategory(android.content.ComponentName, String);
    method public boolean registerAidsForService(android.content.ComponentName, String, java.util.List<java.lang.String>);
    method public boolean registerAidsForService(android.content.ComponentName, String, java.util.List<java.lang.String>);
    method public boolean removeAidsForService(android.content.ComponentName, String);
    method public boolean removeAidsForService(android.content.ComponentName, String);
    method public boolean setOffHostForService(@NonNull android.content.ComponentName, @NonNull String);
    method @RequiresPermission(android.Manifest.permission.NFC) @NonNull public boolean setOffHostForService(@NonNull android.content.ComponentName, @NonNull String);
    method public boolean setPreferredService(android.app.Activity, android.content.ComponentName);
    method public boolean setPreferredService(android.app.Activity, android.content.ComponentName);
    method public boolean supportsAidPrefixRegistration();
    method public boolean supportsAidPrefixRegistration();
    method public boolean unsetOffHostForService(@NonNull android.content.ComponentName);
    method @RequiresPermission(android.Manifest.permission.NFC) @NonNull public boolean unsetOffHostForService(@NonNull android.content.ComponentName);
    method public boolean unsetPreferredService(android.app.Activity);
    method public boolean unsetPreferredService(android.app.Activity);
    field public static final String ACTION_CHANGE_DEFAULT = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT";
    field public static final String ACTION_CHANGE_DEFAULT = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT";
    field public static final String CATEGORY_OTHER = "other";
    field public static final String CATEGORY_OTHER = "other";
+1 −0
Original line number Original line Diff line number Diff line
@@ -526,6 +526,7 @@ public final class NfcAdapter {
     * @return List<String> containing secure elements on the device which supports
     * @return List<String> containing secure elements on the device which supports
     *                      off host card emulation. eSE for Embedded secure element,
     *                      off host card emulation. eSE for Embedded secure element,
     *                      SIM for UICC and so on.
     *                      SIM for UICC and so on.
     * @hide
     */
     */
    public @NonNull List<String> getSupportedOffHostSecureElements() {
    public @NonNull List<String> getSupportedOffHostSecureElements() {
        List<String> offHostSE = new ArrayList<String>();
        List<String> offHostSE = new ArrayList<String>();
+11 −5
Original line number Original line Diff line number Diff line
@@ -432,7 +432,15 @@ public final class ApduServiceInfo implements Parcelable {
        mDynamicAidGroups.put(aidGroup.getCategory(), aidGroup);
        mDynamicAidGroups.put(aidGroup.getCategory(), aidGroup);
    }
    }


    @UnsupportedAppUsage
    /**
     * Sets the off host Secure Element.
     * @param  offHost  Secure Element to set. Only accept strings with prefix SIM or prefix eSE.
     *                  Ref: GSMA TS.26 - NFC Handset Requirements
     *                  TS26_NFC_REQ_069: For UICC, Secure Element Name SHALL be SIM[smartcard slot]
     *                                    (e.g. SIM/SIM1, SIM2… SIMn).
     *                  TS26_NFC_REQ_070: For embedded SE, Secure Element Name SHALL be eSE[number]
     *                                    (e.g. eSE/eSE1, eSE2, etc.).
     */
    public void setOffHostSecureElement(String offHost) {
    public void setOffHostSecureElement(String offHost) {
        mOffHostName = offHost;
        mOffHostName = offHost;
    }
    }
@@ -441,7 +449,6 @@ public final class ApduServiceInfo implements Parcelable {
     * Resets the off host Secure Element to statically defined
     * Resets the off host Secure Element to statically defined
     * by the service in the manifest file.
     * by the service in the manifest file.
     */
     */
    @UnsupportedAppUsage
    public void unsetOffHostSecureElement() {
    public void unsetOffHostSecureElement() {
        mOffHostName = mStaticOffHostName;
        mOffHostName = mStaticOffHostName;
    }
    }
@@ -581,10 +588,9 @@ public final class ApduServiceInfo implements Parcelable {
            pw.println("    On Host Service");
            pw.println("    On Host Service");
        } else {
        } else {
            pw.println("    Off-host Service");
            pw.println("    Off-host Service");
            pw.println("        " + "Current off-host SE" + mOffHostName
            pw.println("        " + "Current off-host SE:" + mOffHostName
                    + " static off-host: " + mOffHostName);
                    + " static off-host SE:" + mStaticOffHostName);
        }
        }
        pw.println("    Static off-host Secure Element:");
        pw.println("    Static AID groups:");
        pw.println("    Static AID groups:");
        for (AidGroup group : mStaticAidGroups.values()) {
        for (AidGroup group : mStaticAidGroups.values()) {
            pw.println("        Category: " + group.category);
            pw.println("        Category: " + group.category);
+21 −2
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package android.nfc.cardemulation;
package android.nfc.cardemulation;


import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SdkConstant.SdkConstantType;
import android.app.Activity;
import android.app.Activity;
@@ -360,6 +361,8 @@ public final class CardEmulation {
     * @param service The component name of the service
     * @param service The component name of the service
     * @return whether the registration was successful.
     * @return whether the registration was successful.
     */
     */
    @RequiresPermission(android.Manifest.permission.NFC)
    @NonNull
    public boolean unsetOffHostForService(@NonNull ComponentName service) {
    public boolean unsetOffHostForService(@NonNull ComponentName service) {
        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
        if (adapter == null) {
        if (adapter == null) {
@@ -391,7 +394,9 @@ public final class CardEmulation {
     * through the manifest, or dynamically by using this API),
     * through the manifest, or dynamically by using this API),
     * it will be replaced with this one. All AIDs registered by
     * it will be replaced with this one. All AIDs registered by
     * this service will be re-routed to this Secure Element if
     * this service will be re-routed to this Secure Element if
     * successful.
     * successful. AIDs that was statically assigned using manifest
     * will re-route to off-host SE that stated in manifest after NFC
     * toggle.
     *
     *
     * <p>Note that you can only set off-host SE for a service that
     * <p>Note that you can only set off-host SE for a service that
     * is running under the same UID as the caller of this API. Typically
     * is running under the same UID as the caller of this API. Typically
@@ -403,9 +408,19 @@ public final class CardEmulation {
     * exists on the device.
     * exists on the device.
     *
     *
     * @param service The component name of the service
     * @param service The component name of the service
     * @param offHostSecureElement Secure Element to register the AID to
     * @param offHostSecureElement Secure Element to register the AID to. Only accept strings with
     *                             prefix SIM or prefix eSE.
     *                             Ref: GSMA TS.26 - NFC Handset Requirements
     *                             TS26_NFC_REQ_069: For UICC, Secure Element Name SHALL be
     *                                               SIM[smartcard slot]
     *                                               (e.g. SIM/SIM1, SIM2… SIMn).
     *                             TS26_NFC_REQ_070: For embedded SE, Secure Element Name SHALL be
     *                                               eSE[number]
     *                                               (e.g. eSE/eSE1, eSE2, etc.).
     * @return whether the registration was successful.
     * @return whether the registration was successful.
     */
     */
    @RequiresPermission(android.Manifest.permission.NFC)
    @NonNull
    public boolean setOffHostForService(@NonNull ComponentName service,
    public boolean setOffHostForService(@NonNull ComponentName service,
            @NonNull String offHostSecureElement) {
            @NonNull String offHostSecureElement) {
        boolean validSecureElement = false;
        boolean validSecureElement = false;
@@ -421,6 +436,10 @@ public final class CardEmulation {
            return false;
            return false;
        }
        }


        if (!offHostSecureElement.startsWith("eSE") && !offHostSecureElement.startsWith("SIM")) {
            return false;
        }

        if (offHostSecureElement.equals("eSE")) {
        if (offHostSecureElement.equals("eSE")) {
            offHostSecureElement = "eSE1";
            offHostSecureElement = "eSE1";
        } else if (offHostSecureElement.equals("SIM")) {
        } else if (offHostSecureElement.equals("SIM")) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -3691,7 +3691,7 @@
             the settings for this service. -->
             the settings for this service. -->
        <attr name="settingsActivity"/>
        <attr name="settingsActivity"/>
        <!-- Secure Element which the AIDs should be routed to -->
        <!-- Secure Element which the AIDs should be routed to -->
        <attr name="secureElementName"/>
        <attr name="secureElementName" format="string"/>
    </declare-styleable>
    </declare-styleable>


    <!-- Specify one or more <code>aid-group</code> elements inside a
    <!-- Specify one or more <code>aid-group</code> elements inside a