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

Commit 33ce5fbd authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "nfc(API): Add API for EUICC offhost CE support" into main am: 9f0ae178

parents e743afeb 9f0ae178
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ package android.nfc.cardemulation {
  public final class CardEmulation {
    method @FlaggedApi("android.permission.flags.wallet_role_enabled") @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public static android.content.ComponentName getPreferredPaymentService(@NonNull android.content.Context);
    method @FlaggedApi("android.nfc.enable_nfc_mainline") @NonNull public java.util.List<android.nfc.cardemulation.ApduServiceInfo> getServices(@NonNull String, int);
    method @FlaggedApi("android.nfc.enable_card_emulation_euicc") public boolean isEuiccSupported();
    method @FlaggedApi("android.nfc.nfc_override_recover_routing_table") public void overrideRoutingTable(@NonNull android.app.Activity, int, int);
    method @FlaggedApi("android.nfc.nfc_override_recover_routing_table") public void recoverRoutingTable(@NonNull android.app.Activity);
  }
+1 −0
Original line number Diff line number Diff line
@@ -50,4 +50,5 @@ interface INfcCardEmulation

    void overrideRoutingTable(int userHandle, String protocol, String technology, in String pkg);
    void recoverRoutingTable(int userHandle);
    boolean isEuiccSupported();
}
+6 −1
Original line number Diff line number Diff line
@@ -721,7 +721,7 @@ public final class NfcAdapter {
     *
     * @return List<String> containing secure elements on the device which supports
     *                      off host card emulation. eSE for Embedded secure element,
     *                      SIM for UICC and so on.
     *                      SIM for UICC, eSIM for EUICC and so on.
     * @hide
     */
    public @NonNull List<String> getSupportedOffHostSecureElements() {
@@ -741,6 +741,11 @@ public final class NfcAdapter {
        if (pm.hasSystemFeature(PackageManager.FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE)) {
            offHostSE.add("eSE");
        }
        if (Flags.enableCardEmulationEuicc()
                && callServiceReturn(
                        () -> sCardEmulationService.isEuiccSupported(), false)) {
            offHostSE.add("eSIM");
        }
        return offHostSE;
    }

+2 −0
Original line number Diff line number Diff line
@@ -308,6 +308,8 @@ public final class ApduServiceInfo implements Parcelable {
                        mOffHostName = "eSE1";
                    } else if (mOffHostName.equals("SIM")) {
                        mOffHostName = "SIM1";
                    } else if (Flags.enableCardEmulationEuicc() && mOffHostName.equals("eSIM")) {
                        mOffHostName = "eSIM1";
                    }
                }
                mStaticOffHostName = mOffHostName;
+18 −2
Original line number Diff line number Diff line
@@ -548,11 +548,13 @@ public final class CardEmulation {

        List<String> validSE = adapter.getSupportedOffHostSecureElements();
        if ((offHostSecureElement.startsWith("eSE") && !validSE.contains("eSE"))
                || (offHostSecureElement.startsWith("SIM") && !validSE.contains("SIM"))) {
                || (offHostSecureElement.startsWith("SIM") && !validSE.contains("SIM"))
                || (offHostSecureElement.startsWith("eSIM") && !validSE.contains("eSIM"))) {
            return false;
        }

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

@@ -560,6 +562,8 @@ public final class CardEmulation {
            offHostSecureElement = "eSE1";
        } else if (offHostSecureElement.equals("SIM")) {
            offHostSecureElement = "SIM1";
        } else if (Flags.enableCardEmulationEuicc() && offHostSecureElement.equals("eSIM")) {
            offHostSecureElement = "eSIM1";
        }
        final String offHostSecureElementV = new String(offHostSecureElement);
        return callServiceReturn(() ->
@@ -984,6 +988,18 @@ public final class CardEmulation {
                    mContext.getUser().getIdentifier()));
    }

    /**
     * Is EUICC supported as a Secure Element EE which supports off host card emulation.
     *
     * @return true if the device supports EUICC for off host card emulation, false otherwise.
     * @hide
     */
    @SystemApi
    @FlaggedApi(android.nfc.Flags.FLAG_ENABLE_CARD_EMULATION_EUICC)
    public boolean isEuiccSupported() {
        return callServiceReturn(() -> sService.isEuiccSupported(), false);
    }

    /**
     * Returns the value of {@link Settings.Secure#NFC_PAYMENT_DEFAULT_COMPONENT}.
     *
Loading