Merge "Increase the timeout for NfcHidlTargetProfilingTest."
diff --git a/ir/1.0/vts/functional/ir_hidl_hal_test.cpp b/ir/1.0/vts/functional/ir_hidl_hal_test.cpp
index 57d0b73..08c7974 100644
--- a/ir/1.0/vts/functional/ir_hidl_hal_test.cpp
+++ b/ir/1.0/vts/functional/ir_hidl_hal_test.cpp
@@ -34,7 +34,7 @@
 class ConsumerIrHidlTest : public ::testing::Test {
  public:
   virtual void SetUp() override {
-    ir = IConsumerIr::getService(false);
+    ir = IConsumerIr::getService();
     ASSERT_NE(ir, nullptr);
   }
 
diff --git a/ir/1.0/vts/functional/vts/testcases/hal/ir/hidl/target/AndroidTest.xml b/ir/1.0/vts/functional/vts/testcases/hal/ir/hidl/target/AndroidTest.xml
index 3ad7e45..bf3d236 100644
--- a/ir/1.0/vts/functional/vts/testcases/hal/ir/hidl/target/AndroidTest.xml
+++ b/ir/1.0/vts/functional/vts/testcases/hal/ir/hidl/target/AndroidTest.xml
@@ -25,7 +25,7 @@
             _64bit::DATA/nativetest64/ir_hidl_hal_test/ir_hidl_hal_test,
             "/>
         <option name="binary-test-type" value="hal_hidl_gtest" />
-        <option name="hwbinder-service" value="android.hardware.ir" />
+        <option name="precondition-hwbinder-service" value="android.hardware.ir" />
         <option name="test-timeout" value="1m" />
     </test>
 </configuration>
diff --git a/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp b/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp
index a50d88f..a0c5f1a 100644
--- a/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp
+++ b/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp
@@ -40,6 +40,8 @@
 /* NCI Commands */
 #define CORE_RESET_CMD \
   { 0x20, 0x00, 0x01, 0x00 }
+#define CORE_RESET_CMD_CONFIG_RESET \
+  { 0x20, 0x00, 0x01, 0x01 }
 #define CORE_CONN_CREATE_CMD \
   { 0x20, 0x04, 0x02, 0x01, 0x00 }
 #define INVALID_COMMAND \
@@ -166,7 +168,7 @@
  * WriteCoreReset:
  * Sends CORE_RESET_CMD
  * Waits for CORE_RESET_RSP
- * Checks the status and the version number
+ * Checks the status, version number and configuration status
  */
 TEST_F(NfcHidlTest, WriteCoreReset) {
   std::vector<uint8_t> cmd = CORE_RESET_CMD;
@@ -178,6 +180,26 @@
   EXPECT_EQ(6ul, last_data_[0].size());
   EXPECT_EQ((int)NfcStatus::OK, last_data_[0][3]);
   EXPECT_GE(VERSION, last_data_[0][4]);
+  EXPECT_EQ(0ul, last_data_[0][5]);
+}
+
+/*
+ * WriteCoreResetConfigReset:
+ * Sends CORE_RESET_CMD_CONFIG_RESET
+ * Waits for CORE_RESET_RSP
+ * Checks the status, version number and configuration status
+ */
+TEST_F(NfcHidlTest, WriteCoreResetConfigReset) {
+  std::vector<uint8_t> cmd = CORE_RESET_CMD_CONFIG_RESET;
+  NfcData data = cmd;
+  EXPECT_EQ(data.size(), nfc_->write(data));
+  // Wait for CORE_RESET_RSP
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(1ul, last_data_.size());
+  EXPECT_EQ(6ul, last_data_[0].size());
+  EXPECT_EQ((int)NfcStatus::OK, last_data_[0][3]);
+  EXPECT_GE(VERSION, last_data_[0][4]);
+  EXPECT_EQ(1ul, last_data_[0][5]);
 }
 
 /*
@@ -273,14 +295,18 @@
     EXPECT_EQ(std::cv_status::no_timeout, wait());
     // Check if the same data was recieved back
     EXPECT_EQ(2ul, last_data_.size());
-    EXPECT_EQ(data.size(), last_data_[0].size());
+
+    /* It is possible that CORE_CONN_CREDITS_NTF is received before data,
+     * Find the order and do further checks depending on that */
+    uint8_t data_index = last_data_[0].size() == data.size() ? 0 : 1;
+    EXPECT_EQ(data.size(), last_data_[data_index].size());
     for (size_t i = 0; i < data.size(); i++) {
-      EXPECT_EQ(data[i], last_data_[0][i]);
+      EXPECT_EQ(data[i], last_data_[data_index][i]);
     }
 
-    EXPECT_EQ(6ul, last_data_[1].size());
+    EXPECT_EQ(6ul, last_data_[!data_index].size());
     // Check if the credit is refilled to 1
-    EXPECT_EQ(1, last_data_[1][5]);
+    EXPECT_EQ(1, last_data_[!data_index][5]);
   }
 }
 
diff --git a/wifi/supplicant/1.0/ISupplicantIface.hal b/wifi/supplicant/1.0/ISupplicantIface.hal
index c0058a0..8bb8c97 100644
--- a/wifi/supplicant/1.0/ISupplicantIface.hal
+++ b/wifi/supplicant/1.0/ISupplicantIface.hal
@@ -138,6 +138,19 @@
   setWpsDeviceName(string name) generates (SupplicantStatus status);
 
   /**
+   * Set the device type for WPS operations.
+   *
+   * @parm type Type of device. Refer to section B.1 of Wifi P2P
+   *       Technical specification v1.2.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
+   */
+  setWpsDeviceType(uint8_t[8] type) generates (SupplicantStatus status);
+
+  /**
    * Set the manufacturer for WPS operations.
    * The manufacturer of the device (up to |WPS_MANUFACTURER_MAX_LEN| ASCII
    * characters).
diff --git a/wifi/supplicant/1.0/ISupplicantStaIface.hal b/wifi/supplicant/1.0/ISupplicantStaIface.hal
index c9d9ee6..68eb179 100644
--- a/wifi/supplicant/1.0/ISupplicantStaIface.hal
+++ b/wifi/supplicant/1.0/ISupplicantStaIface.hal
@@ -67,6 +67,10 @@
     SENSE = 2
   };
 
+  enum ExtRadioWorkDefaults : uint32_t {
+    TIMEOUT_IN_SECS = 10
+  };
+
   /**
    * Register for callbacks from this interface.
    *
@@ -405,4 +409,55 @@
    *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
    */
   setExternalSim(bool useExternalSim) generates (SupplicantStatus status);
+
+  /**
+   * External programs can request supplicant to not start offchannel
+   * operations during other tasks that may need exclusive control of the
+   * radio.
+   *
+   * This method can be used to reserve a slot for radio access. If freq is
+   * specified, other radio work items on the same channel can be completed in
+   * parallel. Otherwise, all other radio work items are blocked during
+   * execution. Timeout must be set to |ExtRadioWorkDefaults.TIMEOUT_IN_SECS|
+   * seconds by default to avoid blocking supplicant operations on the iface
+   * for excessive time. If a longer (or shorter) safety timeout is needed,
+   * that may be specified with the optional timeout parameter. This command
+   * returns an identifier for the radio work item.
+   *
+   * Once the radio work item has been started,
+   * |ISupplicant.onExtRadioWorkStart| callback is indicated that the external
+   * processing can start.
+   *
+   * @param name Name for the radio work being added.
+   * @param freqInMhz Frequency to specify. Set to 0 for all channels.
+   * @param timeoutInSec Timeout tospecify. Set to 0 for default timeout.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
+   * @return id Identifier for this radio work.
+   */
+  addExtRadioWork(string name, uint32_t freqInMhz, uint32_t timeoutInSec)
+      generates (SupplicantStatus status, uint32_t id);
+
+  /**
+   * Indicates to supplicant that the external radio work has completed.
+   * This allows other radio works to be performed. If this method is not
+   * invoked (e.g., due to the external program terminating), supplicant
+   * must time out the radio work item on the iface and send
+   * |ISupplicantCallback.onExtRadioWorkTimeout| event to indicate
+   * that this has happened.
+   *
+   * This method may also be used to cancel items that have been scheduled
+   * via |addExtRadioWork|, but have not yet been started (notified via
+   * |ISupplicantCallback.onExtRadioWorkStart|).
+   *
+   * @return id Identifier generated for the radio work addition
+   *         (using |addExtRadioWork|).
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
+   */
+  removeExtRadioWork(uint32_t id) generates (SupplicantStatus status);
 };
diff --git a/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal b/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
index 4b201d4..c3ec060 100644
--- a/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
+++ b/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
@@ -326,4 +326,18 @@
    * Used to indicate the overlap of a WPS PBC connection attempt.
    */
   oneway onWpsEventPbcOverlap();
+
+  /**
+   * Used to indicate that the external radio work can start now.
+   *
+   * @return id Identifier generated for the radio work request.
+   */
+  oneway onExtRadioWorkStart(uint32_t id);
+
+  /**
+   * Used to indicate that the external radio work request has timed out.
+   *
+   * @return id Identifier generated for the radio work request.
+   */
+  oneway onExtRadioWorkTimeout(uint32_t id);
 };
diff --git a/wifi/supplicant/1.0/ISupplicantStaNetwork.hal b/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
index b347c1d..deaad5d 100644
--- a/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
+++ b/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
@@ -508,8 +508,30 @@
    */
   setEapDomainSuffixMatch(string match)
       generates (SupplicantStatus status);
+
   /**
-   * Get ID string set for this network.
+   * This field can be used to enable proactive key caching which is also
+   * known as opportunistic PMKSA caching for WPA2. This is disabled (0)
+   * by default unless default value is changed with the global okc=1
+   * parameter.
+   *
+   * Proactive key caching is used to make supplicant assume that the APs
+   * are using the same PMK and generate PMKSA cache entries without
+   * doing RSN pre-authentication. This requires support from the AP side
+   * and is normally used with wireless switches that co-locate the
+   * authenticator.
+   *
+   * @param enable true to set, false otherwise.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
+   *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
+   */
+  setProactiveKeyCaching(bool enable) generates (SupplicantStatus status);
+
+  /**
+   * Set ID string for this network.
    * Network identifier string for external scripts.
    *
    * @return idStr ID string value to set.
@@ -523,6 +545,20 @@
   setIdStr(string idStr) generates (SupplicantStatus status);
 
   /**
+   * Set PPS MO ID for this network.
+   * (Hotspot 2.0 PerProviderSubscription/UpdateIdentifier)
+   *
+   * @return id ID value to set.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
+   *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
+   */
+  setUpdateIdentifier(uint32_t id) generates (SupplicantStatus status);
+
+  /**
    * Getters for the various network params.
    */
   /**
@@ -912,11 +948,23 @@
    *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
    *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
    */
-  sendNetworkEapSimGsmAuthResponse(NetworkResponseEapSimGsmAuthParams params)
+  sendNetworkEapSimGsmAuthResponse(vec<NetworkResponseEapSimGsmAuthParams> params)
       generates (SupplicantStatus status);
 
   /**
    * Used to send a response to the
+   * |ISupplicantNetworkCallback.onNetworkEapSimGsmAuthRequest| request.
+   *
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
+   *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
+   */
+  sendNetworkEapSimGsmAuthFailure() generates (SupplicantStatus status);
+
+  /**
+   * Used to send a response to the
    * |ISupplicantNetworkCallback.onNetworkEapSimUmtsAuthRequest| request.
    *
    * @param params Params to be used for EAP UMTS authentication.
@@ -931,6 +979,32 @@
 
   /**
    * Used to send a response to the
+   * |ISupplicantNetworkCallback.onNetworkEapSimUmtsAuthRequest| request.
+   *
+   * @param auts Params to be used for EAP UMTS authentication.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
+   *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
+   */
+  sendNetworkEapSimUmtsAutsResponse(uint8_t[14] auts)
+      generates (SupplicantStatus status);
+
+  /**
+   * Used to send a response to the
+   * |ISupplicantNetworkCallback.onNetworkEapSimUmtsAuthRequest| request.
+   *
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
+   *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
+   */
+  sendNetworkEapSimUmtsAuthFailure() generates (SupplicantStatus status);
+
+  /**
+   * Used to send a response to the
    * |ISupplicantNetworkCallback.onNetworkEapIdentityRequest| request.
    *
    * @param identity Identity to be used for the network.