Update Android.bp and vts/Android.mk for Hidl HALs

* Using update-makefiles.sh to add make rule for profiler in Android.bp
* Remove make rule for profiler in vts/Android.mk.

Bug:31930023
Test: mma
Change-Id: Iea834d8610501c2fce63f65742db31bafb85c0b8
diff --git a/boot/1.0/Android.bp b/boot/1.0/Android.bp
index 4eb728d..266ef4d 100644
--- a/boot/1.0/Android.bp
+++ b/boot/1.0/Android.bp
@@ -112,3 +112,48 @@
         "android.hidl.base@1.0",
     ],
 }
+
+genrule {
+    name: "android.hardware.boot@1.0-IBootControl-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.boot@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/boot/1.0/ $(genDir)/android/hardware/boot/1.0/",
+    srcs: [
+        "IBootControl.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/boot/1.0/BootControl.vts.cpp",
+        "android/hardware/boot/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.boot@1.0-IBootControl-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.boot@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/boot/1.0/ $(genDir)/android/hardware/boot/1.0/",
+    srcs: [
+        "IBootControl.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/boot/1.0/BootControl.vts.h",
+        "android/hardware/boot/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.boot@1.0-IBootControl-vts.profiler",
+    generated_sources: ["android.hardware.boot@1.0-IBootControl-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.boot@1.0-IBootControl-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.boot@1.0-IBootControl-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.boot@1.0",
+    ],
+}
diff --git a/boot/1.0/vts/Android.mk b/boot/1.0/vts/Android.mk
index d3a3851..df5dac8 100644
--- a/boot/1.0/vts/Android.mk
+++ b/boot/1.0/vts/Android.mk
@@ -16,36 +16,4 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# build profiler for boot.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvts_profiler_hidl_boot@1.0
-
-LOCAL_SRC_FILES := \
-  BootControl.vts \
-  types.vts \
-
-LOCAL_C_INCLUDES += \
-  test/vts/drivers/libprofiling \
-
-LOCAL_VTS_MODE := PROFILER
-
-LOCAL_SHARED_LIBRARIES := \
-   android.hardware.boot@1.0 \
-   libbase \
-   libcutils \
-   liblog \
-   libhidlbase \
-   libhidltransport \
-   libhwbinder \
-   libprotobuf-cpp-full \
-   libvts_common \
-   libvts_multidevice_proto \
-   libvts_profiling \
-   libutils \
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
+include $(call all-subdir-makefiles)
\ No newline at end of file
diff --git a/light/2.0/Android.bp b/light/2.0/Android.bp
index a98801c..0ad131c 100644
--- a/light/2.0/Android.bp
+++ b/light/2.0/Android.bp
@@ -112,3 +112,48 @@
         "android.hidl.base@1.0",
     ],
 }
+
+genrule {
+    name: "android.hardware.light@2.0-ILight-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.light@2.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/light/2.0/ $(genDir)/android/hardware/light/2.0/",
+    srcs: [
+        "ILight.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/light/2.0/Light.vts.cpp",
+        "android/hardware/light/2.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.light@2.0-ILight-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.light@2.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/light/2.0/ $(genDir)/android/hardware/light/2.0/",
+    srcs: [
+        "ILight.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/light/2.0/Light.vts.h",
+        "android/hardware/light/2.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.light@2.0-ILight-vts.profiler",
+    generated_sources: ["android.hardware.light@2.0-ILight-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.light@2.0-ILight-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.light@2.0-ILight-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.light@2.0",
+    ],
+}
diff --git a/memtrack/1.0/Android.bp b/memtrack/1.0/Android.bp
index c80ebf8..87342ef 100644
--- a/memtrack/1.0/Android.bp
+++ b/memtrack/1.0/Android.bp
@@ -112,3 +112,48 @@
         "android.hidl.base@1.0",
     ],
 }
+
+genrule {
+    name: "android.hardware.memtrack@1.0-IMemtrack-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.memtrack@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/memtrack/1.0/ $(genDir)/android/hardware/memtrack/1.0/",
+    srcs: [
+        "IMemtrack.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/memtrack/1.0/Memtrack.vts.cpp",
+        "android/hardware/memtrack/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.memtrack@1.0-IMemtrack-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.memtrack@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/memtrack/1.0/ $(genDir)/android/hardware/memtrack/1.0/",
+    srcs: [
+        "IMemtrack.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/memtrack/1.0/Memtrack.vts.h",
+        "android/hardware/memtrack/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.memtrack@1.0-IMemtrack-vts.profiler",
+    generated_sources: ["android.hardware.memtrack@1.0-IMemtrack-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.memtrack@1.0-IMemtrack-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.memtrack@1.0-IMemtrack-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.memtrack@1.0",
+    ],
+}
diff --git a/memtrack/1.0/vts/Android.mk b/memtrack/1.0/vts/Android.mk
index 7b2400f..397f946 100644
--- a/memtrack/1.0/vts/Android.mk
+++ b/memtrack/1.0/vts/Android.mk
@@ -16,36 +16,6 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# build profiler for memtrack.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvts_profiler_hidl_memtrack@1.0
-
-LOCAL_SRC_FILES := \
-  Memtrack.vts \
-  types.vts \
-
-LOCAL_C_INCLUDES += \
-  test/vts/drivers/libprofiling \
-
-LOCAL_VTS_MODE := PROFILER
-
-LOCAL_SHARED_LIBRARIES := \
-   android.hardware.memtrack@1.0 \
-   libbase \
-   libcutils \
-   liblog \
-   libhidlbase \
-   libhidltransport \
-   libhwbinder \
-   libprotobuf-cpp-full \
-   libvts_common \
-   libvts_multidevice_proto \
-   libvts_profiling \
-   libutils \
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-include $(BUILD_SHARED_LIBRARY)
+include $(call all-subdir-makefiles)
 
 include $(LOCAL_PATH)/functional/vts/testcases/hal/memtrack/hidl/target/Android.mk
diff --git a/power/1.0/Android.bp b/power/1.0/Android.bp
index 2eb9e34..8643139 100644
--- a/power/1.0/Android.bp
+++ b/power/1.0/Android.bp
@@ -112,3 +112,48 @@
         "android.hidl.base@1.0",
     ],
 }
+
+genrule {
+    name: "android.hardware.power@1.0-IPower-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.power@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/power/1.0/ $(genDir)/android/hardware/power/1.0/",
+    srcs: [
+        "IPower.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/power/1.0/Power.vts.cpp",
+        "android/hardware/power/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.power@1.0-IPower-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.power@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/power/1.0/ $(genDir)/android/hardware/power/1.0/",
+    srcs: [
+        "IPower.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/power/1.0/Power.vts.h",
+        "android/hardware/power/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.power@1.0-IPower-vts.profiler",
+    generated_sources: ["android.hardware.power@1.0-IPower-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.power@1.0-IPower-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.power@1.0-IPower-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.power@1.0",
+    ],
+}
diff --git a/power/1.0/vts/Android.mk b/power/1.0/vts/Android.mk
index db7e98e..df5dac8 100644
--- a/power/1.0/vts/Android.mk
+++ b/power/1.0/vts/Android.mk
@@ -16,36 +16,4 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# build profiler for power.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvts_profiler_hidl_power@1.0
-
-LOCAL_SRC_FILES := \
-   Power.vts \
-   types.vts \
-
-LOCAL_C_INCLUDES += \
-  test/vts/drivers/libprofiling \
-
-LOCAL_VTS_MODE := PROFILER
-
-LOCAL_SHARED_LIBRARIES := \
-   android.hardware.power@1.0 \
-   libbase \
-   libcutils \
-   liblog \
-   libhidlbase \
-   libhidltransport \
-   libhwbinder \
-   libprotobuf-cpp-full \
-   libvts_common \
-   libvts_multidevice_proto \
-   libvts_profiling \
-   libutils \
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
+include $(call all-subdir-makefiles)
\ No newline at end of file
diff --git a/sensors/1.0/Android.bp b/sensors/1.0/Android.bp
index 437b545..b5ee36a 100644
--- a/sensors/1.0/Android.bp
+++ b/sensors/1.0/Android.bp
@@ -112,3 +112,48 @@
         "android.hidl.base@1.0",
     ],
 }
+
+genrule {
+    name: "android.hardware.sensors@1.0-ISensors-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.sensors@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/sensors/1.0/ $(genDir)/android/hardware/sensors/1.0/",
+    srcs: [
+        "ISensors.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/sensors/1.0/Sensors.vts.cpp",
+        "android/hardware/sensors/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.sensors@1.0-ISensors-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.sensors@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/sensors/1.0/ $(genDir)/android/hardware/sensors/1.0/",
+    srcs: [
+        "ISensors.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/sensors/1.0/Sensors.vts.h",
+        "android/hardware/sensors/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.sensors@1.0-ISensors-vts.profiler",
+    generated_sources: ["android.hardware.sensors@1.0-ISensors-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.sensors@1.0-ISensors-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.sensors@1.0-ISensors-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.sensors@1.0",
+    ],
+}
diff --git a/sensors/1.0/vts/Android.mk b/sensors/1.0/vts/Android.mk
index 93bbd96..60cc723 100644
--- a/sensors/1.0/vts/Android.mk
+++ b/sensors/1.0/vts/Android.mk
@@ -16,38 +16,4 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# build profiler for sensors.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvts_profiler_hidl_sensors@1.0
-
-LOCAL_SRC_FILES := \
-  Sensors.vts \
-  types.vts \
-
-LOCAL_C_INCLUDES += \
-  test/vts/drivers/libprofiling \
-
-LOCAL_VTS_MODE := PROFILER
-
-LOCAL_SHARED_LIBRARIES := \
-   android.hardware.sensors@1.0 \
-   libbase \
-   libutils \
-   libcutils \
-   liblog \
-   libhidlbase \
-   libhidltransport \
-   libhwbinder \
-   libprotobuf-cpp-full \
-   libvts_common \
-   libvts_multidevice_proto \
-   libvts_profiling \
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-include $(BUILD_SHARED_LIBRARY)
-
-# include hidl test makefiles
-include $(LOCAL_PATH)/functional/vts/testcases/hal/sensors/hidl/Android.mk
-
+include $(call all-subdir-makefiles)
diff --git a/thermal/1.0/Android.bp b/thermal/1.0/Android.bp
index c73ab42..f2c60da 100644
--- a/thermal/1.0/Android.bp
+++ b/thermal/1.0/Android.bp
@@ -112,3 +112,48 @@
         "android.hidl.base@1.0",
     ],
 }
+
+genrule {
+    name: "android.hardware.thermal@1.0-IThermal-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.thermal@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/thermal/1.0/ $(genDir)/android/hardware/thermal/1.0/",
+    srcs: [
+        "IThermal.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/thermal/1.0/Thermal.vts.cpp",
+        "android/hardware/thermal/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.thermal@1.0-IThermal-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.thermal@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/thermal/1.0/ $(genDir)/android/hardware/thermal/1.0/",
+    srcs: [
+        "IThermal.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/thermal/1.0/Thermal.vts.h",
+        "android/hardware/thermal/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.thermal@1.0-IThermal-vts.profiler",
+    generated_sources: ["android.hardware.thermal@1.0-IThermal-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.thermal@1.0-IThermal-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.thermal@1.0-IThermal-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.thermal@1.0",
+    ],
+}
diff --git a/thermal/1.0/vts/Android.mk b/thermal/1.0/vts/Android.mk
index 644b2ed..60cc723 100644
--- a/thermal/1.0/vts/Android.mk
+++ b/thermal/1.0/vts/Android.mk
@@ -16,36 +16,4 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# build profiler for thermal.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvts_profiler_hidl_thermal@1.0
-
-LOCAL_SRC_FILES := \
-   Thermal.vts \
-   types.vts \
-
-LOCAL_C_INCLUDES += \
-  test/vts/drivers/libprofiling \
-
-LOCAL_VTS_MODE := PROFILER
-
-LOCAL_SHARED_LIBRARIES := \
-   android.hardware.thermal@1.0 \
-   libbase \
-   libcutils \
-   liblog \
-   libhidlbase \
-   libhidltransport \
-   libhwbinder \
-   libprotobuf-cpp-full \
-   libvts_common \
-   libvts_multidevice_proto \
-   libvts_profiling \
-   libutils \
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
+include $(call all-subdir-makefiles)
diff --git a/tv/cec/1.0/Android.bp b/tv/cec/1.0/Android.bp
index b6dc3b1..4c98cb9 100644
--- a/tv/cec/1.0/Android.bp
+++ b/tv/cec/1.0/Android.bp
@@ -124,3 +124,93 @@
         "android.hidl.base@1.0",
     ],
 }
+
+genrule {
+    name: "android.hardware.tv.cec@1.0-IHdmiCec-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tv.cec@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/tv/cec/1.0/ $(genDir)/android/hardware/tv/cec/1.0/",
+    srcs: [
+        "IHdmiCec.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/tv/cec/1.0/HdmiCec.vts.cpp",
+        "android/hardware/tv/cec/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.tv.cec@1.0-IHdmiCec-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tv.cec@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/tv/cec/1.0/ $(genDir)/android/hardware/tv/cec/1.0/",
+    srcs: [
+        "IHdmiCec.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/tv/cec/1.0/HdmiCec.vts.h",
+        "android/hardware/tv/cec/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.tv.cec@1.0-IHdmiCec-vts.profiler",
+    generated_sources: ["android.hardware.tv.cec@1.0-IHdmiCec-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.tv.cec@1.0-IHdmiCec-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.tv.cec@1.0-IHdmiCec-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.tv.cec@1.0",
+    ],
+}
+
+genrule {
+    name: "android.hardware.tv.cec@1.0-IHdmiCecCallback-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tv.cec@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/tv/cec/1.0/ $(genDir)/android/hardware/tv/cec/1.0/",
+    srcs: [
+        "IHdmiCecCallback.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/tv/cec/1.0/HdmiCecCallback.vts.cpp",
+        "android/hardware/tv/cec/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.tv.cec@1.0-IHdmiCecCallback-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tv.cec@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/tv/cec/1.0/ $(genDir)/android/hardware/tv/cec/1.0/",
+    srcs: [
+        "IHdmiCecCallback.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/tv/cec/1.0/HdmiCecCallback.vts.h",
+        "android/hardware/tv/cec/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.tv.cec@1.0-IHdmiCecCallback-vts.profiler",
+    generated_sources: ["android.hardware.tv.cec@1.0-IHdmiCecCallback-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.tv.cec@1.0-IHdmiCecCallback-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.tv.cec@1.0-IHdmiCecCallback-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.tv.cec@1.0",
+    ],
+}
diff --git a/tv/cec/1.0/vts/Android.mk b/tv/cec/1.0/vts/Android.mk
index a7eeb33..60cc723 100644
--- a/tv/cec/1.0/vts/Android.mk
+++ b/tv/cec/1.0/vts/Android.mk
@@ -16,73 +16,4 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# build VTS profiler for HdmiCec
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvts_profiler_hidl_tv_cec@1.0
-
-LOCAL_SRC_FILES := \
-  HdmiCec.vts \
-  types.vts \
-
-LOCAL_C_INCLUDES += \
-  test/vts/drivers/libprofiling \
-
-LOCAL_VTS_MODE := PROFILER
-
-LOCAL_SHARED_LIBRARIES += \
-  android.hardware.tv.cec@1.0 \
-  libbase \
-  libcutils \
-  liblog \
-  libhidlbase \
-  libhidltransport \
-  libhwbinder \
-  libprotobuf-cpp-full \
-  libvts_common \
-  libvts_multidevice_proto \
-  libvts_profiling \
-  libutils \
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-LOCAL_MULTILIB := both
-
-include $(BUILD_SHARED_LIBRARY)
-
-
-# build VTS profiler for HdmiCecCallback
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvts_profiler_hidl_tv_cec_callback_@1.0
-
-LOCAL_SRC_FILES := \
-  HdmiCecCallback.vts \
-  types.vts \
-
-LOCAL_C_INCLUDES += \
-  test/vts/drivers/libprofiling \
-
-LOCAL_VTS_MODE := PROFILER
-
-LOCAL_SHARED_LIBRARIES += \
-  android.hardware.tv.cec@1.0 \
-  libbase \
-  libcutils \
-  liblog \
-  libhidlbase \
-  libhidltransport \
-  libhwbinder \
-  libprotobuf-cpp-full \
-  libvts_common \
-  libvts_multidevice_proto \
-  libvts_profiling \
-  libutils \
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-LOCAL_MULTILIB := both
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
+include $(call all-subdir-makefiles)
diff --git a/vehicle/2.0/Android.bp b/vehicle/2.0/Android.bp
index 571ef2b..04dfd5a 100644
--- a/vehicle/2.0/Android.bp
+++ b/vehicle/2.0/Android.bp
@@ -124,3 +124,93 @@
         "android.hidl.base@1.0",
     ],
 }
+
+genrule {
+    name: "android.hardware.vehicle@2.0-IVehicle-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.vehicle@2.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/vehicle/2.0/ $(genDir)/android/hardware/vehicle/2.0/",
+    srcs: [
+        "IVehicle.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/vehicle/2.0/Vehicle.vts.cpp",
+        "android/hardware/vehicle/2.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.vehicle@2.0-IVehicle-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.vehicle@2.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/vehicle/2.0/ $(genDir)/android/hardware/vehicle/2.0/",
+    srcs: [
+        "IVehicle.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/vehicle/2.0/Vehicle.vts.h",
+        "android/hardware/vehicle/2.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.vehicle@2.0-IVehicle-vts.profiler",
+    generated_sources: ["android.hardware.vehicle@2.0-IVehicle-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.vehicle@2.0-IVehicle-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.vehicle@2.0-IVehicle-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.vehicle@2.0",
+    ],
+}
+
+genrule {
+    name: "android.hardware.vehicle@2.0-IVehicleCallback-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.vehicle@2.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/vehicle/2.0/ $(genDir)/android/hardware/vehicle/2.0/",
+    srcs: [
+        "IVehicleCallback.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/vehicle/2.0/VehicleCallback.vts.cpp",
+        "android/hardware/vehicle/2.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.vehicle@2.0-IVehicleCallback-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.vehicle@2.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/vehicle/2.0/ $(genDir)/android/hardware/vehicle/2.0/",
+    srcs: [
+        "IVehicleCallback.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/vehicle/2.0/VehicleCallback.vts.h",
+        "android/hardware/vehicle/2.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.vehicle@2.0-IVehicleCallback-vts.profiler",
+    generated_sources: ["android.hardware.vehicle@2.0-IVehicleCallback-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.vehicle@2.0-IVehicleCallback-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.vehicle@2.0-IVehicleCallback-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.vehicle@2.0",
+    ],
+}
diff --git a/vehicle/2.0/vts/Android.mk b/vehicle/2.0/vts/Android.mk
index b7f185d..df5dac8 100644
--- a/vehicle/2.0/vts/Android.mk
+++ b/vehicle/2.0/vts/Android.mk
@@ -16,73 +16,4 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# build profiler for Vehicle.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvts_profiler_hidl_vehicle@2.0
-
-LOCAL_SRC_FILES := \
-  Vehicle.vts \
-  types.vts \
-
-LOCAL_C_INCLUDES += \
-  test/vts/drivers/libprofiling \
-
-LOCAL_VTS_MODE := PROFILER
-
-LOCAL_SHARED_LIBRARIES := \
-  android.hardware.vehicle@2.0 \
-  libbase \
-  libcutils \
-  liblog \
-  libhidlbase \
-  libhidltransport \
-  libhwbinder \
-  libprotobuf-cpp-full \
-  libvts_common \
-  libvts_multidevice_proto \
-  libvts_profiling \
-  libutils \
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-LOCAL_MULTILIB := both
-
-include $(BUILD_SHARED_LIBRARY)
-
-
-# build profiler for VehicleCallback.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvts_profiler_hidl_vehicle_callback_@2.0
-
-LOCAL_SRC_FILES := \
-  Vehicle.vts \
-  types.vts \
-
-LOCAL_C_INCLUDES += \
-  test/vts/drivers/libprofiling \
-
-LOCAL_VTS_MODE := PROFILER
-
-LOCAL_SHARED_LIBRARIES := \
-  android.hardware.vehicle@2.0 \
-  libbase \
-  libcutils \
-  liblog \
-  libhidlbase \
-  libhidltransport \
-  libhwbinder \
-  libprotobuf-cpp-full \
-  libvts_common \
-  libvts_multidevice_proto \
-  libvts_profiling \
-  libutils \
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-LOCAL_MULTILIB := both
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
\ No newline at end of file
+include $(call all-subdir-makefiles)
\ No newline at end of file
diff --git a/vibrator/1.0/Android.bp b/vibrator/1.0/Android.bp
index ec97cfb..cea74bb 100644
--- a/vibrator/1.0/Android.bp
+++ b/vibrator/1.0/Android.bp
@@ -112,3 +112,48 @@
         "android.hidl.base@1.0",
     ],
 }
+
+genrule {
+    name: "android.hardware.vibrator@1.0-IVibrator-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.vibrator@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/vibrator/1.0/ $(genDir)/android/hardware/vibrator/1.0/",
+    srcs: [
+        "IVibrator.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/vibrator/1.0/Vibrator.vts.cpp",
+        "android/hardware/vibrator/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.vibrator@1.0-IVibrator-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.vibrator@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/vibrator/1.0/ $(genDir)/android/hardware/vibrator/1.0/",
+    srcs: [
+        "IVibrator.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/vibrator/1.0/Vibrator.vts.h",
+        "android/hardware/vibrator/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.vibrator@1.0-IVibrator-vts.profiler",
+    generated_sources: ["android.hardware.vibrator@1.0-IVibrator-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.vibrator@1.0-IVibrator-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.vibrator@1.0-IVibrator-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.vibrator@1.0",
+    ],
+}
diff --git a/vibrator/1.0/vts/Android.mk b/vibrator/1.0/vts/Android.mk
index 084dcf7..df5dac8 100644
--- a/vibrator/1.0/vts/Android.mk
+++ b/vibrator/1.0/vts/Android.mk
@@ -16,36 +16,4 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# build profiler for vibrator.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvts_profiler_hidl_vibrator@1.0
-
-LOCAL_SRC_FILES := \
-   Vibrator.vts \
-   types.vts \
-
-LOCAL_C_INCLUDES += \
-  test/vts/drivers/libprofiling \
-
-LOCAL_VTS_MODE := PROFILER
-
-LOCAL_SHARED_LIBRARIES := \
-   android.hardware.vibrator@1.0 \
-   libbase \
-   libcutils \
-   liblog \
-   libhidlbase \
-   libhidltransport \
-   libhwbinder \
-   libprotobuf-cpp-full \
-   libvts_common \
-   libvts_multidevice_proto \
-   libvts_profiling \
-   libutils \
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
+include $(call all-subdir-makefiles)
\ No newline at end of file
diff --git a/vr/1.0/Android.bp b/vr/1.0/Android.bp
index 240b7ad..3397bff 100644
--- a/vr/1.0/Android.bp
+++ b/vr/1.0/Android.bp
@@ -104,3 +104,44 @@
         "android.hidl.base@1.0",
     ],
 }
+
+genrule {
+    name: "android.hardware.vr@1.0-IVr-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.vr@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/vr/1.0/ $(genDir)/android/hardware/vr/1.0/",
+    srcs: [
+        "IVr.hal",
+    ],
+    out: [
+        "android/hardware/vr/1.0/Vr.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.vr@1.0-IVr-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.vr@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/vr/1.0/ $(genDir)/android/hardware/vr/1.0/",
+    srcs: [
+        "IVr.hal",
+    ],
+    out: [
+        "android/hardware/vr/1.0/Vr.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.vr@1.0-IVr-vts.profiler",
+    generated_sources: ["android.hardware.vr@1.0-IVr-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.vr@1.0-IVr-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.vr@1.0-IVr-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.vr@1.0",
+    ],
+}
diff --git a/vr/1.0/vts/Android.mk b/vr/1.0/vts/Android.mk
index ac1cad5..df5dac8 100644
--- a/vr/1.0/vts/Android.mk
+++ b/vr/1.0/vts/Android.mk
@@ -16,36 +16,4 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# build profiler for Vr.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvts_profiler_hidl_vr@1.0
-
-LOCAL_SRC_FILES := \
-   Vr.vts \
-
-LOCAL_C_INCLUDES += \
-  test/vts/drivers/libprofiling \
-
-LOCAL_VTS_MODE := PROFILER
-
-LOCAL_SHARED_LIBRARIES := \
-   android.hardware.vr@1.0 \
-   libbase \
-   libcutils \
-   liblog \
-   libhidlbase \
-   libhidltransport \
-   libhwbinder \
-   libprotobuf-cpp-full \
-   libvts_common \
-   libvts_multidevice_proto \
-   libvts_profiling \
-   libutils \
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-include $(BUILD_SHARED_LIBRARY)
-
-# include hidl test makefiles
-include $(LOCAL_PATH)/functional/vts/testcases/hal/vr/hidl/Android.mk
+include $(call all-subdir-makefiles)
\ No newline at end of file