Merge "Begin converting Android.mk to Android.bp"
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..f093c56
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,18 @@
+// Copyright 2006 The Android Open Source Project
+
+cc_library_shared {
+    name: "libhardware",
+
+    srcs: ["hardware.c"],
+    shared_libs: [
+        "libcutils",
+        "liblog",
+        "libdl",
+    ],
+    cflags: ["-DQEMU_HARDWARE"],
+}
+
+subdirs = [
+    "modules/*",
+    "tests/*",
+]
diff --git a/Android.mk b/Android.mk
index aec6781..8744f46 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,24 +1,3 @@
 # Copyright 2006 The Android Open Source Project
 
-# Setting LOCAL_PATH will mess up all-subdir-makefiles, so do it beforehand.
-SUBDIR_MAKEFILES := $(call all-named-subdir-makefiles,modules tests)
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SHARED_LIBRARIES := libcutils liblog
-
-LOCAL_INCLUDES += $(LOCAL_PATH)
-
-LOCAL_CFLAGS  += -DQEMU_HARDWARE
-QEMU_HARDWARE := true
-
-LOCAL_SHARED_LIBRARIES += libdl
-
-LOCAL_SRC_FILES += hardware.c
-
-LOCAL_MODULE:= libhardware
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(SUBDIR_MAKEFILES)
+include $(call all-named-subdir-makefiles,modules tests)
diff --git a/modules/Android.mk b/modules/Android.mk
index 9f7e5f0..c62b2db 100644
--- a/modules/Android.mk
+++ b/modules/Android.mk
@@ -1,4 +1,3 @@
-hardware_modules := gralloc hwcomposer audio nfc nfc-nci local_time \
-	power usbaudio audio_remote_submix camera usbcamera consumerir sensors vibrator \
-	tv_input fingerprint input
+hardware_modules := gralloc hwcomposer \
+	usbaudio audio_remote_submix camera usbcamera sensors input
 include $(call all-named-subdir-makefiles,$(hardware_modules))
diff --git a/modules/audio/Android.bp b/modules/audio/Android.bp
new file mode 100644
index 0000000..02da2b3
--- /dev/null
+++ b/modules/audio/Android.bp
@@ -0,0 +1,60 @@
+// 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.
+
+// The default audio HAL module, which is a stub, that is loaded if no other
+// device specific modules are present. The exact load order can be seen in
+// libhardware/hardware.c
+//
+// The format of the name is audio.<type>.<hardware/etc>.so where the only
+// required type is 'primary'. Other possibilites are 'a2dp', 'usb', etc.
+cc_library_shared {
+    name: "audio.primary.default",
+    relative_install_path: "hw",
+    srcs: ["audio_hw.c"],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+    ],
+    cflags: ["-Wno-unused-parameter"],
+}
+
+// The stub audio HAL module, identical to the default audio hal, but with
+// different name to be loaded concurrently with other audio HALs if necessary.
+// This can also be used as skeleton for new implementations
+//
+// The format of the name is audio.<type>.<hardware/etc>.so where the only
+// required type is 'primary'. Other possibilites are 'a2dp', 'usb', etc.
+cc_library_shared {
+    name: "audio.stub.default",
+    relative_install_path: "hw",
+    srcs: ["audio_hw.c"],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+    ],
+    cflags: ["-Wno-unused-parameter"],
+}
+
+// The stub audio policy HAL module that can be used as a skeleton for
+// new implementations.
+cc_library_shared {
+    name: "audio_policy.stub",
+    relative_install_path: "hw",
+    srcs: ["audio_policy.c"],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+    ],
+    cflags: ["-Wno-unused-parameter"],
+}
diff --git a/modules/audio/Android.mk b/modules/audio/Android.mk
deleted file mode 100644
index ef4b8f5..0000000
--- a/modules/audio/Android.mk
+++ /dev/null
@@ -1,62 +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)
-
-# The default audio HAL module, which is a stub, that is loaded if no other
-# device specific modules are present. The exact load order can be seen in
-# libhardware/hardware.c
-#
-# The format of the name is audio.<type>.<hardware/etc>.so where the only
-# required type is 'primary'. Other possibilites are 'a2dp', 'usb', etc.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := audio.primary.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := audio_hw.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Wno-unused-parameter
-
-include $(BUILD_SHARED_LIBRARY)
-
-# The stub audio HAL module, identical to the default audio hal, but with
-# different name to be loaded concurrently with other audio HALs if necessary.
-# This can also be used as skeleton for new implementations
-#
-# The format of the name is audio.<type>.<hardware/etc>.so where the only
-# required type is 'primary'. Other possibilites are 'a2dp', 'usb', etc.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := audio.stub.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := audio_hw.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Wno-unused-parameter
-
-include $(BUILD_SHARED_LIBRARY)
-
-# The stub audio policy HAL module that can be used as a skeleton for
-# new implementations.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := audio_policy.stub
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := audio_policy.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Wno-unused-parameter
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/consumerir/Android.bp b/modules/consumerir/Android.bp
new file mode 100644
index 0000000..bbce6b1
--- /dev/null
+++ b/modules/consumerir/Android.bp
@@ -0,0 +1,23 @@
+// Copyright (C) 2013 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: "consumerir.default",
+    relative_install_path: "hw",
+    srcs: ["consumerir.c"],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+    ],
+}
diff --git a/modules/consumerir/Android.mk b/modules/consumerir/Android.mk
deleted file mode 100644
index b881572..0000000
--- a/modules/consumerir/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2013 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 := consumerir.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := consumerir.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/fingerprint/Android.bp b/modules/fingerprint/Android.bp
new file mode 100644
index 0000000..a66f9f9
--- /dev/null
+++ b/modules/fingerprint/Android.bp
@@ -0,0 +1,20 @@
+// Copyright (C) 2013 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: "fingerprint.default",
+    relative_install_path: "hw",
+    srcs: ["fingerprint.c"],
+    shared_libs: ["liblog"],
+}
diff --git a/modules/fingerprint/Android.mk b/modules/fingerprint/Android.mk
deleted file mode 100644
index 58c0a83..0000000
--- a/modules/fingerprint/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2013 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 := fingerprint.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := fingerprint.c
-LOCAL_SHARED_LIBRARIES := liblog
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/local_time/Android.bp b/modules/local_time/Android.bp
new file mode 100644
index 0000000..df32325
--- /dev/null
+++ b/modules/local_time/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.
+
+// The default local time HAL module.  The default module simply uses the
+// system's clock_gettime(CLOCK_MONOTONIC) and does not support HW slewing.
+// Devices which use the default implementation should take care to ensure that
+// the oscillator backing the CLOCK_MONOTONIC implementation is phase locked to
+// the audio and video output hardware.  This default implementation is loaded
+// if no other device specific modules are present. The exact load order can be
+// seen in libhardware/hardware.c
+//
+// The format of the name is local_time.<hardware>.so
+cc_library_shared {
+    name: "local_time.default",
+    relative_install_path: "hw",
+    srcs: ["local_time_hw.c"],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+    ],
+}
diff --git a/modules/local_time/Android.mk b/modules/local_time/Android.mk
deleted file mode 100644
index 91885aa..0000000
--- a/modules/local_time/Android.mk
+++ /dev/null
@@ -1,34 +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)
-
-# The default local time HAL module.  The default module simply uses the
-# system's clock_gettime(CLOCK_MONOTONIC) and does not support HW slewing.
-# Devices which use the default implementation should take care to ensure that
-# the oscillator backing the CLOCK_MONOTONIC implementation is phase locked to
-# the audio and video output hardware.  This default implementation is loaded
-# if no other device specific modules are present. The exact load order can be
-# seen in libhardware/hardware.c
-#
-# The format of the name is local_time.<hardware>.so
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := local_time.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := local_time_hw.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/nfc-nci/Android.bp b/modules/nfc-nci/Android.bp
new file mode 100644
index 0000000..fc73761
--- /dev/null
+++ b/modules/nfc-nci/Android.bp
@@ -0,0 +1,23 @@
+// 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.
+
+cc_library_shared {
+    name: "nfc_nci.default",
+    relative_install_path: "hw",
+    srcs: ["nfc_nci_example.c"],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+    ],
+}
diff --git a/modules/nfc-nci/Android.mk b/modules/nfc-nci/Android.mk
deleted file mode 100644
index c1f679a..0000000
--- a/modules/nfc-nci/Android.mk
+++ /dev/null
@@ -1,25 +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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := nfc_nci.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := nfc_nci_example.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/nfc/Android.bp b/modules/nfc/Android.bp
new file mode 100644
index 0000000..bd93bb5
--- /dev/null
+++ b/modules/nfc/Android.bp
@@ -0,0 +1,23 @@
+// 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.
+
+cc_library_shared {
+    name: "nfc.default",
+    relative_install_path: "hw",
+    srcs: ["nfc_pn544_example.c"],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+    ],
+}
diff --git a/modules/nfc/Android.mk b/modules/nfc/Android.mk
deleted file mode 100644
index 29b239c..0000000
--- a/modules/nfc/Android.mk
+++ /dev/null
@@ -1,25 +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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := nfc.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := nfc_pn544_example.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/power/Android.bp b/modules/power/Android.bp
new file mode 100644
index 0000000..2b86c8b
--- /dev/null
+++ b/modules/power/Android.bp
@@ -0,0 +1,20 @@
+// 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.
+
+cc_library_shared {
+    name: "power.default",
+    relative_install_path: "hw",
+    srcs: ["power.c"],
+    shared_libs: ["liblog"],
+}
diff --git a/modules/power/Android.mk b/modules/power/Android.mk
deleted file mode 100644
index c868ded..0000000
--- a/modules/power/Android.mk
+++ /dev/null
@@ -1,25 +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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := power.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := power.c
-LOCAL_SHARED_LIBRARIES := liblog
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/tv_input/Android.bp b/modules/tv_input/Android.bp
new file mode 100644
index 0000000..beac132
--- /dev/null
+++ b/modules/tv_input/Android.bp
@@ -0,0 +1,23 @@
+// Copyright (C) 2014 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: "tv_input.default",
+    relative_install_path: "hw",
+    shared_libs: [
+        "libcutils",
+        "liblog",
+    ],
+    srcs: ["tv_input.cpp"],
+}
diff --git a/modules/tv_input/Android.mk b/modules/tv_input/Android.mk
deleted file mode 100644
index e8aa7fc..0000000
--- a/modules/tv_input/Android.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (C) 2014 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_RELATIVE_PATH := hw
-LOCAL_SHARED_LIBRARIES := libcutils liblog
-LOCAL_SRC_FILES := tv_input.cpp
-LOCAL_MODULE := tv_input.default
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/vibrator/Android.bp b/modules/vibrator/Android.bp
new file mode 100644
index 0000000..f9afd45
--- /dev/null
+++ b/modules/vibrator/Android.bp
@@ -0,0 +1,24 @@
+// 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: "vibrator.default",
+
+    // HAL module implementation stored in
+    // hw/<VIBRATOR_HARDWARE_MODULE_ID>.default.so
+    relative_install_path: "hw",
+    include_dirs: ["hardware/libhardware"],
+    srcs: ["vibrator.c"],
+    shared_libs: ["liblog"],
+}
diff --git a/modules/vibrator/Android.mk b/modules/vibrator/Android.mk
deleted file mode 100644
index b6b480c..0000000
--- a/modules/vibrator/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 := vibrator.default
-
-# HAL module implementation stored in
-# hw/<VIBRATOR_HARDWARE_MODULE_ID>.default.so
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_C_INCLUDES := hardware/libhardware
-LOCAL_SRC_FILES := vibrator.c
-LOCAL_SHARED_LIBRARIES := liblog
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/tests/fingerprint/Android.bp b/tests/fingerprint/Android.bp
new file mode 100644
index 0000000..7de3dee
--- /dev/null
+++ b/tests/fingerprint/Android.bp
@@ -0,0 +1,14 @@
+cc_test {
+    name: "fingerprint_tests",
+    srcs: ["fingerprint_tests.cpp"],
+
+    shared_libs: [
+        "liblog",
+        "libhardware",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Wextra",
+    ],
+}
diff --git a/tests/fingerprint/Android.mk b/tests/fingerprint/Android.mk
deleted file mode 100644
index 4f03c39..0000000
--- a/tests/fingerprint/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
-    fingerprint_tests.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
-    liblog \
-    libhardware \
-
-#LOCAL_C_INCLUDES += \
-#    system/media/camera/include \
-
-LOCAL_CFLAGS += -Wall -Wextra
-
-LOCAL_MODULE:= fingerprint_tests
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_NATIVE_TEST)
diff --git a/tests/hardware/Android.bp b/tests/hardware/Android.bp
new file mode 100644
index 0000000..668e28f
--- /dev/null
+++ b/tests/hardware/Android.bp
@@ -0,0 +1,15 @@
+cc_library_static {
+    name: "static-hal-check",
+    srcs: [
+        "struct-size.cpp",
+        "struct-offset.cpp",
+        "struct-last.cpp",
+    ],
+    shared_libs: ["libhardware"],
+    cflags: [
+        "-std=gnu++11",
+        "-O0",
+    ],
+
+    include_dirs: ["system/media/camera/include"],
+}
diff --git a/tests/hardware/Android.mk b/tests/hardware/Android.mk
deleted file mode 100644
index 02540c9..0000000
--- a/tests/hardware/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := static-hal-check
-LOCAL_SRC_FILES := struct-size.cpp struct-offset.cpp struct-last.cpp
-LOCAL_SHARED_LIBRARIES := libhardware
-LOCAL_CFLAGS := -std=gnu++11 -O0
-
-LOCAL_C_INCLUDES += \
-    system/media/camera/include
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/tests/nusensors/Android.bp b/tests/nusensors/Android.bp
new file mode 100644
index 0000000..e923468
--- /dev/null
+++ b/tests/nusensors/Android.bp
@@ -0,0 +1,10 @@
+cc_binary {
+    name: "test-nusensors",
+
+    srcs: ["nusensors.cpp"],
+
+    shared_libs: [
+        "libcutils",
+        "libhardware",
+    ],
+}
diff --git a/tests/nusensors/Android.mk b/tests/nusensors/Android.mk
deleted file mode 100644
index ef49096..0000000
--- a/tests/nusensors/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
-	nusensors.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-	libcutils libhardware
-
-LOCAL_MODULE:= test-nusensors
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)