Convert to Android.bp

See build/soong/README.md for more information

Test: mmma hardware/libhardware
Change-Id: Ibb7e2af9d55f581e951d8996cea5e52cd0766b04
diff --git a/modules/Android.mk b/modules/Android.mk
index 462081d..9d934c5 100644
--- a/modules/Android.mk
+++ b/modules/Android.mk
@@ -1,14 +1,5 @@
 hardware_modules := \
-    audio_remote_submix \
     camera \
     gralloc \
-    hwcomposer \
-    input \
-    radio \
-    sensors \
-    thermal \
-    usbaudio \
-    usbcamera \
-    vehicle \
-    vr
+    sensors
 include $(call all-named-subdir-makefiles,$(hardware_modules))
diff --git a/modules/audio_remote_submix/Android.bp b/modules/audio_remote_submix/Android.bp
new file mode 100644
index 0000000..c7d018c
--- /dev/null
+++ b/modules/audio_remote_submix/Android.bp
@@ -0,0 +1,34 @@
+// Copyright (C) 2012 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_library_shared {
+    name: "audio.r_submix.default",
+    relative_install_path: "hw",
+    vendor: true,
+    srcs: ["audio_hw.cpp"],
+    include_dirs: [
+        "system/media/audio_utils/include",
+    ],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+        "libutils",
+        "libnbaio_mono",
+    ],
+    static_libs: ["libmedia_helper"],
+
+    cflags: ["-Wno-unused-parameter"],
+
+    header_libs: ["libhardware_headers"],
+}
diff --git a/modules/audio_remote_submix/Android.mk b/modules/audio_remote_submix/Android.mk
deleted file mode 100644
index 2f59f3a..0000000
--- a/modules/audio_remote_submix/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2012 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := audio.r_submix.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_SRC_FILES := \
-	audio_hw.cpp
-LOCAL_C_INCLUDES += \
-	frameworks/av/include/ \
-	frameworks/native/include/ \
-	$(call include-path-for, audio-utils)
-LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libnbaio_mono
-LOCAL_STATIC_LIBRARIES := libmedia_helper
-LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Wno-unused-parameter
-
-LOCAL_HEADER_LIBRARIES += libhardware_headers
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/modules/camera/3_0/Android.bp b/modules/camera/3_0/Android.bp
new file mode 100644
index 0000000..6d6d1d7
--- /dev/null
+++ b/modules/camera/3_0/Android.bp
@@ -0,0 +1,47 @@
+// Copyright (C) 2012 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_library_shared {
+    name: "camera.default",
+    relative_install_path: "hw",
+
+    include_dirs: [
+        "system/core/include",
+        "system/media/camera/include",
+    ],
+
+    srcs: [
+        "CameraHAL.cpp",
+        "Camera.cpp",
+        "ExampleCamera.cpp",
+        "Metadata.cpp",
+        "Stream.cpp",
+        "VendorTags.cpp",
+    ],
+
+    shared_libs: [
+        "libcamera_metadata",
+        "libcutils",
+        "liblog",
+        "libsync",
+        "libutils",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+        "-fvisibility=hidden",
+    ],
+}
diff --git a/modules/camera/3_0/Android.mk b/modules/camera/3_0/Android.mk
deleted file mode 100644
index 3071a03..0000000
--- a/modules/camera/3_0/Android.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (C) 2012 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := camera.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-
-LOCAL_C_INCLUDES += \
-	system/core/include \
-	system/media/camera/include \
-
-LOCAL_SRC_FILES := \
-	CameraHAL.cpp \
-	Camera.cpp \
-	ExampleCamera.cpp \
-	Metadata.cpp \
-	Stream.cpp \
-	VendorTags.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
-	libcamera_metadata \
-	libcutils \
-	liblog \
-	libsync \
-	libutils \
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror -fvisibility=hidden
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/hwcomposer/Android.bp b/modules/hwcomposer/Android.bp
new file mode 100644
index 0000000..4f429be
--- /dev/null
+++ b/modules/hwcomposer/Android.bp
@@ -0,0 +1,32 @@
+// Copyright (C) 2008 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.
+
+// HAL module implemenation stored in
+// hw/<OVERLAY_HARDWARE_MODULE_ID>.<ro.product.board>.so
+cc_library_shared {
+    name: "hwcomposer.default",
+    relative_install_path: "hw",
+    vendor: true,
+    shared_libs: [
+        "liblog",
+        "libEGL",
+    ],
+    srcs: ["hwcomposer.cpp"],
+    header_libs: ["libhardware_headers"],
+    cflags: [
+        "-DLOG_TAG=\"hwcomposer\"",
+        "-Wall",
+        "-Werror",
+    ],
+}
diff --git a/modules/hwcomposer/Android.mk b/modules/hwcomposer/Android.mk
deleted file mode 100644
index a179eac..0000000
--- a/modules/hwcomposer/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2008 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.
-
-
-LOCAL_PATH := $(call my-dir)
-
-# HAL module implemenation stored in
-# hw/<OVERLAY_HARDWARE_MODULE_ID>.<ro.product.board>.so
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_SHARED_LIBRARIES := liblog libEGL
-LOCAL_SRC_FILES := hwcomposer.cpp
-LOCAL_HEADER_LIBRARIES := libhardware_headers
-LOCAL_MODULE := hwcomposer.default
-LOCAL_CFLAGS:= -DLOG_TAG=\"hwcomposer\"
-LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS += -Wall -Werror
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/input/Android.mk b/modules/input/Android.mk
deleted file mode 100644
index 3011b2e..0000000
--- a/modules/input/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (C) 2015 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/modules/input/evdev/Android.bp b/modules/input/evdev/Android.bp
new file mode 100644
index 0000000..26e711f
--- /dev/null
+++ b/modules/input/evdev/Android.bp
@@ -0,0 +1,60 @@
+// Copyright (C) 2015 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.
+
+// Evdev module implementation
+cc_library_shared {
+    name: "libinput_evdev",
+
+    srcs: [
+        "BitUtils.cpp",
+        "InputHub.cpp",
+        "InputDevice.cpp",
+        "InputDeviceManager.cpp",
+        "InputHost.cpp",
+        "InputMapper.cpp",
+        "MouseInputMapper.cpp",
+        "SwitchInputMapper.cpp",
+    ],
+
+    shared_libs: [
+        "libhardware_legacy",
+        "liblog",
+        "libutils",
+    ],
+
+    export_include_dirs: ["."],
+
+    cppflags: [
+        "-Wno-unused-parameter",
+    ],
+}
+
+// HAL module
+cc_library_shared {
+    name: "input.evdev.default",
+    relative_install_path: "hw",
+
+    srcs: ["EvdevModule.cpp"],
+
+    shared_libs: [
+        "libinput_evdev",
+        "liblog",
+    ],
+
+    cppflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
+}
diff --git a/modules/input/evdev/Android.mk b/modules/input/evdev/Android.mk
deleted file mode 100644
index 8c391b2..0000000
--- a/modules/input/evdev/Android.mk
+++ /dev/null
@@ -1,61 +0,0 @@
-# Copyright (C) 2015 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.
-
-LOCAL_PATH := $(call my-dir)
-
-# Evdev module implementation
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
-    BitUtils.cpp \
-    InputHub.cpp \
-    InputDevice.cpp \
-    InputDeviceManager.cpp \
-    InputHost.cpp \
-    InputMapper.cpp \
-    MouseInputMapper.cpp \
-    SwitchInputMapper.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-    libhardware_legacy \
-    liblog \
-    libutils
-
-LOCAL_CLANG := true
-LOCAL_CPPFLAGS += -Wno-unused-parameter
-
-LOCAL_MODULE := libinput_evdev
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
-
-# HAL module
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := input.evdev.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-
-LOCAL_SRC_FILES := \
-    EvdevModule.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-    libinput_evdev \
-    liblog
-
-LOCAL_CLANG := true
-LOCAL_CPPFLAGS += -Wall -Werror -Wno-unused-parameter
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/sensors/Android.bp b/modules/sensors/Android.bp
index f39ba52..3d14bdf 100644
--- a/modules/sensors/Android.bp
+++ b/modules/sensors/Android.bp
@@ -3,7 +3,7 @@
     vendor: true,
     srcs: [
         "multihal.cpp",
-        "SensorEventQueue.cpp"
+        "SensorEventQueue.cpp",
     ],
     header_libs: [
         "libhardware_headers",
@@ -12,8 +12,28 @@
         "liblog",
         "libcutils",
         "libutils",
-        "libdl"
+        "libdl",
     ],
     export_include_dirs: ["."],
-    cflags: ["-Wall", "-Werror"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+}
+
+cc_test_host {
+    name: "sensorstests",
+    gtest: false,
+    srcs: [
+        "SensorEventQueue.cpp",
+        "tests/SensorEventQueue_test.cpp",
+    ],
+    static_libs: [
+        "libcutils",
+        "libutils",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
 }
diff --git a/modules/sensors/Android.mk b/modules/sensors/Android.mk
index f0045af..bc6a21b 100644
--- a/modules/sensors/Android.mk
+++ b/modules/sensors/Android.mk
@@ -45,5 +45,3 @@
 include $(BUILD_SHARED_LIBRARY)
 
 endif # USE_SENSOR_MULTI_HAL
-
-include $(call all-makefiles-under, $(LOCAL_PATH))
diff --git a/modules/sensors/dynamic_sensor/Android.bp b/modules/sensors/dynamic_sensor/Android.bp
new file mode 100644
index 0000000..214d97c
--- /dev/null
+++ b/modules/sensors/dynamic_sensor/Android.bp
@@ -0,0 +1,134 @@
+// Copyright (C) 2017 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_defaults {
+    name: "dynamic_sensor_defaults",
+
+    // intended to be integrated into hal, thus vendor
+    vendor: true,
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wextra",
+    ],
+    export_include_dirs: ["."],
+
+    shared_libs: [
+        "libhidparser",
+    ],
+
+    target: {
+        android: {
+            srcs: [
+                "BaseDynamicSensorDaemon.cpp",
+                "BaseSensorObject.cpp",
+                "ConnectionDetector.cpp",
+                "DummyDynamicAccelDaemon.cpp",
+                "DynamicSensorManager.cpp",
+                "HidRawDevice.cpp",
+                "HidRawSensor.cpp",
+                "HidRawSensorDaemon.cpp",
+                "HidRawSensorDevice.cpp",
+                "RingBuffer.cpp",
+            ],
+            shared_libs: [
+                "libbase",
+                "libcutils",
+                "liblog",
+                "libutils",
+            ],
+            header_libs: [
+                "libhardware_headers",
+                "libstagefright_foundation_headers",
+            ],
+        },
+
+        host: {
+            local_include_dirs: [
+                "test",
+                "HidUtils/test",
+            ],
+        },
+
+        // host test is targeting linux host only
+        darwin: {
+            enabled: false,
+        },
+    },
+}
+
+//
+// There are two ways to utilize the dynamic sensor module:
+//   1. Use as an extension in an existing hal: declare dependency on libdynamic_sensor_ext shared
+//      library in existing sensor hal.
+//   2. Use as a standalone sensor HAL and configure multihal to combine it with sensor hal that
+//      hosts other sensors: add dependency on sensors.dynamic_sensor_hal in device level makefile and
+//      write multihal configuration file accordingly.
+//
+// Please take only one of these two options to avoid conflict over hardware resource.
+//
+//
+// Option 1: sensor extension module
+//
+cc_library_shared {
+    name: "libdynamic_sensor_ext",
+    defaults: ["dynamic_sensor_defaults"],
+
+    cflags: ["-DLOG_TAG=\"DynamicSensorExt\""],
+}
+
+//
+// Option 2: independent sensor hal
+//
+cc_library_shared {
+    name: "sensors.dynamic_sensor_hal",
+    defaults: ["dynamic_sensor_defaults"],
+    relative_install_path: "hw",
+
+    cflags: ["-DLOG_TAG=\"DynamicSensorHal\""],
+
+    srcs: ["sensors.cpp"],
+}
+
+//
+// Host test for HidRawSensor. Test with dummy test HID descriptors.
+//
+cc_binary_host {
+    name: "hidrawsensor_host_test",
+    defaults: ["dynamic_sensor_defaults"],
+
+    srcs: [
+        "HidRawSensor.cpp",
+        "BaseSensorObject.cpp",
+        "HidUtils/test/TestHidDescriptor.cpp",
+        "test/HidRawSensorTest.cpp",
+    ],
+}
+
+//
+// Host test for HidRawDevice and HidRawSensor. Test with hidraw
+// device node.
+//
+cc_binary_host {
+    name: "hidrawdevice_host_test",
+    defaults: ["dynamic_sensor_defaults"],
+
+    srcs: [
+        "HidRawDevice.cpp",
+        "HidRawSensor.cpp",
+        "BaseSensorObject.cpp",
+        "test/HidRawDeviceTest.cpp",
+    ],
+}
diff --git a/modules/sensors/dynamic_sensor/Android.mk b/modules/sensors/dynamic_sensor/Android.mk
deleted file mode 100644
index 52809dc..0000000
--- a/modules/sensors/dynamic_sensor/Android.mk
+++ /dev/null
@@ -1,138 +0,0 @@
-# Copyright (C) 2017 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.
-
-LOCAL_PATH := $(call my-dir)
-COMMON_CFLAGS := -Wall -Werror -Wextra
-
-dynamic_sensor_src := \
-    BaseDynamicSensorDaemon.cpp \
-    BaseSensorObject.cpp \
-    ConnectionDetector.cpp \
-    DummyDynamicAccelDaemon.cpp \
-    DynamicSensorManager.cpp \
-    HidRawDevice.cpp \
-    HidRawSensor.cpp \
-    HidRawSensorDaemon.cpp \
-    HidRawSensorDevice.cpp \
-    RingBuffer.cpp
-
-dynamic_sensor_shared_lib := \
-    libbase \
-    libcutils \
-    libhidparser \
-    liblog \
-    libutils
-#
-# There are two ways to utilize the dynamic sensor module:
-#   1. Use as an extension in an existing hal: declare dependency on libdynamic_sensor_ext shared
-#      library in existing sensor hal.
-#   2. Use as a standalone sensor HAL and configure multihal to combine it with sensor hal that
-#      hosts other sensors: add dependency on sensors.dynamic_sensor_hal in device level makefile and
-#      write multihal configuration file accordingly.
-#
-# Please take only one of these two options to avoid conflict over hardware resource.
-#
-#
-# Option 1: sensor extension module
-#
-include $(CLEAR_VARS)
-LOCAL_MODULE := libdynamic_sensor_ext
-LOCAL_MODULE_TAGS := optional
-# intended to be integrated into hal, thus proprietary
-LOCAL_PROPRIETARY_MODULE := true
-
-LOCAL_CFLAGS += $(COMMON_CFLAGS) -DLOG_TAG=\"DynamicSensorExt\"
-
-LOCAL_SRC_FILES := $(dynamic_sensor_src)
-
-LOCAL_HEADER_LIBRARIES := \
-    libhardware_headers \
-    libstagefright_foundation_headers \
-
-LOCAL_SHARED_LIBRARIES := $(dynamic_sensor_shared_lib)
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-include $(BUILD_SHARED_LIBRARY)
-
-#
-# Option 2: independent sensor hal
-#
-include $(CLEAR_VARS)
-LOCAL_MODULE := sensors.dynamic_sensor_hal
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_MODULE_TAGS := optional
-# hal module, thus proprietary
-LOCAL_PROPRIETARY_MODULE := true
-
-LOCAL_CFLAGS += $(COMMON_CFLAGS) -DLOG_TAG=\"DynamicSensorHal\"
-
-LOCAL_SRC_FILES := $(dynamic_sensor_src) sensors.cpp
-
-LOCAL_HEADER_LIBRARIES := \
-    libhardware_headers \
-    libstagefright_foundation_headers \
-
-LOCAL_SHARED_LIBRARIES := $(dynamic_sensor_shared_lib)
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-include $(BUILD_SHARED_LIBRARY)
-
-#
-# Host test for HidRawSensor. Test with dummy test HID descriptors.
-#
-include $(CLEAR_VARS)
-LOCAL_MODULE := hidrawsensor_host_test
-LOCAL_MODULE_TAGS := optional
-# host test is targeting linux host only
-LOCAL_MODULE_HOST_OS := linux
-
-LOCAL_CFLAGS += $(COMMON_CFLAGS)
-
-LOCAL_SRC_FILES := \
-    HidRawSensor.cpp \
-    BaseSensorObject.cpp \
-    HidUtils/test/TestHidDescriptor.cpp \
-    test/HidRawSensorTest.cpp
-
-LOCAL_SHARED_LIBRARIES := libhidparser_host
-
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/test $(LOCAL_PATH)/HidUtils/test
-include $(BUILD_HOST_EXECUTABLE)
-
-#
-# Host test for HidRawDevice and HidRawSensor. Test with hidraw
-# device node.
-#
-include $(CLEAR_VARS)
-LOCAL_MODULE := hidrawdevice_host_test
-LOCAL_MODULE_TAGS := optional
-# host test is targeting linux host only
-LOCAL_MODULE_HOST_OS := linux
-
-LOCAL_CFLAGS += $(COMMON_CFLAGS)
-
-LOCAL_SRC_FILES := \
-    HidRawDevice.cpp \
-    HidRawSensor.cpp \
-    BaseSensorObject.cpp \
-    test/HidRawDeviceTest.cpp
-
-LOCAL_SHARED_LIBRARIES := libhidparser_host
-
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/test $(LOCAL_PATH)/HidUtils/test
-include $(BUILD_HOST_EXECUTABLE)
-
-include $(LOCAL_PATH)/HidUtils/Android.mk
diff --git a/modules/sensors/dynamic_sensor/HidUtils/Android.bp b/modules/sensors/dynamic_sensor/HidUtils/Android.bp
new file mode 100644
index 0000000..0eb43f8
--- /dev/null
+++ b/modules/sensors/dynamic_sensor/HidUtils/Android.bp
@@ -0,0 +1,92 @@
+// Copyright (C) 2017 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_defaults {
+    name: "hid_defaults",
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wextra",
+    ],
+}
+
+cc_library {
+    name: "libhidparser",
+    defaults: ["hid_defaults"],
+    host_supported: true,
+
+    // indended to be used by hal components, thus vendor
+    vendor: true,
+
+    srcs: [
+        "HidGlobal.cpp",
+        "HidItem.cpp",
+        "HidLocal.cpp",
+        "HidParser.cpp",
+        "HidReport.cpp",
+        "HidTree.cpp",
+    ],
+    export_include_dirs: ["."],
+
+    target: {
+        android: {
+            cflags: ["-DLOG_TAG=\"HidUtil\""],
+            shared_libs: ["libbase"],
+        },
+    },
+}
+
+//
+// Example of HidParser
+//
+cc_binary_host {
+    name: "hidparser_example",
+    defaults: ["hid_defaults"],
+
+    srcs: [
+        "test/HidParserExample.cpp",
+        "test/TestHidDescriptor.cpp",
+    ],
+    static_libs: ["libhidparser"],
+
+    local_include_dirs: ["test"],
+}
+
+//
+// Another example of HidParser
+//
+cc_binary_host {
+    name: "hidparser_example2",
+    defaults: ["hid_defaults"],
+
+    srcs: [
+        "test/HidParserExample2.cpp",
+        "test/TestHidDescriptor.cpp",
+    ],
+    static_libs: ["libhidparser"],
+
+    local_include_dirs: ["test"],
+}
+
+//
+// Test for TriState template
+//
+cc_test_host {
+    name: "tristate_test",
+    defaults: ["hid_defaults"],
+
+    srcs: ["test/TriStateTest.cpp"],
+
+    local_include_dirs: ["test"],
+}
diff --git a/modules/sensors/dynamic_sensor/HidUtils/Android.mk b/modules/sensors/dynamic_sensor/HidUtils/Android.mk
deleted file mode 100644
index 5a1d890..0000000
--- a/modules/sensors/dynamic_sensor/HidUtils/Android.mk
+++ /dev/null
@@ -1,99 +0,0 @@
-# Copyright (C) 2017 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.
-
-LOCAL_PATH := $(call my-dir)
-COMMON_CFLAGS := -Wall -Werror -Wextra
-
-hidparser_src := \
-    HidGlobal.cpp \
-    HidItem.cpp \
-    HidLocal.cpp \
-    HidParser.cpp \
-    HidReport.cpp \
-    HidTree.cpp
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libhidparser
-LOCAL_MODULE_TAGS := optional
-# indended to be used by hal components, thus propietary
-LOCAL_PROPRIETARY_MODULE := true
-
-LOCAL_CFLAGS += $(COMMON_CFLAGS) -DLOG_TAG=\"HidUtil\"
-LOCAL_SRC_FILES := $(hidparser_src)
-LOCAL_SHARED_LIBRARIES := libbase
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-include $(BUILD_SHARED_LIBRARY)
-
-#
-# host side shared library (for host test, example, etc)
-#
-include $(CLEAR_VARS)
-LOCAL_MODULE := libhidparser_host
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS += $(COMMON_CFLAGS)
-
-LOCAL_SRC_FILES := $(hidparser_src)
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-include $(BUILD_HOST_SHARED_LIBRARY)
-
-#
-# Example of HidParser
-#
-include $(CLEAR_VARS)
-LOCAL_MODULE := hidparser_example
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS += $(COMMON_CFLAGS)
-LOCAL_SRC_FILES := \
-    $(hidparser_src) \
-    test/HidParserExample.cpp \
-    test/TestHidDescriptor.cpp
-
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/test
-include $(BUILD_HOST_EXECUTABLE)
-
-#
-# Another example of HidParser
-#
-include $(CLEAR_VARS)
-LOCAL_MODULE := hidparser_example2
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS += $(COMMON_CFLAGS)
-LOCAL_SRC_FILES := \
-    $(hidparser_src) \
-    test/HidParserExample2.cpp \
-    test/TestHidDescriptor.cpp
-
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/test
-include $(BUILD_HOST_EXECUTABLE)
-
-#
-# Test for TriState template
-#
-include $(CLEAR_VARS)
-LOCAL_MODULE := tristate_test
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS += $(COMMON_CFLAGS)
-LOCAL_SRC_FILES := test/TriStateTest.cpp
-
-LOCAL_STATIC_LIBRARIES := \
-     libgtest \
-     libgtest_main
-
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/test
-include $(BUILD_HOST_NATIVE_TEST)
diff --git a/modules/sensors/tests/Android.mk b/modules/sensors/tests/Android.mk
deleted file mode 100644
index dcf4f24..0000000
--- a/modules/sensors/tests/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
-	SensorEventQueue_test.cpp
-
-LOCAL_CFLAGS := -Wall -Werror
-LOCAL_MODULE := sensorstests
-
-LOCAL_STATIC_LIBRARIES := libcutils libutils
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. bionic
-
-LOCAL_LDLIBS += -lpthread
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/modules/sensors/tests/SensorEventQueue_test.cpp b/modules/sensors/tests/SensorEventQueue_test.cpp
index d3d75ee..07db4c0 100644
--- a/modules/sensors/tests/SensorEventQueue_test.cpp
+++ b/modules/sensors/tests/SensorEventQueue_test.cpp
@@ -4,14 +4,14 @@
 #include <pthread.h>
 #include <cutils/atomic.h>
 
-#include "SensorEventQueue.cpp"
+#include "SensorEventQueue.h"
 
 // Unit tests for the SensorEventQueue.
 
 // Run it like this:
 //
-// make sensorstests -j32 && \
-// out/host/linux-x86/obj/EXECUTABLES/sensorstests_intermediates/sensorstests
+// m sensorstests && \
+// out/host/linux-x86/nativetest64/sensorstests/sensorstests
 
 bool checkWritableBufferSize(SensorEventQueue* queue, int requested, int expected) {
     sensors_event_t* buffer;
diff --git a/modules/soundtrigger/Android.bp b/modules/soundtrigger/Android.bp
new file mode 100644
index 0000000..aa5e804
--- /dev/null
+++ b/modules/soundtrigger/Android.bp
@@ -0,0 +1,32 @@
+// Copyright (C) 2011 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.
+
+// Stub sound_trigger HAL module, used for tests
+cc_library_shared {
+    name: "sound_trigger.stub.default",
+    relative_install_path: "hw",
+    vendor: true,
+    srcs: ["sound_trigger_hw.c"],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+    ],
+    header_libs: ["libhardware_headers"],
+    cflags: [
+        "-Wno-error=incompatible-pointer-types",
+        "-Wno-unused-function",
+        "-Wno-unused-parameter",
+        "-Wno-unused-variable",
+    ],
+}
diff --git a/modules/soundtrigger/Android.mk b/modules/soundtrigger/Android.mk
deleted file mode 100644
index 8250f9b..0000000
--- a/modules/soundtrigger/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2011 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.
-
-LOCAL_PATH := $(call my-dir)
-
-# Stub sound_trigger HAL module, used for tests
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := sound_trigger.stub.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_SRC_FILES := sound_trigger_hw.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/thermal/Android.bp b/modules/thermal/Android.bp
new file mode 100644
index 0000000..ab5c408
--- /dev/null
+++ b/modules/thermal/Android.bp
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 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_library_shared {
+    name: "thermal.default",
+    relative_install_path: "hw",
+    vendor: true,
+    srcs: ["thermal.c"],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+        "libutils",
+    ],
+    header_libs: ["libhardware_headers"],
+    cflags: ["-Wno-unused-parameter"],
+}
diff --git a/modules/thermal/Android.mk b/modules/thermal/Android.mk
deleted file mode 100644
index 1ad55d8..0000000
--- a/modules/thermal/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright (C) 2015 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := thermal.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_SRC_FILES := thermal.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils libutils
-LOCAL_HEADER_LIBRARIES := libhardware_headers
-LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Wno-unused-parameter
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/usbaudio/Android.bp b/modules/usbaudio/Android.bp
new file mode 100644
index 0000000..c7d403f
--- /dev/null
+++ b/modules/usbaudio/Android.bp
@@ -0,0 +1,29 @@
+// Copyright (C) 2012 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_library_shared {
+    name: "audio.usb.default",
+    relative_install_path: "hw",
+    vendor: true,
+    srcs: ["audio_hal.c"],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+        "libtinyalsa",
+        "libaudioutils",
+        "libalsautils",
+    ],
+    cflags: ["-Wno-unused-parameter"],
+    header_libs: ["libhardware_headers"],
+}
diff --git a/modules/usbaudio/Android.mk b/modules/usbaudio/Android.mk
deleted file mode 100644
index 6c8a98f..0000000
--- a/modules/usbaudio/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2012 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := audio.usb.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_SRC_FILES := \
-	audio_hal.c
-LOCAL_C_INCLUDES += \
-	external/tinyalsa/include \
-	$(call include-path-for, audio-utils) \
-	$(call include-path-for, alsa-utils)
-LOCAL_SHARED_LIBRARIES := liblog libcutils libtinyalsa libaudioutils libalsautils
-LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Wno-unused-parameter
-
-LOCAL_HEADER_LIBRARIES += libhardware_headers
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/modules/usbcamera/Android.bp b/modules/usbcamera/Android.bp
new file mode 100644
index 0000000..5e44d3c
--- /dev/null
+++ b/modules/usbcamera/Android.bp
@@ -0,0 +1,42 @@
+// Copyright (C) 2015 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_library_shared {
+    name: "camera.usb.default",
+    relative_install_path: "hw",
+
+    srcs: [
+        "CameraHAL.cpp",
+        "Camera.cpp",
+        "UsbCamera.cpp",
+        "Metadata.cpp",
+        "Stream.cpp",
+        "HotplugThread.cpp",
+    ],
+
+    shared_libs: [
+        "libcamera_metadata",
+        "libcutils",
+        "liblog",
+        "libsync",
+        "libutils",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+        "-fvisibility=hidden",
+    ],
+}
diff --git a/modules/usbcamera/Android.mk b/modules/usbcamera/Android.mk
deleted file mode 100644
index 6a36ac4..0000000
--- a/modules/usbcamera/Android.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (C) 2015 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := camera.usb.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-
-LOCAL_C_INCLUDES += \
-	system/core/include \
-	system/media/camera/include \
-
-LOCAL_SRC_FILES := \
-	CameraHAL.cpp \
-	Camera.cpp \
-	UsbCamera.cpp \
-	Metadata.cpp \
-	Stream.cpp \
-	HotplugThread.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
-	libcamera_metadata \
-	libcutils \
-	liblog \
-	libsync \
-	libutils \
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror -fvisibility=hidden
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/vehicle/Android.bp b/modules/vehicle/Android.bp
new file mode 100644
index 0000000..cb0406a
--- /dev/null
+++ b/modules/vehicle/Android.bp
@@ -0,0 +1,34 @@
+// Copyright (C) 2012 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_library_shared {
+    name: "vehicle.default",
+
+    relative_install_path: "hw",
+    vendor: true,
+    srcs: [
+        "vehicle.c",
+        "timeUtil.cpp",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    header_libs: ["libhardware_headers"],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+        "libutils",
+    ],
+}
diff --git a/modules/vehicle/Android.mk b/modules/vehicle/Android.mk
deleted file mode 100644
index ad2e527..0000000
--- a/modules/vehicle/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (C) 2012 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := vehicle.default
-
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_SRC_FILES := vehicle.c timeUtil.cpp
-LOCAL_CFLAGS := -Wall -Werror
-LOCAL_HEADER_LIBRARIES := libhardware_headers
-LOCAL_SHARED_LIBRARIES := liblog libcutils libutils
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/modules/vr/Android.bp b/modules/vr/Android.bp
new file mode 100644
index 0000000..40f4510
--- /dev/null
+++ b/modules/vr/Android.bp
@@ -0,0 +1,28 @@
+// 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_library_shared {
+    name: "vr.default",
+    relative_install_path: "hw",
+    vendor: true,
+    srcs: ["vr.c"],
+    header_libs: ["libhardware_headers"],
+    shared_libs: ["libcutils"],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
+}
diff --git a/modules/vr/Android.mk b/modules/vr/Android.mk
deleted file mode 100644
index 2cdcb1b..0000000
--- a/modules/vr/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := vr.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_SRC_FILES := vr.c
-LOCAL_HEADER_LIBRARIES := libhardware_headers
-LOCAL_SHARED_LIBRARIES := libcutils
-LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS += -Wall -Werror -Wno-unused-parameter
-
-include $(BUILD_SHARED_LIBRARY)