Merge "Revert "Add auth token parsing to IKeymasterDevice.hal""
diff --git a/audio/effect/2.0/vts/functional/VtsHalAudioEffectV2_0TargetTest.cpp b/audio/effect/2.0/vts/functional/VtsHalAudioEffectV2_0TargetTest.cpp
index f6da213..15a564a 100644
--- a/audio/effect/2.0/vts/functional/VtsHalAudioEffectV2_0TargetTest.cpp
+++ b/audio/effect/2.0/vts/functional/VtsHalAudioEffectV2_0TargetTest.cpp
@@ -31,8 +31,10 @@
 using android::hardware::audio::common::V2_0::AudioDevice;
 using android::hardware::audio::common::V2_0::AudioHandleConsts;
 using android::hardware::audio::common::V2_0::AudioMode;
+using android::hardware::audio::common::V2_0::AudioSource;
 using android::hardware::audio::common::V2_0::Uuid;
 using android::hardware::audio::effect::V2_0::AudioBuffer;
+using android::hardware::audio::effect::V2_0::EffectAuxChannelsConfig;
 using android::hardware::audio::effect::V2_0::EffectBufferConfig;
 using android::hardware::audio::effect::V2_0::EffectConfig;
 using android::hardware::audio::effect::V2_0::EffectDescriptor;
@@ -278,6 +280,33 @@
   EXPECT_EQ(Result::OK, ret2);
 }
 
+TEST_F(AudioEffectHidlTest, GetConfigReverse) {
+  description("Verify that GetConfigReverse does not crash");
+  Return<void> ret =
+      effect->getConfigReverse([&](Result, const EffectConfig&) {});
+  EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, GetSupportedAuxChannelsConfigs) {
+  description("Verify that GetSupportedAuxChannelsConfigs does not crash");
+  Return<void> ret = effect->getSupportedAuxChannelsConfigs(
+      0, [&](Result, const hidl_vec<EffectAuxChannelsConfig>&) {});
+  EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, GetAuxChannelsConfig) {
+  description("Verify that GetAuxChannelsConfig does not crash");
+  Return<void> ret = effect->getAuxChannelsConfig(
+      [&](Result, const EffectAuxChannelsConfig&) {});
+  EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, SetAuxChannelsConfig) {
+  description("Verify that SetAuxChannelsConfig does not crash");
+  Return<Result> ret = effect->setAuxChannelsConfig(EffectAuxChannelsConfig());
+  EXPECT_TRUE(ret.isOk());
+}
+
 // Not generated automatically because AudioBuffer contains
 // instances of hidl_memory which can't be compared properly
 // in general case due to presence of handles.
@@ -394,6 +423,25 @@
   EXPECT_EQ(Result::OK, ret);
 }
 
+TEST_F(AudioEffectHidlTest, SetConfigReverse) {
+  description("Verify that SetConfigReverse does not crash");
+  Return<Result> ret =
+      effect->setConfigReverse(EffectConfig(), nullptr, nullptr);
+  EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, SetInputDevice) {
+  description("Verify that SetInputDevice does not crash");
+  Return<Result> ret = effect->setInputDevice(AudioDevice::IN_BUILTIN_MIC);
+  EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, SetAudioSource) {
+  description("Verify that SetAudioSource does not crash");
+  Return<Result> ret = effect->setAudioSource(AudioSource::MIC);
+  EXPECT_TRUE(ret.isOk());
+}
+
 TEST_F(AudioEffectHidlTest, Offload) {
   description("Verify that calling Offload methods works for an effect");
   EffectOffloadParameter offloadParam;
@@ -434,17 +482,48 @@
   EXPECT_EQ(Result::OK, ret2);
 }
 
-// Testing getConfigReverse, getAuxChannelsConfig,
-// getSupportedAuxChannelsConfigs, setAudioSource, setConfigReverse,
-// setInputDevice doesn't make sense, because normally they are not supported by
-// the Equalizer, but it wouldn't be a problem if some vendor implementation
-// supports them, thus we can't test these methods neither for success, nor for
-// failure.
+TEST_F(AudioEffectHidlTest, Command) {
+  description("Verify that Command does not crash");
+  Return<void> ret = effect->command(0, hidl_vec<uint8_t>(), 0,
+                                     [&](int32_t, const hidl_vec<uint8_t>&) {});
+  EXPECT_TRUE(ret.isOk());
+}
 
-// command, getParameter, getSupportedConfigsForFeature,
-// getCurrentConfigForFeature, setCurrentConfigForFeature, setParameter are
-// opaque channels between vendor apps and HALs, and can't be meaningfully
-// tested with effects that don't support them.
+TEST_F(AudioEffectHidlTest, SetParameter) {
+  description("Verify that SetParameter does not crash");
+  Return<Result> ret =
+      effect->setParameter(hidl_vec<uint8_t>(), hidl_vec<uint8_t>());
+  EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, GetParameter) {
+  description("Verify that GetParameter does not crash");
+  Return<void> ret = effect->getParameter(
+      hidl_vec<uint8_t>(), 0, [&](Result, const hidl_vec<uint8_t>&) {});
+  EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, GetSupportedConfigsForFeature) {
+  description("Verify that GetSupportedConfigsForFeature does not crash");
+  Return<void> ret = effect->getSupportedConfigsForFeature(
+      0, 0, 0, [&](Result, uint32_t, const hidl_vec<uint8_t>&) {});
+  EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, GetCurrentConfigForFeature) {
+  description("Verify that GetCurrentConfigForFeature does not crash");
+  Return<void> ret = effect->getCurrentConfigForFeature(
+      0, 0, [&](Result, const hidl_vec<uint8_t>&) {});
+  EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, SetCurrentConfigForFeature) {
+  description("Verify that SetCurrentConfigForFeature does not crash");
+  Return<Result> ret =
+      effect->setCurrentConfigForFeature(0, hidl_vec<uint8_t>());
+  EXPECT_TRUE(ret.isOk());
+}
+
 
 // The main test class for Equalizer Audio Effect HIDL HAL.
 class EqualizerAudioEffectHidlTest : public AudioEffectHidlTest {
diff --git a/bluetooth/1.0/Android.bp b/bluetooth/1.0/Android.bp
index 2373ceb..75cdcfc 100644
--- a/bluetooth/1.0/Android.bp
+++ b/bluetooth/1.0/Android.bp
@@ -32,6 +32,7 @@
     ],
     out: [
         "android/hardware/bluetooth/1.0/types.h",
+        "android/hardware/bluetooth/1.0/hwtypes.h",
         "android/hardware/bluetooth/1.0/IBluetoothHci.h",
         "android/hardware/bluetooth/1.0/IHwBluetoothHci.h",
         "android/hardware/bluetooth/1.0/BnHwBluetoothHci.h",
diff --git a/boot/1.0/Android.bp b/boot/1.0/Android.bp
index 7265cc2..498c940 100644
--- a/boot/1.0/Android.bp
+++ b/boot/1.0/Android.bp
@@ -30,6 +30,7 @@
     ],
     out: [
         "android/hardware/boot/1.0/types.h",
+        "android/hardware/boot/1.0/hwtypes.h",
         "android/hardware/boot/1.0/IBootControl.h",
         "android/hardware/boot/1.0/IHwBootControl.h",
         "android/hardware/boot/1.0/BnHwBootControl.h",
diff --git a/configstore/1.0/Android.bp b/configstore/1.0/Android.bp
index c2cd54a..712e9a7 100644
--- a/configstore/1.0/Android.bp
+++ b/configstore/1.0/Android.bp
@@ -30,6 +30,7 @@
     ],
     out: [
         "android/hardware/configstore/1.0/types.h",
+        "android/hardware/configstore/1.0/hwtypes.h",
         "android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h",
         "android/hardware/configstore/1.0/IHwSurfaceFlingerConfigs.h",
         "android/hardware/configstore/1.0/BnHwSurfaceFlingerConfigs.h",
diff --git a/gatekeeper/1.0/types.hal b/gatekeeper/1.0/types.hal
index 8c184ee..59076e0 100644
--- a/gatekeeper/1.0/types.hal
+++ b/gatekeeper/1.0/types.hal
@@ -37,6 +37,6 @@
      * otherwise unused (0)
      */
     uint32_t timeout;
-    /* optional crypto blob */
+    /* optional crypto blob. Opaque to Android system. */
     vec<uint8_t> data;
 };
diff --git a/ir/1.0/Android.bp b/ir/1.0/Android.bp
index da49579..5bff1d3 100644
--- a/ir/1.0/Android.bp
+++ b/ir/1.0/Android.bp
@@ -30,6 +30,7 @@
     ],
     out: [
         "android/hardware/ir/1.0/types.h",
+        "android/hardware/ir/1.0/hwtypes.h",
         "android/hardware/ir/1.0/IConsumerIr.h",
         "android/hardware/ir/1.0/IHwConsumerIr.h",
         "android/hardware/ir/1.0/BnHwConsumerIr.h",
diff --git a/nfc/1.0/Android.bp b/nfc/1.0/Android.bp
index e7305b4..7ee3a9e 100644
--- a/nfc/1.0/Android.bp
+++ b/nfc/1.0/Android.bp
@@ -32,6 +32,7 @@
     ],
     out: [
         "android/hardware/nfc/1.0/types.h",
+        "android/hardware/nfc/1.0/hwtypes.h",
         "android/hardware/nfc/1.0/INfc.h",
         "android/hardware/nfc/1.0/IHwNfc.h",
         "android/hardware/nfc/1.0/BnHwNfc.h",
diff --git a/radio/1.0/Android.bp b/radio/1.0/Android.bp
index f59cf66..e457795 100644
--- a/radio/1.0/Android.bp
+++ b/radio/1.0/Android.bp
@@ -38,6 +38,7 @@
     ],
     out: [
         "android/hardware/radio/1.0/types.h",
+        "android/hardware/radio/1.0/hwtypes.h",
         "android/hardware/radio/1.0/IRadio.h",
         "android/hardware/radio/1.0/IHwRadio.h",
         "android/hardware/radio/1.0/BnHwRadio.h",
diff --git a/renderscript/1.0/Android.bp b/renderscript/1.0/Android.bp
index cce34e7..9f2a589 100644
--- a/renderscript/1.0/Android.bp
+++ b/renderscript/1.0/Android.bp
@@ -32,6 +32,7 @@
     ],
     out: [
         "android/hardware/renderscript/1.0/types.h",
+        "android/hardware/renderscript/1.0/hwtypes.h",
         "android/hardware/renderscript/1.0/IContext.h",
         "android/hardware/renderscript/1.0/IHwContext.h",
         "android/hardware/renderscript/1.0/BnHwContext.h",
diff --git a/tests/bar/1.0/Android.bp b/tests/bar/1.0/Android.bp
index 694804c..2edde20 100644
--- a/tests/bar/1.0/Android.bp
+++ b/tests/bar/1.0/Android.bp
@@ -38,6 +38,7 @@
     ],
     out: [
         "android/hardware/tests/bar/1.0/types.h",
+        "android/hardware/tests/bar/1.0/hwtypes.h",
         "android/hardware/tests/bar/1.0/IBar.h",
         "android/hardware/tests/bar/1.0/IHwBar.h",
         "android/hardware/tests/bar/1.0/BnHwBar.h",
diff --git a/tests/baz/1.0/Android.bp b/tests/baz/1.0/Android.bp
index 7939444..8f327e3 100644
--- a/tests/baz/1.0/Android.bp
+++ b/tests/baz/1.0/Android.bp
@@ -34,6 +34,7 @@
     ],
     out: [
         "android/hardware/tests/baz/1.0/types.h",
+        "android/hardware/tests/baz/1.0/hwtypes.h",
         "android/hardware/tests/baz/1.0/IBase.h",
         "android/hardware/tests/baz/1.0/IHwBase.h",
         "android/hardware/tests/baz/1.0/BnHwBase.h",
diff --git a/tests/foo/1.0/Android.bp b/tests/foo/1.0/Android.bp
index 9572855..b221201 100644
--- a/tests/foo/1.0/Android.bp
+++ b/tests/foo/1.0/Android.bp
@@ -38,6 +38,7 @@
     ],
     out: [
         "android/hardware/tests/foo/1.0/types.h",
+        "android/hardware/tests/foo/1.0/hwtypes.h",
         "android/hardware/tests/foo/1.0/IFoo.h",
         "android/hardware/tests/foo/1.0/IHwFoo.h",
         "android/hardware/tests/foo/1.0/BnHwFoo.h",
diff --git a/tv/input/1.0/Android.mk b/tv/input/1.0/Android.mk
index f9e3276..87654da 100644
--- a/tv/input/1.0/Android.mk
+++ b/tv/input/1.0/Android.mk
@@ -1,19 +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.
-#
+# This file is autogenerated by hidl-gen. Do not edit manually.
 
 LOCAL_PATH := $(call my-dir)
 
-include $(call all-subdir-makefiles)
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.tv.input@1.0-java-constants
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir, COMMON)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+#
+GEN := $(intermediates)/android/hardware/tv/input/V1_0/Constants.java
+$(GEN): $(HIDL)
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/ITvInput.hal
+$(GEN): $(LOCAL_PATH)/ITvInputCallback.hal
+
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava-constants \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.tv.input@1.0
+
+$(GEN):
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+# Avoid dependency cycle of framework.jar -> this-library -> framework.jar
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core-oj
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tv/input/1.0/default/TvInput.cpp b/tv/input/1.0/default/TvInput.cpp
index 0bc6401..4ea1dec 100644
--- a/tv/input/1.0/default/TvInput.cpp
+++ b/tv/input/1.0/default/TvInput.cpp
@@ -19,8 +19,6 @@
 
 #include "TvInput.h"
 
-const native_handle_t kNullNativeHandle{sizeof(native_handle_t), 0, 0, {}};
-
 namespace android {
 namespace hardware {
 namespace tv {
@@ -117,8 +115,6 @@
             sidebandStream = stream.sideband_stream_source_handle;
         }
     } else {
-        // TODO(b/30814137)
-        sidebandStream = const_cast<native_handle_t*>(&kNullNativeHandle);
         if (ret == -EBUSY) {
             res = Result::NO_RESOURCE;
         } else if (ret == -EEXIST) {
diff --git a/tv/input/1.0/types.hal b/tv/input/1.0/types.hal
index 55eb6ad..60a3b7b 100644
--- a/tv/input/1.0/types.hal
+++ b/tv/input/1.0/types.hal
@@ -27,6 +27,7 @@
 };
 
 /* Type of physical TV input. */
+@export(name="", value_prefix="TV_INPUT_TYPE_")
 enum TvInputType : int32_t {
     OTHER = 1,         // Generic hardware.
     TUNER = 2,         // Tuner. e.g. built-in terrestrial tuner
@@ -46,6 +47,7 @@
  * regardless of whether the connected external device is electrically on or not.
  * If the device does not have such capability, you must use UNKNOWN.
  */
+@export(name="", value_prefix="CABLE_CONNECTION_STATUS_")
 enum CableConnectionStatus : int32_t {
     UNKNOWN = 0,
     CONNECTED = 1,
@@ -63,6 +65,7 @@
                                                  // must be filled with 0s.
 };
 
+@export(name="", value_prefix="EVENT_")
 enum TvInputEventType : int32_t {
     /*
      * Hardware notifies the framework that a device is available.
diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp
index 2319999..df5c9d2 100644
--- a/wifi/1.0/Android.bp
+++ b/wifi/1.0/Android.bp
@@ -54,6 +54,7 @@
     ],
     out: [
         "android/hardware/wifi/1.0/types.h",
+        "android/hardware/wifi/1.0/hwtypes.h",
         "android/hardware/wifi/1.0/IWifi.h",
         "android/hardware/wifi/1.0/IHwWifi.h",
         "android/hardware/wifi/1.0/BnHwWifi.h",
diff --git a/wifi/1.0/default/Android.mk b/wifi/1.0/default/Android.mk
index cc5e1c6..13f6cc1 100644
--- a/wifi/1.0/default/Android.mk
+++ b/wifi/1.0/default/Android.mk
@@ -48,6 +48,5 @@
     libwifi-hal \
     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/supplicant/1.0/Android.bp b/wifi/supplicant/1.0/Android.bp
index a6c2758..a0adb8d 100644
--- a/wifi/supplicant/1.0/Android.bp
+++ b/wifi/supplicant/1.0/Android.bp
@@ -52,6 +52,7 @@
     ],
     out: [
         "android/hardware/wifi/supplicant/1.0/types.h",
+        "android/hardware/wifi/supplicant/1.0/hwtypes.h",
         "android/hardware/wifi/supplicant/1.0/ISupplicant.h",
         "android/hardware/wifi/supplicant/1.0/IHwSupplicant.h",
         "android/hardware/wifi/supplicant/1.0/BnHwSupplicant.h",