Merge "Add VTS test for automotive AudioControl HAL" into pi-dev
diff --git a/nfc/1.1/Android.bp b/nfc/1.1/Android.bp
index 73dc70a..9a1392e 100644
--- a/nfc/1.1/Android.bp
+++ b/nfc/1.1/Android.bp
@@ -16,7 +16,11 @@
"android.hidl.base@1.0",
],
types: [
+ "Constant",
+ "NfcConfig",
"NfcEvent",
+ "PresenceCheckAlgorithm",
+ "ProtocolDiscoveryConfig",
],
gen_java: true,
}
diff --git a/nfc/1.1/INfc.hal b/nfc/1.1/INfc.hal
index ea6a571..b629d8c 100644
--- a/nfc/1.1/INfc.hal
+++ b/nfc/1.1/INfc.hal
@@ -49,4 +49,11 @@
* NfcStatus::SUCCESS otherwise.
*/
open_1_1(INfcClientCallback clientCallback) generates (NfcStatus status);
+
+ /**
+ * Fetches vendor specific configurations.
+ * @return config indicates support for certain features and
+ * populates the vendor specific configs
+ */
+ getConfig() generates (NfcConfig config);
};
diff --git a/nfc/1.1/types.hal b/nfc/1.1/types.hal
index 2f5ec7f..469e878 100644
--- a/nfc/1.1/types.hal
+++ b/nfc/1.1/types.hal
@@ -21,3 +21,78 @@
/** In case of an error, HCI network needs to be re-initialized */
HCI_NETWORK_RESET = 7
};
+
+enum Constant : uint8_t {
+ UNSUPPORTED_CONFIG = 0xFF,
+};
+
+/**
+ * Vendor Specific Proprietary Protocol & Discovery Configuration.
+ * Set to UNSUPPORTED_CONFIG if not supported.
+ * discovery* fields map to "RF Technology and Mode" in NCI Spec
+ * protocol* fields map to "RF protocols" in NCI Spec
+ */
+struct ProtocolDiscoveryConfig {
+ uint8_t protocol18092Active;
+ uint8_t protocolBPrime;
+ uint8_t protocolDual;
+ uint8_t protocol15693;
+ uint8_t protocolKovio;
+ uint8_t protocolMifare;
+ uint8_t discoveryPollKovio;
+ uint8_t discoveryPollBPrime;
+ uint8_t discoveryListenBPrime;
+};
+
+/* Presence Check Algorithm as per ISO/IEC 14443-4 */
+enum PresenceCheckAlgorithm : uint8_t {
+ /** Lets the stack select an algorithm */
+ DEFAULT = 0,
+ /** ISO-DEP protocol's empty I-block */
+ I_BLOCK = 1,
+ /**
+ * Type - 4 tag protocol iso-dep nak presence check command is sent waiting for
+ * response and notification.
+ */
+ ISO_DEP_NAK = 2
+};
+
+struct NfcConfig {
+ /** If true, NFCC is using bail out mode for either Type A or Type B poll. */
+ bool nfaPollBailOutMode;
+
+ PresenceCheckAlgorithm presenceCheckAlgorithm;
+
+ ProtocolDiscoveryConfig nfaProprietaryCfg;
+
+ /** Default off-host route. 0x00 if there aren't any. Refer to NCI spec. */
+ uint8_t defaultOffHostRoute;
+
+ /**
+ * Default off-host route for Felica. 0x00 if there aren't any. Refer to
+ * NCI spec.
+ */
+ uint8_t defaultOffHostRouteFelica;
+
+ /** Default system code route. 0x00 if there aren't any. Refer NCI spec */
+ uint8_t defaultSystemCodeRoute;
+
+ /**
+ * Default route for all remaining protocols and technology which haven't
+ * been configured.
+ * Device Host(0x00) is the default. Refer to NCI spec.
+ * */
+ uint8_t defaultRoute;
+
+ /** Pipe ID for eSE. 0x00 if there aren't any. */
+ uint8_t offHostESEPipeId;
+
+ /** Pipe ID for UICC. 0x00 if there aren't any. */
+ uint8_t offHostSIMPipeId;
+
+ /** Extended APDU length for ISO_DEP. If not supported default length is 261 */
+ uint32_t maxIsoDepTransceiveLength;
+
+ /** list of white listed host ids, as per ETSI TS 102 622 */
+ vec<uint8_t> hostWhitelist;
+};
diff --git a/nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp b/nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp
index bef412b..0b7c88b 100644
--- a/nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp
+++ b/nfc/1.1/vts/functional/VtsHalNfcV1_1TargetTest.cpp
@@ -30,6 +30,7 @@
using ::android::hardware::nfc::V1_1::INfc;
using ::android::hardware::nfc::V1_1::INfcClientCallback;
using ::android::hardware::nfc::V1_1::NfcEvent;
+using ::android::hardware::nfc::V1_1::NfcConfig;
using ::android::hardware::nfc::V1_0::NfcStatus;
using ::android::hardware::nfc::V1_0::NfcData;
using ::android::hardware::Return;
@@ -37,6 +38,9 @@
using ::android::hardware::hidl_vec;
using ::android::sp;
+// 261 bytes is the default and minimum transceive length
+constexpr unsigned int MIN_ISO_DEP_TRANSCEIVE_LENGTH = 261;
+
constexpr char kCallbackNameSendEvent[] = "sendEvent";
constexpr char kCallbackNameSendData[] = "sendData";
@@ -209,6 +213,17 @@
EXPECT_EQ(NfcStatus::OK, res.args->last_status_);
}
+/*
+ * getConfig:
+ * Calls getConfig()
+ * checks if fields in NfcConfig are populated correctly
+ */
+TEST_F(NfcHidlTest, GetConfig) {
+ nfc_->getConfig([](NfcConfig config) {
+ EXPECT_GE(config.maxIsoDepTransceiveLength, MIN_ISO_DEP_TRANSCEIVE_LENGTH);
+ });
+}
+
int main(int argc, char** argv) {
::testing::AddGlobalTestEnvironment(NfcHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);