Merge changes from topic 'hidl-gk'

* changes:
  gatekeeper HIDL HAL definition
  vts: make sure all Android.mk are found
diff --git a/boot/1.0/default/BootControl.h b/boot/1.0/default/BootControl.h
index 73af4f4..be8a814 100644
--- a/boot/1.0/default/BootControl.h
+++ b/boot/1.0/default/BootControl.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_boot_V1_0_BootControl_H_
-#define HIDL_GENERATED_android_hardware_boot_V1_0_BootControl_H_
+#ifndef ANDROID_HARDWARE_BOOT_V1_0_BOOTCONTROL_H
+#define ANDROID_HARDWARE_BOOT_V1_0_BOOTCONTROL_H
 
 #include <android/hardware/boot/1.0/IBootControl.h>
 #include <hidl/Status.h>
@@ -43,4 +43,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // HIDL_GENERATED_android_hardware_boot_V1_0_BootControl_H_
+#endif  // ANDROID_HARDWARE_BOOT_V1_0_BOOTCONTROL_H
diff --git a/light/2.0/vts/functional/Android.bp b/light/2.0/vts/functional/Android.bp
new file mode 100644
index 0000000..c3475a6
--- /dev/null
+++ b/light/2.0/vts/functional/Android.bp
@@ -0,0 +1,32 @@
+//
+// 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.
+//
+
+cc_test {
+    name: "light_hidl_hal_test",
+    gtest: true,
+    srcs: ["light_hidl_hal_test.cpp"],
+    shared_libs: [
+        "liblog",
+        "libutils",
+        "android.hardware.light@2.0",
+    ],
+    static_libs: ["libgtest"],
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+}
+
diff --git a/light/2.0/vts/functional/light_hidl_hal_test.cpp b/light/2.0/vts/functional/light_hidl_hal_test.cpp
new file mode 100644
index 0000000..db67467
--- /dev/null
+++ b/light/2.0/vts/functional/light_hidl_hal_test.cpp
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "light_hidl_hal_test"
+
+#include <android-base/logging.h>
+#include <android/hardware/light/2.0/ILight.h>
+#include <android/hardware/light/2.0/types.h>
+#include <gtest/gtest.h>
+#include <unistd.h>
+
+using ::android::hardware::light::V2_0::Brightness;
+using ::android::hardware::light::V2_0::Flash;
+using ::android::hardware::light::V2_0::ILight;
+using ::android::hardware::light::V2_0::LightState;
+using ::android::hardware::light::V2_0::Status;
+using ::android::hardware::light::V2_0::Type;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+#define LIGHT_SERVICE_NAME "light"
+
+#define EXPECT_OK(ret) EXPECT_TRUE(ret.getStatus().isOk())
+
+// The main test class for VIBRATOR HIDL HAL.
+class LightHidlTest : public ::testing::Test {
+public:
+    virtual void SetUp() override {
+        light = ILight::getService(LIGHT_SERVICE_NAME);
+
+        ASSERT_NE(light, nullptr);
+        ALOGI("Test is remote: %d", light->isRemote());
+    }
+
+    virtual void TearDown() override {}
+
+    sp<ILight> light;
+};
+
+// A class for test environment setup (kept since this file is a template).
+class LightHidlEnvironment : public ::testing::Environment {
+public:
+    virtual void SetUp() {}
+    virtual void TearDown() {}
+
+private:
+};
+
+const static LightState kWhite = {
+    .color = 0xFFFFFFFF,
+    .flashMode = Flash::TIMED,
+    .flashOnMs = 100,
+    .flashOffMs = 50,
+    .brightnessMode = Brightness::USER,
+};
+
+const static LightState kOff = {
+    .color = 0x00000000,
+    .flashMode = Flash::NONE,
+    .flashOnMs = 0,
+    .flashOffMs = 0,
+    .brightnessMode = Brightness::USER,
+};
+
+/**
+ * Ensure all lights which are reported as supported work.
+ */
+TEST_F(LightHidlTest, TestSupported) {
+    EXPECT_OK(light->getSupportedTypes([this](const hidl_vec<Type> &supportedTypes) {
+        for (size_t i = 0; i < supportedTypes.size(); i++) {
+            EXPECT_OK(light->setLight(supportedTypes[i], kWhite));
+        }
+
+        usleep(500000);
+
+        for (size_t i = 0; i < supportedTypes.size(); i++) {
+            EXPECT_OK(light->setLight(supportedTypes[i], kOff));
+        }
+    }));
+}
+
+int main(int argc, char **argv) {
+    ::testing::AddGlobalTestEnvironment(new LightHidlEnvironment);
+    ::testing::InitGoogleTest(&argc, argv);
+    int status = RUN_ALL_TESTS();
+    ALOGI("Test result = %d", status);
+    return status;
+}
diff --git a/light/Android.bp b/light/Android.bp
index c12cd4f..8d2c986 100644
--- a/light/Android.bp
+++ b/light/Android.bp
@@ -1,4 +1,5 @@
 // This is an autogenerated file, do not edit.
 subdirs = [
     "2.0",
+    "2.0/vts/functional",
 ]
diff --git a/nfc/1.0/default/Nfc.h b/nfc/1.0/default/Nfc.h
index e596495..5257636 100644
--- a/nfc/1.0/default/Nfc.h
+++ b/nfc/1.0/default/Nfc.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_nfc_V1_0_Nfc_H_
-#define HIDL_GENERATED_android_hardware_nfc_V1_0_Nfc_H_
+#ifndef ANDROID_HARDWARE_NFC_V1_0_NFC_H
+#define ANDROID_HARDWARE_NFC_V1_0_NFC_H
 
 #include <android/hardware/nfc/1.0/INfc.h>
 #include <hidl/Status.h>
@@ -56,4 +56,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // HIDL_GENERATED_android_hardware_nfc_V1_0_Nfc_H_
+#endif  // ANDROID_HARDWARE_NFC_V1_0_NFC_H
diff --git a/tests/bar/1.0/default/Bar.h b/tests/bar/1.0/default/Bar.h
index 29eedec..d23c1e1 100644
--- a/tests/bar/1.0/default/Bar.h
+++ b/tests/bar/1.0/default/Bar.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_bar_V1_0_Bar_H_
-#define HIDL_GENERATED_android_hardware_tests_bar_V1_0_Bar_H_
+#ifndef ANDROID_HARDWARE_TESTS_BAR_V1_0_BAR_H
+#define ANDROID_HARDWARE_TESTS_BAR_V1_0_BAR_H
 
 #include <android/hardware/tests/bar/1.0/IBar.h>
 #include <hidl/Status.h>
@@ -79,4 +79,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // HIDL_GENERATED_android_hardware_tests_bar_V1_0_Bar_H_
+#endif  // ANDROID_HARDWARE_TESTS_BAR_V1_0_BAR_H
diff --git a/tests/bar/1.0/default/ImportTypes.h b/tests/bar/1.0/default/ImportTypes.h
index b43be70..59c7bea 100644
--- a/tests/bar/1.0/default/ImportTypes.h
+++ b/tests/bar/1.0/default/ImportTypes.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_bar_V1_0_ImportTypes_H_
-#define HIDL_GENERATED_android_hardware_tests_bar_V1_0_ImportTypes_H_
+#ifndef ANDROID_HARDWARE_TESTS_BAR_V1_0_IMPORTTYPES_H
+#define ANDROID_HARDWARE_TESTS_BAR_V1_0_IMPORTTYPES_H
 
 #include <android/hardware/tests/bar/1.0/IImportTypes.h>
 #include <hidl/Status.h>
@@ -33,4 +33,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // HIDL_GENERATED_android_hardware_tests_bar_V1_0_ImportTypes_H_
+#endif  // ANDROID_HARDWARE_TESTS_BAR_V1_0_IMPORTTYPES_H
diff --git a/tests/foo/1.0/default/Foo.h b/tests/foo/1.0/default/Foo.h
index 703c210..84629db 100644
--- a/tests/foo/1.0/default/Foo.h
+++ b/tests/foo/1.0/default/Foo.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_foo_V1_0_Foo_H_
-#define HIDL_GENERATED_android_hardware_tests_foo_V1_0_Foo_H_
+#ifndef ANDROID_HARDWARE_TESTS_FOO_V1_0_FOO_H
+#define ANDROID_HARDWARE_TESTS_FOO_V1_0_FOO_H
 
 #include <android/hardware/tests/foo/1.0/IFoo.h>
 #include <hidl/Status.h>
@@ -71,4 +71,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // HIDL_GENERATED_android_hardware_tests_foo_V1_0_Foo_H_
+#endif  // ANDROID_HARDWARE_TESTS_FOO_V1_0_FOO_H
diff --git a/tests/foo/1.0/default/FooCallback.h b/tests/foo/1.0/default/FooCallback.h
index 00233b5..3164a9d 100644
--- a/tests/foo/1.0/default/FooCallback.h
+++ b/tests/foo/1.0/default/FooCallback.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_foo_V1_0_FooCallback_H_
-#define HIDL_GENERATED_android_hardware_tests_foo_V1_0_FooCallback_H_
+#ifndef ANDROID_HARDWARE_TESTS_FOO_V1_0_FOOCALLBACK_H
+#define ANDROID_HARDWARE_TESTS_FOO_V1_0_FOOCALLBACK_H
 
 #include <android/hardware/tests/foo/1.0/IFooCallback.h>
 #include <hidl/Status.h>
@@ -43,4 +43,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // HIDL_GENERATED_android_hardware_tests_foo_V1_0_FooCallback_H_
+#endif  // ANDROID_HARDWARE_TESTS_FOO_V1_0_FOOCALLBACK_H
diff --git a/tests/inheritance/1.0/default/Child.h b/tests/inheritance/1.0/default/Child.h
index 0d34e83..268dfeb 100644
--- a/tests/inheritance/1.0/default/Child.h
+++ b/tests/inheritance/1.0/default/Child.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Child_H_
-#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Child_H_
+#ifndef ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_CHILD_H
+#define ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_CHILD_H
 
 #include <android/hardware/tests/inheritance/1.0/IChild.h>
 #include <hidl/Status.h>
@@ -41,4 +41,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Child_H_
+#endif  // ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_CHILD_H
diff --git a/tests/inheritance/1.0/default/Fetcher.h b/tests/inheritance/1.0/default/Fetcher.h
index d389853..da9b153 100644
--- a/tests/inheritance/1.0/default/Fetcher.h
+++ b/tests/inheritance/1.0/default/Fetcher.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Fetcher_H_
-#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Fetcher_H_
+#ifndef ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_FETCHER_H
+#define ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_FETCHER_H
 
 #include "Child.h"
 #include <android/hardware/tests/inheritance/1.0/IFetcher.h>
@@ -42,4 +42,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Fetcher_H_
+#endif  // ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_FETCHER_H
diff --git a/tests/inheritance/1.0/default/Grandparent.h b/tests/inheritance/1.0/default/Grandparent.h
index e1113bf..5458b01 100644
--- a/tests/inheritance/1.0/default/Grandparent.h
+++ b/tests/inheritance/1.0/default/Grandparent.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Grandparent_H_
-#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Grandparent_H_
+#ifndef ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_GRANDPARENT_H
+#define ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_GRANDPARENT_H
 
 #include <android/hardware/tests/inheritance/1.0/IGrandparent.h>
 #include <hidl/Status.h>
@@ -34,4 +34,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Grandparent_H_
+#endif  // ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_GRANDPARENT_H
diff --git a/tests/inheritance/1.0/default/Parent.h b/tests/inheritance/1.0/default/Parent.h
index 2e07fdc..48085fd 100644
--- a/tests/inheritance/1.0/default/Parent.h
+++ b/tests/inheritance/1.0/default/Parent.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Parent_H_
-#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Parent_H_
+#ifndef ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_PARENT_H
+#define ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_PARENT_H
 
 #include <android/hardware/tests/inheritance/1.0/IParent.h>
 #include <hidl/Status.h>
@@ -37,4 +37,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Parent_H_
+#endif  // ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_PARENT_H
diff --git a/tests/libhwbinder/1.0/default/Benchmark.h b/tests/libhwbinder/1.0/default/Benchmark.h
index 454fdf2..74b3745 100644
--- a/tests/libhwbinder/1.0/default/Benchmark.h
+++ b/tests/libhwbinder/1.0/default/Benchmark.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_benchmark_V1_0_Benchmark_H_
-#define HIDL_GENERATED_android_hardware_benchmark_V1_0_Benchmark_H_
+#ifndef ANDROID_HARDWARE_BENCHMARK_V1_0_BENCHMARK_H
+#define ANDROID_HARDWARE_BENCHMARK_V1_0_BENCHMARK_H
 
 #include <android/hardware/tests/libhwbinder/1.0/IBenchmark.h>
 #include <hidl/Status.h>
@@ -28,4 +28,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // HIDL_GENERATED_android_hardware_benchmark_V1_0_Benchmark_H_
+#endif  // ANDROID_HARDWARE_BENCHMARK_V1_0_BENCHMARK_H
diff --git a/tests/pointer/1.0/default/Graph.h b/tests/pointer/1.0/default/Graph.h
index cbd5a8a..03bd163 100644
--- a/tests/pointer/1.0/default/Graph.h
+++ b/tests/pointer/1.0/default/Graph.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Graph_H_
-#define HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Graph_H_
+#ifndef ANDROID_HARDWARE_TESTS_POINTER_V1_0_GRAPH_H
+#define ANDROID_HARDWARE_TESTS_POINTER_V1_0_GRAPH_H
 
 #include <android/hardware/tests/pointer/1.0/IGraph.h>
 #include <hidl/Status.h>
@@ -44,4 +44,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Graph_H_
+#endif  // ANDROID_HARDWARE_TESTS_POINTER_V1_0_GRAPH_H
diff --git a/tests/pointer/1.0/default/Pointer.h b/tests/pointer/1.0/default/Pointer.h
index 41d96fd..87b0f56 100644
--- a/tests/pointer/1.0/default/Pointer.h
+++ b/tests/pointer/1.0/default/Pointer.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Pointer_H_
-#define HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Pointer_H_
+#ifndef ANDROID_HARDWARE_TESTS_POINTER_V1_0_POINTER_H
+#define ANDROID_HARDWARE_TESTS_POINTER_V1_0_POINTER_H
 
 #include <android/hardware/tests/pointer/1.0/IPointer.h>
 #include <android-base/logging.h>
@@ -345,4 +345,4 @@
 
 #undef PUSH_ERROR_IF
 
-#endif  // HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Pointer_H_
+#endif  // ANDROID_HARDWARE_TESTS_POINTER_V1_0_POINTER_H