Merge changes Id207ae31,Ib18c6d2e,I4af19080,I03686e55,Iea1d7d22, ...

* changes:
  Audio HAL VTS: Add tests for IStreamIn
  Audio HAL VTS: Add at least negative tests for IStream
  Audio HAL VTS: Test IStream::debugDump
  Audio HAL VTS: Split big test for better traceability
  Audio hal VTS: pretty print AudioDevice and ChannelMask
  Audio Hal VTS: Refactor ASSERT_RESULT helper
  Audio hal VTS: generate names for parametrized tests
  Audio hal VTS: factorize master volume test
  Fix potentiel deadlock in audio VTS
diff --git a/automotive/evs/1.0/default/EvsCamera.cpp b/automotive/evs/1.0/default/EvsCamera.cpp
index 542cd1f..c4436ee 100644
--- a/automotive/evs/1.0/default/EvsCamera.cpp
+++ b/automotive/evs/1.0/default/EvsCamera.cpp
@@ -162,7 +162,7 @@
         if (buffer.memHandle == nullptr) {
             ALOGE("ignoring doneWithFrame called with null handle");
         } else if (buffer.bufferId >= mBuffers.size()) {
-            ALOGE("ignoring doneWithFrame called with invalid bufferId %d (max is %zd)",
+            ALOGE("ignoring doneWithFrame called with invalid bufferId %d (max is %zu)",
                   buffer.bufferId, mBuffers.size()-1);
         } else if (!mBuffers[buffer.bufferId].inUse) {
             ALOGE("ignoring doneWithFrame called on frame %d which is already free",
diff --git a/bluetooth/1.0/default/vendor_interface.cc b/bluetooth/1.0/default/vendor_interface.cc
index a6507dd..57ea1a3 100644
--- a/bluetooth/1.0/default/vendor_interface.cc
+++ b/bluetooth/1.0/default/vendor_interface.cc
@@ -215,11 +215,9 @@
 
   ALOGD("%s vendor library loaded", __func__);
 
-  // Power cycle chip
+  // Power on the controller
 
-  int power_state = BT_VND_PWR_OFF;
-  lib_interface_->op(BT_VND_OP_POWER_CTRL, &power_state);
-  power_state = BT_VND_PWR_ON;
+  int power_state = BT_VND_PWR_ON;
   lib_interface_->op(BT_VND_OP_POWER_CTRL, &power_state);
 
   // Get the UART socket(s)
diff --git a/media/omx/1.0/IGraphicBufferSource.hal b/media/omx/1.0/IGraphicBufferSource.hal
index 4dbfd32..62073ad 100644
--- a/media/omx/1.0/IGraphicBufferSource.hal
+++ b/media/omx/1.0/IGraphicBufferSource.hal
@@ -29,25 +29,25 @@
  */
 interface IGraphicBufferSource {
 
-    configure(IOmxNode omxNode, Dataspace dataspace);
+    configure(IOmxNode omxNode, Dataspace dataspace) generates (Status status);
 
-    setSuspend(bool suspend, int64_t timeUs);
+    setSuspend(bool suspend, int64_t timeUs) generates (Status status);
 
-    setRepeatPreviousFrameDelayUs(int64_t repeatAfterUs);
+    setRepeatPreviousFrameDelayUs(int64_t repeatAfterUs) generates (Status status);
 
-    setMaxFps(float maxFps);
+    setMaxFps(float maxFps) generates (Status status);
 
-    setTimeLapseConfig(int64_t timePerFrameUs, int64_t timePerCaptureUs);
+    setTimeLapseConfig(int64_t timePerFrameUs, int64_t timePerCaptureUs) generates (Status status);
 
-    setStartTimeUs(int64_t startTimeUs);
+    setStartTimeUs(int64_t startTimeUs) generates (Status status);
 
-    setStopTimeUs(int64_t stopTimeUs);
+    setStopTimeUs(int64_t stopTimeUs) generates (Status status);
 
-    setColorAspects(ColorAspects aspects);
+    setColorAspects(ColorAspects aspects) generates (Status status);
 
-    setTimeOffsetUs(int64_t timeOffsetUs);
+    setTimeOffsetUs(int64_t timeOffsetUs) generates (Status status);
 
-    signalEndOfInputStream();
+    signalEndOfInputStream() generates (Status status);
 
 };
 
diff --git a/wifi/1.0/default/Android.mk b/wifi/1.0/default/Android.mk
index 00e5f98..cc5e1c6 100644
--- a/wifi/1.0/default/Android.mk
+++ b/wifi/1.0/default/Android.mk
@@ -18,6 +18,9 @@
 LOCAL_MODULE_RELATIVE_PATH := hw
 LOCAL_PROPRIETARY_MODULE := true
 LOCAL_CPPFLAGS := -Wall -Werror -Wextra
+ifdef WIFI_HIDL_FEATURE_AWARE
+LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_AWARE
+endif
 LOCAL_SRC_FILES := \
     hidl_struct_util.cpp \
     hidl_sync_util.cpp \
@@ -43,7 +46,8 @@
     libnl \
     libutils \
     libwifi-hal \
-    libwifi-system
+    libwifi-system \
+    libcld80211
 LOCAL_WHOLE_STATIC_LIBRARIES := $(LIB_WIFI_HAL)
 LOCAL_INIT_RC := android.hardware.wifi@1.0-service.rc
 include $(BUILD_EXECUTABLE)
diff --git a/wifi/1.0/default/hidl_struct_util.cpp b/wifi/1.0/default/hidl_struct_util.cpp
index 98a62bf..a89f8c0 100644
--- a/wifi/1.0/default/hidl_struct_util.cpp
+++ b/wifi/1.0/default/hidl_struct_util.cpp
@@ -1898,10 +1898,12 @@
   hidl_result->timeStampInUs = legacy_result.ts;
   hidl_result->burstDurationInMs = legacy_result.burst_duration;
   hidl_result->negotiatedBurstNum = legacy_result.negotiated_burst_num;
-  if (!convertLegacyIeToHidl(*legacy_result.LCI, &hidl_result->lci)) {
+  if (legacy_result.LCI && !convertLegacyIeToHidl(*legacy_result.LCI,
+                                                  &hidl_result->lci)) {
     return false;
   }
-  if (!convertLegacyIeToHidl(*legacy_result.LCR, &hidl_result->lcr)) {
+  if (legacy_result.LCR && !convertLegacyIeToHidl(*legacy_result.LCR,
+                                                  &hidl_result->lcr)) {
     return false;
   }
   return true;
diff --git a/wifi/1.0/default/wifi_chip.cpp b/wifi/1.0/default/wifi_chip.cpp
index 6f980c0..9c41a40 100644
--- a/wifi/1.0/default/wifi_chip.cpp
+++ b/wifi/1.0/default/wifi_chip.cpp
@@ -19,6 +19,7 @@
 #include "hidl_return_util.h"
 #include "hidl_struct_util.h"
 #include "wifi_chip.h"
+#include "wifi_feature_flags.h"
 #include "wifi_status_util.h"
 
 namespace {
@@ -388,16 +389,21 @@
   // The chip combination supported for current devices is fixed for now with
   // 2 separate modes of operation:
   // Mode 1 (STA mode): Will support 1 STA and 1 P2P or NAN iface operations
-  // concurrently.
+  // concurrently [NAN conditional on wifiHidlFeatureAware]
   // Mode 2 (AP mode): Will support 1 AP iface operations.
   // TODO (b/32997844): Read this from some device specific flags in the
   // makefile.
   // STA mode iface combinations.
   const IWifiChip::ChipIfaceCombinationLimit
       sta_chip_iface_combination_limit_1 = {{IfaceType::STA}, 1};
-  const IWifiChip::ChipIfaceCombinationLimit
-      sta_chip_iface_combination_limit_2 = {{IfaceType::P2P, IfaceType::NAN},
-                                            1};
+  IWifiChip::ChipIfaceCombinationLimit sta_chip_iface_combination_limit_2;
+  if (WifiFeatureFlags::wifiHidlFeatureAware) {
+    sta_chip_iface_combination_limit_2 = {{IfaceType::P2P, IfaceType::NAN},
+                                          1};
+  } else {
+    sta_chip_iface_combination_limit_2 = {{IfaceType::P2P},
+                                          1};
+  }
   const IWifiChip::ChipIfaceCombination sta_chip_iface_combination = {
       {sta_chip_iface_combination_limit_1, sta_chip_iface_combination_limit_2}};
   const IWifiChip::ChipMode sta_chip_mode = {kStaChipModeId,
@@ -552,18 +558,22 @@
 
 std::pair<WifiStatus, sp<IWifiNanIface>> WifiChip::createNanIfaceInternal() {
   // Only 1 of NAN or P2P iface can be active at a time.
-  if (current_mode_id_ != kStaChipModeId || nan_iface_.get() ||
-      p2p_iface_.get()) {
+  if (WifiFeatureFlags::wifiHidlFeatureAware) {
+    if (current_mode_id_ != kStaChipModeId || nan_iface_.get() ||
+        p2p_iface_.get()) {
+      return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
+    }
+    std::string ifname = legacy_hal_.lock()->getNanIfaceName();
+    nan_iface_ = new WifiNanIface(ifname, legacy_hal_);
+    for (const auto& callback : event_cb_handler_.getCallbacks()) {
+      if (!callback->onIfaceAdded(IfaceType::NAN, ifname).isOk()) {
+        LOG(ERROR) << "Failed to invoke onIfaceAdded callback";
+      }
+    }
+    return {createWifiStatus(WifiStatusCode::SUCCESS), nan_iface_};
+  } else {
     return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
   }
-  std::string ifname = legacy_hal_.lock()->getNanIfaceName();
-  nan_iface_ = new WifiNanIface(ifname, legacy_hal_);
-  for (const auto& callback : event_cb_handler_.getCallbacks()) {
-    if (!callback->onIfaceAdded(IfaceType::NAN, ifname).isOk()) {
-      LOG(ERROR) << "Failed to invoke onIfaceAdded callback";
-    }
-  }
-  return {createWifiStatus(WifiStatusCode::SUCCESS), nan_iface_};
 }
 
 std::pair<WifiStatus, std::vector<hidl_string>>
diff --git a/wifi/1.0/default/wifi_feature_flags.h b/wifi/1.0/default/wifi_feature_flags.h
new file mode 100644
index 0000000..3502fbd
--- /dev/null
+++ b/wifi/1.0/default/wifi_feature_flags.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef WIFI_FEATURE_FLAGS_H_
+#define WIFI_FEATURE_FLAGS_H_
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+class WifiFeatureFlags {
+ public:
+#ifdef WIFI_HIDL_FEATURE_AWARE
+  static const bool wifiHidlFeatureAware = true;
+#else
+  static const bool wifiHidlFeatureAware = false;
+#endif // WIFI_HIDL_FEATURE_AWARE
+};
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace wifi
+}  // namespace hardware
+}  // namespace android
+
+#endif  // WIFI_FEATURE_FLAGS_H_