Merge "Convert to Soong" am: acbd94d76f am: b1005a8a2a
am: d00c851e55

Change-Id: I889b5d31535d927b3aa9cf5ad6af955ca0678356
diff --git a/apct-tests/perftests/core/Android.mk b/apct-tests/perftests/core/Android.mk
index b5a76cf..77bacbe 100644
--- a/apct-tests/perftests/core/Android.mk
+++ b/apct-tests/perftests/core/Android.mk
@@ -27,5 +27,3 @@
 LOCAL_COMPATIBILITY_SUITE += device-tests
 
 include $(BUILD_PACKAGE)
-
-include $(call all-makefiles-under, $(LOCAL_PATH))
diff --git a/apct-tests/perftests/core/jni/Android.bp b/apct-tests/perftests/core/jni/Android.bp
new file mode 100644
index 0000000..4c0f2aa
--- /dev/null
+++ b/apct-tests/perftests/core/jni/Android.bp
@@ -0,0 +1,13 @@
+cc_library_shared {
+    name: "libperftestscore_jni",
+    sdk_version: "21",
+
+    srcs: ["SystemPerfTest.cpp"],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wunused",
+        "-Wunreachable-code",
+    ],
+}
diff --git a/apct-tests/perftests/core/jni/Android.mk b/apct-tests/perftests/core/jni/Android.mk
deleted file mode 100644
index d4c3f1e..0000000
--- a/apct-tests/perftests/core/jni/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_SDK_VERSION := 21
-
-LOCAL_SRC_FILES:= \
-    SystemPerfTest.cpp \
-
-LOCAL_C_INCLUDES += \
-    $(JNI_H_INCLUDE)
-
-LOCAL_MODULE := libperftestscore_jni
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/cmds/idmap/Android.bp b/cmds/idmap/Android.bp
new file mode 100644
index 0000000..ae5d74a
--- /dev/null
+++ b/cmds/idmap/Android.bp
@@ -0,0 +1,38 @@
+// 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_binary {
+    name: "idmap",
+
+    srcs: [
+        "idmap.cpp",
+        "create.cpp",
+        "scan.cpp",
+        "inspect.cpp",
+    ],
+
+    shared_libs: [
+        "liblog",
+        "libutils",
+        "libandroidfw",
+        "libcutils",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wunused",
+        "-Wunreachable-code",
+    ],
+}
diff --git a/cmds/idmap/Android.mk b/cmds/idmap/Android.mk
deleted file mode 100644
index aeb8a0c..0000000
--- a/cmds/idmap/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_SRC_FILES := idmap.cpp create.cpp scan.cpp inspect.cpp
-
-LOCAL_SHARED_LIBRARIES := liblog libutils libandroidfw libcutils
-
-LOCAL_MODULE := idmap
-
-LOCAL_C_INCLUDES := external/zlib
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
-
-include $(BUILD_EXECUTABLE)
diff --git a/core/tests/coretests/apks/install_jni_lib/Android.bp b/core/tests/coretests/apks/install_jni_lib/Android.bp
new file mode 100644
index 0000000..c1a6bd0
--- /dev/null
+++ b/core/tests/coretests/apks/install_jni_lib/Android.bp
@@ -0,0 +1,26 @@
+// 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_test_library {
+    name: "libframeworks_coretests_jni",
+
+    srcs: ["com_android_frameworks_coretests_JNITest.cpp"],
+
+    sdk_version: "16",
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+}
diff --git a/core/tests/coretests/apks/install_jni_lib/Android.mk b/core/tests/coretests/apks/install_jni_lib/Android.mk
deleted file mode 100644
index d7b38e8..0000000
--- a/core/tests/coretests/apks/install_jni_lib/Android.mk
+++ /dev/null
@@ -1,37 +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_SRC_FILES := \
-    com_android_frameworks_coretests_JNITest.cpp
-
-LOCAL_SDK_VERSION := 16
-
-LOCAL_CFLAGS += -Wall -Werror
-
-LOCAL_MODULE := libframeworks_coretests_jni
-
-# this does not prevent build system
-# from installing library to /system/lib
-LOCAL_MODULE_TAGS := tests
-
-# .. we want to avoid that... so we put it somewhere
-# bionic linker cant find it without outside help (nativetests):
-LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
-LOCAL_MODULE_PATH_64 := $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/core/tests/hosttests/test-apps/SharedUid/32/Android.mk b/core/tests/hosttests/test-apps/SharedUid/32/Android.mk
index e141bbe..7b44f9e 100644
--- a/core/tests/hosttests/test-apps/SharedUid/32/Android.mk
+++ b/core/tests/hosttests/test-apps/SharedUid/32/Android.mk
@@ -36,8 +36,3 @@
 
 LOCAL_SDK_VERSION := current
 include $(BUILD_PACKAGE)
-
-# ============================================================
-
-# Also build all of the sub-targets under this one: the shared library.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/core/tests/hosttests/test-apps/SharedUid/32/jni/Android.bp b/core/tests/hosttests/test-apps/SharedUid/32/jni/Android.bp
new file mode 100644
index 0000000..6db0ba5
--- /dev/null
+++ b/core/tests/hosttests/test-apps/SharedUid/32/jni/Android.bp
@@ -0,0 +1,38 @@
+//
+// 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.
+//
+
+// This makefile supplies the rules for building a library of JNI code for
+// use by our example of how to bundle a shared library with an APK.
+
+cc_test_library {
+
+    // This is the target being built.
+    name: "libpmtest32",
+    compile_multilib: "32",
+
+    // All of the source files that we will compile.
+    srcs: ["native.cpp"],
+
+    shared_libs: ["liblog"],
+
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+    ],
+
+    sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/SharedUid/32/jni/Android.mk b/core/tests/hosttests/test-apps/SharedUid/32/jni/Android.mk
deleted file mode 100644
index 9b9e811..0000000
--- a/core/tests/hosttests/test-apps/SharedUid/32/jni/Android.mk
+++ /dev/null
@@ -1,38 +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.
-#
-
-# This makefile supplies the rules for building a library of JNI code for
-# use by our example of how to bundle a shared library with an APK.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# This is the target being built.
-LOCAL_MODULE:= libpmtest32
-LOCAL_MULTILIB := 32
-LOCAL_MODULE_TAGS := tests
-
-# All of the source files that we will compile.
-LOCAL_SRC_FILES:= \
-  native.cpp
-
-LOCAL_LDLIBS := -llog
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/core/tests/hosttests/test-apps/SharedUid/64/Android.mk b/core/tests/hosttests/test-apps/SharedUid/64/Android.mk
index 4f24f33..cc088c1a 100644
--- a/core/tests/hosttests/test-apps/SharedUid/64/Android.mk
+++ b/core/tests/hosttests/test-apps/SharedUid/64/Android.mk
@@ -36,8 +36,3 @@
 
 LOCAL_SDK_VERSION := current
 include $(BUILD_PACKAGE)
-
-# ============================================================
-
-# Also build all of the sub-targets under this one: the shared library.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/core/tests/hosttests/test-apps/SharedUid/64/jni/Android.bp b/core/tests/hosttests/test-apps/SharedUid/64/jni/Android.bp
new file mode 100644
index 0000000..582f2a7
--- /dev/null
+++ b/core/tests/hosttests/test-apps/SharedUid/64/jni/Android.bp
@@ -0,0 +1,37 @@
+//
+// 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.
+//
+
+// This Android.bp supplies the rules for building a library of JNI code for
+// use by our example of how to bundle a shared library with an APK.
+
+cc_test_library {
+    // This is the target being built.
+    name: "libpmtest64",
+    compile_multilib: "64",
+
+    // All of the source files that we will compile.
+    srcs: ["native.cpp"],
+
+    shared_libs: ["liblog"],
+
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+    ],
+
+    sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/SharedUid/64/jni/Android.mk b/core/tests/hosttests/test-apps/SharedUid/64/jni/Android.mk
deleted file mode 100644
index 600a5d1..0000000
--- a/core/tests/hosttests/test-apps/SharedUid/64/jni/Android.mk
+++ /dev/null
@@ -1,39 +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.
-#
-
-# This makefile supplies the rules for building a library of JNI code for
-# use by our example of how to bundle a shared library with an APK.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# This is the target being built.
-LOCAL_MODULE:= libpmtest64
-LOCAL_MULTILIB := 64
-LOCAL_MODULE_TAGS := tests
-
-
-# All of the source files that we will compile.
-LOCAL_SRC_FILES:= \
-  native.cpp
-
-LOCAL_LDLIBS := -llog
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/core/tests/hosttests/test-apps/SharedUid/dual/Android.mk b/core/tests/hosttests/test-apps/SharedUid/dual/Android.mk
index 60af2b9..5bcd078 100644
--- a/core/tests/hosttests/test-apps/SharedUid/dual/Android.mk
+++ b/core/tests/hosttests/test-apps/SharedUid/dual/Android.mk
@@ -56,8 +56,3 @@
 
 LOCAL_SDK_VERSION := current
 include $(BUILD_PACKAGE)
-
-# ============================================================
-
-# Also build all of the sub-targets under this one: the shared library.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/core/tests/hosttests/test-apps/SharedUid/dual/jni/Android.bp b/core/tests/hosttests/test-apps/SharedUid/dual/jni/Android.bp
new file mode 100644
index 0000000..3e043afe
--- /dev/null
+++ b/core/tests/hosttests/test-apps/SharedUid/dual/jni/Android.bp
@@ -0,0 +1,39 @@
+//
+// 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.
+//
+
+// This Android.bp supplies the rules for building a library of JNI code for
+// use by our example of how to bundle a shared library with an APK.
+
+cc_test_library {
+
+    // This is the target being built.
+    name: "libpmtestdual",
+    compile_multilib: "both",
+    gtest: false,
+
+    // All of the source files that we will compile.
+    srcs: ["native.cpp"],
+
+    shared_libs: ["liblog"],
+
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+    ],
+
+    sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/SharedUid/dual/jni/Android.mk b/core/tests/hosttests/test-apps/SharedUid/dual/jni/Android.mk
deleted file mode 100644
index 8e9ac6b..0000000
--- a/core/tests/hosttests/test-apps/SharedUid/dual/jni/Android.mk
+++ /dev/null
@@ -1,38 +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.
-#
-
-# This makefile supplies the rules for building a library of JNI code for
-# use by our example of how to bundle a shared library with an APK.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# This is the target being built.
-LOCAL_MODULE:= libpmtestdual
-LOCAL_MULTILIB := both
-LOCAL_MODULE_TAGS := tests
-
-# All of the source files that we will compile.
-LOCAL_SRC_FILES:= \
-  native.cpp
-
-LOCAL_LDLIBS = -llog
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/drm/jni/Android.bp b/drm/jni/Android.bp
new file mode 100644
index 0000000..1e33f0e
--- /dev/null
+++ b/drm/jni/Android.bp
@@ -0,0 +1,38 @@
+//
+// Copyright (C) 2010 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: "libdrmframework_jni",
+
+    srcs: ["android_drm_DrmManagerClient.cpp"],
+
+    shared_libs: [
+        "libdrmframework",
+        "liblog",
+        "libutils",
+        "libandroid_runtime",
+        "libnativehelper",
+        "libbinder",
+        "libdl",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wunused",
+        "-Wunreachable-code",
+    ],
+}
diff --git a/drm/jni/Android.mk b/drm/jni/Android.mk
deleted file mode 100644
index d0797a9..0000000
--- a/drm/jni/Android.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Copyright (C) 2010 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_SRC_FILES:= \
-    android_drm_DrmManagerClient.cpp
-
-LOCAL_MODULE:= libdrmframework_jni
-
-LOCAL_SHARED_LIBRARIES := \
-    libdrmframework \
-    liblog \
-    libutils \
-    libandroid_runtime \
-    libnativehelper \
-    libbinder \
-    libdl
-
-LOCAL_STATIC_LIBRARIES :=
-
-LOCAL_C_INCLUDES += \
-    $(JNI_H_INCLUDE) \
-    $(TOP)/frameworks/av/drm/libdrmframework/include \
-    $(TOP)/frameworks/av/drm/libdrmframework/plugins/common/include \
-    $(TOP)/frameworks/av/include \
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/libs/androidfw/Android.bp b/libs/androidfw/Android.bp
index 70d5216..e39926b 100644
--- a/libs/androidfw/Android.bp
+++ b/libs/androidfw/Android.bp
@@ -57,6 +57,7 @@
         "ZipUtils.cpp",
     ],
     export_include_dirs: ["include"],
+    export_shared_lib_headers: ["libz"],
     target: {
         android: {
             srcs: [
diff --git a/media/mca/filterfw/Android.bp b/media/mca/filterfw/Android.bp
new file mode 100644
index 0000000..71899cf
--- /dev/null
+++ b/media/mca/filterfw/Android.bp
@@ -0,0 +1,73 @@
+// 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: "libfilterfw",
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+
+    whole_static_libs: [
+        "libfilterfw_jni",
+        "libfilterfw_native",
+    ],
+
+    shared_libs: [
+        "libGLESv2",
+        "libEGL",
+        "libgui",
+        "libdl",
+        "libcutils",
+        "libutils",
+        "liblog",
+        "libandroid",
+        "libjnigraphics",
+        "libmedia",
+    ],
+}
+
+cc_library_static {
+    name: "libfilterfw_jni",
+
+    srcs: [
+        "jni/jni_init.cpp",
+        "jni/jni_gl_environment.cpp",
+        "jni/jni_gl_frame.cpp",
+        "jni/jni_native_buffer.cpp",
+        "jni/jni_native_frame.cpp",
+        "jni/jni_native_program.cpp",
+        "jni/jni_shader_program.cpp",
+        "jni/jni_util.cpp",
+        "jni/jni_vertex_frame.cpp",
+    ],
+
+    local_include_dirs: ["native"],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wunused",
+        "-Wunreachable-code",
+        "-Wno-unused-parameter",
+    ],
+
+    shared_libs: [
+        "libmedia",
+        "libgui",
+        "libandroid",
+    ],
+}
diff --git a/media/mca/filterfw/Android.mk b/media/mca/filterfw/Android.mk
deleted file mode 100644
index 37f1e13..0000000
--- a/media/mca/filterfw/Android.mk
+++ /dev/null
@@ -1,48 +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.
-#
-
-#####################
-# Build native sublibraries
-
-include $(all-subdir-makefiles)
-
-#####################
-# Build main libfilterfw
-
-include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_MODULE := libfilterfw
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_WHOLE_STATIC_LIBRARIES := libfilterfw_jni \
-                                libfilterfw_native
-
-LOCAL_SHARED_LIBRARIES := \
-                          libGLESv2 \
-                          libEGL \
-                          libgui \
-                          libdl \
-                          libcutils \
-                          libutils \
-                          liblog \
-                          libandroid \
-                          libjnigraphics \
-                          libmedia
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/media/mca/filterfw/jni/Android.mk b/media/mca/filterfw/jni/Android.mk
deleted file mode 100644
index 9842e70..0000000
--- a/media/mca/filterfw/jni/Android.mk
+++ /dev/null
@@ -1,48 +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)
-
-#####################
-# Build module libfilterfw_jni
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE    = libfilterfw_jni
-
-LOCAL_SRC_FILES = jni_init.cpp \
-                  jni_gl_environment.cpp \
-                  jni_gl_frame.cpp \
-                  jni_native_buffer.cpp \
-                  jni_native_frame.cpp \
-                  jni_native_program.cpp \
-                  jni_shader_program.cpp \
-                  jni_util.cpp \
-                  jni_vertex_frame.cpp
-
-# Need FilterFW lib
-include $(LOCAL_PATH)/../native/libfilterfw.mk
-
-# Also need the JNI headers.
-LOCAL_C_INCLUDES += \
-    $(JNI_H_INCLUDE) \
-    $(LOCAL_PATH)/..
-
-LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code -Wno-unused-parameter
-
-LOCAL_SHARED_LIBRARIES := libmedia libgui libandroid
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/media/mca/filterfw/native/Android.bp b/media/mca/filterfw/native/Android.bp
new file mode 100644
index 0000000..7a8a6a1
--- /dev/null
+++ b/media/mca/filterfw/native/Android.bp
@@ -0,0 +1,43 @@
+// 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.
+//
+
+//####################
+// Build module libfilterfw_static
+
+cc_library_static {
+    name: "libfilterfw_native",
+
+    srcs: [
+        "core/geometry.cpp",
+        "core/gl_env.cpp",
+        "core/gl_frame.cpp",
+        "core/native_frame.cpp",
+        "core/native_program.cpp",
+        "core/shader_program.cpp",
+        "core/vertex_frame.cpp",
+        "core/value.cpp",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wunused",
+        "-Wunreachable-code",
+    ],
+
+    static_libs: ["libarect"],
+
+    shared_libs: ["libgui"],
+}
diff --git a/media/mca/filterfw/native/Android.mk b/media/mca/filterfw/native/Android.mk
deleted file mode 100644
index feaefcb..0000000
--- a/media/mca/filterfw/native/Android.mk
+++ /dev/null
@@ -1,52 +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)
-
-#####################
-# Build module libfilterfw_static
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := libfilterfw_native
-
-LOCAL_SRC_FILES += core/geometry.cpp \
-                   core/gl_env.cpp \
-                   core/gl_frame.cpp \
-                   core/native_frame.cpp \
-                   core/native_program.cpp \
-                   core/shader_program.cpp \
-                   core/vertex_frame.cpp \
-                   core/value.cpp
-
-# add local includes
-include $(LOCAL_PATH)/libfilterfw.mk
-
-# gcc should always be placed at the end.
-LOCAL_EXPORT_LDLIBS := -llog -lgcc
-
-LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
-
-LOCAL_STATIC_LIBRARIES := \
-    libarect \
-
-LOCAL_SHARED_LIBRARIES += \
-    libgui \
-
-# TODO: Build a shared library as well?
-include $(BUILD_STATIC_LIBRARY)
-
diff --git a/media/mca/filterfw/native/libfilterfw.mk b/media/mca/filterfw/native/libfilterfw.mk
deleted file mode 100644
index 69227ce..0000000
--- a/media/mca/filterfw/native/libfilterfw.mk
+++ /dev/null
@@ -1,30 +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.
-#
-
-# Add include paths for native code.
-FFW_PATH := $(call my-dir)
-
-# Uncomment the requirements below, once we need them:
-
-# Neven FaceDetect SDK
-#LOCAL_C_INCLUDES += external/neven/FaceRecEm/common/src/b_FDSDK \
-#	external/neven/FaceRecEm/common/src \
-#	external/neven/Embedded/common/conf \
-#	external/neven/Embedded/common/src \
-#	external/neven/unix/src
-
-# Finally, add this directory
-LOCAL_C_INCLUDES += $(FFW_PATH)
-
diff --git a/media/mca/filterpacks/Android.bp b/media/mca/filterpacks/Android.bp
new file mode 100644
index 0000000..34fb27d
--- /dev/null
+++ b/media/mca/filterpacks/Android.bp
@@ -0,0 +1,58 @@
+// 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_static {
+    name: "libfilterpack_base",
+    srcs: [
+        "native/base/geometry.cpp",
+        "native/base/time_util.cpp",
+    ],
+
+    cflags: [
+        "-DANDROID",
+        "-Wall",
+        "-Werror",
+        "-Wunused",
+        "-Wunreachable-code",
+    ],
+}
+
+cc_library_shared {
+    name: "libfilterpack_imageproc",
+
+    srcs: [
+        "native/imageproc/brightness.c",
+        "native/imageproc/contrast.c",
+        "native/imageproc/invert.c",
+        "native/imageproc/to_rgba.c",
+    ],
+
+    shared_libs: [
+        "liblog",
+        "libutils",
+        "libfilterfw",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wunused",
+        "-Wunreachable-code",
+
+        // Bug: http://b/29823425 Disable constant-conversion warning triggered in
+        // native/imageproc/to_rgba.c
+        "-Wno-constant-conversion",
+    ],
+}
diff --git a/media/mca/filterpacks/Android.mk b/media/mca/filterpacks/Android.mk
deleted file mode 100644
index d89b1e9..0000000
--- a/media/mca/filterpacks/Android.mk
+++ /dev/null
@@ -1,57 +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)
-
-##
-# base
-##
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := libfilterpack_base
-LOCAL_SRC_FILES := native/base/geometry.cpp \
-                   native/base/time_util.cpp
-
-LOCAL_CFLAGS := -DANDROID
-
-LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
-
-include $(BUILD_STATIC_LIBRARY)
-
-##
-# filterpack_imageproc
-##
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := libfilterpack_imageproc
-
-LOCAL_SRC_FILES += native/imageproc/brightness.c \
-                   native/imageproc/contrast.c \
-                   native/imageproc/invert.c \
-                   native/imageproc/to_rgba.c
-
-LOCAL_SHARED_LIBRARIES := liblog libutils libfilterfw
-
-LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
-
-# Bug: http://b/29823425 Disable constant-conversion warning triggered in
-# native/imageproc/to_rgba.c
-LOCAL_CFLAGS += -Wno-constant-conversion
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/media/tests/audiotests/Android.bp b/media/tests/audiotests/Android.bp
new file mode 100644
index 0000000..8ef7694
--- /dev/null
+++ b/media/tests/audiotests/Android.bp
@@ -0,0 +1,24 @@
+cc_test {
+    name: "shared_mem_test",
+    gtest: false,
+
+    srcs: ["shared_mem_test.cpp"],
+
+    shared_libs: [
+        "liblog",
+        "libcutils",
+        "libutils",
+        "libbinder",
+        "libhardware_legacy",
+        "libmedia",
+        "libaudioclient",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-error=deprecated-declarations",
+        "-Wunused",
+        "-Wunreachable-code",
+    ],
+}
diff --git a/media/tests/audiotests/Android.mk b/media/tests/audiotests/Android.mk
deleted file mode 100644
index 01e42bd..0000000
--- a/media/tests/audiotests/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= shared_mem_test
-
-LOCAL_SRC_FILES := \
-    shared_mem_test.cpp
-
-LOCAL_SHARED_LIBRARIES :=  \
-    libc \
-    liblog \
-    libcutils \
-    libutils \
-    libbinder \
-    libhardware_legacy \
-    libmedia \
-    libaudioclient \
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_CFLAGS += -Wall -Werror -Wno-error=deprecated-declarations -Wunused -Wunreachable-code
-
-include $(BUILD_EXECUTABLE)
diff --git a/native/webview/Android.mk b/native/webview/Android.mk
deleted file mode 100644
index a2a93d7..0000000
--- a/native/webview/Android.mk
+++ /dev/null
@@ -1,19 +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.
-#
-
-# Include all the makefiles for subdirectories.
-include $(call all-subdir-makefiles)
-
diff --git a/native/webview/loader/Android.bp b/native/webview/loader/Android.bp
new file mode 100644
index 0000000..0ba256f
--- /dev/null
+++ b/native/webview/loader/Android.bp
@@ -0,0 +1,32 @@
+//
+// 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.
+
+// This package provides the system interfaces required to load WebView.
+
+// Loader library which handles address space reservation and relro sharing.
+// Does NOT link any native chromium code.
+cc_library_shared {
+    name: "libwebviewchromium_loader",
+
+    srcs: ["loader.cpp"],
+
+    cflags: ["-Werror"],
+
+    shared_libs: [
+        "libdl",
+        "liblog",
+        "libnativeloader",
+    ],
+}
diff --git a/native/webview/loader/Android.mk b/native/webview/loader/Android.mk
deleted file mode 100644
index e8a7d97..0000000
--- a/native/webview/loader/Android.mk
+++ /dev/null
@@ -1,40 +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.
-
-# This package provides the system interfaces required to load WebView.
-
-LOCAL_PATH := $(call my-dir)
-
-# Loader library which handles address space reservation and relro sharing.
-# Does NOT link any native chromium code.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= libwebviewchromium_loader
-
-LOCAL_SRC_FILES := \
-        loader.cpp \
-
-LOCAL_CFLAGS := \
-        -Werror \
-
-LOCAL_SHARED_LIBRARIES += \
-        libdl \
-        liblog \
-        libnativeloader \
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/packages/CtsShim/build/jni/Android.bp b/packages/CtsShim/build/jni/Android.bp
new file mode 100644
index 0000000..ea15b43
--- /dev/null
+++ b/packages/CtsShim/build/jni/Android.bp
@@ -0,0 +1,21 @@
+//
+// 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_library_shared {
+    name: "libshim_jni",
+    srcs: ["Shim.c"],
+    sdk_version: "24",
+}
diff --git a/packages/CtsShim/build/jni/Android.mk b/packages/CtsShim/build/jni/Android.mk
deleted file mode 100644
index 968fc0b..0000000
--- a/packages/CtsShim/build/jni/Android.mk
+++ /dev/null
@@ -1,27 +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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libshim_jni
-
-LOCAL_SRC_FILES := Shim.c
-
-LOCAL_SDK_VERSION := 24
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/packages/DefaultContainerService/Android.mk b/packages/DefaultContainerService/Android.mk
index 01c8768..10c35c0 100644
--- a/packages/DefaultContainerService/Android.mk
+++ b/packages/DefaultContainerService/Android.mk
@@ -15,5 +15,3 @@
 LOCAL_PRIVILEGED_MODULE := true
 
 include $(BUILD_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/packages/DefaultContainerService/jni/Android.bp b/packages/DefaultContainerService/jni/Android.bp
new file mode 100644
index 0000000..7d7b095
--- /dev/null
+++ b/packages/DefaultContainerService/jni/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2010 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: "libdefcontainer_jni",
+
+    srcs: ["com_android_defcontainer_MeasurementUtils.cpp"],
+
+    shared_libs: [
+        "libnativehelper",
+        "libutils",
+        "liblog",
+    ],
+
+    static_libs: ["libdiskusage"],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wunused",
+        "-Wunreachable-code",
+    ],
+}
diff --git a/packages/DefaultContainerService/jni/Android.mk b/packages/DefaultContainerService/jni/Android.mk
deleted file mode 100644
index 7808ae1..0000000
--- a/packages/DefaultContainerService/jni/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Copyright (C) 2010 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_SRC_FILES := \
-    com_android_defcontainer_MeasurementUtils.cpp
-
-LOCAL_C_INCLUDES += \
-    $(JNI_H_INCLUDES)
-
-LOCAL_SHARED_LIBRARIES := \
-    libnativehelper \
-    libutils \
-    liblog
-
-LOCAL_STATIC_LIBRARIES := \
-    libdiskusage
-
-LOCAL_MODULE := libdefcontainer_jni
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/packages/PrintSpooler/jni/Android.bp b/packages/PrintSpooler/jni/Android.bp
new file mode 100644
index 0000000..789312e
--- /dev/null
+++ b/packages/PrintSpooler/jni/Android.bp
@@ -0,0 +1,18 @@
+cc_library_shared {
+    name: "libprintspooler_jni",
+
+    srcs: ["com_android_printspooler_util_BitmapSerializeUtils.cpp"],
+
+    shared_libs: [
+        "libnativehelper",
+        "libjnigraphics",
+        "liblog",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wunused",
+        "-Wunreachable-code",
+    ],
+}
diff --git a/packages/PrintSpooler/jni/Android.mk b/packages/PrintSpooler/jni/Android.mk
deleted file mode 100644
index 9fd4c84..0000000
--- a/packages/PrintSpooler/jni/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
-    com_android_printspooler_util_BitmapSerializeUtils.cpp \
-
-LOCAL_C_INCLUDES += \
-    $(JNI_H_INCLUDE)
-
-LOCAL_SHARED_LIBRARIES := \
-    libnativehelper \
-    libjnigraphics \
-    liblog
-
-LOCAL_MODULE := libprintspooler_jni
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.bp b/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.bp
new file mode 100644
index 0000000..0b16b0e
--- /dev/null
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.bp
@@ -0,0 +1,41 @@
+// 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_test_library {
+    name: "libsmartcamera_jni",
+
+    sdk_version: "14",
+
+    srcs: [
+        "contrast.cpp",
+        "brightness.cpp",
+        "exposure.cpp",
+        "colorspace.cpp",
+        "histogram.cpp",
+        "frametovalues.cpp",
+        "pixelutils.cpp",
+        "sobeloperator.cpp",
+        "stats_scorer.cpp",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
+
+    stl: "c++_static",
+}
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.mk b/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.mk
deleted file mode 100644
index 6e0d58a..0000000
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.mk
+++ /dev/null
@@ -1,45 +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.
-#
-
-FILTERFW_NATIVE_PATH := $(call my-dir)
-
-
-#
-# Build module libfilterframework
-#
-LOCAL_PATH := $(FILTERFW_NATIVE_PATH)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SDK_VERSION := 14
-
-LOCAL_MODULE := libsmartcamera_jni
-
-LOCAL_SRC_FILES := contrast.cpp \
-                brightness.cpp \
-                exposure.cpp \
-                colorspace.cpp \
-                histogram.cpp \
-                frametovalues.cpp \
-                pixelutils.cpp \
-                sobeloperator.cpp \
-                stats_scorer.cpp
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror -Wno-unused-parameter
-
-LOCAL_NDK_STL_VARIANT := c++_static
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/touchlag/Android.bp b/tests/touchlag/Android.bp
new file mode 100644
index 0000000..2610cb3
--- /dev/null
+++ b/tests/touchlag/Android.bp
@@ -0,0 +1,17 @@
+cc_test {
+    name: "test-touchlag",
+    gtest: false,
+
+    srcs: ["touchlag.cpp"],
+
+    shared_libs: [
+        "libcutils",
+        "libutils",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+    ],
+}
diff --git a/tests/touchlag/Android.mk b/tests/touchlag/Android.mk
deleted file mode 100644
index 70b1989..0000000
--- a/tests/touchlag/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
-	touchlag.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-	libcutils libutils \
-
-LOCAL_MODULE:= test-touchlag
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_EXECUTABLE)
diff --git a/vr/Android.bp b/vr/Android.bp
new file mode 100644
index 0000000..b5904d6
--- /dev/null
+++ b/vr/Android.bp
@@ -0,0 +1,40 @@
+// 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.
+
+// Library to perform dlopen on the actual shared library.
+cc_library_shared {
+    name: "libdvr_loader",
+    owner: "google",
+    srcs: ["dvr_library_loader.cpp"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+}
+
+// Java platform library for vr stuff.
+java_library {
+    name: "com.google.vr.platform",
+    owner: "google",
+    required: [
+        "libdvr_loader",
+        "libdvr",
+    ],
+    srcs: ["java/**/*.java"],
+}
+
+prebuilt_etc_xml {
+    name: "com.google.vr.platform.xml",
+    src: "com.google.vr.platform.xml",
+}
diff --git a/vr/Android.mk b/vr/Android.mk
deleted file mode 100644
index 73e9f23..0000000
--- a/vr/Android.mk
+++ /dev/null
@@ -1,39 +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)
-
-# Library to perform dlopen on the actual shared library.
-include $(CLEAR_VARS)
-LOCAL_MODULE := libdvr_loader
-LOCAL_MODULE_OWNER := google
-LOCAL_SRC_FILES := dvr_library_loader.cpp
-LOCAL_CFLAGS := -Wall -Werror
-include $(BUILD_SHARED_LIBRARY)
-
-# Java platform library for vr stuff.
-include $(CLEAR_VARS)
-LOCAL_MODULE := com.google.vr.platform
-LOCAL_MODULE_OWNER := google
-LOCAL_REQUIRED_MODULES := libdvr_loader libdvr
-LOCAL_SRC_FILES := $(call all-java-files-under, java)
-include $(BUILD_JAVA_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := com.google.vr.platform.xml
-LOCAL_SRC_FILES := com.google.vr.platform.xml
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_OWNER := google
-LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
-include $(BUILD_PREBUILT)