Add Off-Host Card Emulation Features
Test: CTS test; manual Bug: 117253962 Change-Id: I7c35b1bffbc57870bb8c67704811a2649854d94e
This commit is contained in:
@@ -11317,6 +11317,8 @@ package android.content.pm {
|
||||
field public static final java.lang.String FEATURE_NFC = "android.hardware.nfc";
|
||||
field public static final java.lang.String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
|
||||
field public static final java.lang.String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
|
||||
field public static final java.lang.String FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE = "android.hardware.nfc.ese";
|
||||
field public static final java.lang.String FEATURE_NFC_OFF_HOST_CARD_EMULATION_UICC = "android.hardware.nfc.uicc";
|
||||
field public static final java.lang.String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep";
|
||||
field public static final java.lang.String FEATURE_PC = "android.hardware.type.pc";
|
||||
field public static final java.lang.String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture";
|
||||
@@ -29159,6 +29161,7 @@ package android.nfc {
|
||||
method public deprecated 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 static android.nfc.NfcAdapter getDefaultAdapter(android.content.Context);
|
||||
method 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 invokeBeam(android.app.Activity);
|
||||
method public boolean isEnabled();
|
||||
|
||||
@@ -1912,6 +1912,23 @@ public abstract class PackageManager {
|
||||
@SdkConstant(SdkConstantType.FEATURE)
|
||||
public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
|
||||
|
||||
/**
|
||||
* Feature for {@link #getSystemAvailableFeatures} and
|
||||
* {@link #hasSystemFeature}: The device supports uicc-
|
||||
* based NFC card emulation.
|
||||
*/
|
||||
@SdkConstant(SdkConstantType.FEATURE)
|
||||
public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_UICC =
|
||||
"android.hardware.nfc.uicc";
|
||||
|
||||
/**
|
||||
* Feature for {@link #getSystemAvailableFeatures} and
|
||||
* {@link #hasSystemFeature}: The device supports eSE-
|
||||
* based NFC card emulation.
|
||||
*/
|
||||
@SdkConstant(SdkConstantType.FEATURE)
|
||||
public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE = "android.hardware.nfc.ese";
|
||||
|
||||
/**
|
||||
* Feature for {@link #getSystemAvailableFeatures} and
|
||||
* {@link #hasSystemFeature}: The device supports any
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.nfc;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.annotation.SdkConstant;
|
||||
import android.annotation.SdkConstant.SdkConstantType;
|
||||
@@ -42,7 +43,9 @@ import android.os.ServiceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents the local NFC adapter.
|
||||
@@ -487,6 +490,35 @@ public final class NfcAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of Secure Elements which support off host card emulation.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
public @NonNull List<String> getSupportedOffHostSecureElements() {
|
||||
List<String> offHostSE = new ArrayList<String>();
|
||||
IPackageManager pm = ActivityThread.getPackageManager();
|
||||
if (pm == null) {
|
||||
Log.e(TAG, "Cannot get package manager, assuming no off-host CE feature");
|
||||
return offHostSE;
|
||||
}
|
||||
try {
|
||||
if (pm.hasSystemFeature(PackageManager.FEATURE_NFC_OFF_HOST_CARD_EMULATION_UICC, 0)) {
|
||||
offHostSE.add("SIM");
|
||||
}
|
||||
if (pm.hasSystemFeature(PackageManager.FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE, 0)) {
|
||||
offHostSE.add("eSE");
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Package manager query failed, assuming no off-host CE feature", e);
|
||||
offHostSE.clear();
|
||||
return offHostSE;
|
||||
}
|
||||
return offHostSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the NfcAdapter for application context,
|
||||
* or throws if NFC is not available.
|
||||
|
||||
Reference in New Issue
Block a user