Merge "sound trigger HAL: remove dummy Union" into oc-dev
am: 8630ea169c

Change-Id: I772808083c8d053fef706e6ab056ba7f751718db
diff --git a/bluetooth/1.0/default/vendor_interface.cc b/bluetooth/1.0/default/vendor_interface.cc
index 68cac5f..bb66460 100644
--- a/bluetooth/1.0/default/vendor_interface.cc
+++ b/bluetooth/1.0/default/vendor_interface.cc
@@ -16,8 +16,6 @@
 
 #include "vendor_interface.h"
 
-#include <assert.h>
-
 #define LOG_TAG "android.hardware.bluetooth@1.0-impl"
 #include <android-base/logging.h>
 #include <cutils/properties.h>
@@ -165,7 +163,7 @@
     InitializeCompleteCallback initialize_complete_cb,
     PacketReadCallback event_cb, PacketReadCallback acl_cb,
     PacketReadCallback sco_cb) {
-  assert(!g_vendor_interface);
+  CHECK(!g_vendor_interface);
   g_vendor_interface = new VendorInterface();
   return g_vendor_interface->Open(initialize_complete_cb, event_cb, acl_cb,
                                   sco_cb);
diff --git a/radio/1.0/IRadio.hal b/radio/1.0/IRadio.hal
index 2976290..236dbf5 100644
--- a/radio/1.0/IRadio.hal
+++ b/radio/1.0/IRadio.hal
@@ -1285,10 +1285,11 @@
      *
      * @param serial Serial number of request.
      * @param aid AID value, See ETSI 102.221 and 101.220.
+     * @param p2 P2 value, described in ISO 7816-4. Ignore if equal to P2Constant:NO_P2
      *
      * Response callback is IRadioResponse.iccOpenLogicalChannelResponse()
      */
-    oneway iccOpenLogicalChannel(int32_t serial, string aid);
+    oneway iccOpenLogicalChannel(int32_t serial, string aid, int32_t p2);
 
     /**
      * Close a previously opened logical channel. This command reflects TS 27.007
diff --git a/radio/1.0/types.hal b/radio/1.0/types.hal
index 2224c8b..c5d7f8a 100644
--- a/radio/1.0/types.hal
+++ b/radio/1.0/types.hal
@@ -1161,6 +1161,10 @@
                                           // this doesn't mean no data is expected.
 };
 
+enum P2Constant : int32_t {
+    NO_P2 = -1,                           // No P2 value is provided
+};
+
 struct RadioResponseInfo {
     RadioResponseType type;               // Response type
     int32_t serial;                       // Serial number of the request
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
index 19738d5..107feb4 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
@@ -246,9 +246,10 @@
  */
 TEST_F(RadioHidlTest, iccOpenLogicalChannel) {
   int serial = 1;
-
+  int p2 = 0x04;
+  // Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is requested.
   for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
-    radio->iccOpenLogicalChannel(++serial, cardStatus.applications[i].aidPtr);
+    radio->iccOpenLogicalChannel(++serial, cardStatus.applications[i].aidPtr, p2);
     EXPECT_EQ(std::cv_status::no_timeout, wait());
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
@@ -317,4 +318,4 @@
   if (cardStatus.cardState == CardState::ABSENT) {
     ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::PASSWORD_INCORRECT);
   }
-}
\ No newline at end of file
+}
diff --git a/wifi/1.0/default/hidl_struct_util.cpp b/wifi/1.0/default/hidl_struct_util.cpp
index 83b2e53..077dbb8 100644
--- a/wifi/1.0/default/hidl_struct_util.cpp
+++ b/wifi/1.0/default/hidl_struct_util.cpp
@@ -1075,6 +1075,7 @@
         hidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0;
   legacy_request->recv_indication_cfg |=
         hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0;
+  legacy_request->recv_indication_cfg |= 0x8;
   legacy_request->cipher_type = (unsigned int) hidl_request.baseConfigs.securityConfig.cipherType;
   if (hidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) {
     legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK;
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.0/default/wifi_legacy_hal.cpp
index ba57ba7..44acc04 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.0/default/wifi_legacy_hal.cpp
@@ -180,6 +180,12 @@
   }
 }
 
+std::function<void(const NanPublishRepliedInd&)>
+    on_nan_event_publish_replied_user_callback;
+void onAysncNanEventPublishReplied(NanPublishRepliedInd* /* event */) {
+  LOG(ERROR) << "onAysncNanEventPublishReplied triggered";
+}
+
 std::function<void(const NanPublishTerminatedInd&)>
     on_nan_event_publish_terminated_user_callback;
 void onAysncNanEventPublishTerminated(NanPublishTerminatedInd* event) {
@@ -1054,6 +1060,7 @@
   return global_func_table_.wifi_nan_register_handler(
       wlan_interface_handle_,
       {onAysncNanNotifyResponse,
+       onAysncNanEventPublishReplied,
        onAysncNanEventPublishTerminated,
        onAysncNanEventMatch,
        onAysncNanEventMatchExpired,