Merge "Move ACTION_DIAL to not forwarded intents section." into qt-dev am: ffd18031b7
am: 3c8d1b1658

Change-Id: I4e70e92c3d905de69fe6c030e706443ae2895d79
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 2513993..2ee426a 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -13,11 +13,17 @@
                       tests/autofillservice/
                       tests/contentcaptureservice/
                       tests/tests/animation/
+                      tests/tests/carrierapi/
                       tests/tests/content/
                       tests/tests/graphics/
                       tests/tests/hardware/
                       tests/tests/preference/
                       tests/tests/print/
+                      tests/tests/telephony/
+                      tests/tests/telephony2/
+                      tests/tests/telephony3/
+                      tests/tests/telephony4/
+                      tests/tests/telephonyprovider/
                       tests/tests/text/
                       tests/tests/theme/
                       tests/tests/transition/
diff --git a/apps/CtsVerifier/Android.bp b/apps/CtsVerifier/Android.bp
new file mode 100644
index 0000000..01c579e
--- /dev/null
+++ b/apps/CtsVerifier/Android.bp
@@ -0,0 +1,4 @@
+filegroup {
+    name: "CtsVerifierMockVrListenerServiceFiles",
+    srcs: ["src/com/android/cts/verifier/vr/MockVrListenerService.java"],
+}
diff --git a/apps/CtsVerifier/jni/Android.mk b/apps/CtsVerifier/jni/Android.mk
deleted file mode 100644
index 4343259..0000000
--- a/apps/CtsVerifier/jni/Android.mk
+++ /dev/null
@@ -1,17 +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.
-#
-
-include $(call all-subdir-makefiles)
diff --git a/apps/CtsVerifier/jni/audio_loopback/Android.bp b/apps/CtsVerifier/jni/audio_loopback/Android.bp
new file mode 100644
index 0000000..9227c75
--- /dev/null
+++ b/apps/CtsVerifier/jni/audio_loopback/Android.bp
@@ -0,0 +1,21 @@
+cc_test_library {
+    name: "libaudioloopback_jni",
+    srcs: [
+        "sles.cpp",
+        "jni_sles.c",
+        "audio_utils/atomic.c",
+        "audio_utils/fifo.c",
+        "audio_utils/roundup.c",
+    ],
+    shared_libs: [
+        "libOpenSLES",
+        "liblog",
+    ],
+    ldflags: ["-Wl,--hash-style=sysv"],
+    cflags: [
+        "-DSTDC_HEADERS",
+        "-Werror",
+        "-Wall",
+    ],
+    sdk_version: "23",
+}
diff --git a/apps/CtsVerifier/jni/audio_loopback/Android.mk b/apps/CtsVerifier/jni/audio_loopback/Android.mk
deleted file mode 100644
index 0223e4f..0000000
--- a/apps/CtsVerifier/jni/audio_loopback/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE      := libaudioloopback_jni
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES   := \
-	sles.cpp \
-	jni_sles.c \
-	audio_utils/atomic.c \
-	audio_utils/fifo.c \
-	audio_utils/roundup.c
-
-LOCAL_SHARED_LIBRARIES := \
-	libOpenSLES \
-	liblog
-
-LOCAL_LDFLAGS := -Wl,--hash-style=sysv
-
-LOCAL_CFLAGS := -DSTDC_HEADERS \
-	-Werror -Wall
-
-LOCAL_SDK_VERSION := 23
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/apps/CtsVerifier/jni/midi/Android.bp b/apps/CtsVerifier/jni/midi/Android.bp
new file mode 100644
index 0000000..4e707eb
--- /dev/null
+++ b/apps/CtsVerifier/jni/midi/Android.bp
@@ -0,0 +1,41 @@
+//
+// Copyright (C) 2018 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: "libctsnativemidi_jni",
+    srcs: [
+        "com_android_cts_verifier_audio_midilib_NativeMidiManager.cpp",
+        "MidiTestManager.cpp",
+    ],
+    include_dirs: [
+        "frameworks/base/media/native/midi/include",
+        "frameworks/av/media/ndk/include",
+        "system/core/include/cutils",
+    ],
+    sdk_version: "current",
+    //stl: "c++_static"
+    stl: "system",
+    shared_libs: [
+        "liblog",
+        "libamidi",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+        "-Wno-unused-variable",
+    ],
+}
diff --git a/apps/CtsVerifier/jni/midi/Android.mk b/apps/CtsVerifier/jni/midi/Android.mk
deleted file mode 100644
index c76f0c7..0000000
--- a/apps/CtsVerifier/jni/midi/Android.mk
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# Copyright (C) 2018 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 := libctsnativemidi_jni
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
-	com_android_cts_verifier_audio_midilib_NativeMidiManager.cpp \
-	MidiTestManager.cpp
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-LOCAL_C_INCLUDES += \
-    frameworks/base/media/native/midi/include \
-    frameworks/av/media/ndk/include \
-    system/core/include/cutils
-
-#LOCAL_CXX_STL := libc++_static
-#LOCAL_NDK_STL_VARIANT := libc++_static
-
-#APP_STL := stlport_static
-#APP_STL := gnustl_static
-
-LOCAL_SDK_VERSION := current
-LOCAL_NDK_STL_VARIANT := system
-
-LOCAL_SHARED_LIBRARIES := liblog libamidi \
-
-LOCAL_CFLAGS := \
-        -Wall -Werror \
-        -Wno-unused-parameter \
-        -Wno-unused-variable \
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/apps/CtsVerifier/jni/verifier/Android.bp b/apps/CtsVerifier/jni/verifier/Android.bp
new file mode 100644
index 0000000..ddd6743
--- /dev/null
+++ b/apps/CtsVerifier/jni/verifier/Android.bp
@@ -0,0 +1,33 @@
+//
+// 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_test_library {
+    name: "libctsverifier_jni",
+    srcs: [
+        "CtsVerifierJniOnLoad.cpp",
+        "com_android_cts_verifier_camera_StatsImage.cpp",
+    ],
+    sdk_version: "current",
+    stl: "system",
+    shared_libs: ["liblog"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+        "-Wno-unused-variable",
+    ],
+
+}
diff --git a/apps/CtsVerifier/jni/verifier/Android.mk b/apps/CtsVerifier/jni/verifier/Android.mk
deleted file mode 100644
index 9ee7eee..0000000
--- a/apps/CtsVerifier/jni/verifier/Android.mk
+++ /dev/null
@@ -1,41 +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_MODULE := libctsverifier_jni
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
-		CtsVerifierJniOnLoad.cpp \
-		com_android_cts_verifier_camera_StatsImage.cpp
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-LOCAL_SDK_VERSION := current
-LOCAL_NDK_STL_VARIANT := system
-
-LOCAL_SHARED_LIBRARIES := liblog \
-
-LOCAL_CFLAGS := \
-        -Wall -Werror \
-        -Wno-unused-parameter \
-        -Wno-unused-variable \
-
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/common/device-side/util-axt/OWNERS b/common/device-side/util-axt/OWNERS
index b7726fc..6c89609 100644
--- a/common/device-side/util-axt/OWNERS
+++ b/common/device-side/util-axt/OWNERS
@@ -1,13 +1,2 @@
-#  Android EngProd Approvers
-guangzhu@google.com
-fdeng@google.com
-moonk@google.com
-jdesprez@google.com
-sbasi@google.com
 
-# Android Partner Eng Approvers
-aaronholden@google.com
-yuji@google.com
-nickrose@google.com
-
-per-file *Android.bp=*
+per-file Android.bp=guangzhu@google.com, fdeng@google.com, moonk@google.com, jdesprez@google.com, aaronholden@google.com, yuji@google.com, nickrose@google.com
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BatteryUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BatteryUtils.java
index b671f5f..4ad538c 100644
--- a/common/device-side/util-axt/src/com/android/compatibility/common/util/BatteryUtils.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BatteryUtils.java
@@ -18,6 +18,8 @@
 import static com.android.compatibility.common.util.SettingsUtils.putGlobalSetting;
 import static com.android.compatibility.common.util.TestUtils.waitUntil;
 
+import android.content.Intent;
+import android.content.IntentFilter;
 import android.content.pm.PackageManager;
 import android.os.BatteryManager;
 import android.os.PowerManager;
@@ -129,6 +131,13 @@
 
     /** @return true if the device supports battery saver. */
     public static boolean isBatterySaverSupported() {
+        final Intent batteryInfo = InstrumentationRegistry.getContext().registerReceiver(
+                null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+        if (!batteryInfo.getBooleanExtra(BatteryManager.EXTRA_PRESENT, true)) {
+            // Devices without battery does not support battery saver.
+            return false;
+        }
+
         final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
         return !(pm.hasSystemFeature(PackageManager.FEATURE_WATCH) ||
             pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE));
diff --git a/common/device-side/util/OWNERS b/common/device-side/util/OWNERS
index b7726fc..6c89609 100644
--- a/common/device-side/util/OWNERS
+++ b/common/device-side/util/OWNERS
@@ -1,13 +1,2 @@
-#  Android EngProd Approvers
-guangzhu@google.com
-fdeng@google.com
-moonk@google.com
-jdesprez@google.com
-sbasi@google.com
 
-# Android Partner Eng Approvers
-aaronholden@google.com
-yuji@google.com
-nickrose@google.com
-
-per-file *Android.bp=*
+per-file Android.bp=guangzhu@google.com, fdeng@google.com, moonk@google.com, jdesprez@google.com, aaronholden@google.com, yuji@google.com, nickrose@google.com
diff --git a/hostsidetests/abioverride/Android.bp b/hostsidetests/abioverride/Android.bp
new file mode 100644
index 0000000..7717acc
--- /dev/null
+++ b/hostsidetests/abioverride/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+java_test_host {
+    name: "CtsAbiOverrideHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    libs: [
+        "compatibility-host-util",
+        "cts-tradefed",
+        "tradefed",
+    ],
+}
diff --git a/hostsidetests/abioverride/Android.mk b/hostsidetests/abioverride/Android.mk
deleted file mode 100644
index 0877b43..0000000
--- a/hostsidetests/abioverride/Android.mk
+++ /dev/null
@@ -1,34 +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_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := CtsAbiOverrideHostTestCases
-
-LOCAL_MODULE_TAGS := tests
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_CTS_TEST_PACKAGE := android.host.abioverride
-
-LOCAL_JAVA_LIBRARIES := compatibility-host-util cts-tradefed tradefed
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/abioverride/app/Android.bp b/hostsidetests/abioverride/app/Android.bp
new file mode 100644
index 0000000..12923c0
--- /dev/null
+++ b/hostsidetests/abioverride/app/Android.bp
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+    name: "CtsAbiOverrideTestApp",
+    defaults: ["cts_defaults"],
+    compile_multilib: "both",
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+    ],
+    jni_libs: ["libctsabioverride"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/abioverride/app/Android.mk b/hostsidetests/abioverride/app/Android.mk
deleted file mode 100755
index d6016dd..0000000
--- a/hostsidetests/abioverride/app/Android.mk
+++ /dev/null
@@ -1,48 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_MULTILIB := both
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-
-
-LOCAL_JNI_SHARED_LIBRARIES := libctsabioverride
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsAbiOverrideTestApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/abioverride/app/jni/Android.bp b/hostsidetests/abioverride/app/jni/Android.bp
new file mode 100644
index 0000000..f3a3f93
--- /dev/null
+++ b/hostsidetests/abioverride/app/jni/Android.bp
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_test_library {
+    name: "libctsabioverride",
+    srcs: ["CtsAbiOverrideJniOnLoad.cpp"],
+    // Ignore unused parameters.
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
+    shared_libs: ["libnativehelper_compat_libc++"],
+    stl: "none",
+    sdk_version: "current",
+}
diff --git a/hostsidetests/abioverride/app/jni/Android.mk b/hostsidetests/abioverride/app/jni/Android.mk
deleted file mode 100644
index e8725bd..0000000
--- a/hostsidetests/abioverride/app/jni/Android.mk
+++ /dev/null
@@ -1,35 +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 := libctsabioverride
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := CtsAbiOverrideJniOnLoad.cpp
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-# Ignore unused parameters.
-LOCAL_CFLAGS += -Wall -Werror -Wno-unused-parameter
-
-LOCAL_SHARED_LIBRARIES := libnativehelper_compat_libc++
-LOCAL_NDK_STL_VARIANT := none
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/hostsidetests/backup/AllowBackup/Android.bp b/hostsidetests/backup/AllowBackup/Android.bp
new file mode 100644
index 0000000..39ce56f
--- /dev/null
+++ b/hostsidetests/backup/AllowBackup/Android.bp
@@ -0,0 +1,23 @@
+// 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.
+
+java_library {
+    name: "CtsAllowBackupLib",
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "androidx.test.rules",
+        "platform-test-annotations",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/AllowBackup/Android.mk b/hostsidetests/backup/AllowBackup/Android.mk
deleted file mode 100644
index b798d87..0000000
--- a/hostsidetests/backup/AllowBackup/Android.mk
+++ /dev/null
@@ -1,15 +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 $(call all-subdir-makefiles)
diff --git a/hostsidetests/backup/AllowBackup/BackupAllowedApp/Android.bp b/hostsidetests/backup/AllowBackup/BackupAllowedApp/Android.bp
new file mode 100644
index 0000000..1f7fb9a4
--- /dev/null
+++ b/hostsidetests/backup/AllowBackup/BackupAllowedApp/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "BackupAllowedApp",
+    defaults: ["cts_defaults"],
+    static_libs: ["CtsAllowBackupLib"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/AllowBackup/BackupAllowedApp/Android.mk b/hostsidetests/backup/AllowBackup/BackupAllowedApp/Android.mk
deleted file mode 100644
index ba164a0..0000000
--- a/hostsidetests/backup/AllowBackup/BackupAllowedApp/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)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := BackupAllowedApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/Android.bp b/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/Android.bp
new file mode 100644
index 0000000..a8e2fa3
--- /dev/null
+++ b/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "BackupNotAllowedApp",
+    defaults: ["cts_defaults"],
+    static_libs: ["CtsAllowBackupLib"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/Android.mk b/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/Android.mk
deleted file mode 100644
index 124afe4..0000000
--- a/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/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)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := BackupNotAllowedApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/Android.bp b/hostsidetests/backup/Android.bp
new file mode 100644
index 0000000..98a36e0
--- /dev/null
+++ b/hostsidetests/backup/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+java_test_host {
+    name: "CtsBackupHostTestCases",
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "arcts",
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+        "truth-prebuilt",
+    ],
+}
diff --git a/hostsidetests/backup/Android.mk b/hostsidetests/backup/Android.mk
deleted file mode 100644
index bbe7d47..0000000
--- a/hostsidetests/backup/Android.mk
+++ /dev/null
@@ -1,32 +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_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := tests
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-LOCAL_MODULE := CtsBackupHostTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util truth-prebuilt
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/backup/FullBackupOnly/Android.bp b/hostsidetests/backup/FullBackupOnly/Android.bp
new file mode 100644
index 0000000..acac2e1
--- /dev/null
+++ b/hostsidetests/backup/FullBackupOnly/Android.bp
@@ -0,0 +1,24 @@
+// 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.
+
+java_library {
+    name: "CtsFullBackupOnlyLib",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "androidx.test.rules",
+        "platform-test-annotations",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/FullBackupOnly/Android.mk b/hostsidetests/backup/FullBackupOnly/Android.mk
deleted file mode 100644
index 521ac4d..0000000
--- a/hostsidetests/backup/FullBackupOnly/Android.mk
+++ /dev/null
@@ -1,17 +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 $(call all-subdir-makefiles)
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/Android.bp b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/Android.bp
new file mode 100644
index 0000000..f14e5d0
--- /dev/null
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "FullBackupOnlyFalseNoAgentApp",
+    defaults: ["cts_defaults"],
+    static_libs: ["CtsFullBackupOnlyLib"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/Android.mk b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/Android.mk
deleted file mode 100644
index a520e78..0000000
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/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)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := FullBackupOnlyFalseNoAgentApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/Android.bp b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/Android.bp
new file mode 100644
index 0000000..01e25ef
--- /dev/null
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "FullBackupOnlyFalseWithAgentApp",
+    defaults: ["cts_defaults"],
+    static_libs: ["CtsFullBackupOnlyLib"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/Android.mk b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/Android.mk
deleted file mode 100644
index 2e6d68f..0000000
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/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)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := FullBackupOnlyFalseWithAgentApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/Android.bp b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/Android.bp
new file mode 100644
index 0000000..8fb4b4b
--- /dev/null
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "FullBackupOnlyTrueWithAgentApp",
+    defaults: ["cts_defaults"],
+    static_libs: ["CtsFullBackupOnlyLib"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/Android.mk b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/Android.mk
deleted file mode 100644
index e1af880..0000000
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/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)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := FullBackupOnlyTrueWithAgentApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/KeyValueApp/Android.bp b/hostsidetests/backup/KeyValueApp/Android.bp
new file mode 100644
index 0000000..8619dd0
--- /dev/null
+++ b/hostsidetests/backup/KeyValueApp/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsKeyValueBackupRestoreApp",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "platform-test-annotations",
+    ],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/KeyValueApp/Android.mk b/hostsidetests/backup/KeyValueApp/Android.mk
deleted file mode 100644
index 7635b63..0000000
--- a/hostsidetests/backup/KeyValueApp/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)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsKeyValueBackupRestoreApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/OtherSoundsSettingsApp/Android.bp b/hostsidetests/backup/OtherSoundsSettingsApp/Android.bp
new file mode 100644
index 0000000..fac14e6
--- /dev/null
+++ b/hostsidetests/backup/OtherSoundsSettingsApp/Android.bp
@@ -0,0 +1,31 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsBackupOtherSoundsSettingsApp",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "platform-test-annotations",
+        "compatibility-device-util-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/backup/OtherSoundsSettingsApp/Android.mk b/hostsidetests/backup/OtherSoundsSettingsApp/Android.mk
deleted file mode 100644
index 2e959f1..0000000
--- a/hostsidetests/backup/OtherSoundsSettingsApp/Android.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (C) 2018 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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    platform-test-annotations \
-    compatibility-device-util-axt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsBackupOtherSoundsSettingsApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
-
-
diff --git a/hostsidetests/backup/ProfileFullBackupApp/Android.bp b/hostsidetests/backup/ProfileFullBackupApp/Android.bp
new file mode 100644
index 0000000..c5d7dd1
--- /dev/null
+++ b/hostsidetests/backup/ProfileFullBackupApp/Android.bp
@@ -0,0 +1,31 @@
+// Copyright (C) 2019 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.
+
+android_test_helper_app {
+    name: "CtsProfileFullBackupApp",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "platform-test-annotations",
+        "truth-prebuilt",
+    ],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/ProfileFullBackupApp/Android.mk b/hostsidetests/backup/ProfileFullBackupApp/Android.mk
deleted file mode 100644
index cbf29f8..0000000
--- a/hostsidetests/backup/ProfileFullBackupApp/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (C) 2019 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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    platform-test-annotations \
-    truth-prebuilt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsProfileFullBackupApp
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/ProfileKeyValueApp/Android.bp b/hostsidetests/backup/ProfileKeyValueApp/Android.bp
new file mode 100644
index 0000000..df6b009
--- /dev/null
+++ b/hostsidetests/backup/ProfileKeyValueApp/Android.bp
@@ -0,0 +1,31 @@
+// Copyright (C) 2019 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.
+
+android_test_helper_app {
+    name: "CtsProfileKeyValueApp",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "platform-test-annotations",
+        "truth-prebuilt",
+    ],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/backup/ProfileKeyValueApp/Android.mk b/hostsidetests/backup/ProfileKeyValueApp/Android.mk
deleted file mode 100644
index 3e543ec..0000000
--- a/hostsidetests/backup/ProfileKeyValueApp/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (C) 2019 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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    platform-test-annotations \
-    truth-prebuilt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsProfileKeyValueApp
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/ProfileSerialNumberApp/Android.bp b/hostsidetests/backup/ProfileSerialNumberApp/Android.bp
new file mode 100644
index 0000000..d8713cc
--- /dev/null
+++ b/hostsidetests/backup/ProfileSerialNumberApp/Android.bp
@@ -0,0 +1,32 @@
+// Copyright (C) 2019 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.
+
+android_test_helper_app {
+    name: "CtsProfileSerialNumberApp",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "platform-test-annotations",
+        "compatibility-device-util-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+    ],
+    // Uncomment when b/78787392 is fixed
+    // sdk_version: "system_test_current",
+    platform_apis: true,
+}
diff --git a/hostsidetests/backup/ProfileSerialNumberApp/Android.mk b/hostsidetests/backup/ProfileSerialNumberApp/Android.mk
deleted file mode 100644
index 0e6e5f7..0000000
--- a/hostsidetests/backup/ProfileSerialNumberApp/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2019 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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules  \
-                               platform-test-annotations  \
-                               compatibility-device-util-axt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts
-
-LOCAL_PACKAGE_NAME := CtsProfileSerialNumberApp
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/RestoreAnyVersion/Android.bp b/hostsidetests/backup/RestoreAnyVersion/Android.bp
new file mode 100644
index 0000000..7ce7333
--- /dev/null
+++ b/hostsidetests/backup/RestoreAnyVersion/Android.bp
@@ -0,0 +1,24 @@
+// 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.
+
+java_library {
+    name: "CtsRestoreAnyVersionLib",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "platform-test-annotations",
+    ],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/RestoreAnyVersion/Android.mk b/hostsidetests/backup/RestoreAnyVersion/Android.mk
deleted file mode 100644
index 521ac4d..0000000
--- a/hostsidetests/backup/RestoreAnyVersion/Android.mk
+++ /dev/null
@@ -1,17 +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 $(call all-subdir-makefiles)
diff --git a/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/Android.bp b/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/Android.bp
new file mode 100644
index 0000000..5f536c3
--- /dev/null
+++ b/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsBackupRestoreAnyVersionAppUpdate",
+    defaults: ["cts_defaults"],
+    static_libs: ["CtsRestoreAnyVersionLib"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/Android.mk b/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/Android.mk
deleted file mode 100644
index c68429c..0000000
--- a/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/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)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsBackupRestoreAnyVersionAppUpdate
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/Android.bp b/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/Android.bp
new file mode 100644
index 0000000..587ffb9
--- /dev/null
+++ b/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsBackupRestoreAnyVersionNoRestoreApp",
+    defaults: ["cts_defaults"],
+    static_libs: ["CtsRestoreAnyVersionLib"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/Android.mk b/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/Android.mk
deleted file mode 100644
index 854c35d..0000000
--- a/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/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)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsBackupRestoreAnyVersionNoRestoreApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/Android.bp b/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/Android.bp
new file mode 100644
index 0000000..c7c63fe
--- /dev/null
+++ b/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsBackupRestoreAnyVersionApp",
+    defaults: ["cts_defaults"],
+    static_libs: ["CtsRestoreAnyVersionLib"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/Android.mk b/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/Android.mk
deleted file mode 100644
index 2606779..0000000
--- a/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/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)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsBackupRestoreAnyVersionApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/SharedPreferencesRestoreApp/Android.bp b/hostsidetests/backup/SharedPreferencesRestoreApp/Android.bp
new file mode 100644
index 0000000..24131cc
--- /dev/null
+++ b/hostsidetests/backup/SharedPreferencesRestoreApp/Android.bp
@@ -0,0 +1,29 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsSharedPreferencesRestoreApp",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "platform-test-annotations",
+    ],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/SharedPreferencesRestoreApp/Android.mk b/hostsidetests/backup/SharedPreferencesRestoreApp/Android.mk
deleted file mode 100644
index d3e6cc3..0000000
--- a/hostsidetests/backup/SharedPreferencesRestoreApp/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)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts
-
-LOCAL_PACKAGE_NAME := CtsSharedPreferencesRestoreApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/SuccessNotificationApp/Android.bp b/hostsidetests/backup/SuccessNotificationApp/Android.bp
new file mode 100644
index 0000000..f4ff7e0
--- /dev/null
+++ b/hostsidetests/backup/SuccessNotificationApp/Android.bp
@@ -0,0 +1,29 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsBackupSuccessNotificationApp",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "platform-test-annotations",
+    ],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/SuccessNotificationApp/Android.mk b/hostsidetests/backup/SuccessNotificationApp/Android.mk
deleted file mode 100644
index bd10a97..0000000
--- a/hostsidetests/backup/SuccessNotificationApp/Android.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright (C) 2018 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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts
-
-LOCAL_PACKAGE_NAME := CtsBackupSuccessNotificationApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/SyncAdapterSettingsApp/Android.bp b/hostsidetests/backup/SyncAdapterSettingsApp/Android.bp
new file mode 100644
index 0000000..290c350
--- /dev/null
+++ b/hostsidetests/backup/SyncAdapterSettingsApp/Android.bp
@@ -0,0 +1,31 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsBackupSyncAdapterSettingsApp",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "platform-test-annotations",
+        "compatibility-device-util-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/backup/SyncAdapterSettingsApp/Android.mk b/hostsidetests/backup/SyncAdapterSettingsApp/Android.mk
deleted file mode 100644
index f256692..0000000
--- a/hostsidetests/backup/SyncAdapterSettingsApp/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (C) 2018 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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-        androidx.test.rules \
-        platform-test-annotations \
-        compatibility-device-util-axt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsBackupSyncAdapterSettingsApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/fullbackupapp/Android.bp b/hostsidetests/backup/fullbackupapp/Android.bp
new file mode 100644
index 0000000..696be0c
--- /dev/null
+++ b/hostsidetests/backup/fullbackupapp/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsFullbackupApp",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "platform-test-annotations",
+    ],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "arcts",
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/fullbackupapp/Android.mk b/hostsidetests/backup/fullbackupapp/Android.mk
deleted file mode 100644
index 0d3f3b1..0000000
--- a/hostsidetests/backup/fullbackupapp/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)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsFullbackupApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/includeexcludeapp/Android.bp b/hostsidetests/backup/includeexcludeapp/Android.bp
new file mode 100644
index 0000000..5093888
--- /dev/null
+++ b/hostsidetests/backup/includeexcludeapp/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsIncludeExcludeApp",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "platform-test-annotations",
+    ],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "arcts",
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/backup/includeexcludeapp/Android.mk b/hostsidetests/backup/includeexcludeapp/Android.mk
deleted file mode 100644
index 166ecae..0000000
--- a/hostsidetests/backup/includeexcludeapp/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)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsIncludeExcludeApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/bootstats/Android.bp b/hostsidetests/bootstats/Android.bp
new file mode 100644
index 0000000..ca1e292
--- /dev/null
+++ b/hostsidetests/bootstats/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+java_test_host {
+    name: "CtsBootStatsTestCases",
+    defaults: ["cts_defaults"],
+    // Only compile source java files in this apk.
+    srcs: ["src/**/*.java"],
+    static_libs: ["framework-protos"],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+        "libprotobuf-java-full",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/bootstats/Android.mk b/hostsidetests/bootstats/Android.mk
deleted file mode 100644
index 87bff19..0000000
--- a/hostsidetests/bootstats/Android.mk
+++ /dev/null
@@ -1,34 +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)
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := CtsBootStatsTestCases
-LOCAL_STATIC_JAVA_LIBRARIES := framework-protos
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util libprotobuf-java-full
-
-LOCAL_CTS_TEST_PACKAGE := android.bootstats
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/compilation/Android.bp b/hostsidetests/compilation/Android.bp
new file mode 100644
index 0000000..f522f7e
--- /dev/null
+++ b/hostsidetests/compilation/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+java_test_host {
+    name: "CtsCompilationTestCases",
+    srcs: ["src/**/*.java"],
+    java_resource_dirs: ["assets/"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+        "guava",
+    ],
+}
diff --git a/hostsidetests/compilation/Android.mk b/hostsidetests/compilation/Android.mk
deleted file mode 100644
index 5a27baf..0000000
--- a/hostsidetests/compilation/Android.mk
+++ /dev/null
@@ -1,36 +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_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_RESOURCE_DIRS := assets/
-
-LOCAL_MODULE_TAGS := tests
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE := CtsCompilationTestCases
-
-LOCAL_MIN_SDK_VERSION := 23
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util guava
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/compilation/app/Android.bp b/hostsidetests/compilation/app/Android.bp
new file mode 100644
index 0000000..f4954c7
--- /dev/null
+++ b/hostsidetests/compilation/app/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsCompilationApp",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/compilation/app/Android.mk b/hostsidetests/compilation/app/Android.mk
deleted file mode 100644
index 4a51a21..0000000
--- a/hostsidetests/compilation/app/Android.mk
+++ /dev/null
@@ -1,31 +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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := 29
-
-LOCAL_PACKAGE_NAME := CtsCompilationApp
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/compilation/assets/CtsCompilationApp.apk b/hostsidetests/compilation/assets/CtsCompilationApp.apk
index ba89b24..18c76d3 100644
--- a/hostsidetests/compilation/assets/CtsCompilationApp.apk
+++ b/hostsidetests/compilation/assets/CtsCompilationApp.apk
Binary files differ
diff --git a/hostsidetests/cpptools/Android.bp b/hostsidetests/cpptools/Android.bp
new file mode 100644
index 0000000..208e734
--- /dev/null
+++ b/hostsidetests/cpptools/Android.bp
@@ -0,0 +1,29 @@
+// 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.
+
+java_test_host {
+    name: "CtsCppToolsTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "ddmlib-prebuilt",
+        "tradefed",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/cpptools/Android.mk b/hostsidetests/cpptools/Android.mk
index 8078290..10ba650 100644
--- a/hostsidetests/cpptools/Android.mk
+++ b/hostsidetests/cpptools/Android.mk
@@ -13,23 +13,4 @@
 # limitations under the License.
 
 LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := optional
-
-# Must match the package name in CtsTestCaseList.mk
-LOCAL_MODULE := CtsCppToolsTestCases
-
-LOCAL_JAVA_LIBRARIES := ddmlib-prebuilt tradefed
-
-LOCAL_CTS_TEST_PACKAGE := android.tests.cpptools
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
 include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/cpptools/test-apps/BasicApp/Android.bp b/hostsidetests/cpptools/test-apps/BasicApp/Android.bp
new file mode 100644
index 0000000..f96f5a5
--- /dev/null
+++ b/hostsidetests/cpptools/test-apps/BasicApp/Android.bp
@@ -0,0 +1,28 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsCppToolsApp",
+    defaults: ["cts_support_defaults"],
+    // Don't include this package in any target.
+    // When built, explicitly put it in the data partition.
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/cpptools/test-apps/BasicApp/Android.mk b/hostsidetests/cpptools/test-apps/BasicApp/Android.mk
deleted file mode 100644
index 2719cd9..0000000
--- a/hostsidetests/cpptools/test-apps/BasicApp/Android.mk
+++ /dev/null
@@ -1,34 +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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsCppToolsApp
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/cpptools/test-apps/DomainSocketApp/Android.bp b/hostsidetests/cpptools/test-apps/DomainSocketApp/Android.bp
new file mode 100644
index 0000000..d4dab8b
--- /dev/null
+++ b/hostsidetests/cpptools/test-apps/DomainSocketApp/Android.bp
@@ -0,0 +1,27 @@
+// Copyright (C) 2019 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.
+
+android_test_helper_app {
+    name: "CtsDomainSocket",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    static_libs: ["androidx.test.rules"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/cpptools/test-apps/DomainSocketApp/Android.mk b/hostsidetests/cpptools/test-apps/DomainSocketApp/Android.mk
deleted file mode 100644
index b018cc9..0000000
--- a/hostsidetests/cpptools/test-apps/DomainSocketApp/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2019 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_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_PACKAGE_NAME := CtsDomainSocket
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
\ No newline at end of file
diff --git a/hostsidetests/deviceidle/Android.bp b/hostsidetests/deviceidle/Android.bp
new file mode 100644
index 0000000..d7bb076
--- /dev/null
+++ b/hostsidetests/deviceidle/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+java_test_host {
+    name: "CtsDeviceIdleHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/deviceidle/Android.mk b/hostsidetests/deviceidle/Android.mk
deleted file mode 100644
index e73d70f..0000000
--- a/hostsidetests/deviceidle/Android.mk
+++ /dev/null
@@ -1,32 +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 := CtsDeviceIdleHostTestCases
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-
-LOCAL_CTS_TEST_PACKAGE := android.deviceidle
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/dexmetadata/Android.mk b/hostsidetests/dexmetadata/Android.mk
deleted file mode 100644
index 9af9f44..0000000
--- a/hostsidetests/dexmetadata/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (C) 2018 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 $(call all-subdir-makefiles)
diff --git a/hostsidetests/dexmetadata/app/Android.bp b/hostsidetests/dexmetadata/app/Android.bp
new file mode 100644
index 0000000..904aa38
--- /dev/null
+++ b/hostsidetests/dexmetadata/app/Android.bp
@@ -0,0 +1,30 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsDexMetadataDeviceTestApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+    ],
+    // Tag this module as test artifact for cts,
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/dexmetadata/app/Android.mk b/hostsidetests/dexmetadata/app/Android.mk
deleted file mode 100644
index 8d17ebd..0000000
--- a/hostsidetests/dexmetadata/app/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2018 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_PACKAGE_NAME := CtsDexMetadataDeviceTestApp
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt
-
-# Tag this module as test artifact for cts,
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
-
-# Include the make files below us.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/dexmetadata/app/SplitApp/Android.bp b/hostsidetests/dexmetadata/app/SplitApp/Android.bp
new file mode 100644
index 0000000..ec148f0
--- /dev/null
+++ b/hostsidetests/dexmetadata/app/SplitApp/Android.bp
@@ -0,0 +1,22 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsDexMetadataSplitApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as test artifact for cts
+    test_suites: ["cts"],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/dexmetadata/app/SplitApp/Android.mk b/hostsidetests/dexmetadata/app/SplitApp/Android.mk
deleted file mode 100644
index 41935d3..0000000
--- a/hostsidetests/dexmetadata/app/SplitApp/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) 2018 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_PACKAGE_NAME := CtsDexMetadataSplitApp
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as test artifact for cts
-LOCAL_COMPATIBILITY_SUITE := cts
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
-
-# Include the make files below us
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/dexmetadata/app/SplitApp/SplitAppFeatureA/Android.bp b/hostsidetests/dexmetadata/app/SplitApp/SplitAppFeatureA/Android.bp
new file mode 100644
index 0000000..df0a8bc
--- /dev/null
+++ b/hostsidetests/dexmetadata/app/SplitApp/SplitAppFeatureA/Android.bp
@@ -0,0 +1,22 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsDexMetadataSplitAppFeatureA",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as test artifact for cts
+    test_suites: ["cts"],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/dexmetadata/app/SplitApp/SplitAppFeatureA/Android.mk b/hostsidetests/dexmetadata/app/SplitApp/SplitAppFeatureA/Android.mk
deleted file mode 100644
index 839ca5c..0000000
--- a/hostsidetests/dexmetadata/app/SplitApp/SplitAppFeatureA/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2018 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_PACKAGE_NAME := CtsDexMetadataSplitAppFeatureA
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as test artifact for cts
-LOCAL_COMPATIBILITY_SUITE := cts
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/dexmetadata/host/Android.bp b/hostsidetests/dexmetadata/host/Android.bp
new file mode 100644
index 0000000..56d989f
--- /dev/null
+++ b/hostsidetests/dexmetadata/host/Android.bp
@@ -0,0 +1,30 @@
+// Copyright (C) 2018 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.
+
+java_test_host {
+    name: "CtsDexMetadataHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    java_resource_dirs: ["res"],
+    libs: [
+        "compatibility-host-util",
+        "cts-tradefed",
+        "tradefed",
+    ],
+    // tag this module as test artifact for cts
+    test_suites: [
+        "cts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/dexmetadata/host/Android.mk b/hostsidetests/dexmetadata/host/Android.mk
deleted file mode 100644
index cae13cd..0000000
--- a/hostsidetests/dexmetadata/host/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2018 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 := CtsDexMetadataHostTestCases
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_RESOURCE_DIRS := res
-
-LOCAL_JAVA_LIBRARIES := \
-    compatibility-host-util \
-    cts-tradefed \
-    tradefed
-
-# tag this module as test artifact for cts
-LOCAL_COMPATIBILITY_SUITE := cts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/dumpsys/Android.bp b/hostsidetests/dumpsys/Android.bp
new file mode 100644
index 0000000..cdcd366
--- /dev/null
+++ b/hostsidetests/dumpsys/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+java_test_host {
+    name: "CtsDumpsysHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    // Must match the package name in CtsTestCaseList.mk
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/dumpsys/Android.mk b/hostsidetests/dumpsys/Android.mk
deleted file mode 100644
index d15996c..0000000
--- a/hostsidetests/dumpsys/Android.mk
+++ /dev/null
@@ -1,33 +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_SRC_FILES := $(call all-java-files-under, src)
-
-# Must match the package name in CtsTestCaseList.mk
-LOCAL_MODULE := CtsDumpsysHostTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed
-
-LOCAL_CTS_TEST_PACKAGE := android.dumpsys
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/dumpsys/apps/Android.mk b/hostsidetests/dumpsys/apps/Android.mk
deleted file mode 100644
index 4a74e80..0000000
--- a/hostsidetests/dumpsys/apps/Android.mk
+++ /dev/null
@@ -1,20 +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)
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.bp b/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.bp
new file mode 100644
index 0000000..1dcf148
--- /dev/null
+++ b/hostsidetests/dumpsys/apps/FramestatsTestApp/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.
+
+android_test_helper_app {
+    name: "CtsFramestatsTestApp",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    static_libs: ["androidx.test.rules"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk b/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk
deleted file mode 100644
index a772a05..0000000
--- a/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk
+++ /dev/null
@@ -1,31 +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_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_PACKAGE_NAME := CtsFramestatsTestApp
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.bp b/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.bp
new file mode 100644
index 0000000..8bd1e8e
--- /dev/null
+++ b/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsProcStatsHelperApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: ["junit"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    sdk_version: "test_current",
+    min_sdk_version: "24",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk b/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk
deleted file mode 100644
index bb33f34..0000000
--- a/hostsidetests/dumpsys/apps/ProcStatsHelperApp/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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsProcStatsHelperApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := junit
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 24
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.bp b/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.bp
new file mode 100644
index 0000000..abaf6cd
--- /dev/null
+++ b/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsProcStatsApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "android.test.runner.stubs",
+        "junit",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    sdk_version: "test_current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk b/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk
deleted file mode 100644
index d58d18d..0000000
--- a/hostsidetests/dumpsys/apps/ProcStatsTestApp/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)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsProcStatsApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/dumpsys/apps/storagedapp/Android.bp b/hostsidetests/dumpsys/apps/storagedapp/Android.bp
new file mode 100644
index 0000000..321d5f9
--- /dev/null
+++ b/hostsidetests/dumpsys/apps/storagedapp/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsStoragedTestApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "android.test.runner.stubs",
+        "junit",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    sdk_version: "test_current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/dumpsys/apps/storagedapp/Android.mk b/hostsidetests/dumpsys/apps/storagedapp/Android.mk
deleted file mode 100644
index 9192a44..0000000
--- a/hostsidetests/dumpsys/apps/storagedapp/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)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsStoragedTestApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/edi/Android.bp b/hostsidetests/edi/Android.bp
new file mode 100644
index 0000000..d9a907e
--- /dev/null
+++ b/hostsidetests/edi/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+java_test_host {
+    name: "CtsEdiHostTestCases",
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+    ],
+}
diff --git a/hostsidetests/edi/Android.mk b/hostsidetests/edi/Android.mk
deleted file mode 100644
index a403cde..0000000
--- a/hostsidetests/edi/Android.mk
+++ /dev/null
@@ -1,32 +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_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := tests
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_MODULE := CtsEdiHostTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/harmfulappwarning/Android.bp b/hostsidetests/harmfulappwarning/Android.bp
new file mode 100644
index 0000000..eef6b59
--- /dev/null
+++ b/hostsidetests/harmfulappwarning/Android.bp
@@ -0,0 +1,29 @@
+// Copyright (C) 2018 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.
+
+java_test_host {
+    name: "CtsHarmfulAppWarningHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/harmfulappwarning/Android.mk b/hostsidetests/harmfulappwarning/Android.mk
deleted file mode 100644
index 5ec2e99..0000000
--- a/hostsidetests/harmfulappwarning/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (C) 2018 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 := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MODULE := CtsHarmfulAppWarningHostTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed
-
-
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_CTS_TEST_PACKAGE := android.host.harmfulappwarning
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/harmfulappwarning/sampleapp/Android.bp b/hostsidetests/harmfulappwarning/sampleapp/Android.bp
new file mode 100644
index 0000000..e129af5
--- /dev/null
+++ b/hostsidetests/harmfulappwarning/sampleapp/Android.bp
@@ -0,0 +1,33 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsHarmfulAppWarningSampleApp",
+    // Don't include this package in any target
+    // When built, explicitly put it in the data partition.
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/harmfulappwarning/sampleapp/Android.mk b/hostsidetests/harmfulappwarning/sampleapp/Android.mk
deleted file mode 100644
index a0aba0d..0000000
--- a/hostsidetests/harmfulappwarning/sampleapp/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) 2018 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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsHarmfulAppWarningSampleApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/harmfulappwarning/testapp/Android.bp b/hostsidetests/harmfulappwarning/testapp/Android.bp
new file mode 100644
index 0000000..9e1174f
--- /dev/null
+++ b/hostsidetests/harmfulappwarning/testapp/Android.bp
@@ -0,0 +1,36 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsHarmfulAppWarningTestApp",
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    static_libs: [
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "ub-uiautomator",
+    ],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/harmfulappwarning/testapp/Android.mk b/hostsidetests/harmfulappwarning/testapp/Android.mk
deleted file mode 100644
index 34854f4..0000000
--- a/hostsidetests/harmfulappwarning/testapp/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (C) 2018 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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    compatibility-device-util-axt \
-    ub-uiautomator
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsHarmfulAppWarningTestApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/incident/Android.bp b/hostsidetests/incident/Android.bp
new file mode 100644
index 0000000..1589078
--- /dev/null
+++ b/hostsidetests/incident/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+java_test_host {
+    name: "CtsIncidentHostTestCases",
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+        "platformprotos",
+    ],
+}
diff --git a/hostsidetests/incident/Android.mk b/hostsidetests/incident/Android.mk
deleted file mode 100644
index 898400d..0000000
--- a/hostsidetests/incident/Android.mk
+++ /dev/null
@@ -1,31 +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_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE := CtsIncidentHostTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util platformprotos
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/incident/apps/Android.mk b/hostsidetests/incident/apps/Android.mk
deleted file mode 100644
index 4a74e80..0000000
--- a/hostsidetests/incident/apps/Android.mk
+++ /dev/null
@@ -1,20 +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)
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/incident/apps/batterystatsapp/Android.bp b/hostsidetests/incident/apps/batterystatsapp/Android.bp
new file mode 100644
index 0000000..3cbe960
--- /dev/null
+++ b/hostsidetests/incident/apps/batterystatsapp/Android.bp
@@ -0,0 +1,36 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsBatteryStatsApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "android.test.runner.stubs",
+        "junit",
+        "org.apache.http.legacy",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    sdk_version: "test_current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/incident/apps/batterystatsapp/Android.mk b/hostsidetests/incident/apps/batterystatsapp/Android.mk
deleted file mode 100644
index 534dbb2a..0000000
--- a/hostsidetests/incident/apps/batterystatsapp/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)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsBatteryStatsApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit org.apache.http.legacy
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/incident/apps/boundwidgetapp/Android.bp b/hostsidetests/incident/apps/boundwidgetapp/Android.bp
new file mode 100644
index 0000000..4e710d8
--- /dev/null
+++ b/hostsidetests/incident/apps/boundwidgetapp/Android.bp
@@ -0,0 +1,36 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsAppWidgetApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "android.test.runner.stubs",
+        "junit",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    sdk_version: "test_current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/incident/apps/boundwidgetapp/Android.mk b/hostsidetests/incident/apps/boundwidgetapp/Android.mk
deleted file mode 100644
index d9c9eefe..0000000
--- a/hostsidetests/incident/apps/boundwidgetapp/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)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsAppWidgetApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/incident/apps/errorsapp/Android.bp b/hostsidetests/incident/apps/errorsapp/Android.bp
new file mode 100644
index 0000000..738feb5
--- /dev/null
+++ b/hostsidetests/incident/apps/errorsapp/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsErrorsApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    compile_multilib: "both",
+    libs: [
+        "android.test.runner.stubs",
+        "junit",
+    ],
+    // Includes the jni code as a shared library
+    jni_libs: ["libcrash-jni"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    sdk_version: "test_current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/incident/apps/errorsapp/Android.mk b/hostsidetests/incident/apps/errorsapp/Android.mk
deleted file mode 100644
index c137656..0000000
--- a/hostsidetests/incident/apps/errorsapp/Android.mk
+++ /dev/null
@@ -1,46 +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_PACKAGE_NAME := CtsErrorsApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MULTILIB := both
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit
-
-# Includes the jni code as a shared library
-LOCAL_JNI_SHARED_LIBRARIES := libcrash-jni
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/incident/apps/errorsapp/jni/Android.bp b/hostsidetests/incident/apps/errorsapp/jni/Android.bp
new file mode 100644
index 0000000..7c61818
--- /dev/null
+++ b/hostsidetests/incident/apps/errorsapp/jni/Android.bp
@@ -0,0 +1,24 @@
+// 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_test_library {
+    name: "libcrash-jni",
+    srcs: ["crash-jni.c"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/incident/apps/errorsapp/jni/Android.mk b/hostsidetests/incident/apps/errorsapp/jni/Android.mk
deleted file mode 100644
index 75d1d09..0000000
--- a/hostsidetests/incident/apps/errorsapp/jni/Android.mk
+++ /dev/null
@@ -1,32 +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    := libcrash-jni
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := crash-jni.c
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/hostsidetests/incident/apps/graphicsstatsapp/Android.bp b/hostsidetests/incident/apps/graphicsstatsapp/Android.bp
new file mode 100644
index 0000000..52b5c74
--- /dev/null
+++ b/hostsidetests/incident/apps/graphicsstatsapp/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsGraphicsStatsApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "android.test.runner.stubs",
+        "junit",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    sdk_version: "test_current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/incident/apps/graphicsstatsapp/Android.mk b/hostsidetests/incident/apps/graphicsstatsapp/Android.mk
deleted file mode 100644
index 588b67b..0000000
--- a/hostsidetests/incident/apps/graphicsstatsapp/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)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsGraphicsStatsApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
\ No newline at end of file
diff --git a/hostsidetests/incident/apps/netstatsapp/Android.bp b/hostsidetests/incident/apps/netstatsapp/Android.bp
new file mode 100644
index 0000000..551d27e
--- /dev/null
+++ b/hostsidetests/incident/apps/netstatsapp/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsNetStatsApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "android.test.runner.stubs",
+        "junit",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    sdk_version: "test_current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/incident/apps/netstatsapp/Android.mk b/hostsidetests/incident/apps/netstatsapp/Android.mk
deleted file mode 100644
index 41ebd09..0000000
--- a/hostsidetests/incident/apps/netstatsapp/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)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsNetStatsApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/incident/apps/notificationsapp/Android.bp b/hostsidetests/incident/apps/notificationsapp/Android.bp
new file mode 100644
index 0000000..6bd3991
--- /dev/null
+++ b/hostsidetests/incident/apps/notificationsapp/Android.bp
@@ -0,0 +1,36 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsNotificationIncidentTestApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "android.test.runner.stubs",
+        "junit",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    sdk_version: "test_current",
+    java_resource_dirs: ["res"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/incident/apps/notificationsapp/Android.mk b/hostsidetests/incident/apps/notificationsapp/Android.mk
deleted file mode 100644
index 2c9f3fd..0000000
--- a/hostsidetests/incident/apps/notificationsapp/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2018 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_PACKAGE_NAME := CtsNotificationIncidentTestApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SDK_VERSION := test_current
-
-LOCAL_JAVA_RESOURCE_DIRS := res
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/incident/apps/procstatsapp/Android.bp b/hostsidetests/incident/apps/procstatsapp/Android.bp
new file mode 100644
index 0000000..0626e23
--- /dev/null
+++ b/hostsidetests/incident/apps/procstatsapp/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsProcStatsProtoApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "android.test.runner.stubs",
+        "junit",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    sdk_version: "test_current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/incident/apps/procstatsapp/Android.mk b/hostsidetests/incident/apps/procstatsapp/Android.mk
deleted file mode 100644
index 8fcad57..0000000
--- a/hostsidetests/incident/apps/procstatsapp/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)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsProcStatsProtoApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/inputmethodservice/Android.mk b/hostsidetests/inputmethodservice/Android.mk
deleted file mode 100644
index b798d87..0000000
--- a/hostsidetests/inputmethodservice/Android.mk
+++ /dev/null
@@ -1,15 +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 $(call all-subdir-makefiles)
diff --git a/hostsidetests/inputmethodservice/common/Android.bp b/hostsidetests/inputmethodservice/common/Android.bp
new file mode 100644
index 0000000..feb59a3
--- /dev/null
+++ b/hostsidetests/inputmethodservice/common/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+// Build the common library for use device-side
+java_test {
+    name: "CtsInputMethodServiceCommon",
+    srcs: ["src/**/*.java"],
+    libs: ["junit"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "test_current",
+}
+
+// Build the common library for use host-side
+java_test_host {
+    name: "cts-inputmethodservice-common-host",
+    srcs: ["src/**/*.java"],
+    libs: ["junit"],
+}
diff --git a/hostsidetests/inputmethodservice/common/Android.mk b/hostsidetests/inputmethodservice/common/Android.mk
deleted file mode 100644
index a118474..0000000
--- a/hostsidetests/inputmethodservice/common/Android.mk
+++ /dev/null
@@ -1,50 +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.
-
-###############################################################################
-# Build the common library for use device-side
-###############################################################################
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_LIBRARIES := junit
-
-LOCAL_MODULE_TAGS := tests
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_MODULE := CtsInputMethodServiceCommon
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-###############################################################################
-# Build the common library for use host-side
-###############################################################################
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_LIBRARIES := junit
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MODULE := cts-inputmethodservice-common-host
-
-include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/inputmethodservice/deviceside/Android.mk b/hostsidetests/inputmethodservice/deviceside/Android.mk
deleted file mode 100644
index b798d87..0000000
--- a/hostsidetests/inputmethodservice/deviceside/Android.mk
+++ /dev/null
@@ -1,15 +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 $(call all-subdir-makefiles)
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/Android.bp b/hostsidetests/inputmethodservice/deviceside/devicetest/Android.bp
new file mode 100644
index 0000000..7139b91
--- /dev/null
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/Android.bp
@@ -0,0 +1,37 @@
+// 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.
+
+android_test {
+    name: "CtsInputMethodServiceDeviceTests",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: ["android.test.runner.stubs"],
+    static_libs: [
+        "androidx.test.rules",
+        "hamcrest",
+        "hamcrest-library",
+        "ub-uiautomator",
+        "CtsInputMethodServiceCommon",
+        "CtsInputMethodServiceLib",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "test_current",
+    min_sdk_version: "19",
+}
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk b/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk
deleted file mode 100644
index 1a57e27..0000000
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk
+++ /dev/null
@@ -1,46 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_RESOURCE_DIR := res
-LOCAL_JAVA_LIBRARY := android.test.runner.stubs
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    hamcrest hamcrest-library \
-    ub-uiautomator \
-    CtsInputMethodServiceCommon \
-    CtsInputMethodServiceLib
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsInputMethodServiceDeviceTests
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 19
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/inputmethodservice/deviceside/edittextapp/Android.bp b/hostsidetests/inputmethodservice/deviceside/edittextapp/Android.bp
new file mode 100644
index 0000000..fce63b4
--- /dev/null
+++ b/hostsidetests/inputmethodservice/deviceside/edittextapp/Android.bp
@@ -0,0 +1,29 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "EditTextApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    static_libs: ["CtsInputMethodServiceCommon"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "test_current",
+    min_sdk_version: "28",
+}
diff --git a/hostsidetests/inputmethodservice/deviceside/edittextapp/Android.mk b/hostsidetests/inputmethodservice/deviceside/edittextapp/Android.mk
deleted file mode 100644
index a089809..0000000
--- a/hostsidetests/inputmethodservice/deviceside/edittextapp/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2018 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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_RESOURCE_DIR := res
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    CtsInputMethodServiceCommon
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := EditTextApp
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 28
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/inputmethodservice/deviceside/ime1/Android.bp b/hostsidetests/inputmethodservice/deviceside/ime1/Android.bp
new file mode 100644
index 0000000..765fe2d
--- /dev/null
+++ b/hostsidetests/inputmethodservice/deviceside/ime1/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsInputMethod1",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "CtsInputMethodServiceCommon",
+        "CtsInputMethodServiceLib",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "test_current",
+    min_sdk_version: "19",
+}
diff --git a/hostsidetests/inputmethodservice/deviceside/ime1/Android.mk b/hostsidetests/inputmethodservice/deviceside/ime1/Android.mk
deleted file mode 100644
index 3b98a87..0000000
--- a/hostsidetests/inputmethodservice/deviceside/ime1/Android.mk
+++ /dev/null
@@ -1,42 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_RESOURCE_DIR := res
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    CtsInputMethodServiceCommon \
-    CtsInputMethodServiceLib
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsInputMethod1
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 19
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/inputmethodservice/deviceside/ime2/Android.bp b/hostsidetests/inputmethodservice/deviceside/ime2/Android.bp
new file mode 100644
index 0000000..e8f865f
--- /dev/null
+++ b/hostsidetests/inputmethodservice/deviceside/ime2/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+android_test {
+    name: "CtsInputMethod2",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "CtsInputMethodServiceCommon",
+        "CtsInputMethodServiceLib",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "test_current",
+    min_sdk_version: "19",
+}
diff --git a/hostsidetests/inputmethodservice/deviceside/ime2/Android.mk b/hostsidetests/inputmethodservice/deviceside/ime2/Android.mk
deleted file mode 100644
index 7b9ebeb..0000000
--- a/hostsidetests/inputmethodservice/deviceside/ime2/Android.mk
+++ /dev/null
@@ -1,42 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_RESOURCE_DIR := res
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    CtsInputMethodServiceCommon \
-    CtsInputMethodServiceLib
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsInputMethod2
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 19
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/inputmethodservice/deviceside/lib/Android.bp b/hostsidetests/inputmethodservice/deviceside/lib/Android.bp
new file mode 100644
index 0000000..cecc584
--- /dev/null
+++ b/hostsidetests/inputmethodservice/deviceside/lib/Android.bp
@@ -0,0 +1,29 @@
+// 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.
+
+java_test_helper_library {
+    name: "CtsInputMethodServiceLib",
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "androidx.annotation_annotation",
+        "CtsInputMethodServiceCommon",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/inputmethodservice/deviceside/lib/Android.mk b/hostsidetests/inputmethodservice/deviceside/lib/Android.mk
deleted file mode 100644
index 9a99bdc..0000000
--- a/hostsidetests/inputmethodservice/deviceside/lib/Android.mk
+++ /dev/null
@@ -1,33 +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_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.annotation_annotation \
-    CtsInputMethodServiceCommon
-
-LOCAL_MODULE_TAGS := tests
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE := CtsInputMethodServiceLib
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/hostsidetests/inputmethodservice/deviceside/provider/Android.bp b/hostsidetests/inputmethodservice/deviceside/provider/Android.bp
new file mode 100644
index 0000000..d9363e8
--- /dev/null
+++ b/hostsidetests/inputmethodservice/deviceside/provider/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.
+
+android_test_helper_app {
+    name: "CtsInputMethodServiceEventProvider",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "CtsInputMethodServiceCommon",
+        "CtsInputMethodServiceLib",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "test_current",
+    min_sdk_version: "26",
+}
diff --git a/hostsidetests/inputmethodservice/deviceside/provider/Android.mk b/hostsidetests/inputmethodservice/deviceside/provider/Android.mk
deleted file mode 100644
index 73d4b84..0000000
--- a/hostsidetests/inputmethodservice/deviceside/provider/Android.mk
+++ /dev/null
@@ -1,41 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    CtsInputMethodServiceCommon \
-    CtsInputMethodServiceLib
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsInputMethodServiceEventProvider
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 26
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/inputmethodservice/hostside/Android.bp b/hostsidetests/inputmethodservice/hostside/Android.bp
new file mode 100644
index 0000000..5e99fdf
--- /dev/null
+++ b/hostsidetests/inputmethodservice/hostside/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.
+
+java_test_host {
+    name: "CtsInputMethodServiceHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    libs: [
+        "compatibility-host-util",
+        "cts-tradefed",
+        "tradefed",
+    ],
+    static_libs: ["cts-inputmethodservice-common-host"],
+}
diff --git a/hostsidetests/inputmethodservice/hostside/Android.mk b/hostsidetests/inputmethodservice/hostside/Android.mk
deleted file mode 100644
index 2cfca0e..0000000
--- a/hostsidetests/inputmethodservice/hostside/Android.mk
+++ /dev/null
@@ -1,35 +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_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := tests
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_MODULE := CtsInputMethodServiceHostTestCases
-
-LOCAL_JAVA_LIBRARIES := \
-    compatibility-host-util \
-    cts-tradefed \
-    tradefed
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    cts-inputmethodservice-common-host
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jdwpsecurity/Android.bp b/hostsidetests/jdwpsecurity/Android.bp
new file mode 100644
index 0000000..0d16257
--- /dev/null
+++ b/hostsidetests/jdwpsecurity/Android.bp
@@ -0,0 +1,29 @@
+// 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.
+
+java_test_host {
+    name: "CtsJdwpSecurityHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/jdwpsecurity/Android.mk b/hostsidetests/jdwpsecurity/Android.mk
deleted file mode 100644
index c740f61..0000000
--- a/hostsidetests/jdwpsecurity/Android.mk
+++ /dev/null
@@ -1,35 +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_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := optional
-
-# Must match the package name in CtsTestCaseList.mk
-LOCAL_MODULE := CtsJdwpSecurityHostTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_CTS_TEST_PACKAGE := android.host.jdwpsecurity
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jdwpsecurity/OWNERS b/hostsidetests/jdwpsecurity/OWNERS
new file mode 100644
index 0000000..6e06299
--- /dev/null
+++ b/hostsidetests/jdwpsecurity/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 86431
+include /hostsidetests/jvmti/run-tests/OWNERS
diff --git a/hostsidetests/jdwpsecurity/app/Android.bp b/hostsidetests/jdwpsecurity/app/Android.bp
new file mode 100644
index 0000000..0942d47
--- /dev/null
+++ b/hostsidetests/jdwpsecurity/app/Android.bp
@@ -0,0 +1,24 @@
+// 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.
+
+java_test_helper_library {
+    name: "CtsJdwpApp",
+    srcs: ["**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/jdwpsecurity/app/Android.mk b/hostsidetests/jdwpsecurity/app/Android.mk
deleted file mode 100644
index e1523ab..0000000
--- a/hostsidetests/jdwpsecurity/app/Android.mk
+++ /dev/null
@@ -1,23 +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_TAGS := optional
-LOCAL_MODULE := CtsJdwpApp
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-include $(BUILD_JAVA_LIBRARY)
diff --git a/hostsidetests/jdwptunnel/OWNERS b/hostsidetests/jdwptunnel/OWNERS
new file mode 100644
index 0000000..6e06299
--- /dev/null
+++ b/hostsidetests/jdwptunnel/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 86431
+include /hostsidetests/jvmti/run-tests/OWNERS
diff --git a/hostsidetests/jvmti/allocation-tracking/OWNERS b/hostsidetests/jvmti/allocation-tracking/OWNERS
new file mode 100644
index 0000000..2dbff0d
--- /dev/null
+++ b/hostsidetests/jvmti/allocation-tracking/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 86431
+include ../run-tests/OWNERS
diff --git a/hostsidetests/jvmti/attaching/OWNERS b/hostsidetests/jvmti/attaching/OWNERS
new file mode 100644
index 0000000..2dbff0d
--- /dev/null
+++ b/hostsidetests/jvmti/attaching/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 86431
+include ../run-tests/OWNERS
diff --git a/hostsidetests/jvmti/redefining/OWNERS b/hostsidetests/jvmti/redefining/OWNERS
new file mode 100644
index 0000000..2dbff0d
--- /dev/null
+++ b/hostsidetests/jvmti/redefining/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 86431
+include ../run-tests/OWNERS
diff --git a/hostsidetests/jvmti/run-tests/test-1900/OWNERS b/hostsidetests/jvmti/run-tests/test-1900/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1900/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1900/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1900/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1900/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1901/OWNERS b/hostsidetests/jvmti/run-tests/test-1901/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1901/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1901/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1901/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1901/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1902/OWNERS b/hostsidetests/jvmti/run-tests/test-1902/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1902/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1902/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1902/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1902/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1903/OWNERS b/hostsidetests/jvmti/run-tests/test-1903/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1903/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1903/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1903/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1903/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1904/OWNERS b/hostsidetests/jvmti/run-tests/test-1904/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1904/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1904/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1904/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1904/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1906/OWNERS b/hostsidetests/jvmti/run-tests/test-1906/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1906/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1906/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1906/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1906/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1907/OWNERS b/hostsidetests/jvmti/run-tests/test-1907/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1907/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1907/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1907/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1907/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1908/OWNERS b/hostsidetests/jvmti/run-tests/test-1908/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1908/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1908/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1908/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1908/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1909/OWNERS b/hostsidetests/jvmti/run-tests/test-1909/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1909/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1909/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1909/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1909/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1910/OWNERS b/hostsidetests/jvmti/run-tests/test-1910/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1910/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1910/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1910/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1910/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1911/OWNERS b/hostsidetests/jvmti/run-tests/test-1911/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1911/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1911/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1911/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1911/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1912/OWNERS b/hostsidetests/jvmti/run-tests/test-1912/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1912/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1912/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1912/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1912/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1913/OWNERS b/hostsidetests/jvmti/run-tests/test-1913/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1913/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1913/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1913/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1913/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1914/OWNERS b/hostsidetests/jvmti/run-tests/test-1914/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1914/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1914/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1914/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1914/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1915/OWNERS b/hostsidetests/jvmti/run-tests/test-1915/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1915/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1915/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1915/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1915/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1916/OWNERS b/hostsidetests/jvmti/run-tests/test-1916/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1916/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1916/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1916/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1916/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1917/OWNERS b/hostsidetests/jvmti/run-tests/test-1917/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1917/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1917/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1917/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1917/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1920/OWNERS b/hostsidetests/jvmti/run-tests/test-1920/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1920/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1920/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1920/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1920/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1921/OWNERS b/hostsidetests/jvmti/run-tests/test-1921/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1921/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1921/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1921/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1921/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1922/OWNERS b/hostsidetests/jvmti/run-tests/test-1922/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1922/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1922/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1922/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1922/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1923/OWNERS b/hostsidetests/jvmti/run-tests/test-1923/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1923/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1923/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1923/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1923/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1924/OWNERS b/hostsidetests/jvmti/run-tests/test-1924/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1924/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1924/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1924/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1924/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1925/OWNERS b/hostsidetests/jvmti/run-tests/test-1925/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1925/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1925/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1925/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1925/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1926/OWNERS b/hostsidetests/jvmti/run-tests/test-1926/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1926/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1926/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1926/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1926/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1927/OWNERS b/hostsidetests/jvmti/run-tests/test-1927/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1927/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1927/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1927/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1927/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1928/OWNERS b/hostsidetests/jvmti/run-tests/test-1928/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1928/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1928/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1928/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1928/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1930/OWNERS b/hostsidetests/jvmti/run-tests/test-1930/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1930/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1930/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1930/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1930/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1931/OWNERS b/hostsidetests/jvmti/run-tests/test-1931/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1931/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1931/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1931/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1931/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1932/OWNERS b/hostsidetests/jvmti/run-tests/test-1932/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1932/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1932/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1932/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1932/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1933/OWNERS b/hostsidetests/jvmti/run-tests/test-1933/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1933/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1933/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1933/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1933/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1934/OWNERS b/hostsidetests/jvmti/run-tests/test-1934/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1934/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1934/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1934/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1934/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1936/OWNERS b/hostsidetests/jvmti/run-tests/test-1936/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1936/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1936/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1936/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1936/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1937/OWNERS b/hostsidetests/jvmti/run-tests/test-1937/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1937/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1937/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1937/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1937/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1939/OWNERS b/hostsidetests/jvmti/run-tests/test-1939/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1939/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1939/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1939/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1939/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1941/OWNERS b/hostsidetests/jvmti/run-tests/test-1941/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1941/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1941/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1941/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1941/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1942/OWNERS b/hostsidetests/jvmti/run-tests/test-1942/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1942/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1942/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1942/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1942/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1943/OWNERS b/hostsidetests/jvmti/run-tests/test-1943/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1943/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1943/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1943/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1943/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1953/OWNERS b/hostsidetests/jvmti/run-tests/test-1953/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1953/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1953/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1953/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1953/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1958/OWNERS b/hostsidetests/jvmti/run-tests/test-1958/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1958/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-1958/app/OWNERS b/hostsidetests/jvmti/run-tests/test-1958/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-1958/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-902/OWNERS b/hostsidetests/jvmti/run-tests/test-902/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-902/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-902/app/OWNERS b/hostsidetests/jvmti/run-tests/test-902/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-902/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-903/OWNERS b/hostsidetests/jvmti/run-tests/test-903/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-903/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-903/app/OWNERS b/hostsidetests/jvmti/run-tests/test-903/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-903/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-904/OWNERS b/hostsidetests/jvmti/run-tests/test-904/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-904/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-904/app/OWNERS b/hostsidetests/jvmti/run-tests/test-904/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-904/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-905/OWNERS b/hostsidetests/jvmti/run-tests/test-905/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-905/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-905/app/OWNERS b/hostsidetests/jvmti/run-tests/test-905/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-905/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-906/OWNERS b/hostsidetests/jvmti/run-tests/test-906/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-906/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-906/app/OWNERS b/hostsidetests/jvmti/run-tests/test-906/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-906/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-907/OWNERS b/hostsidetests/jvmti/run-tests/test-907/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-907/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-907/app/OWNERS b/hostsidetests/jvmti/run-tests/test-907/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-907/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-908/OWNERS b/hostsidetests/jvmti/run-tests/test-908/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-908/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-908/app/OWNERS b/hostsidetests/jvmti/run-tests/test-908/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-908/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-910/OWNERS b/hostsidetests/jvmti/run-tests/test-910/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-910/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-910/app/OWNERS b/hostsidetests/jvmti/run-tests/test-910/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-910/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-911/OWNERS b/hostsidetests/jvmti/run-tests/test-911/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-911/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-911/app/OWNERS b/hostsidetests/jvmti/run-tests/test-911/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-911/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-912/OWNERS b/hostsidetests/jvmti/run-tests/test-912/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-912/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-912/app/OWNERS b/hostsidetests/jvmti/run-tests/test-912/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-912/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-913/OWNERS b/hostsidetests/jvmti/run-tests/test-913/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-913/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-913/app/OWNERS b/hostsidetests/jvmti/run-tests/test-913/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-913/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-914/OWNERS b/hostsidetests/jvmti/run-tests/test-914/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-914/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-914/app/OWNERS b/hostsidetests/jvmti/run-tests/test-914/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-914/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-915/OWNERS b/hostsidetests/jvmti/run-tests/test-915/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-915/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-915/app/OWNERS b/hostsidetests/jvmti/run-tests/test-915/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-915/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-917/OWNERS b/hostsidetests/jvmti/run-tests/test-917/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-917/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-917/app/OWNERS b/hostsidetests/jvmti/run-tests/test-917/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-917/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-918/OWNERS b/hostsidetests/jvmti/run-tests/test-918/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-918/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-918/app/OWNERS b/hostsidetests/jvmti/run-tests/test-918/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-918/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-919/OWNERS b/hostsidetests/jvmti/run-tests/test-919/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-919/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-919/app/OWNERS b/hostsidetests/jvmti/run-tests/test-919/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-919/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-920/OWNERS b/hostsidetests/jvmti/run-tests/test-920/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-920/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-920/app/OWNERS b/hostsidetests/jvmti/run-tests/test-920/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-920/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-922/OWNERS b/hostsidetests/jvmti/run-tests/test-922/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-922/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-922/app/OWNERS b/hostsidetests/jvmti/run-tests/test-922/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-922/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-923/OWNERS b/hostsidetests/jvmti/run-tests/test-923/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-923/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-923/app/OWNERS b/hostsidetests/jvmti/run-tests/test-923/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-923/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-924/OWNERS b/hostsidetests/jvmti/run-tests/test-924/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-924/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-924/app/OWNERS b/hostsidetests/jvmti/run-tests/test-924/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-924/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-926/OWNERS b/hostsidetests/jvmti/run-tests/test-926/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-926/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-926/app/OWNERS b/hostsidetests/jvmti/run-tests/test-926/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-926/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-927/OWNERS b/hostsidetests/jvmti/run-tests/test-927/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-927/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-927/app/OWNERS b/hostsidetests/jvmti/run-tests/test-927/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-927/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-928/OWNERS b/hostsidetests/jvmti/run-tests/test-928/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-928/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-928/app/OWNERS b/hostsidetests/jvmti/run-tests/test-928/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-928/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-930/OWNERS b/hostsidetests/jvmti/run-tests/test-930/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-930/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-930/app/OWNERS b/hostsidetests/jvmti/run-tests/test-930/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-930/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-931/OWNERS b/hostsidetests/jvmti/run-tests/test-931/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-931/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-931/app/OWNERS b/hostsidetests/jvmti/run-tests/test-931/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-931/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-932/OWNERS b/hostsidetests/jvmti/run-tests/test-932/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-932/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-932/app/OWNERS b/hostsidetests/jvmti/run-tests/test-932/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-932/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-940/OWNERS b/hostsidetests/jvmti/run-tests/test-940/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-940/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-940/app/OWNERS b/hostsidetests/jvmti/run-tests/test-940/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-940/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-942/OWNERS b/hostsidetests/jvmti/run-tests/test-942/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-942/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-942/app/OWNERS b/hostsidetests/jvmti/run-tests/test-942/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-942/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-944/OWNERS b/hostsidetests/jvmti/run-tests/test-944/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-944/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-944/app/OWNERS b/hostsidetests/jvmti/run-tests/test-944/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-944/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-945/OWNERS b/hostsidetests/jvmti/run-tests/test-945/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-945/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-945/app/OWNERS b/hostsidetests/jvmti/run-tests/test-945/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-945/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-947/OWNERS b/hostsidetests/jvmti/run-tests/test-947/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-947/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-947/app/OWNERS b/hostsidetests/jvmti/run-tests/test-947/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-947/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-951/OWNERS b/hostsidetests/jvmti/run-tests/test-951/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-951/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-951/app/OWNERS b/hostsidetests/jvmti/run-tests/test-951/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-951/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-982/OWNERS b/hostsidetests/jvmti/run-tests/test-982/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-982/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-982/app/OWNERS b/hostsidetests/jvmti/run-tests/test-982/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-982/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-983/OWNERS b/hostsidetests/jvmti/run-tests/test-983/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-983/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-983/app/OWNERS b/hostsidetests/jvmti/run-tests/test-983/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-983/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-984/OWNERS b/hostsidetests/jvmti/run-tests/test-984/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-984/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-984/app/OWNERS b/hostsidetests/jvmti/run-tests/test-984/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-984/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-985/OWNERS b/hostsidetests/jvmti/run-tests/test-985/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-985/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-985/app/OWNERS b/hostsidetests/jvmti/run-tests/test-985/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-985/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-986/OWNERS b/hostsidetests/jvmti/run-tests/test-986/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-986/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-986/app/OWNERS b/hostsidetests/jvmti/run-tests/test-986/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-986/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-988/OWNERS b/hostsidetests/jvmti/run-tests/test-988/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-988/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-988/app/OWNERS b/hostsidetests/jvmti/run-tests/test-988/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-988/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-989/OWNERS b/hostsidetests/jvmti/run-tests/test-989/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-989/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-989/app/OWNERS b/hostsidetests/jvmti/run-tests/test-989/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-989/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-990/OWNERS b/hostsidetests/jvmti/run-tests/test-990/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-990/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-990/app/OWNERS b/hostsidetests/jvmti/run-tests/test-990/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-990/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-991/OWNERS b/hostsidetests/jvmti/run-tests/test-991/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-991/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-991/app/OWNERS b/hostsidetests/jvmti/run-tests/test-991/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-991/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-992/OWNERS b/hostsidetests/jvmti/run-tests/test-992/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-992/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-992/app/OWNERS b/hostsidetests/jvmti/run-tests/test-992/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-992/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-993/OWNERS b/hostsidetests/jvmti/run-tests/test-993/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-993/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-993/app/OWNERS b/hostsidetests/jvmti/run-tests/test-993/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-993/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-994/OWNERS b/hostsidetests/jvmti/run-tests/test-994/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-994/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-994/app/OWNERS b/hostsidetests/jvmti/run-tests/test-994/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-994/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-995/OWNERS b/hostsidetests/jvmti/run-tests/test-995/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-995/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-995/app/OWNERS b/hostsidetests/jvmti/run-tests/test-995/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-995/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-996/OWNERS b/hostsidetests/jvmti/run-tests/test-996/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-996/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-996/app/OWNERS b/hostsidetests/jvmti/run-tests/test-996/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-996/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-997/OWNERS b/hostsidetests/jvmti/run-tests/test-997/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-997/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/run-tests/test-997/app/OWNERS b/hostsidetests/jvmti/run-tests/test-997/app/OWNERS
deleted file mode 100644
index d6078e0..0000000
--- a/hostsidetests/jvmti/run-tests/test-997/app/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# DO NOT DELETE: OWNERS is intended to be empty as module owner and bug component are defined
-# in parent directory. This file is needed as a placeholder for verification purpose as we
-# need to tell the difference between "no owner is specified for this module" vs "explicitly
-# defer to parent OWNERS file"
diff --git a/hostsidetests/jvmti/tagging/OWNERS b/hostsidetests/jvmti/tagging/OWNERS
new file mode 100644
index 0000000..2dbff0d
--- /dev/null
+++ b/hostsidetests/jvmti/tagging/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 86431
+include ../run-tests/OWNERS
diff --git a/hostsidetests/media/Android.bp b/hostsidetests/media/Android.bp
new file mode 100644
index 0000000..e6b114a
--- /dev/null
+++ b/hostsidetests/media/Android.bp
@@ -0,0 +1,42 @@
+//
+// 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.
+//
+
+java_test_host {
+    name: "CtsMediaHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: [
+        "src/**/*.java",
+        ":CtsMediaSessionTestCommon",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+    ],
+}
+
+filegroup {
+    name: "CtsMediaSessionTestCommon",
+    srcs: ["common/**/*.java"],
+}
diff --git a/hostsidetests/media/Android.mk b/hostsidetests/media/Android.mk
deleted file mode 100644
index 4823ec8..0000000
--- a/hostsidetests/media/Android.mk
+++ /dev/null
@@ -1,36 +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_SRC_FILES := \
-    $(call all-java-files-under, common) \
-    $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := tests
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_MODULE := CtsMediaHostTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-include $(call first-makefiles-under,$(LOCAL_PATH))
-
diff --git a/hostsidetests/media/app/MediaSessionTest/Android.bp b/hostsidetests/media/app/MediaSessionTest/Android.bp
new file mode 100644
index 0000000..07d1c35
--- /dev/null
+++ b/hostsidetests/media/app/MediaSessionTest/Android.bp
@@ -0,0 +1,34 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsMediaSessionHostTestApp",
+    defaults: ["cts_defaults"],
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    srcs: [
+        "src/**/*.java",
+        ":CtsMediaSessionTestCommon",
+    ],
+    static_libs: [
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+    ],
+    sdk_version: "test_current",
+    min_sdk_version: "26",
+}
diff --git a/hostsidetests/media/app/MediaSessionTest/Android.mk b/hostsidetests/media/app/MediaSessionTest/Android.mk
deleted file mode 100644
index 3901276..0000000
--- a/hostsidetests/media/app/MediaSessionTest/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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsMediaSessionHostTestApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../../common)
-
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    compatibility-device-util-axt \
-
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 26
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/media/app/MediaSessionTestHelper/Android.bp b/hostsidetests/media/app/MediaSessionTestHelper/Android.bp
new file mode 100644
index 0000000..31e2d54
--- /dev/null
+++ b/hostsidetests/media/app/MediaSessionTestHelper/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsMediaSessionTestHelper",
+    defaults: ["cts_defaults"],
+    srcs: [
+        "src/**/*.java",
+        ":CtsMediaSessionTestCommon",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/media/app/MediaSessionTestHelper/Android.mk b/hostsidetests/media/app/MediaSessionTestHelper/Android.mk
deleted file mode 100644
index 514f86a..0000000
--- a/hostsidetests/media/app/MediaSessionTestHelper/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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../../common)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsMediaSessionTestHelper
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
-
diff --git a/hostsidetests/media/bitstreams/Android.bp b/hostsidetests/media/bitstreams/Android.bp
new file mode 100644
index 0000000..186a0ef
--- /dev/null
+++ b/hostsidetests/media/bitstreams/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+java_test_host {
+    name: "CtsMediaBitstreamsTestCases",
+    srcs: [
+        "src/**/*.java",
+	"common/src/**/*.java"],
+    libs: [
+        "compatibility-host-util",
+        "cts-tradefed",
+        "tradefed",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    java_resources: ["DynamicConfig.xml"],
+    required: ["cts-dynamic-config"],
+}
diff --git a/hostsidetests/media/bitstreams/Android.mk b/hostsidetests/media/bitstreams/Android.mk
deleted file mode 100644
index 8f161c9..0000000
--- a/hostsidetests/media/bitstreams/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)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SRC_FILES += $(call all-java-files-under, common/src)
-
-LOCAL_JAVA_LIBRARIES := compatibility-host-util cts-tradefed tradefed
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := CtsMediaBitstreamsTestCases
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_JAVA_RESOURCE_FILES := $(LOCAL_PATH)/DynamicConfig.xml
-
-LOCAL_REQUIRED_MODULES := cts-dynamic-config
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/media/bitstreams/app/Android.bp b/hostsidetests/media/bitstreams/app/Android.bp
new file mode 100644
index 0000000..f7e0395
--- /dev/null
+++ b/hostsidetests/media/bitstreams/app/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsMediaBitstreamsDeviceSideTestApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "media-bitstreams-common-devicesidelib",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/media/bitstreams/app/Android.mk b/hostsidetests/media/bitstreams/app/Android.mk
deleted file mode 100644
index 9ed5506..0000000
--- a/hostsidetests/media/bitstreams/app/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)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt media-bitstreams-common-devicesidelib
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsMediaBitstreamsDeviceSideTestApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/media/bitstreams/common/Android.bp b/hostsidetests/media/bitstreams/common/Android.bp
new file mode 100644
index 0000000..a21bd21
--- /dev/null
+++ b/hostsidetests/media/bitstreams/common/Android.bp
@@ -0,0 +1,23 @@
+// 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.
+
+//##############################################################################
+// Build the common library for use device-side
+//##############################################################################
+
+java_library {
+    name: "media-bitstreams-common-devicesidelib",
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/media/bitstreams/common/Android.mk b/hostsidetests/media/bitstreams/common/Android.mk
deleted file mode 100644
index 1691257..0000000
--- a/hostsidetests/media/bitstreams/common/Android.mk
+++ /dev/null
@@ -1,31 +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.
-
-###############################################################################
-# Build the common library for use device-side
-###############################################################################
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := media-bitstreams-common-devicesidelib
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/hostsidetests/monkey/Android.bp b/hostsidetests/monkey/Android.bp
new file mode 100644
index 0000000..28b2501
--- /dev/null
+++ b/hostsidetests/monkey/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+java_test_host {
+    name: "CtsMonkeyTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/monkey/Android.mk b/hostsidetests/monkey/Android.mk
deleted file mode 100644
index 052313c..0000000
--- a/hostsidetests/monkey/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_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := CtsMonkeyTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-
-# prefix zzz intentional to run this last
-LOCAL_CTS_TEST_PACKAGE := zzz.android.monkey
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/monkey/test-apps/Android.mk b/hostsidetests/monkey/test-apps/Android.mk
deleted file mode 100644
index b189007..0000000
--- a/hostsidetests/monkey/test-apps/Android.mk
+++ /dev/null
@@ -1,19 +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)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/monkey/test-apps/CtsMonkeyApp/Android.bp b/hostsidetests/monkey/test-apps/CtsMonkeyApp/Android.bp
new file mode 100644
index 0000000..a3022eb
--- /dev/null
+++ b/hostsidetests/monkey/test-apps/CtsMonkeyApp/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.
+
+android_test_helper_app {
+    name: "CtsMonkeyApp",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/monkey/test-apps/CtsMonkeyApp/Android.mk b/hostsidetests/monkey/test-apps/CtsMonkeyApp/Android.mk
deleted file mode 100644
index 868a3bd..0000000
--- a/hostsidetests/monkey/test-apps/CtsMonkeyApp/Android.mk
+++ /dev/null
@@ -1,36 +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_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := CtsMonkeyApp
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/monkey/test-apps/CtsMonkeyApp2/Android.bp b/hostsidetests/monkey/test-apps/CtsMonkeyApp2/Android.bp
new file mode 100644
index 0000000..52c812a
--- /dev/null
+++ b/hostsidetests/monkey/test-apps/CtsMonkeyApp2/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.
+
+android_test_helper_app {
+    name: "CtsMonkeyApp2",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/monkey/test-apps/CtsMonkeyApp2/Android.mk b/hostsidetests/monkey/test-apps/CtsMonkeyApp2/Android.mk
deleted file mode 100644
index 150d0b6..0000000
--- a/hostsidetests/monkey/test-apps/CtsMonkeyApp2/Android.mk
+++ /dev/null
@@ -1,36 +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_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := CtsMonkeyApp2
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/multiuser/Android.bp b/hostsidetests/multiuser/Android.bp
new file mode 100644
index 0000000..cc4bd81
--- /dev/null
+++ b/hostsidetests/multiuser/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+java_test_host {
+    name: "CtsMultiUserHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "tools-common-prebuilt",
+        "cts-tradefed",
+        "tradefed",
+        "platform-test-annotations-host",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/multiuser/Android.mk b/hostsidetests/multiuser/Android.mk
deleted file mode 100644
index e4c654d..0000000
--- a/hostsidetests/multiuser/Android.mk
+++ /dev/null
@@ -1,35 +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 := CtsMultiUserHostTestCases
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := tools-common-prebuilt cts-tradefed tradefed platform-test-annotations-host
-
-LOCAL_CTS_TEST_PACKAGE := android.host.multiuser
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/net/Android.bp b/hostsidetests/net/Android.bp
new file mode 100644
index 0000000..b6f5142
--- /dev/null
+++ b/hostsidetests/net/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+java_test_host {
+    name: "CtsHostsideNetworkTests",
+    defaults: ["cts_defaults"],
+    // Only compile source java files in this apk.
+    srcs: ["src/**/*.java"],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/net/Android.mk b/hostsidetests/net/Android.mk
deleted file mode 100644
index 7270580..0000000
--- a/hostsidetests/net/Android.mk
+++ /dev/null
@@ -1,34 +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)
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := CtsHostsideNetworkTests
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed
-
-LOCAL_CTS_TEST_PACKAGE := android.net.hostsidenetwork
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/net/aidl/Android.bp b/hostsidetests/net/aidl/Android.bp
new file mode 100644
index 0000000..320a1fa
--- /dev/null
+++ b/hostsidetests/net/aidl/Android.bp
@@ -0,0 +1,24 @@
+// 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.
+
+java_test_helper_library {
+    name: "CtsHostsideNetworkTestsAidl",
+    sdk_version: "current",
+    srcs: [
+        "com/android/cts/net/hostside/IMyService.aidl",
+        "com/android/cts/net/hostside/INetworkCallback.aidl",
+        "com/android/cts/net/hostside/INetworkStateObserver.aidl",
+        "com/android/cts/net/hostside/IRemoteSocketFactory.aidl",
+    ],
+}
diff --git a/hostsidetests/net/aidl/Android.mk b/hostsidetests/net/aidl/Android.mk
deleted file mode 100644
index 20dabc1..0000000
--- a/hostsidetests/net/aidl/Android.mk
+++ /dev/null
@@ -1,26 +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_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := \
-        com/android/cts/net/hostside/IMyService.aidl \
-        com/android/cts/net/hostside/INetworkCallback.aidl \
-        com/android/cts/net/hostside/INetworkStateObserver.aidl \
-        com/android/cts/net/hostside/IRemoteSocketFactory.aidl
-LOCAL_MODULE := CtsHostsideNetworkTestsAidl
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/hostsidetests/net/app/Android.bp b/hostsidetests/net/app/Android.bp
new file mode 100644
index 0000000..d66b71b
--- /dev/null
+++ b/hostsidetests/net/app/Android.bp
@@ -0,0 +1,39 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsHostsideNetworkTestsApp",
+    defaults: ["cts_support_defaults"],
+    //sdk_version: "current",
+    platform_apis: true,
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ub-uiautomator",
+        "CtsHostsideNetworkTestsAidl",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/net/app/Android.mk b/hostsidetests/net/app/Android.mk
deleted file mode 100644
index 11f6bb1..0000000
--- a/hostsidetests/net/app/Android.mk
+++ /dev/null
@@ -1,39 +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_TAGS := tests
-#LOCAL_SDK_VERSION := current
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt ub-uiautomator \
-        CtsHostsideNetworkTestsAidl
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsHostsideNetworkTestsApp
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/net/app2/Android.bp b/hostsidetests/net/app2/Android.bp
new file mode 100644
index 0000000..8a3c8e7
--- /dev/null
+++ b/hostsidetests/net/app2/Android.bp
@@ -0,0 +1,30 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsHostsideNetworkTestsApp2",
+    defaults: ["cts_support_defaults"],
+    sdk_version: "current",
+    static_libs: ["CtsHostsideNetworkTestsAidl"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    certificate: ":cts-net-app",
+}
diff --git a/hostsidetests/net/app2/Android.mk b/hostsidetests/net/app2/Android.mk
deleted file mode 100644
index 5c0bae1..0000000
--- a/hostsidetests/net/app2/Android.mk
+++ /dev/null
@@ -1,37 +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_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := CtsHostsideNetworkTestsAidl
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsHostsideNetworkTestsApp2
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_CERTIFICATE := cts/hostsidetests/net/certs/cts-net-app
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/net/certs/Android.bp b/hostsidetests/net/certs/Android.bp
new file mode 100644
index 0000000..ab4cf34
--- /dev/null
+++ b/hostsidetests/net/certs/Android.bp
@@ -0,0 +1,4 @@
+android_app_certificate {
+    name: "cts-net-app",
+    certificate: "cts-net-app",
+}
diff --git a/hostsidetests/numberblocking/Android.bp b/hostsidetests/numberblocking/Android.bp
new file mode 100644
index 0000000..9c50e44
--- /dev/null
+++ b/hostsidetests/numberblocking/Android.bp
@@ -0,0 +1,29 @@
+// 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.
+
+java_test_host {
+    name: "CtsHostsideNumberBlockingTestCases",
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+    ],
+}
diff --git a/hostsidetests/numberblocking/Android.mk b/hostsidetests/numberblocking/Android.mk
deleted file mode 100644
index d57a0d9..0000000
--- a/hostsidetests/numberblocking/Android.mk
+++ /dev/null
@@ -1,32 +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_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := tests
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE := CtsHostsideNumberBlockingTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/numberblocking/app/Android.bp b/hostsidetests/numberblocking/app/Android.bp
new file mode 100644
index 0000000..2716f87
--- /dev/null
+++ b/hostsidetests/numberblocking/app/Android.bp
@@ -0,0 +1,36 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsHostsideNumberBlockingAppTest",
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+    ],
+    libs: ["android.test.base.stubs"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/numberblocking/app/Android.mk b/hostsidetests/numberblocking/app/Android.mk
deleted file mode 100644
index 08bf132..0000000
--- a/hostsidetests/numberblocking/app/Android.mk
+++ /dev/null
@@ -1,41 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsHostsideNumberBlockingAppTest
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/os/Android.bp b/hostsidetests/os/Android.bp
new file mode 100644
index 0000000..c359656
--- /dev/null
+++ b/hostsidetests/os/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+java_test_host {
+    // Must match the package name in CtsTestCaseList.mk
+    name: "CtsOsHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/hostsidetests/os/Android.mk b/hostsidetests/os/Android.mk
deleted file mode 100644
index 932e2cf..0000000
--- a/hostsidetests/os/Android.mk
+++ /dev/null
@@ -1,36 +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_TAGS := optional
-
-# Must match the package name in CtsTestCaseList.mk
-LOCAL_MODULE := CtsOsHostTestCases
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-
-LOCAL_CTS_TEST_PACKAGE := android.host.os
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/os/app/Android.bp b/hostsidetests/os/app/Android.bp
new file mode 100644
index 0000000..384ab55
--- /dev/null
+++ b/hostsidetests/os/app/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.
+
+android_test_helper_app {
+    name: "CtsDeviceOsTestApp",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/hostsidetests/os/app/Android.mk b/hostsidetests/os/app/Android.mk
deleted file mode 100644
index 31e2812..0000000
--- a/hostsidetests/os/app/Android.mk
+++ /dev/null
@@ -1,31 +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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsDeviceOsTestApp
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/Android.mk b/hostsidetests/os/test-apps/Android.mk
deleted file mode 100644
index 0767e4b..0000000
--- a/hostsidetests/os/test-apps/Android.mk
+++ /dev/null
@@ -1,23 +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)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.bp b/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.bp
new file mode 100644
index 0000000..fb22fad
--- /dev/null
+++ b/hostsidetests/os/test-apps/HostLinkVerificationApp/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.
+//
+
+android_test_helper_app {
+    name: "CtsHostLinkVerificationApp",
+    defaults: ["cts_support_defaults"],
+    sdk_version: "current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk b/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk
deleted file mode 100644
index 99c2e1d..0000000
--- a/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk
+++ /dev/null
@@ -1,29 +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_TAGS := tests
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := CtsHostLinkVerificationApp
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/ProcfsTestApp/Android.bp b/hostsidetests/os/test-apps/ProcfsTestApp/Android.bp
new file mode 100644
index 0000000..df61619
--- /dev/null
+++ b/hostsidetests/os/test-apps/ProcfsTestApp/Android.bp
@@ -0,0 +1,29 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsHostProcfsTestApp",
+    defaults: ["cts_support_defaults"],
+    sdk_version: "current",
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/hostsidetests/os/test-apps/ProcfsTestApp/Android.mk b/hostsidetests/os/test-apps/ProcfsTestApp/Android.mk
deleted file mode 100644
index e42804f..0000000
--- a/hostsidetests/os/test-apps/ProcfsTestApp/Android.mk
+++ /dev/null
@@ -1,31 +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_TAGS := tests
-LOCAL_SDK_VERSION := current
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsHostProcfsTestApp
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.bp b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.bp
new file mode 100644
index 0000000..1e78ba5
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.bp
@@ -0,0 +1,33 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsStaticSharedLibConsumerApp1",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+    ],
+    libs: ["CtsStaticSharedLibProviderApp1"],
+    platform_apis: true,
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk
deleted file mode 100644
index 85aade7..0000000
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk
+++ /dev/null
@@ -1,36 +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_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    compatibility-device-util-axt
-
-LOCAL_RES_LIBRARIES := CtsStaticSharedLibProviderApp1
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedLibConsumerApp1
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.bp b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.bp
new file mode 100644
index 0000000..b4537c4
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.bp
@@ -0,0 +1,29 @@
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsStaticSharedLibConsumerApp2",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    static_libs: ["androidx.test.rules"],
+    libs: ["CtsStaticSharedLibProviderApp4"],
+    sdk_version: "current",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk
deleted file mode 100644
index 9e35c0e..0000000
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk
+++ /dev/null
@@ -1,33 +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_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_RES_LIBRARIES := CtsStaticSharedLibProviderApp4
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedLibConsumerApp2
-LOCAL_SDK_VERSION := current
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.bp b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.bp
new file mode 100644
index 0000000..4d4f7c9
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.bp
@@ -0,0 +1,29 @@
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsStaticSharedLibConsumerApp3",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    static_libs: ["androidx.test.rules"],
+    libs: ["CtsStaticSharedLibProviderApp7"],
+    sdk_version: "current",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.mk
deleted file mode 100644
index 6bb0f71..0000000
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.mk
+++ /dev/null
@@ -1,35 +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_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_RES_LIBRARIES := CtsStaticSharedLibProviderApp7
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedLibConsumerApp3
-LOCAL_SDK_VERSION := current
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_USE_AAPT2 := true
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp1/Android.bp b/hostsidetests/os/test-apps/StaticSharedLibProviderApp1/Android.bp
new file mode 100644
index 0000000..1a9c933
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderApp1/Android.bp
@@ -0,0 +1,35 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsStaticSharedLibProviderApp1",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    certificate: ":cts-keyset-test-b",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    optimize: {
+        enabled: false,
+    },
+    aaptflags: ["--shared-lib"],
+    libs: ["CtsStaticSharedLibProviderRecursive"],
+    export_package_resources: true,
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp1/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderApp1/Android.mk
deleted file mode 100644
index 85ee025..0000000
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderApp1/Android.mk
+++ /dev/null
@@ -1,40 +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_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedLibProviderApp1
-LOCAL_SDK_VERSION := current
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_AAPT_FLAGS := --shared-lib
-
-LOCAL_RES_LIBRARIES := CtsStaticSharedLibProviderRecursive
-
-LOCAL_EXPORT_PACKAGE_RESOURCES := true
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp2/Android.bp b/hostsidetests/os/test-apps/StaticSharedLibProviderApp2/Android.bp
new file mode 100644
index 0000000..0904361
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderApp2/Android.bp
@@ -0,0 +1,30 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsStaticSharedLibProviderApp2",
+    defaults: ["cts_support_defaults"],
+    sdk_version: "current",
+    certificate: ":cts-keyset-test-b",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    aaptflags: ["--shared-lib"],
+    export_package_resources: true,
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp2/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderApp2/Android.mk
deleted file mode 100644
index 97606eb..0000000
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderApp2/Android.mk
+++ /dev/null
@@ -1,35 +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_TAGS := tests
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedLibProviderApp2
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_AAPT_FLAGS := --shared-lib
-
-LOCAL_EXPORT_PACKAGE_RESOURCES := true
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp3/Android.bp b/hostsidetests/os/test-apps/StaticSharedLibProviderApp3/Android.bp
new file mode 100644
index 0000000..c866c6f
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderApp3/Android.bp
@@ -0,0 +1,29 @@
+//
+// 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.
+
+android_test_helper_app {
+    name: "CtsStaticSharedLibProviderApp3",
+    defaults: ["cts_support_defaults"],
+    sdk_version: "current",
+    certificate: ":cts-keyset-test-b",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    aaptflags: ["--shared-lib"],
+    export_package_resources: true,
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp3/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderApp3/Android.mk
deleted file mode 100644
index add7087..0000000
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderApp3/Android.mk
+++ /dev/null
@@ -1,34 +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_TAGS := tests
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedLibProviderApp3
-LOCAL_SDK_VERSION := current
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_AAPT_FLAGS := --shared-lib
-
-LOCAL_EXPORT_PACKAGE_RESOURCES := true
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp4/Android.bp b/hostsidetests/os/test-apps/StaticSharedLibProviderApp4/Android.bp
new file mode 100644
index 0000000..8989e22
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderApp4/Android.bp
@@ -0,0 +1,33 @@
+//
+// 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.
+
+android_test_helper_app {
+    name: "CtsStaticSharedLibProviderApp4",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    certificate: ":cts-keyset-test-a",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    optimize: {
+        enabled: false,
+    },
+    aaptflags: ["--shared-lib"],
+    export_package_resources: true,
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp4/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderApp4/Android.mk
deleted file mode 100644
index 9bba678..0000000
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderApp4/Android.mk
+++ /dev/null
@@ -1,37 +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_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedLibProviderApp4
-LOCAL_SDK_VERSION := current
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_AAPT_FLAGS := --shared-lib
-
-LOCAL_EXPORT_PACKAGE_RESOURCES := true
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp5/Android.bp b/hostsidetests/os/test-apps/StaticSharedLibProviderApp5/Android.bp
new file mode 100644
index 0000000..d77f030
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderApp5/Android.bp
@@ -0,0 +1,30 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsStaticSharedLibProviderApp5",
+    defaults: ["cts_support_defaults"],
+    sdk_version: "current",
+    certificate: ":cts-keyset-test-b",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    aaptflags: ["--shared-lib"],
+    export_package_resources: true,
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp5/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderApp5/Android.mk
deleted file mode 100644
index 84fc7b6..0000000
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderApp5/Android.mk
+++ /dev/null
@@ -1,35 +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_TAGS := tests
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedLibProviderApp5
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_AAPT_FLAGS := --shared-lib
-
-LOCAL_EXPORT_PACKAGE_RESOURCES := true
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp6/Android.bp b/hostsidetests/os/test-apps/StaticSharedLibProviderApp6/Android.bp
new file mode 100644
index 0000000..9048774
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderApp6/Android.bp
@@ -0,0 +1,30 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsStaticSharedLibProviderApp6",
+    defaults: ["cts_support_defaults"],
+    sdk_version: "current",
+    certificate: ":cts-keyset-test-b",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    aaptflags: ["--shared-lib"],
+    export_package_resources: true,
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp6/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderApp6/Android.mk
deleted file mode 100644
index 13cb9bd..0000000
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderApp6/Android.mk
+++ /dev/null
@@ -1,35 +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_TAGS := tests
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedLibProviderApp6
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_AAPT_FLAGS := --shared-lib
-
-LOCAL_EXPORT_PACKAGE_RESOURCES := true
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp7/Android.bp b/hostsidetests/os/test-apps/StaticSharedLibProviderApp7/Android.bp
new file mode 100644
index 0000000..253aa34
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderApp7/Android.bp
@@ -0,0 +1,35 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsStaticSharedLibProviderApp7",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    certificate: ":cts-keyset-test-b",
+    additional_certificates: [":cts-keyset-test-a"],
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    optimize: {
+        enabled: false,
+    },
+    aaptflags: ["--shared-lib"],
+    export_package_resources: true,
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp7/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderApp7/Android.mk
deleted file mode 100644
index 7788e25..0000000
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderApp7/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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedLibProviderApp7
-LOCAL_SDK_VERSION := current
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-
-LOCAL_ADDITIONAL_CERTIFICATES := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_AAPT_FLAGS := --shared-lib
-
-LOCAL_EXPORT_PACKAGE_RESOURCES := true
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderAppRecursive/Android.bp b/hostsidetests/os/test-apps/StaticSharedLibProviderAppRecursive/Android.bp
new file mode 100644
index 0000000..0812dc0
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderAppRecursive/Android.bp
@@ -0,0 +1,34 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsStaticSharedLibProviderRecursive",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    certificate: ":cts-keyset-test-b",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    optimize: {
+        enabled: false,
+    },
+    aaptflags: ["--shared-lib"],
+    export_package_resources: true,
+    sdk_version: "current",
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderAppRecursive/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderAppRecursive/Android.mk
deleted file mode 100644
index 0631904..0000000
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderAppRecursive/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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedLibProviderRecursive
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_AAPT_FLAGS := --shared-lib
-
-LOCAL_EXPORT_PACKAGE_RESOURCES := true
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.bp b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.bp
new file mode 100644
index 0000000..578c338
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.bp
@@ -0,0 +1,48 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsStaticSharedNativeLibConsumer",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    static_libs: ["androidx.test.rules"],
+    jni_libs: ["libstaticsharednativelibconsumerjni"],
+    sdk_version: "current",
+    compile_multilib: "both",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
+
+cc_test_library {
+    name: "libstaticsharednativelibconsumerjni",
+    gtest: false,
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+    ],
+    srcs: ["**/*.cpp"],
+    shared_libs: [
+        "liblog",
+        "libstaticsharednativelibprovider",
+    ],
+    sdk_version: "current",
+    stl: "none",
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.mk b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.mk
deleted file mode 100644
index 9564193..0000000
--- a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.mk
+++ /dev/null
@@ -1,66 +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_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules
-
-LOCAL_JNI_SHARED_LIBRARIES := libstaticsharednativelibconsumerjni
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedNativeLibConsumer
-LOCAL_SDK_VERSION := current
-
-LOCAL_MULTILIB := both
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
-#########################################################################
-# Build JNI Shared Library
-#########################################################################
-
-LOCAL_PATH:= $(LOCAL_PATH)/jni
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_CFLAGS := -Wall -Wextra -Werror
-
-LOCAL_SRC_FILES := $(call all-cpp-files-under)
-
-LOCAL_SHARED_LIBRARIES := liblog \
-    libstaticsharednativelibprovider
-
-LOCAL_SDK_VERSION := current
-LOCAL_NDK_STL_VARIANT := none
-
-LOCAL_C_INCLUDES += \
-    $(JNI_H_INCLUDE) \
-    $(LOCAL_PATH)/../CtsStaticSharedNativeLibProvider/native/version.h
-
-LOCAL_MODULE := libstaticsharednativelibconsumerjni
-
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/hostsidetests/os/test-apps/StaticSharedNativeLibProvider/Android.bp b/hostsidetests/os/test-apps/StaticSharedNativeLibProvider/Android.bp
new file mode 100644
index 0000000..c76e6d8
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedNativeLibProvider/Android.bp
@@ -0,0 +1,50 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsStaticSharedNativeLibProvider",
+    defaults: ["cts_support_defaults"],
+    jni_libs: ["libstaticsharednativelibprovider"],
+    sdk_version: "current",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    optimize: {
+        enabled: false,
+    },
+    aaptflags: ["--shared-lib"],
+    export_package_resources: true,
+    compile_multilib: "both",
+    certificate: ":cts-keyset-test-b",
+}
+
+cc_test_library {
+    name: "libstaticsharednativelibprovider",
+    gtest: false,
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+    ],
+    srcs: ["**/*.cpp"],
+    sdk_version: "current",
+    local_include_dirs: ["native"],
+    export_include_dirs: ["native"],
+    stl: "none",
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedNativeLibProvider/Android.mk b/hostsidetests/os/test-apps/StaticSharedNativeLibProvider/Android.mk
deleted file mode 100644
index 655adea..0000000
--- a/hostsidetests/os/test-apps/StaticSharedNativeLibProvider/Android.mk
+++ /dev/null
@@ -1,64 +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_TAGS := tests
-
-LOCAL_JNI_SHARED_LIBRARIES := libstaticsharednativelibprovider
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedNativeLibProvider
-LOCAL_SDK_VERSION := current
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_AAPT_FLAGS := --shared-lib
-
-LOCAL_EXPORT_PACKAGE_RESOURCES := true
-
-LOCAL_MULTILIB := both
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
-#########################################################################
-# Build Shared Library
-#########################################################################
-
-LOCAL_PATH:= $(LOCAL_PATH)/native
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_CFLAGS := -Wall -Wextra -Werror
-
-LOCAL_SRC_FILES := $(call all-cpp-files-under)
-
-LOCAL_MODULE := libstaticsharednativelibprovider
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/native/version.h
-
-LOCAL_NDK_STL_VARIANT := none
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/hostsidetests/os/test-apps/StaticSharedNativeLibProvider1/Android.bp b/hostsidetests/os/test-apps/StaticSharedNativeLibProvider1/Android.bp
new file mode 100644
index 0000000..005553b
--- /dev/null
+++ b/hostsidetests/os/test-apps/StaticSharedNativeLibProvider1/Android.bp
@@ -0,0 +1,35 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsStaticSharedNativeLibProvider1",
+    defaults: ["cts_support_defaults"],
+    jni_libs: ["libstaticsharednativelibprovider"],
+    sdk_version: "current",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    optimize: {
+        enabled: false,
+    },
+    aaptflags: ["--shared-lib"],
+    export_package_resources: true,
+    compile_multilib: "both",
+    certificate: ":cts-keyset-test-b",
+}
diff --git a/hostsidetests/os/test-apps/StaticSharedNativeLibProvider1/Android.mk b/hostsidetests/os/test-apps/StaticSharedNativeLibProvider1/Android.mk
deleted file mode 100644
index b26939a..0000000
--- a/hostsidetests/os/test-apps/StaticSharedNativeLibProvider1/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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_JNI_SHARED_LIBRARIES := libstaticsharednativelibprovider
-
-LOCAL_PACKAGE_NAME := CtsStaticSharedNativeLibProvider1
-LOCAL_SDK_VERSION := current
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_AAPT_FLAGS := --shared-lib
-
-LOCAL_EXPORT_PACKAGE_RESOURCES := true
-
-LOCAL_MULTILIB := both
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/sample/Android.bp b/hostsidetests/sample/Android.bp
new file mode 100644
index 0000000..33158cd
--- /dev/null
+++ b/hostsidetests/sample/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+java_test_host {
+    name: "CtsSampleHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+    ],
+}
diff --git a/hostsidetests/sample/Android.mk b/hostsidetests/sample/Android.mk
deleted file mode 100644
index 1b9bd44..0000000
--- a/hostsidetests/sample/Android.mk
+++ /dev/null
@@ -1,32 +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_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := tests
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_MODULE := CtsSampleHostTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/sample/app/Android.bp b/hostsidetests/sample/app/Android.bp
new file mode 100644
index 0000000..e942c64
--- /dev/null
+++ b/hostsidetests/sample/app/Android.bp
@@ -0,0 +1,27 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsSampleDeviceApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/sample/app/Android.mk b/hostsidetests/sample/app/Android.mk
deleted file mode 100644
index bc271b6..0000000
--- a/hostsidetests/sample/app/Android.mk
+++ /dev/null
@@ -1,37 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsSampleDeviceApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/sample/app2/Android.bp b/hostsidetests/sample/app2/Android.bp
new file mode 100644
index 0000000..3acdeb5
--- /dev/null
+++ b/hostsidetests/sample/app2/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.
+
+android_test_helper_app {
+    name: "CtsSampleDeviceApp2",
+    defaults: ["cts_defaults"],
+    static_libs: ["androidx.test.rules"],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/sample/app2/Android.mk b/hostsidetests/sample/app2/Android.mk
deleted file mode 100644
index e050412..0000000
--- a/hostsidetests/sample/app2/Android.mk
+++ /dev/null
@@ -1,39 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsSampleDeviceApp2
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/seccomp/Android.bp b/hostsidetests/seccomp/Android.bp
new file mode 100644
index 0000000..cb61ad4
--- /dev/null
+++ b/hostsidetests/seccomp/Android.bp
@@ -0,0 +1,29 @@
+// 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.
+
+java_test_host {
+    name: "CtsSeccompHostTestCases",
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+    ],
+}
diff --git a/hostsidetests/seccomp/Android.mk b/hostsidetests/seccomp/Android.mk
deleted file mode 100644
index 2c1c077..0000000
--- a/hostsidetests/seccomp/Android.mk
+++ /dev/null
@@ -1,32 +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_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := tests
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE := CtsSeccompHostTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/seccomp/app/Android.bp b/hostsidetests/seccomp/app/Android.bp
new file mode 100644
index 0000000..da78d53
--- /dev/null
+++ b/hostsidetests/seccomp/app/Android.bp
@@ -0,0 +1,37 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsSeccompDeviceApp",
+    compile_multilib: "both",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+    ],
+    jni_libs: [
+        "libctsseccomp_jni",
+        "libcts_jni",
+        "libnativehelper_compat_libc++",
+    ],
+    srcs: ["src/**/*.java"],
+    asset_dirs: ["assets"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/seccomp/app/Android.mk b/hostsidetests/seccomp/app/Android.mk
deleted file mode 100644
index 216a3c5..0000000
--- a/hostsidetests/seccomp/app/Android.mk
+++ /dev/null
@@ -1,54 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-          androidx.test.rules \
-          compatibility-device-util-axt \
-
-LOCAL_JNI_SHARED_LIBRARIES := \
-          libctsseccomp_jni \
-          libcts_jni \
-          libnativehelper_compat_libc++ \
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsSeccompDeviceApp
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/seccomp/app/jni/Android.bp b/hostsidetests/seccomp/app/jni/Android.bp
new file mode 100644
index 0000000..3dc4f1c
--- /dev/null
+++ b/hostsidetests/seccomp/app/jni/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.
+
+cc_test_library {
+    name: "libctsseccomp_jni",
+    gtest: false,
+    srcs: [
+        "CtsSeccompJniOnLoad.cpp",
+        "android_seccomp_cts_app_SeccompDeviceTest.cpp",
+    ],
+    sdk_version: "current",
+    static_libs: ["cpufeatures"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    shared_libs: [
+        "liblog",
+    ],
+    stl: "c++_static",
+}
diff --git a/hostsidetests/seccomp/app/jni/Android.mk b/hostsidetests/seccomp/app/jni/Android.mk
deleted file mode 100644
index 3637f27..0000000
--- a/hostsidetests/seccomp/app/jni/Android.mk
+++ /dev/null
@@ -1,36 +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 := libctsseccomp_jni
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
-		CtsSeccompJniOnLoad.cpp \
-		android_seccomp_cts_app_SeccompDeviceTest.cpp \
-
-LOCAL_SDK_VERSION := current
-LOCAL_LDLIBS := -llog
-LOCAL_C_INCLUDES += ndk/sources/cpufeatures
-LOCAL_STATIC_LIBRARIES := cpufeatures
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_NDK_STL_VARIANT := c++_static
-include $(BUILD_SHARED_LIBRARY)
diff --git a/hostsidetests/shortcuts/Android.mk b/hostsidetests/shortcuts/Android.mk
deleted file mode 100644
index 3d02f9c..0000000
--- a/hostsidetests/shortcuts/Android.mk
+++ /dev/null
@@ -1,17 +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 $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/shortcuts/deviceside/Android.bp b/hostsidetests/shortcuts/deviceside/Android.bp
new file mode 100644
index 0000000..df7acb7
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/Android.bp
@@ -0,0 +1,9 @@
+java_defaults {
+    name: "hostsidetests-shortcuts-deviceside-defaults",
+    static_libs: [
+        "hostsidetests-shortcuts-deviceside-common",
+        "ShortcutManagerTestUtils",
+    ],
+    libs: ["android.test.base.stubs"],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/shortcuts/deviceside/Android.mk b/hostsidetests/shortcuts/deviceside/Android.mk
deleted file mode 100644
index 3d02f9c..0000000
--- a/hostsidetests/shortcuts/deviceside/Android.mk
+++ /dev/null
@@ -1,17 +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 $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/shortcuts/deviceside/backup/Android.mk b/hostsidetests/shortcuts/deviceside/backup/Android.mk
deleted file mode 100644
index 3d02f9c..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/Android.mk
+++ /dev/null
@@ -1,17 +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 $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.bp b/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.bp
new file mode 100644
index 0000000..8a5bf93
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupLauncher1",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+
+    srcs: [
+        "src/**/*.java",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk
deleted file mode 100644
index 2c647d3..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk
+++ /dev/null
@@ -1,44 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupLauncher1
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.bp b/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.bp
new file mode 100644
index 0000000..73b4f75
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupLauncher2",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+
+    srcs: [
+        "src/**/*.java",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk
deleted file mode 100644
index 4279ea6..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk
+++ /dev/null
@@ -1,44 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupLauncher2
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.bp b/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.bp
new file mode 100644
index 0000000..3f2b17c
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupLauncher3",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+
+    srcs: [
+        "src/**/*.java",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk
deleted file mode 100644
index f4f3cdd..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk
+++ /dev/null
@@ -1,44 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupLauncher3
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.bp b/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.bp
new file mode 100644
index 0000000..81276ff
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupLauncher4new",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    static_libs: [
+        "CtsShortcutBackupPublisher4oldLib",
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.mk
deleted file mode 100644
index 8509b88..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.mk
+++ /dev/null
@@ -1,44 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupLauncher4new
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../launcher4old/src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.bp b/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.bp
new file mode 100644
index 0000000..89a4ab9
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.bp
@@ -0,0 +1,41 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupLauncher4old",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    static_libs: [
+        "CtsShortcutBackupPublisher4oldLib",
+        "compatibility-device-util-axt",
+    ],
+}
+
+android_library {
+    name: "CtsShortcutBackupLauncher4oldLib",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+    srcs: ["src/**/*.java"],
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.mk
deleted file mode 100644
index 2ac1739..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.mk
+++ /dev/null
@@ -1,44 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupLauncher4old
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.bp b/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.bp
new file mode 100644
index 0000000..f8db411
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupPublisher1",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    srcs: [
+        "src/**/*.java",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk
deleted file mode 100644
index 16e42c2..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk
+++ /dev/null
@@ -1,44 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupPublisher1
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.bp b/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.bp
new file mode 100644
index 0000000..1b4e96a
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupPublisher2",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    srcs: [
+        "src/**/*.java",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk
deleted file mode 100644
index bd54e76..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk
+++ /dev/null
@@ -1,44 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupPublisher2
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.bp b/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.bp
new file mode 100644
index 0000000..f473520
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupPublisher3",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+
+    srcs: [
+        "src/**/*.java",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk
deleted file mode 100644
index ec0d201..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk
+++ /dev/null
@@ -1,44 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupPublisher3
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.bp b/hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.bp
new file mode 100644
index 0000000..54fc458
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new/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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupPublisher4new",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    static_libs: [
+        "CtsShortcutBackupPublisher4oldLib",
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.mk
deleted file mode 100644
index 8f4993a..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.mk
+++ /dev/null
@@ -1,46 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupPublisher4new
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../publisher4old/src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.bp b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.bp
new file mode 100644
index 0000000..895d2e6
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupPublisher4new_nobackup",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    static_libs: [
+        "CtsShortcutBackupPublisher4oldLib",
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.mk
deleted file mode 100644
index 456da8f..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.mk
+++ /dev/null
@@ -1,46 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupPublisher4new_nobackup
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../publisher4old/src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.bp b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.bp
new file mode 100644
index 0000000..3b739fa
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupPublisher4new_nomanifest",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    static_libs: [
+        "CtsShortcutBackupPublisher4oldLib",
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.mk
deleted file mode 100644
index 6b7e3af..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.mk
+++ /dev/null
@@ -1,46 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupPublisher4new_nomanifest
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../publisher4old/src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.bp b/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.bp
new file mode 100644
index 0000000..ae33f42
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupPublisher4new_wrongkey",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    static_libs: [
+        "CtsShortcutBackupPublisher4oldLib",
+        "compatibility-device-util-axt",
+    ],
+    certificate: ":cts-testkey1",
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.mk
deleted file mode 100644
index 1f46743..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.mk
+++ /dev/null
@@ -1,48 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupPublisher4new_wrongkey
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../publisher4old/src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.bp b/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.bp
new file mode 100644
index 0000000..1a8929e
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.bp
@@ -0,0 +1,41 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupPublisher4old",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    static_libs: [
+        "CtsShortcutBackupPublisher4oldLib",
+        "compatibility-device-util-axt",
+    ],
+}
+
+android_library {
+    name: "CtsShortcutBackupPublisher4oldLib",
+    srcs: ["src/**/*.java"],
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.mk
deleted file mode 100644
index 0e84c87..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.mk
+++ /dev/null
@@ -1,44 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupPublisher4old
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.bp b/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.bp
new file mode 100644
index 0000000..ce09a9c
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/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.
+
+android_test_helper_app {
+    name: "CtsShortcutBackupPublisher4old_nomanifest",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    static_libs: [
+        "CtsShortcutBackupPublisher4oldLib",
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.mk
deleted file mode 100644
index 1f772a9..0000000
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.mk
+++ /dev/null
@@ -1,46 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutBackupPublisher4old_nomanifest
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../publisher4old/src) \
-    $(call all-java-files-under, ../../common/src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/common/Android.bp b/hostsidetests/shortcuts/deviceside/common/Android.bp
new file mode 100644
index 0000000..ea69333
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/common/Android.bp
@@ -0,0 +1,9 @@
+java_library {
+    name: "hostsidetests-shortcuts-deviceside-common",
+    srcs: ["src/**/*.java"],
+    libs: [
+        "android.test.base.stubs",
+        "ShortcutManagerTestUtils",
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/multiuser/Android.bp b/hostsidetests/shortcuts/deviceside/multiuser/Android.bp
new file mode 100644
index 0000000..d20151e
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/multiuser/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsShortcutMultiuserTest",
+    defaults: [
+        "cts_defaults",
+        "hostsidetests-shortcuts-deviceside-defaults",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    srcs: [
+        "src/**/*.java",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/multiuser/Android.mk b/hostsidetests/shortcuts/deviceside/multiuser/Android.mk
deleted file mode 100644
index 255b569..0000000
--- a/hostsidetests/shortcuts/deviceside/multiuser/Android.mk
+++ /dev/null
@@ -1,46 +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.
-
-# We build two APKs from the same source files, each with a different set of resources.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutMultiuserTest
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/deviceside/upgrade/Android.bp b/hostsidetests/shortcuts/deviceside/upgrade/Android.bp
new file mode 100644
index 0000000..a0e435f
--- /dev/null
+++ b/hostsidetests/shortcuts/deviceside/upgrade/Android.bp
@@ -0,0 +1,49 @@
+// 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.
+
+// We build two APKs from the same source files, each with a different set of resources.
+android_test_helper_app {
+    name: "CtsShortcutUpgradeVersion1",
+    defaults: [
+        "hostsidetests-shortcuts-deviceside-defaults",
+        "cts_defaults",
+    ],
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["version1/res"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
+
+android_test_helper_app {
+    name: "CtsShortcutUpgradeVersion2",
+    defaults: [
+        "hostsidetests-shortcuts-deviceside-defaults",
+        "cts_defaults",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["version2/res"],
+    static_libs: [
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/hostsidetests/shortcuts/deviceside/upgrade/Android.mk b/hostsidetests/shortcuts/deviceside/upgrade/Android.mk
deleted file mode 100644
index 0397afc..0000000
--- a/hostsidetests/shortcuts/deviceside/upgrade/Android.mk
+++ /dev/null
@@ -1,83 +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.
-
-# We build two APKs from the same source files, each with a different set of resources.
-
-# =================================
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutUpgradeVersion1
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../common/src)
-
-LOCAL_RESOURCE_DIR :=  $(LOCAL_PATH)/version1/res
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
-
-# =============================
-
-include $(CLEAR_VARS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutUpgradeVersion2
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../common/src)
-
-LOCAL_RESOURCE_DIR :=  $(LOCAL_PATH)/version2/res
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := system_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/shortcuts/hostside/Android.bp b/hostsidetests/shortcuts/hostside/Android.bp
new file mode 100644
index 0000000..2188702
--- /dev/null
+++ b/hostsidetests/shortcuts/hostside/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+java_test_host {
+    name: "CtsShortcutHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "tools-common-prebuilt",
+        "cts-tradefed",
+        "tradefed",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/shortcuts/hostside/Android.mk b/hostsidetests/shortcuts/hostside/Android.mk
deleted file mode 100644
index f8bf4dd..0000000
--- a/hostsidetests/shortcuts/hostside/Android.mk
+++ /dev/null
@@ -1,35 +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 := CtsShortcutHostTestCases
-
-LOCAL_CTS_TEST_PACKAGE := android.shortcutshostside
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := tools-common-prebuilt cts-tradefed tradefed
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/PackageInstallerSessionInfoSubject.java b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/PackageInstallerSessionInfoSubject.java
index e56e00f..e78e5f3 100644
--- a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/PackageInstallerSessionInfoSubject.java
+++ b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/PackageInstallerSessionInfoSubject.java
@@ -18,9 +18,8 @@
 
 import android.content.pm.PackageInstaller;
 
-import com.google.common.truth.FailureStrategy;
+import com.google.common.truth.FailureMetadata;
 import com.google.common.truth.Subject;
-import com.google.common.truth.SubjectFactory;
 import com.google.common.truth.Truth;
 
 import javax.annotation.Nullable;
@@ -28,19 +27,19 @@
 final class PackageInstallerSessionInfoSubject extends
         Subject<PackageInstallerSessionInfoSubject, PackageInstaller.SessionInfo> {
 
-    private PackageInstallerSessionInfoSubject(FailureStrategy failureStrategy,
+    private PackageInstallerSessionInfoSubject(FailureMetadata failureMetadata,
             @Nullable PackageInstaller.SessionInfo subject) {
-        super(failureStrategy, subject);
+        super(failureMetadata, subject);
     }
 
-    private static SubjectFactory<PackageInstallerSessionInfoSubject,
+    private static Subject.Factory<PackageInstallerSessionInfoSubject,
             PackageInstaller.SessionInfo> sessions() {
-        return new SubjectFactory<PackageInstallerSessionInfoSubject,
+        return new Subject.Factory<PackageInstallerSessionInfoSubject,
                 PackageInstaller.SessionInfo>() {
             @Override
-            public PackageInstallerSessionInfoSubject getSubject(FailureStrategy failureStrategy,
+            public PackageInstallerSessionInfoSubject createSubject(FailureMetadata failureMetadata,
                     PackageInstaller.SessionInfo session) {
-                return new PackageInstallerSessionInfoSubject(failureStrategy, session);
+                return new PackageInstallerSessionInfoSubject(failureMetadata, session);
             }
         };
     }
@@ -51,17 +50,17 @@
     }
 
     public void isStagedSessionReady() {
-        check().withFailureMessage(failureMessage("in state READY")).that(
+        check().withMessage(failureMessage("in state READY")).that(
                 getSubject().isStagedSessionReady()).isTrue();
     }
 
     public void isStagedSessionApplied() {
-        check().withFailureMessage(failureMessage("in state APPLIED")).that(
+        check().withMessage(failureMessage("in state APPLIED")).that(
                 getSubject().isStagedSessionApplied()).isTrue();
     }
 
     public void isStagedSessionFailed() {
-        check().withFailureMessage(failureMessage("in state FAILED")).that(
+        check().withMessage(failureMessage("in state FAILED")).that(
                 getSubject().isStagedSessionFailed()).isTrue();
     }
 
diff --git a/hostsidetests/systemui/Android.bp b/hostsidetests/systemui/Android.bp
new file mode 100644
index 0000000..f263446
--- /dev/null
+++ b/hostsidetests/systemui/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+java_test_host {
+    name: "CtsSystemUiHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/systemui/Android.mk b/hostsidetests/systemui/Android.mk
deleted file mode 100644
index ba437b9..0000000
--- a/hostsidetests/systemui/Android.mk
+++ /dev/null
@@ -1,36 +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_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MODULE := CtsSystemUiHostTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-
-LOCAL_CTS_TEST_PACKAGE := android.host.systemui
-
-LOCAL_SDK_VERSION := current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/systemui/app/Android.bp b/hostsidetests/systemui/app/Android.bp
new file mode 100644
index 0000000..7083b80
--- /dev/null
+++ b/hostsidetests/systemui/app/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsSystemUiDeviceApp",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/systemui/app/Android.mk b/hostsidetests/systemui/app/Android.mk
deleted file mode 100644
index fed7a9f..0000000
--- a/hostsidetests/systemui/app/Android.mk
+++ /dev/null
@@ -1,37 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsSystemUiDeviceApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/theme/assets/R/260dpi.zip b/hostsidetests/theme/assets/R/260dpi.zip
new file mode 100644
index 0000000..ba5d363
--- /dev/null
+++ b/hostsidetests/theme/assets/R/260dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/280dpi.zip b/hostsidetests/theme/assets/R/280dpi.zip
new file mode 100644
index 0000000..34ea14c
--- /dev/null
+++ b/hostsidetests/theme/assets/R/280dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/300dpi.zip b/hostsidetests/theme/assets/R/300dpi.zip
new file mode 100644
index 0000000..7595d24
--- /dev/null
+++ b/hostsidetests/theme/assets/R/300dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/340dpi.zip b/hostsidetests/theme/assets/R/340dpi.zip
new file mode 100644
index 0000000..8ce960c
--- /dev/null
+++ b/hostsidetests/theme/assets/R/340dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/360dpi.zip b/hostsidetests/theme/assets/R/360dpi.zip
new file mode 100644
index 0000000..aae3adc
--- /dev/null
+++ b/hostsidetests/theme/assets/R/360dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/400dpi.zip b/hostsidetests/theme/assets/R/400dpi.zip
new file mode 100644
index 0000000..363d602
--- /dev/null
+++ b/hostsidetests/theme/assets/R/400dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/420dpi.zip b/hostsidetests/theme/assets/R/420dpi.zip
new file mode 100644
index 0000000..0f2ce47
--- /dev/null
+++ b/hostsidetests/theme/assets/R/420dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/440dpi.zip b/hostsidetests/theme/assets/R/440dpi.zip
new file mode 100644
index 0000000..2328c61
--- /dev/null
+++ b/hostsidetests/theme/assets/R/440dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/560dpi.zip b/hostsidetests/theme/assets/R/560dpi.zip
new file mode 100644
index 0000000..5f1bb0b
--- /dev/null
+++ b/hostsidetests/theme/assets/R/560dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/hdpi.zip b/hostsidetests/theme/assets/R/hdpi.zip
new file mode 100644
index 0000000..6d82318
--- /dev/null
+++ b/hostsidetests/theme/assets/R/hdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/ldpi.zip b/hostsidetests/theme/assets/R/ldpi.zip
new file mode 100644
index 0000000..cc60027
--- /dev/null
+++ b/hostsidetests/theme/assets/R/ldpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/mdpi.zip b/hostsidetests/theme/assets/R/mdpi.zip
new file mode 100644
index 0000000..66d41d4
--- /dev/null
+++ b/hostsidetests/theme/assets/R/mdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/tvdpi.zip b/hostsidetests/theme/assets/R/tvdpi.zip
new file mode 100644
index 0000000..b43032f
--- /dev/null
+++ b/hostsidetests/theme/assets/R/tvdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/xhdpi.zip b/hostsidetests/theme/assets/R/xhdpi.zip
new file mode 100644
index 0000000..64905f3
--- /dev/null
+++ b/hostsidetests/theme/assets/R/xhdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/xxhdpi.zip b/hostsidetests/theme/assets/R/xxhdpi.zip
new file mode 100644
index 0000000..b2cb422
--- /dev/null
+++ b/hostsidetests/theme/assets/R/xxhdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/R/xxxhdpi.zip b/hostsidetests/theme/assets/R/xxxhdpi.zip
new file mode 100644
index 0000000..d00dbbd
--- /dev/null
+++ b/hostsidetests/theme/assets/R/xxxhdpi.zip
Binary files differ
diff --git a/hostsidetests/trustedvoice/Android.bp b/hostsidetests/trustedvoice/Android.bp
new file mode 100644
index 0000000..8394d6d
--- /dev/null
+++ b/hostsidetests/trustedvoice/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+java_test_host {
+    name: "CtsTrustedVoiceHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    // Must match the package name in CtsTestCaseList.mk
+    libs: [
+        "cts-tradefed",
+        "ddmlib-prebuilt",
+        "tradefed",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/trustedvoice/Android.mk b/hostsidetests/trustedvoice/Android.mk
deleted file mode 100644
index 34806f3..0000000
--- a/hostsidetests/trustedvoice/Android.mk
+++ /dev/null
@@ -1,35 +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_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := optional
-
-# Must match the package name in CtsTestCaseList.mk
-LOCAL_MODULE := CtsTrustedVoiceHostTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed ddmlib-prebuilt tradefed
-
-LOCAL_CTS_TEST_PACKAGE := android.host.trustedvoice
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/trustedvoice/app/Android.bp b/hostsidetests/trustedvoice/app/Android.bp
new file mode 100644
index 0000000..3841b80
--- /dev/null
+++ b/hostsidetests/trustedvoice/app/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsTrustedVoiceApp",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/hostsidetests/trustedvoice/app/Android.mk b/hostsidetests/trustedvoice/app/Android.mk
deleted file mode 100644
index 5127579..0000000
--- a/hostsidetests/trustedvoice/app/Android.mk
+++ /dev/null
@@ -1,34 +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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsTrustedVoiceApp
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/tv/Android.bp b/hostsidetests/tv/Android.bp
new file mode 100644
index 0000000..01d598fe
--- /dev/null
+++ b/hostsidetests/tv/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+java_test_host {
+    name: "CtsHostsideTvTests",
+    defaults: ["cts_defaults"],
+    // Only compile source java files in this apk.
+    srcs: ["src/**/*.java"],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/tv/Android.mk b/hostsidetests/tv/Android.mk
deleted file mode 100644
index 79f976a..0000000
--- a/hostsidetests/tv/Android.mk
+++ /dev/null
@@ -1,34 +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)
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := CtsHostsideTvTests
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-
-LOCAL_CTS_TEST_PACKAGE := android.tv.hostsidetv
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/tv/app/Android.bp b/hostsidetests/tv/app/Android.bp
new file mode 100644
index 0000000..b6151be
--- /dev/null
+++ b/hostsidetests/tv/app/Android.bp
@@ -0,0 +1,38 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsHostsideTvInputApp",
+    defaults: ["cts_support_defaults"],
+    sdk_version: "test_current",
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    optimize: {
+        enabled: false,
+    },
+    dex_preopt: {
+        enabled: false,
+    },
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/tv/app/Android.mk b/hostsidetests/tv/app/Android.mk
deleted file mode 100644
index 0b49885..0000000
--- a/hostsidetests/tv/app/Android.mk
+++ /dev/null
@@ -1,35 +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_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsHostsideTvInputApp
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/tv/app2/Android.bp b/hostsidetests/tv/app2/Android.bp
new file mode 100644
index 0000000..e8d31f7
--- /dev/null
+++ b/hostsidetests/tv/app2/Android.bp
@@ -0,0 +1,33 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsHostsideTvInputMonitor",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    srcs: ["src/**/*.java"],
+    libs: ["android.test.runner.stubs"],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/tv/app2/Android.mk b/hostsidetests/tv/app2/Android.mk
deleted file mode 100644
index 8257909..0000000
--- a/hostsidetests/tv/app2/Android.mk
+++ /dev/null
@@ -1,38 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsHostsideTvInputMonitor
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/tzdata/Android.bp b/hostsidetests/tzdata/Android.bp
new file mode 100644
index 0000000..cec8a3b
--- /dev/null
+++ b/hostsidetests/tzdata/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.
+
+java_test_host {
+    name: "CtsHostTzDataTests",
+    defaults: ["cts_defaults"],
+    // Only compile source java files in this apk.
+    srcs: ["src/**/*.java"],
+    libs: ["tradefed"],
+    static_libs: [
+        "tzdata-testing",
+        "time_zone_distro",
+        "time_zone_distro_builder",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/tzdata/Android.mk b/hostsidetests/tzdata/Android.mk
deleted file mode 100644
index f5bd2f1..0000000
--- a/hostsidetests/tzdata/Android.mk
+++ /dev/null
@@ -1,33 +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)
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := CtsHostTzDataTests
-
-LOCAL_JAVA_LIBRARIES := tradefed
-
-LOCAL_STATIC_JAVA_LIBRARIES := tzdata-testing time_zone_distro time_zone_distro_builder
-
-LOCAL_CTS_TEST_PACKAGE := android.host.tzdata
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/tzdata/OWNERS b/hostsidetests/tzdata/OWNERS
new file mode 100644
index 0000000..2d36574
--- /dev/null
+++ b/hostsidetests/tzdata/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 24949
+include platform/libcore:/OWNERS
diff --git a/hostsidetests/ui/appA/Android.bp b/hostsidetests/ui/appA/Android.bp
new file mode 100644
index 0000000..9b92163
--- /dev/null
+++ b/hostsidetests/ui/appA/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsDeviceTaskSwitchingAppA",
+    defaults: ["cts_support_defaults"],
+    // don't include this package in any target
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/ui/appA/Android.mk b/hostsidetests/ui/appA/Android.mk
deleted file mode 100644
index 17da676..0000000
--- a/hostsidetests/ui/appA/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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsDeviceTaskSwitchingAppA
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/ui/appB/Android.bp b/hostsidetests/ui/appB/Android.bp
new file mode 100644
index 0000000..60f5853
--- /dev/null
+++ b/hostsidetests/ui/appB/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsDeviceTaskSwitchingAppB",
+    defaults: ["cts_support_defaults"],
+    // don't include this package in any target
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/ui/appB/Android.mk b/hostsidetests/ui/appB/Android.mk
deleted file mode 100644
index 11fc2b0..0000000
--- a/hostsidetests/ui/appB/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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsDeviceTaskSwitchingAppB
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/ui/control/Android.bp b/hostsidetests/ui/control/Android.bp
new file mode 100644
index 0000000..4ff73a0
--- /dev/null
+++ b/hostsidetests/ui/control/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.
+
+android_test {
+    name: "CtsDeviceTaskSwitchingControl",
+    defaults: ["cts_support_defaults"],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/hostsidetests/ui/control/Android.mk b/hostsidetests/ui/control/Android.mk
deleted file mode 100644
index 2a30338..0000000
--- a/hostsidetests/ui/control/Android.mk
+++ /dev/null
@@ -1,36 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsDeviceTaskSwitchingControl
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/usage/Android.bp b/hostsidetests/usage/Android.bp
new file mode 100644
index 0000000..5ebeb54
--- /dev/null
+++ b/hostsidetests/usage/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+java_test_host {
+    name: "CtsAppUsageHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    // Must match the package name in CtsTestCaseList.mk
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/hostsidetests/usage/Android.mk b/hostsidetests/usage/Android.mk
deleted file mode 100644
index ff4f5e0..0000000
--- a/hostsidetests/usage/Android.mk
+++ /dev/null
@@ -1,33 +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_SRC_FILES := $(call all-java-files-under, src)
-
-# Must match the package name in CtsTestCaseList.mk
-LOCAL_MODULE := CtsAppUsageHostTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed
-
-LOCAL_CTS_TEST_PACKAGE := android.host.app.usage
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/usage/app/Android.bp b/hostsidetests/usage/app/Android.bp
new file mode 100644
index 0000000..48a30d9
--- /dev/null
+++ b/hostsidetests/usage/app/Android.bp
@@ -0,0 +1,45 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsAppUsageTestApp",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
+
+// Build a second one similar to the first
+
+android_test_helper_app {
+    name: "CtsAppUsageTestAppToo",
+    defaults: ["cts_support_defaults"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    aaptflags: [
+        "--rename-manifest-package",
+        "android.app.usage.apptoo",
+    ],
+}
diff --git a/hostsidetests/usage/app/Android.mk b/hostsidetests/usage/app/Android.mk
deleted file mode 100644
index 3d51230..0000000
--- a/hostsidetests/usage/app/Android.mk
+++ /dev/null
@@ -1,51 +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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := CtsAppUsageTestApp
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
-# Build a second one similar to the first
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := CtsAppUsageTestAppToo
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_AAPT_FLAGS += --rename-manifest-package android.app.usage.apptoo
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/usb/Android.bp b/hostsidetests/usb/Android.bp
new file mode 100644
index 0000000..8c0bd95
--- /dev/null
+++ b/hostsidetests/usb/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+java_test_host {
+    name: "CtsUsbTests",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "cts-tradefed",
+        "tradefed",
+        "compatibility-host-util",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/hostsidetests/usb/Android.mk b/hostsidetests/usb/Android.mk
deleted file mode 100644
index 116fa39..0000000
--- a/hostsidetests/usb/Android.mk
+++ /dev/null
@@ -1,34 +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)
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := CtsUsbTests
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-
-LOCAL_CTS_TEST_PACKAGE := android.usb
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/usb/SerialTestApp/Android.bp b/hostsidetests/usb/SerialTestApp/Android.bp
new file mode 100644
index 0000000..ec06142
--- /dev/null
+++ b/hostsidetests/usb/SerialTestApp/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsUsbSerialTestApp",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: ["android.test.base.stubs"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "test_current",
+    min_sdk_version: "27",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/hostsidetests/usb/SerialTestApp/Android.mk b/hostsidetests/usb/SerialTestApp/Android.mk
deleted file mode 100644
index d14bcc0..0000000
--- a/hostsidetests/usb/SerialTestApp/Android.mk
+++ /dev/null
@@ -1,38 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt \
-	compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsUsbSerialTestApp
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 27
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/webkit/Android.bp b/hostsidetests/webkit/Android.bp
new file mode 100644
index 0000000..afbb007
--- /dev/null
+++ b/hostsidetests/webkit/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+java_test_host {
+    name: "CtsHostsideWebViewTests",
+    defaults: ["cts_defaults"],
+    // Only compile source java files in this apk.
+    srcs: ["src/**/*.java"],
+    libs: [
+        "tradefed",
+        "compatibility-host-util",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/hostsidetests/webkit/Android.mk b/hostsidetests/webkit/Android.mk
deleted file mode 100644
index 814760a..0000000
--- a/hostsidetests/webkit/Android.mk
+++ /dev/null
@@ -1,34 +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)
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := CtsHostsideWebViewTests
-
-LOCAL_JAVA_LIBRARIES := tradefed compatibility-host-util
-
-LOCAL_CTS_TEST_PACKAGE := android.webkit.hostside
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_HOST_JAVA_LIBRARY)
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/webkit/app/Android.bp b/hostsidetests/webkit/app/Android.bp
new file mode 100644
index 0000000..b2ce1f2
--- /dev/null
+++ b/hostsidetests/webkit/app/Android.bp
@@ -0,0 +1,40 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsWebViewStartupApp",
+    defaults: ["cts_support_defaults"],
+    // Don't include this package in any target.
+    sdk_version: "test_current",
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctsdeviceutillegacy-axt",
+        "ctstestserver",
+        "ctstestrunner-axt",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/hostsidetests/webkit/app/Android.mk b/hostsidetests/webkit/app/Android.mk
deleted file mode 100644
index 98a7092..0000000
--- a/hostsidetests/webkit/app/Android.mk
+++ /dev/null
@@ -1,45 +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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctsdeviceutillegacy-axt \
-    ctstestserver \
-    ctstestrunner-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-# When built, explicitly put it in the data partition.
-#LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsWebViewStartupApp
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/libs/rollback/src/com/android/cts/rollback/lib/RollbackInfoSubject.java b/libs/rollback/src/com/android/cts/rollback/lib/RollbackInfoSubject.java
index 2769b80..8bc9247 100644
--- a/libs/rollback/src/com/android/cts/rollback/lib/RollbackInfoSubject.java
+++ b/libs/rollback/src/com/android/cts/rollback/lib/RollbackInfoSubject.java
@@ -20,9 +20,8 @@
 import android.content.rollback.PackageRollbackInfo;
 import android.content.rollback.RollbackInfo;
 
-import com.google.common.truth.FailureStrategy;
+import com.google.common.truth.FailureMetadata;
 import com.google.common.truth.Subject;
-import com.google.common.truth.SubjectFactory;
 import com.google.common.truth.Truth;
 
 import java.util.ArrayList;
@@ -42,20 +41,20 @@
     /**
      * Gets the subject factory for RollbackInfo.
      */
-    public static SubjectFactory<RollbackInfoSubject, RollbackInfo> rollbacks() {
+    public static Subject.Factory<RollbackInfoSubject, RollbackInfo> rollbacks() {
         return SUBJECT_FACTORY;
     }
 
-    private static final SubjectFactory<RollbackInfoSubject, RollbackInfo> SUBJECT_FACTORY =
-            new SubjectFactory<RollbackInfoSubject, RollbackInfo>() {
+    private static final Subject.Factory<RollbackInfoSubject, RollbackInfo> SUBJECT_FACTORY =
+            new Subject.Factory<RollbackInfoSubject, RollbackInfo>() {
                 @Override
-                public RollbackInfoSubject getSubject(FailureStrategy fs, RollbackInfo that) {
+                public RollbackInfoSubject createSubject(FailureMetadata fs, RollbackInfo that) {
                     return new RollbackInfoSubject(fs, that);
                 }
             };
 
-    private RollbackInfoSubject(FailureStrategy failureStrategy, RollbackInfo subject) {
-        super(failureStrategy, subject);
+    private RollbackInfoSubject(FailureMetadata failureMetadata, RollbackInfo subject) {
+        super(failureMetadata, subject);
     }
 
     /**
diff --git a/tests/JobSchedulerSharedUid/Android.bp b/tests/JobSchedulerSharedUid/Android.bp
new file mode 100644
index 0000000..1320dc2
--- /dev/null
+++ b/tests/JobSchedulerSharedUid/Android.bp
@@ -0,0 +1,39 @@
+// Copyright (C) 2018 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.
+
+android_test {
+    name: "CtsJobSchedulerSharedUidTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ub-uiautomator",
+        "androidx.test.rules",
+    ],
+    libs: ["android.test.base.stubs"],
+    srcs: [
+        "src/**/*.java",
+        "JobSharedUidTestApp/src/**/*.java",
+        "jobperm/src/**/*.java",
+        "shareduid/src/**/*.java",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    //sdk_version: "current"
+    platform_apis: true,
+
+}
diff --git a/tests/JobSchedulerSharedUid/Android.mk b/tests/JobSchedulerSharedUid/Android.mk
deleted file mode 100755
index 0b9912c..0000000
--- a/tests/JobSchedulerSharedUid/Android.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (C) 2018 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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ub-uiautomator androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SRC_FILES += $(call all-java-files-under, JobSharedUidTestApp/src)
-LOCAL_SRC_FILES += $(call all-java-files-under, jobperm/src)
-LOCAL_SRC_FILES += $(call all-java-files-under, shareduid/src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# Must match the package name in CtsTestCaseList.mk
-LOCAL_PACKAGE_NAME := CtsJobSchedulerSharedUidTestCases
-
-#LOCAL_SDK_VERSION := current
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/JobSchedulerSharedUid/JobSharedUidTestApp/Android.bp b/tests/JobSchedulerSharedUid/JobSharedUidTestApp/Android.bp
new file mode 100644
index 0000000..6ff76da
--- /dev/null
+++ b/tests/JobSchedulerSharedUid/JobSharedUidTestApp/Android.bp
@@ -0,0 +1,26 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsJobSharedUidTestApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/tests/JobSchedulerSharedUid/JobSharedUidTestApp/Android.mk b/tests/JobSchedulerSharedUid/JobSharedUidTestApp/Android.mk
deleted file mode 100644
index f3d36db..0000000
--- a/tests/JobSchedulerSharedUid/JobSharedUidTestApp/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2018 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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src) \
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsJobSharedUidTestApp
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/JobSchedulerSharedUid/jobperm/Android.bp b/tests/JobSchedulerSharedUid/jobperm/Android.bp
new file mode 100644
index 0000000..e20fc55
--- /dev/null
+++ b/tests/JobSchedulerSharedUid/jobperm/Android.bp
@@ -0,0 +1,30 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsJobSchedulerJobPerm",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "android-support-annotations",
+        "compatibility-device-util-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    platform_apis: true,
+}
diff --git a/tests/JobSchedulerSharedUid/jobperm/Android.mk b/tests/JobSchedulerSharedUid/jobperm/Android.mk
deleted file mode 100644
index 2a1b2ae..0000000
--- a/tests/JobSchedulerSharedUid/jobperm/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2018 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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-annotations \
-    compatibility-device-util-axt \
-
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src) \
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsJobSchedulerJobPerm
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/JobSchedulerSharedUid/shareduid/Android.bp b/tests/JobSchedulerSharedUid/shareduid/Android.bp
new file mode 100644
index 0000000..68ed7f5
--- /dev/null
+++ b/tests/JobSchedulerSharedUid/shareduid/Android.bp
@@ -0,0 +1,27 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsJobSchedulerSharedUid",
+    defaults: ["cts_defaults"],
+    static_libs: ["compatibility-device-util-axt"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/JobSchedulerSharedUid/shareduid/Android.mk b/tests/JobSchedulerSharedUid/shareduid/Android.mk
deleted file mode 100644
index cfc89cd..0000000
--- a/tests/JobSchedulerSharedUid/shareduid/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2018 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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src) \
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsJobSchedulerSharedUid
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/acceleration/Android.bp b/tests/acceleration/Android.bp
new file mode 100644
index 0000000..5ab6a1c
--- /dev/null
+++ b/tests/acceleration/Android.bp
@@ -0,0 +1,41 @@
+// 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.
+
+android_test {
+    name: "CtsAccelerationTestCases",
+    defaults: ["cts_defaults"],
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/acceleration/Android.mk b/tests/acceleration/Android.mk
deleted file mode 100644
index 33ecfb4..0000000
--- a/tests/acceleration/Android.mk
+++ /dev/null
@@ -1,41 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsAccelerationTestCases
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/accessibilityservice/Android.bp b/tests/accessibilityservice/Android.bp
new file mode 100644
index 0000000..527ce29
--- /dev/null
+++ b/tests/accessibilityservice/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.
+
+android_test {
+    name: "CtsAccessibilityServiceTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "hamcrest-library",
+        "mockito-target-minus-junit4",
+        "platform-test-annotations",
+        "CtsAccessibilityCommon",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/accessibilityservice/Android.mk b/tests/accessibilityservice/Android.mk
deleted file mode 100644
index c4480d7..0000000
--- a/tests/accessibilityservice/Android.mk
+++ /dev/null
@@ -1,41 +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_MODULE_TAGS := optional
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    hamcrest-library \
-    mockito-target-minus-junit4 \
-    platform-test-annotations \
-    CtsAccessibilityCommon
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsAccessibilityServiceTestCases
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/admin/Android.bp b/tests/admin/Android.bp
new file mode 100644
index 0000000..93ebf89
--- /dev/null
+++ b/tests/admin/Android.bp
@@ -0,0 +1,37 @@
+// 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.
+
+android_test {
+    name: "CtsAdminTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "mockito-target-minus-junit4",
+        "truth-prebuilt",
+        "testng",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    instrumentation_for: "CtsAdminApp",
+    sdk_version: "test_current",
+}
diff --git a/tests/admin/Android.mk b/tests/admin/Android.mk
deleted file mode 100644
index bc2a36a..0000000
--- a/tests/admin/Android.mk
+++ /dev/null
@@ -1,41 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt mockito-target-minus-junit4 truth-prebuilt testng
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsAdminTestCases
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_INSTRUMENTATION_FOR := CtsAdminApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/app/Android.bp b/tests/app/Android.bp
new file mode 100644
index 0000000..f9ea9c2
--- /dev/null
+++ b/tests/app/Android.bp
@@ -0,0 +1,112 @@
+// 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.
+
+android_test {
+    name: "CtsAppTestCases",
+    defaults: ["cts_defaults"],
+    libs: [
+        "android.test.runner.stubs",
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ctstestserver",
+        "mockito-target-minus-junit4",
+        "androidx.test.rules",
+        "platform-test-annotations",
+        "cts-wm-util",
+        "androidx.test.rules",
+        "platformprotosnano",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    instrumentation_for: "CtsAppTestStubs",
+    sdk_version: "test_current",
+    min_sdk_version: "14",
+}
+
+android_test_helper_app {
+    name: "CtsDownloadManagerApi28",
+    defaults: ["cts_defaults"],
+    libs: [
+        "android.test.runner.stubs",
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ctstestserver",
+        "mockito-target-minus-junit4",
+        "androidx.test.rules",
+        "platform-test-annotations",
+        "androidx.test.rules",
+    ],
+    srcs: [
+        "DownloadManagerApi28Test/src/**/*.java",
+        "src/android/app/cts/DownloadManagerTestBase.java",
+    ],
+    resource_dirs: ["app/res"],
+    asset_dirs: ["app/assets"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+    min_sdk_version: "14",
+    manifest: "DownloadManagerApi28Test/AndroidManifest.xml",
+}
+
+android_test {
+    name: "CtsDownloadManagerLegacy",
+    defaults: ["cts_defaults"],
+    libs: [
+        "android.test.runner.stubs",
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ctstestserver",
+        "mockito-target-minus-junit4",
+        "androidx.test.rules",
+        "platform-test-annotations",
+        "androidx.test.rules",
+    ],
+    srcs: [
+        "DownloadManagerLegacyTest/src/**/*.java",
+        "src/android/app/cts/DownloadManagerTestBase.java",
+    ],
+    resource_dirs: ["app/res"],
+    asset_dirs: ["app/assets"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+    min_sdk_version: "14",
+    manifest: "DownloadManagerLegacyTest/AndroidManifest.xml",
+}
diff --git a/tests/app/Android.mk b/tests/app/Android.mk
deleted file mode 100644
index aa7eafe..0000000
--- a/tests/app/Android.mk
+++ /dev/null
@@ -1,55 +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)
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_JAVA_LIBRARIES := \
-    android.test.runner.stubs \
-    org.apache.http.legacy \
-    android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ctstestserver \
-    mockito-target-minus-junit4 \
-    androidx.test.rules \
-    platform-test-annotations \
-    cts-wm-util \
-    androidx.test.rules \
-    platformprotosnano
-
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsAppTestCases
-
-LOCAL_INSTRUMENTATION_FOR := CtsAppTestStubs
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 11
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/app/CantSaveState1/Android.bp b/tests/app/CantSaveState1/Android.bp
new file mode 100644
index 0000000..401d7e3
--- /dev/null
+++ b/tests/app/CantSaveState1/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsCantSaveState1",
+    defaults: ["cts_support_defaults"],
+    srcs: ["**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/tests/app/CantSaveState1/Android.mk b/tests/app/CantSaveState1/Android.mk
deleted file mode 100644
index 72c762d..0000000
--- a/tests/app/CantSaveState1/Android.mk
+++ /dev/null
@@ -1,33 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsCantSaveState1
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/app/CantSaveState2/Android.bp b/tests/app/CantSaveState2/Android.bp
new file mode 100644
index 0000000..77a1487
--- /dev/null
+++ b/tests/app/CantSaveState2/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsCantSaveState2",
+    defaults: ["cts_support_defaults"],
+    srcs: ["**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/tests/app/CantSaveState2/Android.mk b/tests/app/CantSaveState2/Android.mk
deleted file mode 100644
index 4023063..0000000
--- a/tests/app/CantSaveState2/Android.mk
+++ /dev/null
@@ -1,33 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsCantSaveState2
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/app/DownloadManagerApi28Test/Android.mk b/tests/app/DownloadManagerApi28Test/Android.mk
deleted file mode 100644
index 51f4dde..0000000
--- a/tests/app/DownloadManagerApi28Test/Android.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright (C) 2019 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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_JAVA_LIBRARIES := \
-    android.test.runner.stubs \
-    org.apache.http.legacy \
-    android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ctstestserver \
-    mockito-target-minus-junit4 \
-    androidx.test.rules \
-    platform-test-annotations \
-    androidx.test.rules \
-
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src) \
-    ../src/android/app/cts/DownloadManagerTestBase.java
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../app/res
-
-LOCAL_ASSET_DIR := $(LOCAL_PATH)/../app/assets
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsDownloadManagerApi28
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 11
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
\ No newline at end of file
diff --git a/tests/app/DownloadManagerLegacyTest/Android.mk b/tests/app/DownloadManagerLegacyTest/Android.mk
deleted file mode 100644
index 8f1bcba..0000000
--- a/tests/app/DownloadManagerLegacyTest/Android.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright (C) 2019 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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_JAVA_LIBRARIES := \
-    android.test.runner.stubs \
-    org.apache.http.legacy \
-    android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ctstestserver \
-    mockito-target-minus-junit4 \
-    androidx.test.rules \
-    platform-test-annotations \
-    androidx.test.rules \
-
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src) \
-    ../src/android/app/cts/DownloadManagerTestBase.java
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../app/res
-
-LOCAL_ASSET_DIR := $(LOCAL_PATH)/../app/assets
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsDownloadManagerLegacy
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 11
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
\ No newline at end of file
diff --git a/tests/app/NotificationDelegator/Android.bp b/tests/app/NotificationDelegator/Android.bp
new file mode 100644
index 0000000..13b0cac
--- /dev/null
+++ b/tests/app/NotificationDelegator/Android.bp
@@ -0,0 +1,26 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "NotificationDelegator",
+    defaults: ["cts_support_defaults"],
+    srcs: ["**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/tests/app/NotificationDelegator/Android.mk b/tests/app/NotificationDelegator/Android.mk
deleted file mode 100644
index dde1787..0000000
--- a/tests/app/NotificationDelegator/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2018 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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := NotificationDelegator
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/app/app/Android.bp b/tests/app/app/Android.bp
new file mode 100644
index 0000000..a7a77d4
--- /dev/null
+++ b/tests/app/app/Android.bp
@@ -0,0 +1,142 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsAppTestStubs",
+    defaults: ["cts_support_defaults"],
+    libs: [
+        "android.test.runner.stubs",
+        "telephony-common",
+        "voip-common",
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ctstestserver",
+        "mockito-target-minus-junit4",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "src/android/app/stubs/ISecondary.aidl",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    platform_apis: true,
+}
+
+android_test_helper_app {
+    name: "CtsAppTestStubsApp1",
+    defaults: ["cts_support_defaults"],
+    libs: [
+        "android.test.runner.stubs",
+        "telephony-common",
+        "voip-common",
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ctstestserver",
+        "mockito-target-minus-junit4",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "src/android/app/stubs/ISecondary.aidl",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    platform_apis: true,
+    aaptflags: [
+        "--rename-manifest-package com.android.app1",
+    ],
+}
+
+android_test {
+    name: "CtsAppTestStubsApp2",
+    defaults: ["cts_support_defaults"],
+    libs: [
+        "android.test.runner.stubs",
+        "telephony-common",
+        "voip-common",
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ctstestserver",
+        "mockito-target-minus-junit4",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "src/android/app/stubs/ISecondary.aidl",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    platform_apis: true,
+    aaptflags: [
+        "--rename-manifest-package com.android.app2",
+    ],
+}
+
+android_test_helper_app {
+    name: "CtsAppTestStubsApp3",
+    defaults: ["cts_support_defaults"],
+    libs: [
+        "android.test.runner.stubs",
+        "telephony-common",
+        "voip-common",
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ctstestserver",
+        "mockito-target-minus-junit4",
+        "androidx.legacy_legacy-support-v4",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "src/android/app/stubs/ISecondary.aidl",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    platform_apis: true,
+    aaptflags: [
+        "--rename-manifest-package com.android.app3",
+    ],
+}
diff --git a/tests/app/app/Android.mk b/tests/app/app/Android.mk
deleted file mode 100644
index d973bab..0000000
--- a/tests/app/app/Android.mk
+++ /dev/null
@@ -1,52 +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)
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_JAVA_LIBRARIES := \
-    android.test.runner.stubs \
-    telephony-common \
-    voip-common \
-    org.apache.http.legacy \
-    android.test.base.stubs \
-
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ctstestserver \
-    mockito-target-minus-junit4 \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-              src/android/app/stubs/ISecondary.aidl
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsAppTestStubs
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_USE_AAPT2 := true
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/app/app1/Android.mk b/tests/app/app1/Android.mk
deleted file mode 100644
index 9286c88..0000000
--- a/tests/app/app1/Android.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright (C) 2018 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)/../app
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_JAVA_LIBRARIES := \
-    android.test.runner.stubs \
-    telephony-common \
-    voip-common \
-    org.apache.http.legacy \
-    android.test.base.stubs \
-
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ctstestserver \
-    mockito-target-minus-junit4 \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-              src/android/app/stubs/ISecondary.aidl
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsAppTestStubsApp1
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_AAPT_FLAGS += --rename-manifest-package com.android.app1
-
-# Disable AAPT2 manifest checks to fix:
-# cts/tests/app/app/AndroidManifest.xml:25: error: unexpected element <meta-data> found in <manifest><permission>.
-# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements.
-LOCAL_AAPT_FLAGS += --warn-manifest-validation
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/app/app2/Android.mk b/tests/app/app2/Android.mk
deleted file mode 100644
index 3e2543b..0000000
--- a/tests/app/app2/Android.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright (C) 2018 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)/../app
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_JAVA_LIBRARIES := \
-    android.test.runner.stubs \
-    telephony-common \
-    voip-common \
-    org.apache.http.legacy \
-    android.test.base.stubs \
-
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ctstestserver \
-    mockito-target-minus-junit4 \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-              src/android/app/stubs/ISecondary.aidl
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsAppTestStubsApp2
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_AAPT_FLAGS += --rename-manifest-package com.android.app2
-
-# Disable AAPT2 manifest checks to fix:
-# cts/tests/app/app/AndroidManifest.xml:25: error: unexpected element <meta-data> found in <manifest><permission>.
-# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements.
-LOCAL_AAPT_FLAGS += --warn-manifest-validation
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/app/app3/Android.mk b/tests/app/app3/Android.mk
deleted file mode 100644
index 79e9c98..0000000
--- a/tests/app/app3/Android.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright (C) 2018 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)/../app
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_JAVA_LIBRARIES := \
-    android.test.runner.stubs \
-    telephony-common \
-    voip-common \
-    org.apache.http.legacy \
-    android.test.base.stubs \
-
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ctstestserver \
-    mockito-target-minus-junit4 \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-              src/android/app/stubs/ISecondary.aidl
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsAppTestStubsApp3
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_AAPT_FLAGS += --rename-manifest-package com.android.app3
-
-# Disable AAPT2 manifest checks to fix:
-# cts/tests/app/app/AndroidManifest.xml:25: error: unexpected element <meta-data> found in <manifest><permission>.
-# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements.
-LOCAL_AAPT_FLAGS += --warn-manifest-validation
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/app/src/android/app/cts/SystemFeaturesTest.java b/tests/app/src/android/app/cts/SystemFeaturesTest.java
index 2257689..fa7e980 100644
--- a/tests/app/src/android/app/cts/SystemFeaturesTest.java
+++ b/tests/app/src/android/app/cts/SystemFeaturesTest.java
@@ -327,6 +327,24 @@
     }
 
     @Test
+    public void testNfcFeatures() {
+        if (NfcAdapter.getDefaultAdapter(mContext) != null) {
+            // Watches MAY support all FEATURE_NFC features when an NfcAdapter is available, but
+            // non-watches MUST support them both.
+            if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_WATCH)) {
+                assertOneAvailable(PackageManager.FEATURE_NFC,
+                    PackageManager.FEATURE_NFC_HOST_CARD_EMULATION);
+            } else {
+                assertAvailable(PackageManager.FEATURE_NFC);
+                assertAvailable(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION);
+            }
+        } else {
+            assertNotAvailable(PackageManager.FEATURE_NFC);
+            assertNotAvailable(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION);
+        }
+    }
+
+    @Test
     public void testScreenFeatures() {
         assertTrue(mPackageManager.hasSystemFeature(PackageManager.FEATURE_SCREEN_LANDSCAPE)
                 || mPackageManager.hasSystemFeature(PackageManager.FEATURE_SCREEN_PORTRAIT));
diff --git a/tests/inputmethod/Android.bp b/tests/inputmethod/Android.bp
new file mode 100644
index 0000000..1309bcb
--- /dev/null
+++ b/tests/inputmethod/Android.bp
@@ -0,0 +1,41 @@
+// 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.
+
+android_test {
+    name: "CtsInputMethodTestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    compile_multilib: "both",
+    libs: ["android.test.runner.stubs"],
+    static_libs: [
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "CtsMockInputMethodLib",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "src/**/I*.aidl",
+    ],
+    aidl: {
+        local_include_dirs: ["src"],
+    },
+    sdk_version: "test_current",
+}
diff --git a/tests/inputmethod/Android.mk b/tests/inputmethod/Android.mk
deleted file mode 100644
index c9c5953..0000000
--- a/tests/inputmethod/Android.mk
+++ /dev/null
@@ -1,49 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_MULTILIB := both
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    CtsMockInputMethodLib
-
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src) \
-    $(call all-Iaidl-files-under, src)
-
-LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/src
-
-LOCAL_PACKAGE_NAME := CtsInputMethodTestCases
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/inputmethod/mockime/Android.bp b/tests/inputmethod/mockime/Android.bp
new file mode 100644
index 0000000..1b68764
--- /dev/null
+++ b/tests/inputmethod/mockime/Android.bp
@@ -0,0 +1,50 @@
+// 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.
+
+java_test_helper_library {
+    name: "CtsMockInputMethodLib",
+    sdk_version: "test_current",
+
+    // TODO: ideally we should split MockIme source files into three categories
+    //       1) common, 2) common + IME-only, and 3) common + client-only.
+    //       Currently, both MockIme APK and test APKs that use MockIme contain
+    //       all the Java classes, which is inefficient.
+    srcs: ["src/**/*.java"],
+    libs: ["junit"],
+    static_libs: [
+        "androidx.annotation_annotation",
+        "compatibility-device-util-axt",
+    ],
+}
+
+android_test_helper_app {
+    name: "CtsMockInputMethod",
+    defaults: ["cts_defaults"],
+    optimize: {
+        enabled: false,
+    },
+    sdk_version: "current",
+    min_sdk_version: "19",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    static_libs: [
+        "androidx.annotation_annotation",
+        "CtsMockInputMethodLib",
+    ],
+}
diff --git a/tests/inputmethod/mockime/Android.mk b/tests/inputmethod/mockime/Android.mk
deleted file mode 100644
index d0b1eec..0000000
--- a/tests/inputmethod/mockime/Android.mk
+++ /dev/null
@@ -1,60 +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 := CtsMockInputMethodLib
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SDK_VERSION := current
-
-# TODO: ideally we should split MockIme source files into three categories
-#       1) common, 2) common + IME-only, and 3) common + client-only.
-#       Currently, both MockIme APK and test APKs that use MockIme contain
-#       all the Java classes, which is inefficient.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_LIBRARIES := junit
-LOCAL_STATIC_JAVA_LIBRARIES := \
-   androidx.annotation_annotation \
-   compatibility-device-util-axt
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-# -----------
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PACKAGE_NAME := CtsMockInputMethod
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 19
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-   androidx.annotation_annotation \
-   CtsMockInputMethodLib
-
-include $(BUILD_PACKAGE)
diff --git a/tests/jdwp/OWNERS b/tests/jdwp/OWNERS
new file mode 100644
index 0000000..6e06299
--- /dev/null
+++ b/tests/jdwp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 86431
+include /hostsidetests/jvmti/run-tests/OWNERS
diff --git a/tests/libcore/Android.mk b/tests/libcore/Android.mk
deleted file mode 100644
index 00d1223..0000000
--- a/tests/libcore/Android.mk
+++ /dev/null
@@ -1,16 +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.
-
-# Build the test APK using its own makefile, and any other CTS-related packages
-include $(call all-subdir-makefiles)
diff --git a/tests/libcore/jsr166/Android.bp b/tests/libcore/jsr166/Android.bp
new file mode 100644
index 0000000..83e0331
--- /dev/null
+++ b/tests/libcore/jsr166/Android.bp
@@ -0,0 +1,36 @@
+// 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.
+
+android_test {
+    name: "CtsLibcoreJsr166TestCases",
+    defaults: ["cts_support_defaults"],
+    platform_apis: true,
+    static_libs: [
+        "cts-core-test-runner-axt",
+        "jsr166-tests",
+    ],
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    java_resources: [":libcore-expectations-knownfailures"],
+}
diff --git a/tests/libcore/jsr166/Android.mk b/tests/libcore/jsr166/Android.mk
deleted file mode 100644
index 3cb2bfa..0000000
--- a/tests/libcore/jsr166/Android.mk
+++ /dev/null
@@ -1,42 +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_PACKAGE_NAME := CtsLibcoreJsr166TestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    cts-core-test-runner-axt \
-    jsr166-tests
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-LOCAL_JACK_FLAGS := --multi-dex native
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_JAVA_RESOURCE_FILES := libcore/expectations/knownfailures.txt
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/libcore/jsr166/OWNERS b/tests/libcore/jsr166/OWNERS
deleted file mode 100644
index 7b5c0ad..0000000
--- a/tests/libcore/jsr166/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# NOTE: Each source root in CTS should have an OWNERS file as a reminder to
-# add owners to it. It's okay for this file to be empty because the parent
-# directory's owners get inherited by default.
diff --git a/tests/libcore/luni/Android.bp b/tests/libcore/luni/Android.bp
new file mode 100644
index 0000000..a754ce4
--- /dev/null
+++ b/tests/libcore/luni/Android.bp
@@ -0,0 +1,63 @@
+// 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.
+
+android_test {
+    name: "CtsLibcoreTestCases",
+    defaults: ["cts_support_defaults"],
+    platform_apis: true,
+    static_libs: [
+        "apache-harmony-tests",
+        "conscrypt-tests",
+        "core-tests",
+        "cts-core-test-runner-axt",
+        "mockito-target-minus-junit4",
+        "time_zone_distro-tests",
+        "time_zone_distro_installer-tests",
+    ],
+    dex_preopt: {
+        enabled: false,
+    },
+    dxflags: ["--multi-dex"],
+    // Exclude apache harmony tests from coverage instrumentation, since it breaks
+    // the tests of reflection APIs by adding fields and methods to the test classes.
+    jacoco: {
+        exclude_filter: ["org.apache.harmony.tests.**"],
+    },
+    optimize: {
+        enabled: false,
+    },
+    jni_libs: [
+        "libjavacoretests",
+        "libsqlite_jni",
+        "libnativehelper_compat_libc++",
+        "libc++",
+    ],
+    // Include both the 32 and 64 bit versions of libjavacoretests,
+    // where applicable.
+    compile_multilib: "both",
+    // This test requires cts-dalvik-host-test-runner to be built to run via Atest.
+    host_required: ["cts-dalvik-host-test-runner"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    // NOTE: virtualdeviceknownfailures.txt is only used for simulated/cloud-based
+    // continuous build configurations, so it's not referenced in AndroidTest.xml
+    java_resources: [
+        ":libcore-expectations-knownfailures",
+        ":libcore-expectations-virtualdeviceknownfailures",
+    ],
+}
diff --git a/tests/libcore/luni/Android.mk b/tests/libcore/luni/Android.mk
deleted file mode 100644
index 2ba08cb..0000000
--- a/tests/libcore/luni/Android.mk
+++ /dev/null
@@ -1,66 +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_PACKAGE_NAME := CtsLibcoreTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    apache-harmony-tests \
-    conscrypt-tests \
-    core-tests \
-    cts-core-test-runner-axt \
-    mockito-target-minus-junit4 \
-    time_zone_distro-tests \
-    time_zone_distro_installer-tests
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-LOCAL_JACK_FLAGS := --multi-dex native
-LOCAL_DX_FLAGS := --multi-dex
-
-# Exclude apache harmony tests from coverage instrumentation, since it breaks
-# the tests of reflection APIs by adding fields and methods to the test classes.
-LOCAL_JACK_COVERAGE_EXCLUDE_FILTER := org.apache.harmony.tests.*
-
-LOCAL_PROGUARD_ENABLED := disabled
-# Keep META-INF/ resources from LOCAL_STATIC_JAVA_LIBRARIES. http://b/62341677
-LOCAL_DONT_DELETE_JAR_META_INF := true
-LOCAL_JNI_SHARED_LIBRARIES := libjavacoretests libsqlite_jni libnativehelper_compat_libc++ libc++
-
-# Include both the 32 and 64 bit versions of libjavacoretests,
-# where applicable.
-LOCAL_MULTILIB := both
-
-# This test requires cts-dalvik-host-test-runner to be built to run via Atest.
-LOCAL_HOST_REQUIRED_MODULES := cts-dalvik-host-test-runner
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# NOTE: virtualdeviceknownfailures.txt is only used for simulated/cloud-based
-# continuous build configurations, so it's not referenced in AndroidTest.xml
-LOCAL_JAVA_RESOURCE_FILES := \
-    libcore/expectations/knownfailures.txt \
-    libcore/expectations/virtualdeviceknownfailures.txt
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/libcore/luni/OWNERS b/tests/libcore/luni/OWNERS
deleted file mode 100644
index 7b5c0ad..0000000
--- a/tests/libcore/luni/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# NOTE: Each source root in CTS should have an OWNERS file as a reminder to
-# add owners to it. It's okay for this file to be empty because the parent
-# directory's owners get inherited by default.
diff --git a/tests/libcore/ojluni/Android.bp b/tests/libcore/ojluni/Android.bp
new file mode 100644
index 0000000..83fe2aa
--- /dev/null
+++ b/tests/libcore/ojluni/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+
+android_test {
+    name: "CtsLibcoreOjTestCases",
+    defaults: ["cts_support_defaults"],
+    platform_apis: true,
+    static_libs: ["core-ojtests-public"],
+    libs: ["testng"],
+    dxflags: ["--core-library"],
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    // Include both the 32 and 64 bit versions of libjavacoretests,
+    // where applicable.
+    compile_multilib: "both",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    java_resources: [":libcore-expectations-knownfailures"],
+}
diff --git a/tests/libcore/ojluni/Android.mk b/tests/libcore/ojluni/Android.mk
deleted file mode 100644
index 8354615..0000000
--- a/tests/libcore/ojluni/Android.mk
+++ /dev/null
@@ -1,52 +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_PACKAGE_NAME := CtsLibcoreOjTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    core-ojtests-public
-
-LOCAL_JAVA_LIBRARIES := testng
-
-LOCAL_DX_FLAGS := --core-library
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-LOCAL_JACK_FLAGS := --multi-dex native
-
-# Keep META-INF/ resources from LOCAL_STATIC_JAVA_LIBRARIES. http://b/62231394
-LOCAL_DONT_DELETE_JAR_META_INF := true
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-# Include both the 32 and 64 bit versions of libjavacoretests,
-# where applicable.
-LOCAL_MULTILIB := both
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_JAVA_RESOURCE_FILES := libcore/expectations/knownfailures.txt
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/libcore/ojluni/OWNERS b/tests/libcore/ojluni/OWNERS
deleted file mode 100644
index 7b5c0ad..0000000
--- a/tests/libcore/ojluni/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# NOTE: Each source root in CTS should have an OWNERS file as a reminder to
-# add owners to it. It's okay for this file to be empty because the parent
-# directory's owners get inherited by default.
diff --git a/tests/libcore/okhttp/Android.bp b/tests/libcore/okhttp/Android.bp
new file mode 100644
index 0000000..5052019
--- /dev/null
+++ b/tests/libcore/okhttp/Android.bp
@@ -0,0 +1,41 @@
+// 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.
+
+android_test {
+    name: "CtsLibcoreOkHttpTestCases",
+    defaults: ["cts_support_defaults"],
+    platform_apis: true,
+    static_libs: [
+        "bouncycastle-unbundled",
+        "cts-core-test-runner-axt",
+        "okhttp-nojarjar",
+        "okhttp-tests-nojarjar",
+    ],
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    // Include both the 32 and 64 bit versions of libjavacoretests,
+    // where applicable.
+    compile_multilib: "both",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    java_resources: [":libcore-expectations-knownfailures"],
+}
diff --git a/tests/libcore/okhttp/Android.mk b/tests/libcore/okhttp/Android.mk
deleted file mode 100644
index eb061da..0000000
--- a/tests/libcore/okhttp/Android.mk
+++ /dev/null
@@ -1,48 +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_PACKAGE_NAME := CtsLibcoreOkHttpTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    bouncycastle-unbundled \
-    cts-core-test-runner-axt \
-    okhttp-nojarjar \
-    okhttp-tests-nojarjar
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-LOCAL_JACK_FLAGS := --multi-dex native
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-# Include both the 32 and 64 bit versions of libjavacoretests,
-# where applicable.
-LOCAL_MULTILIB := both
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_JAVA_RESOURCE_FILES := libcore/expectations/knownfailures.txt
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/libcore/okhttp/OWNERS b/tests/libcore/okhttp/OWNERS
deleted file mode 100644
index 7b5c0ad..0000000
--- a/tests/libcore/okhttp/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# NOTE: Each source root in CTS should have an OWNERS file as a reminder to
-# add owners to it. It's okay for this file to be empty because the parent
-# directory's owners get inherited by default.
diff --git a/tests/libcore/runner/Android.bp b/tests/libcore/runner/Android.bp
new file mode 100644
index 0000000..2b8c525
--- /dev/null
+++ b/tests/libcore/runner/Android.bp
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+    name: "CtsLibcoreTestRunner",
+    defaults: ["cts_support_defaults"],
+    sdk_version: "test_current",
+    static_libs: ["cts-core-test-runner-axt"],
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/libcore/runner/Android.mk b/tests/libcore/runner/Android.mk
deleted file mode 100644
index 093779b..0000000
--- a/tests/libcore/runner/Android.mk
+++ /dev/null
@@ -1,39 +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_PACKAGE_NAME := CtsLibcoreTestRunner
-LOCAL_SDK_VERSION := current
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    cts-core-test-runner-axt
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-LOCAL_JACK_FLAGS := --multi-dex native
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/libcore/runner/OWNERS b/tests/libcore/runner/OWNERS
deleted file mode 100644
index 7b5c0ad..0000000
--- a/tests/libcore/runner/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# NOTE: Each source root in CTS should have an OWNERS file as a reminder to
-# add owners to it. It's okay for this file to be empty because the parent
-# directory's owners get inherited by default.
diff --git a/tests/libcore/wycheproof-bc/Android.bp b/tests/libcore/wycheproof-bc/Android.bp
new file mode 100644
index 0000000..f719b1a
--- /dev/null
+++ b/tests/libcore/wycheproof-bc/Android.bp
@@ -0,0 +1,39 @@
+// 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.
+
+android_test {
+    name: "CtsLibcoreWycheproofBCTestCases",
+    defaults: ["cts_support_defaults"],
+    platform_apis: true,
+    static_libs: [
+        "cts-core-test-runner-axt",
+        "wycheproof",
+    ],
+    srcs: ["src/**/*.java"],
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    // Include both the 32 and 64 bit versions of libjavacoretests,
+    // where applicable.
+    compile_multilib: "both",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+    ],
+    java_resources: [":libcore-expectations-knownfailures"],
+}
diff --git a/tests/libcore/wycheproof-bc/Android.mk b/tests/libcore/wycheproof-bc/Android.mk
deleted file mode 100644
index 832a155..0000000
--- a/tests/libcore/wycheproof-bc/Android.mk
+++ /dev/null
@@ -1,48 +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_PACKAGE_NAME := CtsLibcoreWycheproofBCTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    cts-core-test-runner-axt \
-    wycheproof
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,src)
-
-LOCAL_DEX_PREOPT := false
-LOCAL_JACK_FLAGS := --multi-dex native
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-# Include both the 32 and 64 bit versions of libjavacoretests,
-# where applicable.
-LOCAL_MULTILIB := both
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts
-
-LOCAL_JAVA_RESOURCE_FILES := libcore/expectations/knownfailures.txt
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/libcore/wycheproof-bc/OWNERS b/tests/libcore/wycheproof-bc/OWNERS
deleted file mode 100644
index 7b5c0ad..0000000
--- a/tests/libcore/wycheproof-bc/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# NOTE: Each source root in CTS should have an OWNERS file as a reminder to
-# add owners to it. It's okay for this file to be empty because the parent
-# directory's owners get inherited by default.
diff --git a/tests/libcore/wycheproof/Android.bp b/tests/libcore/wycheproof/Android.bp
new file mode 100644
index 0000000..3a9eb28
--- /dev/null
+++ b/tests/libcore/wycheproof/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.
+
+android_test {
+    name: "CtsLibcoreWycheproofConscryptTestCases",
+    defaults: ["cts_support_defaults"],
+    platform_apis: true,
+    static_libs: [
+        "cts-core-test-runner-axt",
+        "wycheproof",
+    ],
+    srcs: ["src/**/*.java"],
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    // Include both the 32 and 64 bit versions of libjavacoretests,
+    // where applicable.
+    compile_multilib: "both",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    java_resources: [":libcore-expectations-knownfailures"],
+}
diff --git a/tests/libcore/wycheproof/Android.mk b/tests/libcore/wycheproof/Android.mk
deleted file mode 100644
index 0f8fdbf..0000000
--- a/tests/libcore/wycheproof/Android.mk
+++ /dev/null
@@ -1,48 +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_PACKAGE_NAME := CtsLibcoreWycheproofConscryptTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    cts-core-test-runner-axt \
-    wycheproof
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,src)
-
-LOCAL_DEX_PREOPT := false
-LOCAL_JACK_FLAGS := --multi-dex native
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-# Include both the 32 and 64 bit versions of libjavacoretests,
-# where applicable.
-LOCAL_MULTILIB := both
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_JAVA_RESOURCE_FILES := libcore/expectations/knownfailures.txt
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/libcore/wycheproof/OWNERS b/tests/libcore/wycheproof/OWNERS
deleted file mode 100644
index 7b5c0ad..0000000
--- a/tests/libcore/wycheproof/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# NOTE: Each source root in CTS should have an OWNERS file as a reminder to
-# add owners to it. It's okay for this file to be empty because the parent
-# directory's owners get inherited by default.
diff --git a/tests/mocking/Android.mk b/tests/mocking/Android.mk
deleted file mode 100644
index cfd03be..0000000
--- a/tests/mocking/Android.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/mocking/extended/Android.bp b/tests/mocking/extended/Android.bp
new file mode 100644
index 0000000..c60f0a3
--- /dev/null
+++ b/tests/mocking/extended/Android.bp
@@ -0,0 +1,43 @@
+// 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.
+
+// NOTE: when converting this file to Android.bp, verify that
+// 'atest CtsExtendedMockingTestCases' succeeds.
+
+android_test_helper_app {
+    name: "CtsExtendedMockingTestCases",
+    defaults: ["cts_defaults"],
+    libs: ["android.test.runner.stubs"],
+    static_libs: [
+        "mockito-target-extended",
+        "androidx.test.rules",
+        "ctstestrunner-axt",
+        "dexmaker-mockmaker-tests",
+        "dexmaker-inline-mockmaker-tests",
+        "dexmaker-extended-mockmaker-tests",
+        "android-support-v4",
+    ],
+    compile_multilib: "both",
+    jni_libs: [
+        "libdexmakerjvmtiagent",
+        "libmultiplejvmtiagentsinterferenceagent",
+        "libstaticjvmtiagent",
+    ],
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/tests/mocking/extended/Android.mk b/tests/mocking/extended/Android.mk
deleted file mode 100644
index 39c4dd2..0000000
--- a/tests/mocking/extended/Android.mk
+++ /dev/null
@@ -1,46 +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.
-
-# NOTE: when converting this file to Android.bp, verify that
-# 'atest CtsExtendedMockingTestCases' succeeds.
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := \
-    tests
-LOCAL_JAVA_LIBRARIES := \
-    android.test.runner.stubs
-LOCAL_STATIC_JAVA_LIBRARIES = \
-    mockito-target-extended \
-    androidx.test.rules \
-    ctstestrunner-axt \
-    dexmaker-mockmaker-tests \
-    dexmaker-inline-mockmaker-tests \
-    dexmaker-extended-mockmaker-tests \
-    android-support-v4
-LOCAL_MULTILIB := \
-    both
-LOCAL_JNI_SHARED_LIBRARIES := \
-    libdexmakerjvmtiagent \
-    libmultiplejvmtiagentsinterferenceagent \
-    libstaticjvmtiagent
-LOCAL_COMPATIBILITY_SUITE := \
-    cts vts general-tests
-LOCAL_PACKAGE_NAME := \
-    CtsExtendedMockingTestCases
-LOCAL_SDK_VERSION := \
-    current
-include $(BUILD_CTS_PACKAGE)
-
diff --git a/tests/netsecpolicy/Android.bp b/tests/netsecpolicy/Android.bp
new file mode 100644
index 0000000..1dbfe9f
--- /dev/null
+++ b/tests/netsecpolicy/Android.bp
@@ -0,0 +1,54 @@
+// 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.
+android_test {
+    name: "CtsNetSecPolicyUsesCleartextTrafficFalse",
+    defaults: ["cts_support_defaults"],
+    srcs: ["usescleartexttraffic-shared/src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+    manifest: "usescleartexttraffic-false/AndroidManifest.xml",
+}
+
+android_test {
+    name: "CtsNetSecPolicyUsesCleartextTrafficTrue",
+    defaults: ["cts_support_defaults"],
+    srcs: ["usescleartexttraffic-shared/src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+    manifest: "usescleartexttraffic-true/AndroidManifest.xml",
+}
+
+android_test {
+    name: "CtsNetSecPolicyUsesCleartextTrafficUnspecified",
+    defaults: ["cts_support_defaults"],
+    srcs: ["usescleartexttraffic-shared/src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+    manifest: "usescleartexttraffic-unspecified/AndroidManifest.xml",
+}
diff --git a/tests/netsecpolicy/Android.mk b/tests/netsecpolicy/Android.mk
deleted file mode 100644
index 137672e..0000000
--- a/tests/netsecpolicy/Android.mk
+++ /dev/null
@@ -1,17 +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 $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/netsecpolicy/usescleartexttraffic-false/Android.mk b/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
deleted file mode 100644
index 34422f8..0000000
--- a/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
+++ /dev/null
@@ -1,33 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, \
-    ../usescleartexttraffic-shared/src)
-
-LOCAL_PACKAGE_NAME := CtsNetSecPolicyUsesCleartextTrafficFalse
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/netsecpolicy/usescleartexttraffic-true/Android.mk b/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
deleted file mode 100644
index efabeb2..0000000
--- a/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
+++ /dev/null
@@ -1,33 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, \
-    ../usescleartexttraffic-shared/src)
-
-LOCAL_PACKAGE_NAME := CtsNetSecPolicyUsesCleartextTrafficTrue
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk b/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
deleted file mode 100644
index 9960bca..0000000
--- a/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
+++ /dev/null
@@ -1,33 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, \
-    ../usescleartexttraffic-shared/src)
-
-LOCAL_PACKAGE_NAME := CtsNetSecPolicyUsesCleartextTrafficUnspecified
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/security/src/android/keystore/cts/Attestation.java b/tests/security/src/android/keystore/cts/Attestation.java
index bf344ca..6beac46 100644
--- a/tests/security/src/android/keystore/cts/Attestation.java
+++ b/tests/security/src/android/keystore/cts/Attestation.java
@@ -129,7 +129,7 @@
 
         s.append("\nChallenge");
         String stringChallenge = new String(attestationChallenge);
-        if (CharMatcher.ASCII.matchesAllOf(stringChallenge)) {
+        if (CharMatcher.ascii().matchesAllOf(stringChallenge)) {
             s.append(": [" + stringChallenge + "]");
         } else {
             s.append(" (base64): [" + BaseEncoding.base64().encode(attestationChallenge) + "]");
diff --git a/tests/signature/Android.bp b/tests/signature/Android.bp
index 21344ea..5cadd88 100644
--- a/tests/signature/Android.bp
+++ b/tests/signature/Android.bp
@@ -14,6 +14,9 @@
 
 // Compat.
 java_library_host {
-  name: "signature-hostside",
-  static_libs: ["signature-common-javalib"],
+    name: "signature-hostside",
+    visibility: [
+        "//cts/tests/signature/tests",
+    ],
+    static_libs: ["signature-common-javalib"],
 }
diff --git a/tests/signature/TEST_MAPPING b/tests/signature/TEST_MAPPING
index 8b76f04..5e8cc07 100644
--- a/tests/signature/TEST_MAPPING
+++ b/tests/signature/TEST_MAPPING
@@ -25,6 +25,9 @@
       "name": "CtsApacheHttpLegacyUsesLibraryApiSignatureTestCases"
     },
     {
+      "name": "CtsIntentSignatureTestCases"
+    },
+    {
       "name": "CtsHiddenApiBlacklistApi27TestCases"
     },
     {
diff --git a/tests/signature/api-check/android-test-base-28-api/Android.mk b/tests/signature/api-check/android-test-base-28-api/Android.mk
index 02f3a50..1b698ad 100644
--- a/tests/signature/api-check/android-test-base-28-api/Android.mk
+++ b/tests/signature/api-check/android-test-base-28-api/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SIGNATURE_API_FILES := \
     android-test-base-current.api \
 
-LOCAL_MIN_SDK_VERSION := 25
+LOCAL_MIN_SDK_VERSION := 27
 LOCAL_SDK_VERSION := 28
 
 include $(LOCAL_PATH)/../build_signature_apk.mk
diff --git a/tests/signature/api-check/android-test-base-28-api/AndroidManifest.xml b/tests/signature/api-check/android-test-base-28-api/AndroidManifest.xml
index e5f1269..1ed4315 100644
--- a/tests/signature/api-check/android-test-base-28-api/AndroidManifest.xml
+++ b/tests/signature/api-check/android-test-base-28-api/AndroidManifest.xml
@@ -20,7 +20,7 @@
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
 
-    <uses-sdk android:minSdkVersion="25" android:targetSdkVersion="28"/>
+    <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="28"/>
 
     <application android:debuggable="true"
                  android:extractNativeLibs="true"
diff --git a/tests/signature/api-check/android-test-base-28-api/OWNERS b/tests/signature/api-check/android-test-base-28-api/OWNERS
new file mode 100644
index 0000000..aaadab7
--- /dev/null
+++ b/tests/signature/api-check/android-test-base-28-api/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 24949
+include ../android-test-base-current-api/OWNERS
diff --git a/tests/signature/api-check/android-test-base-current-api/OWNERS b/tests/signature/api-check/android-test-base-current-api/OWNERS
index 7841a94..682d0b0 100644
--- a/tests/signature/api-check/android-test-base-current-api/OWNERS
+++ b/tests/signature/api-check/android-test-base-current-api/OWNERS
@@ -1,2 +1,4 @@
 # Bug component: 24949
-paulduffin@google.com
\ No newline at end of file
+paulduffin@google.com
+jiyong@google.com
+tnorbye@google.com
diff --git a/tests/signature/api-check/android-test-runner-current-api/OWNERS b/tests/signature/api-check/android-test-runner-current-api/OWNERS
new file mode 100644
index 0000000..aaadab7
--- /dev/null
+++ b/tests/signature/api-check/android-test-runner-current-api/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 24949
+include ../android-test-base-current-api/OWNERS
diff --git a/tests/signature/api-check/apache-http-legacy-27-api/Android.mk b/tests/signature/api-check/apache-http-legacy-27-api/Android.mk
index 906dda8..698fe4f 100644
--- a/tests/signature/api-check/apache-http-legacy-27-api/Android.mk
+++ b/tests/signature/api-check/apache-http-legacy-27-api/Android.mk
@@ -22,6 +22,6 @@
     current.api \
     apache-http-legacy-current.api \
 
-LOCAL_MIN_SDK_VERSION := 22
+LOCAL_MIN_SDK_VERSION := 27
 
 include $(LOCAL_PATH)/../build_signature_apk.mk
diff --git a/tests/signature/api-check/apache-http-legacy-27-api/AndroidManifest.xml b/tests/signature/api-check/apache-http-legacy-27-api/AndroidManifest.xml
index 8044d4b..8a789d9 100644
--- a/tests/signature/api-check/apache-http-legacy-27-api/AndroidManifest.xml
+++ b/tests/signature/api-check/apache-http-legacy-27-api/AndroidManifest.xml
@@ -20,7 +20,7 @@
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
 
-    <uses-sdk android:minSdkVersion="22" android:targetSdkVersion="27"/>
+    <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27"/>
 
     <application android:extractNativeLibs="true" android:largeHeap="true"/>
 
diff --git a/tests/signature/api-check/apache-http-legacy-current-api/OWNERS b/tests/signature/api-check/apache-http-legacy-current-api/OWNERS
new file mode 100644
index 0000000..aaadab7
--- /dev/null
+++ b/tests/signature/api-check/apache-http-legacy-current-api/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 24949
+include ../android-test-base-current-api/OWNERS
diff --git a/tests/signature/api-check/apache-http-legacy-uses-library-api/OWNERS b/tests/signature/api-check/apache-http-legacy-uses-library-api/OWNERS
new file mode 100644
index 0000000..aaadab7
--- /dev/null
+++ b/tests/signature/api-check/apache-http-legacy-uses-library-api/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 24949
+include ../android-test-base-current-api/OWNERS
diff --git a/tests/signature/api-check/current-api/AndroidTest.xml b/tests/signature/api-check/current-api/AndroidTest.xml
index dc6ded5..0d77827 100644
--- a/tests/signature/api-check/current-api/AndroidTest.xml
+++ b/tests/signature/api-check/current-api/AndroidTest.xml
@@ -43,8 +43,8 @@
         <option name="package" value="android.signature.cts.api.current" />
         <option name="runner" value="repackaged.android.test.InstrumentationTestRunner" />
         <option name="class" value="android.signature.cts.api.current.SignatureTest" />
-        <option name="instrumentation-arg" key="expected-api-files" value="current.api,android-test-base-current.api" />
-        <option name="instrumentation-arg" key="unexpected-api-files" value="android-test-mock-current.api,android-test-runner-current.api" />
+        <option name="instrumentation-arg" key="expected-api-files" value="current.api" />
+        <option name="instrumentation-arg" key="unexpected-api-files" value="android-test-base-current.api,android-test-mock-current.api,android-test-runner-current.api" />
         <option name="runtime-hint" value="30s" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/hidden-api-blacklist-27-api/Android.mk b/tests/signature/api-check/hidden-api-blacklist-27-api/Android.mk
index 59f7d6f2..a663264 100644
--- a/tests/signature/api-check/hidden-api-blacklist-27-api/Android.mk
+++ b/tests/signature/api-check/hidden-api-blacklist-27-api/Android.mk
@@ -19,4 +19,5 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 LOCAL_SIGNATURE_API_FILES := hiddenapi_flags.csv
 LOCAL_JNI_SHARED_LIBRARIES := libcts_dexchecker
+LOCAL_MIN_SDK_VERSION := 27
 include $(LOCAL_PATH)/../build_signature_apk.mk
diff --git a/tests/signature/api-check/hidden-api-blacklist-27-api/AndroidManifest.xml b/tests/signature/api-check/hidden-api-blacklist-27-api/AndroidManifest.xml
index c714e97..cd3949e 100644
--- a/tests/signature/api-check/hidden-api-blacklist-27-api/AndroidManifest.xml
+++ b/tests/signature/api-check/hidden-api-blacklist-27-api/AndroidManifest.xml
@@ -19,7 +19,7 @@
           package="android.signature.cts.api.hiddenapi_blacklist_api_27">
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
-    <uses-sdk android:targetSdkVersion="27" />
+    <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27" />
 
     <application android:extractNativeLibs="true" android:largeHeap="true"/>
 
diff --git a/tests/signature/api-check/hidden-api-blacklist-28-api/Android.mk b/tests/signature/api-check/hidden-api-blacklist-28-api/Android.mk
index f1cd2f3..a053bda 100644
--- a/tests/signature/api-check/hidden-api-blacklist-28-api/Android.mk
+++ b/tests/signature/api-check/hidden-api-blacklist-28-api/Android.mk
@@ -19,4 +19,5 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 LOCAL_SIGNATURE_API_FILES := hiddenapi_flags.csv
 LOCAL_JNI_SHARED_LIBRARIES := libcts_dexchecker
+LOCAL_MIN_SDK_VERSION := 27
 include $(LOCAL_PATH)/../build_signature_apk.mk
diff --git a/tests/signature/api-check/hidden-api-blacklist-28-api/AndroidManifest.xml b/tests/signature/api-check/hidden-api-blacklist-28-api/AndroidManifest.xml
index d011b88..cb1c4bc 100644
--- a/tests/signature/api-check/hidden-api-blacklist-28-api/AndroidManifest.xml
+++ b/tests/signature/api-check/hidden-api-blacklist-28-api/AndroidManifest.xml
@@ -19,7 +19,7 @@
           package="android.signature.cts.api.hiddenapi_blacklist_api_28">
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
-    <uses-sdk android:targetSdkVersion="28" />
+    <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="28" />
 
     <application android:extractNativeLibs="true" android:largeHeap="true"/>
 
diff --git a/tests/signature/api-check/shared-libs-api/Android.mk b/tests/signature/api-check/shared-libs-api/Android.mk
index 1540caa..ee3e962 100644
--- a/tests/signature/api-check/shared-libs-api/Android.mk
+++ b/tests/signature/api-check/shared-libs-api/Android.mk
@@ -16,11 +16,15 @@
 
 include $(CLEAR_VARS)
 
+all_shared_libs_modules :=
+
 $(foreach ver,$(call int_range_list,28,$(PLATFORM_SDK_VERSION)),\
   $(foreach api_level,public system,\
     $(foreach lib,$(filter-out android,$(filter-out %removed,\
       $(basename $(notdir $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/$(ver)/$(api_level)/api/*.txt))))),\
-        $(eval all_shared_libs_files += $(lib)-$(ver)-$(api_level).api))))
+        $(eval all_shared_libs_modules += $(lib)-$(ver)-$(api_level).api))))
+
+all_shared_libs_files := $(addprefix $(COMPATIBILITY_TESTCASES_OUT_cts)/,$(all_shared_libs_modules))
 
 include $(CLEAR_VARS)
 LOCAL_MODULE := cts-shared-libs-all.api
@@ -29,11 +33,13 @@
 LOCAL_MODULE_PATH = $(TARGET_OUT_DATA_ETC)
 LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
 include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): $(addprefix $(COMPATIBILITY_TESTCASES_OUT_cts)/,$(all_shared_libs_files))
+$(LOCAL_BUILT_MODULE): $(SOONG_ZIP)
+$(LOCAL_BUILT_MODULE): PRIVATE_SHARED_LIBS_FILES := $(all_shared_libs_files)
+$(LOCAL_BUILT_MODULE): $(all_shared_libs_files)
 	@echo "Zip API files $^ -> $@"
 	@mkdir -p $(dir $@)
 	$(hide) rm -f $@
-	$(hide) zip -q $@ $^
+	$(hide) $(SOONG_ZIP) -o $@ -C . $(addprefix -f ,$(PRIVATE_SHARED_LIBS_FILES))
 
 include $(CLEAR_VARS)
 
@@ -58,7 +64,7 @@
 
 LOCAL_SIGNATURE_API_FILES := \
     shared-libs-all.api.zip \
-    $(all_shared_libs_files)
+    $(all_shared_libs_modules)
 
 LOCAL_STATIC_JAVA_LIBRARIES := cts-api-signature-multilib-test
 
@@ -66,4 +72,5 @@
 
 LOCAL_JAVA_SDK_LIBRARIES :=
 all_shared_libs_files :=
+all_shared_libs_modules :=
 
diff --git a/tests/signature/api-check/shared-libs-api/src/android/signature/cts/api/SignatureMultiLibsTest.java b/tests/signature/api-check/shared-libs-api/src/android/signature/cts/api/SignatureMultiLibsTest.java
index c04f7ccb..485ab6c 100644
--- a/tests/signature/api-check/shared-libs-api/src/android/signature/cts/api/SignatureMultiLibsTest.java
+++ b/tests/signature/api-check/shared-libs-api/src/android/signature/cts/api/SignatureMultiLibsTest.java
@@ -18,13 +18,11 @@
 
 import android.signature.cts.ApiComplianceChecker;
 import android.signature.cts.ApiDocumentParser;
-import java.io.File;
-import java.io.FileInputStream;
+import android.signature.cts.VirtualPath;
+import android.signature.cts.VirtualPath.LocalFilePath;
 import java.io.IOException;
-import java.io.InputStream;
 import java.util.Arrays;
 import java.util.stream.Stream;
-import java.util.zip.ZipFile;
 
 import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
 
@@ -70,21 +68,9 @@
         return getLibraries().anyMatch(libraryName::equals);
     }
 
-    protected Stream<InputStream> readFile(File file) {
-        try {
-            if (file.getName().endsWith(".zip")) {
-                ZipFile zip = new ZipFile(file);
-                return zip.stream().filter(entry -> checkLibrary(entry.getName())).map(entry -> {
-                    try {
-                        return zip.getInputStream(entry);
-                    } catch (IOException e) {
-                        throw new RuntimeException(e);
-                    }});
-            } else {
-                return Stream.of(new FileInputStream(file));
-            }
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
+    @Override
+    protected Stream<VirtualPath> getZipEntryFiles(LocalFilePath path) throws IOException {
+        // Only return entries corresponding to shared libraries.
+        return super.getZipEntryFiles(path).filter(p -> checkLibrary(p.toString()));
     }
 }
diff --git a/tests/signature/api-check/src/java/android/signature/cts/api/AbstractApiTest.java b/tests/signature/api-check/src/java/android/signature/cts/api/AbstractApiTest.java
index 4167c9c..995b655 100644
--- a/tests/signature/api-check/src/java/android/signature/cts/api/AbstractApiTest.java
+++ b/tests/signature/api-check/src/java/android/signature/cts/api/AbstractApiTest.java
@@ -21,10 +21,10 @@
 import android.signature.cts.ExcludingClassProvider;
 import android.signature.cts.FailureType;
 import android.signature.cts.JDiffClassDescription;
+import android.signature.cts.VirtualPath;
+import android.signature.cts.VirtualPath.LocalFilePath;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.nio.ByteBuffer;
@@ -32,11 +32,8 @@
 import java.nio.file.Files;
 import java.nio.file.StandardOpenOption;
 import java.util.EnumSet;
-import java.util.HashSet;
-import java.util.Set;
 import java.util.stream.Stream;
 import java.util.zip.ZipFile;
-import org.xmlpull.v1.XmlPullParserException;
 import repackaged.android.test.InstrumentationTestCase;
 import repackaged.android.test.InstrumentationTestRunner;
 
@@ -136,36 +133,41 @@
             throw new RuntimeException(e);
         }
     }
-    Stream<InputStream> readFile(File file) {
+
+    /**
+     * Given a path in the local file system (possibly of a zip file) flatten it into a stream of
+     * virtual paths.
+     */
+    private Stream<VirtualPath> flattenPaths(LocalFilePath path) {
         try {
-            if (file.getName().endsWith(".zip")) {
-                @SuppressWarnings("resource")
-                ZipFile zip = new ZipFile(file);
-                return zip.stream().map(entry -> {
-                    try {
-                        return zip.getInputStream(entry);
-                    } catch (IOException e) {
-                        throw new RuntimeException(e);
-                    }});
+            if (path.toString().endsWith(".zip")) {
+                return getZipEntryFiles(path);
             } else {
-                return Stream.of(new FileInputStream(file));
+                return Stream.of(path);
             }
         } catch (IOException e) {
             throw new RuntimeException(e);
         }
     }
 
+    /**
+     * Get the zip entries that are files.
+     *
+     * @param path the path to the zip file.
+     * @return paths to zip entries
+     */
+    protected Stream<VirtualPath> getZipEntryFiles(LocalFilePath path) throws IOException {
+        @SuppressWarnings("resource")
+        ZipFile zip = new ZipFile(path.toFile());
+        return zip.stream().map(entry -> VirtualPath.get(zip, entry));
+    }
+
     Stream<JDiffClassDescription> parseApiFilesAsStream(
             ApiDocumentParser apiDocumentParser, String[] apiFiles) {
+        LocalFilePath apiFileDirectory = VirtualPath.get(API_FILE_DIRECTORY);
         return Stream.of(apiFiles)
-                .map(name -> new File(API_FILE_DIRECTORY + "/" + name))
-                .flatMap(this::readFile)
-                .flatMap(stream -> {
-                    try {
-                        return apiDocumentParser.parseAsStream(stream);
-                    } catch (IOException | XmlPullParserException e) {
-                        throw new RuntimeException(e);
-                    }
-                });
+                .map(apiFileDirectory::resolve)
+                .flatMap(this::flattenPaths)
+                .flatMap(apiDocumentParser::parseAsStream);
     }
 }
diff --git a/tests/signature/api-check/src/java/android/signature/cts/api/SignatureTest.java b/tests/signature/api-check/src/java/android/signature/cts/api/SignatureTest.java
index 7861df7..9083f0c 100644
--- a/tests/signature/api-check/src/java/android/signature/cts/api/SignatureTest.java
+++ b/tests/signature/api-check/src/java/android/signature/cts/api/SignatureTest.java
@@ -23,13 +23,11 @@
 import android.signature.cts.FailureType;
 import android.signature.cts.JDiffClassDescription;
 import android.signature.cts.ReflectionHelper;
-import java.io.IOException;
 import java.util.Comparator;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
-import org.xmlpull.v1.XmlPullParserException;
 
 /**
  * Performs the signature check via a JUnit test.
@@ -97,9 +95,7 @@
         }
     }
 
-    private Set<JDiffClassDescription> loadUnexpectedClasses()
-            throws IOException, XmlPullParserException {
-
+    private Set<JDiffClassDescription> loadUnexpectedClasses() {
         ApiDocumentParser apiDocumentParser = new ApiDocumentParser(TAG);
         return parseApiFilesAsStream(apiDocumentParser, unexpectedApiFiles)
                 .collect(Collectors.toCollection(SignatureTest::newSetOfClassDescriptions));
@@ -109,11 +105,8 @@
         return new TreeSet<>(Comparator.comparing(JDiffClassDescription::getAbsoluteClassName));
     }
 
-    private void loadBaseClasses(ApiComplianceChecker complianceChecker)
-            throws IOException, XmlPullParserException {
-
-        ApiDocumentParser apiDocumentParser =
-                new ApiDocumentParser(TAG);
+    private void loadBaseClasses(ApiComplianceChecker complianceChecker) {
+        ApiDocumentParser apiDocumentParser = new ApiDocumentParser(TAG);
         parseApiFilesAsStream(apiDocumentParser, baseApiFiles)
                 .forEach(complianceChecker::addBaseClass);
     }
diff --git a/tests/signature/api-check/system-annotation/Android.mk b/tests/signature/api-check/system-annotation/Android.mk
index 680e422..429f5f8 100644
--- a/tests/signature/api-check/system-annotation/Android.mk
+++ b/tests/signature/api-check/system-annotation/Android.mk
@@ -25,4 +25,5 @@
     car-system-current.api \
     car-system-removed.api \
 
+LOCAL_MIN_SDK_VERSION := 27
 include $(LOCAL_PATH)/../build_signature_apk.mk
diff --git a/tests/signature/api-check/system-annotation/AndroidManifest.xml b/tests/signature/api-check/system-annotation/AndroidManifest.xml
index 34a12c4..0a254e3 100644
--- a/tests/signature/api-check/system-annotation/AndroidManifest.xml
+++ b/tests/signature/api-check/system-annotation/AndroidManifest.xml
@@ -20,7 +20,7 @@
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
 
-    <uses-sdk android:targetSdkVersion="28" />
+    <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="28" />
 
     <application android:debuggable="true"
                  android:extractNativeLibs="true"
diff --git a/tests/signature/api-check/system-api/Android.mk b/tests/signature/api-check/system-api/Android.mk
index e795a6d..5f7d3f9 100644
--- a/tests/signature/api-check/system-api/Android.mk
+++ b/tests/signature/api-check/system-api/Android.mk
@@ -14,12 +14,13 @@
 
 LOCAL_PATH := $(call my-dir)
 
-all_system_api_files := system-current.api system-removed.api
+all_system_api_modules := system-current.api system-removed.api
 $(foreach ver,$(PLATFORM_SYSTEMSDK_VERSIONS),\
   $(if $(call math_is_number,$(ver)),\
-    $(eval all_system_api_files += system-$(ver).api)\
+    $(eval all_system_api_modules += system-$(ver).api)\
   )\
 )
+all_system_api_files := $(addprefix $(COMPATIBILITY_TESTCASES_OUT_cts)/,$(all_system_api_modules))
 
 include $(CLEAR_VARS)
 LOCAL_MODULE := cts-system-all.api
@@ -28,11 +29,13 @@
 LOCAL_MODULE_PATH = $(TARGET_OUT_DATA_ETC)
 LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
 include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): $(addprefix $(COMPATIBILITY_TESTCASES_OUT_cts)/,$(all_system_api_files))
+$(LOCAL_BUILT_MODULE): $(SOONG_ZIP)
+$(LOCAL_BUILT_MODULE): PRIVATE_SYSTEM_API_FILES := $(all_system_api_files)
+$(LOCAL_BUILT_MODULE): $(all_system_api_files)
 	@echo "Zip API files $^ -> $@"
 	@mkdir -p $(dir $@)
 	$(hide) rm -f $@
-	$(hide) zip -q $@ $^
+	$(hide) $(SOONG_ZIP) -o $@ -C . $(addprefix -f ,$(PRIVATE_SYSTEM_API_FILES))
 
 include $(CLEAR_VARS)
 
@@ -42,9 +45,10 @@
     current.api \
     android-test-mock-current.api \
     android-test-runner-current.api \
-    $(all_sytem_api_files) \
+    $(all_sytem_api_modules) \
     system-all.api.zip
 
 include $(LOCAL_PATH)/../build_signature_apk.mk
 
 all_system_api_files :=
+all_system_api_modules :=
diff --git a/tests/signature/intent-check/Android.mk b/tests/signature/intent-check/Android.mk
index b015d21..be3fb26 100644
--- a/tests/signature/intent-check/Android.mk
+++ b/tests/signature/intent-check/Android.mk
@@ -34,4 +34,9 @@
 
 LOCAL_HOST_REQUIRED_MODULES := cts-dynamic-config
 
+LOCAL_REQUIRED_MODULES := \
+    cts-current-api \
+    cts-system-current-api \
+    cts-system-removed-api
+
 include $(BUILD_CTS_PACKAGE)
diff --git a/tests/signature/intent-check/AndroidTest.xml b/tests/signature/intent-check/AndroidTest.xml
index e76cd79..f546558 100644
--- a/tests/signature/intent-check/AndroidTest.xml
+++ b/tests/signature/intent-check/AndroidTest.xml
@@ -49,6 +49,7 @@
     </target_preparer>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="android.signature.cts.intent" />
+        <option name="class" value="android.signature.cts.intent.IntentTest" />
         <option name="runtime-hint" value="10s" />
         <!-- disable isolated storage so tests can access dynamic config stored in /sdcard. -->
         <option name="isolated-storage" value="false" />
diff --git a/tests/signature/intent-check/src/android/signature/cts/intent/IntentTest.java b/tests/signature/intent-check/src/android/signature/cts/intent/IntentTest.java
index af5c4b9..7cbfaad 100644
--- a/tests/signature/intent-check/src/android/signature/cts/intent/IntentTest.java
+++ b/tests/signature/intent-check/src/android/signature/cts/intent/IntentTest.java
@@ -15,14 +15,12 @@
  */
 package android.signature.cts.intent;
 
-import static android.signature.cts.CurrentApi.CURRENT_API_FILE;
-import static android.signature.cts.CurrentApi.SYSTEM_CURRENT_API_FILE;
-import static android.signature.cts.CurrentApi.SYSTEM_REMOVED_API_FILE;
-
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.signature.cts.ApiDocumentParser;
+import android.signature.cts.CurrentApi;
 import android.signature.cts.JDiffClassDescription.JDiffField;
+import android.signature.cts.VirtualPath;
 import android.util.Log;
 
 import androidx.test.InstrumentationRegistry;
@@ -34,12 +32,10 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.xmlpull.v1.XmlPullParserException;
 
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.HashSet;
 import java.util.List;
@@ -51,6 +47,16 @@
  */
 @RunWith(AndroidJUnit4.class)
 public class IntentTest {
+
+    private static final String CURRENT_API_FILE =
+            CurrentApi.API_FILE_DIRECTORY + "/current.api";
+
+    private static final String SYSTEM_CURRENT_API_FILE =
+            CurrentApi.API_FILE_DIRECTORY + "/system-current.api";
+
+    private static final String SYSTEM_REMOVED_API_FILE =
+            CurrentApi.API_FILE_DIRECTORY + "/system-removed.api";
+
     private static final String TAG = IntentTest.class.getSimpleName();
 
     private static final File SIGNATURE_TEST_PACKGES =
@@ -111,25 +117,20 @@
     }
 
     private Set<String> lookupPlatformIntents() {
-        try {
-            Set<String> intents = new HashSet<>();
-            intents.addAll(parse(CURRENT_API_FILE));
-            intents.addAll(parse(SYSTEM_CURRENT_API_FILE));
-            intents.addAll(parse(SYSTEM_REMOVED_API_FILE));
-            return intents;
-        } catch (XmlPullParserException | IOException e) {
-            throw new RuntimeException("failed to parse", e);
-        }
+        Set<String> intents = new HashSet<>();
+        intents.addAll(parse(CURRENT_API_FILE));
+        intents.addAll(parse(SYSTEM_CURRENT_API_FILE));
+        intents.addAll(parse(SYSTEM_REMOVED_API_FILE));
+        return intents;
     }
 
-    private static Set<String> parse(String apiFileName)
-            throws XmlPullParserException, IOException {
+    private static Set<String> parse(String apiFileName) {
 
         Set<String> androidIntents = new HashSet<>();
 
         ApiDocumentParser apiDocumentParser = new ApiDocumentParser(TAG);
 
-        apiDocumentParser.parseAsStream(new FileInputStream(new File(apiFileName))).forEach(
+        apiDocumentParser.parseAsStream(VirtualPath.get(apiFileName)).forEach(
                 classDescription -> {
                     for (JDiffField diffField : classDescription.getFieldList()) {
                         String fieldValue = diffField.getValueString();
diff --git a/tests/signature/lib/android/Android.bp b/tests/signature/lib/android/Android.bp
index 55066ad..cb38ada 100644
--- a/tests/signature/lib/android/Android.bp
+++ b/tests/signature/lib/android/Android.bp
@@ -12,11 +12,15 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-java_library_static {
-  name: "cts-signature-common",
-  host_supported: false,
-  installable: false,
-  srcs: ["src/**/*.java"],
-  static_libs: ["signature-common-javalib"],
-  sdk_version: "current",
+java_library {
+    name: "cts-signature-common",
+    visibility: [
+        "//cts/tests/signature:__subpackages__",
+    ],
+    installable: false,
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "signature-common-javalib",
+    ],
+    sdk_version: "current",
 }
diff --git a/tests/signature/lib/android/src/android/signature/cts/ApiDocumentParser.java b/tests/signature/lib/android/src/android/signature/cts/ApiDocumentParser.java
index 18afa98..4a5c504 100644
--- a/tests/signature/lib/android/src/android/signature/cts/ApiDocumentParser.java
+++ b/tests/signature/lib/android/src/android/signature/cts/ApiDocumentParser.java
@@ -15,32 +15,8 @@
  */
 package android.signature.cts;
 
-import static android.signature.cts.CurrentApi.ATTRIBUTE_NAME;
-import static android.signature.cts.CurrentApi.ATTRIBUTE_TYPE;
-import static android.signature.cts.CurrentApi.TAG_CLASS;
-import static android.signature.cts.CurrentApi.TAG_CONSTRUCTOR;
-import static android.signature.cts.CurrentApi.TAG_EXCEPTION;
-import static android.signature.cts.CurrentApi.TAG_FIELD;
-import static android.signature.cts.CurrentApi.TAG_IMPLEMENTS;
-import static android.signature.cts.CurrentApi.TAG_INTERFACE;
-import static android.signature.cts.CurrentApi.TAG_METHOD;
-import static android.signature.cts.CurrentApi.TAG_PACKAGE;
-import static android.signature.cts.CurrentApi.TAG_PARAM;
-import static android.signature.cts.CurrentApi.TAG_ROOT;
-
-import android.util.Log;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.Spliterator;
-import java.util.function.Consumer;
 import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlPullParserFactory;
+
 
 /**
  * Parses an XML api definition file and constructs and populates an {@link JDiffClassDescription}
@@ -50,177 +26,23 @@
  */
 public class ApiDocumentParser {
 
-    private static final Set<String> KEY_TAG_SET;
-    static {
-        KEY_TAG_SET = new HashSet<>();
-        Collections.addAll(KEY_TAG_SET,
-                TAG_PACKAGE,
-                TAG_CLASS,
-                TAG_INTERFACE,
-                TAG_IMPLEMENTS,
-                TAG_CONSTRUCTOR,
-                TAG_METHOD,
-                TAG_PARAM,
-                TAG_EXCEPTION,
-                TAG_FIELD);
-    }
-
     private final String tag;
 
-    private final XmlPullParserFactory factory;
-
-    public ApiDocumentParser(String tag) throws XmlPullParserException {
+    public ApiDocumentParser(String tag) {
         this.tag = tag;
-        factory = XmlPullParserFactory.newInstance();
     }
 
-    public Stream<JDiffClassDescription> parseAsStream(InputStream inputStream)
-            throws XmlPullParserException, IOException {
-        XmlPullParser parser = factory.newPullParser();
-        parser.setInput(inputStream, null);
-        return StreamSupport.stream(new ClassDescriptionSpliterator(parser), false);
-    }
-
-    private class ClassDescriptionSpliterator implements Spliterator<JDiffClassDescription> {
-
-        private final XmlPullParser parser;
-
-        JDiffClassDescription currentClass = null;
-        String currentPackage = "";
-        JDiffClassDescription.JDiffMethod currentMethod = null;
-
-        ClassDescriptionSpliterator(XmlPullParser parser) throws IOException, XmlPullParserException {
-            this.parser = parser;
-            logd(String.format("Name: %s", parser.getName()));
-            logd(String.format("Text: %s", parser.getText()));
-            logd(String.format("Namespace: %s", parser.getNamespace()));
-            logd(String.format("Line Number: %s", parser.getLineNumber()));
-            logd(String.format("Column Number: %s", parser.getColumnNumber()));
-            logd(String.format("Position Description: %s", parser.getPositionDescription()));
-            beginDocument(parser, TAG_ROOT);
-        }
-
-        @Override
-        public boolean tryAdvance(Consumer<? super JDiffClassDescription> action) {
-            JDiffClassDescription classDescription;
-            try {
-                classDescription = next();
-            } catch (IOException|XmlPullParserException e) {
-                throw new RuntimeException(e);
-            }
-
-            if (classDescription == null) {
-                return false;
-            }
-            action.accept(classDescription);
-            return true;
-        }
-
-        @Override
-        public Spliterator<JDiffClassDescription> trySplit() {
-            return null;
-        }
-
-        @Override
-        public long estimateSize() {
-            return Long.MAX_VALUE;
-        }
-
-        @Override
-        public int characteristics() {
-            return ORDERED | DISTINCT | NONNULL | IMMUTABLE;
-        }
-
-        private void beginDocument(XmlPullParser parser, String firstElementName)
-                throws XmlPullParserException, IOException {
-            int type;
-            do {
-                type = parser.next();
-            } while (type != XmlPullParser.START_TAG && type != XmlPullParser.END_DOCUMENT);
-
-            if (type != XmlPullParser.START_TAG) {
-                throw new XmlPullParserException("No start tag found");
-            }
-
-            if (!parser.getName().equals(firstElementName)) {
-                throw new XmlPullParserException("Unexpected start tag: found " + parser.getName() +
-                        ", expected " + firstElementName);
-            }
-        }
-
-        private JDiffClassDescription next() throws IOException, XmlPullParserException {
-            int type;
-            while (true) {
-                do {
-                    type = parser.next();
-                } while (type != XmlPullParser.START_TAG && type != XmlPullParser.END_DOCUMENT
-                        && type != XmlPullParser.END_TAG);
-
-                if (type == XmlPullParser.END_DOCUMENT) {
-                    logd("Reached end of document");
-                    break;
-                }
-
-                String tagname = parser.getName();
-                if (type == XmlPullParser.END_TAG) {
-                    if (TAG_CLASS.equals(tagname) || TAG_INTERFACE.equals(tagname)) {
-                        logd("Reached end of class: " + currentClass);
-                        return currentClass;
-                    } else if (TAG_PACKAGE.equals(tagname)) {
-                        currentPackage = "";
-                    }
-                    continue;
-                }
-
-                if (!KEY_TAG_SET.contains(tagname)) {
-                    continue;
-                }
-
-                if (tagname.equals(TAG_PACKAGE)) {
-                    currentPackage = parser.getAttributeValue(null, ATTRIBUTE_NAME);
-                } else if (tagname.equals(TAG_CLASS)) {
-                    currentClass = CurrentApi.loadClassInfo(
-                            parser, false, currentPackage);
-                } else if (tagname.equals(TAG_INTERFACE)) {
-                    currentClass = CurrentApi.loadClassInfo(
-                            parser, true, currentPackage);
-                } else if (tagname.equals(TAG_IMPLEMENTS)) {
-                    currentClass.addImplInterface(parser.getAttributeValue(null, ATTRIBUTE_NAME));
-                } else if (tagname.equals(TAG_CONSTRUCTOR)) {
-                    JDiffClassDescription.JDiffConstructor constructor =
-                            CurrentApi.loadConstructorInfo(parser, currentClass);
-                    currentClass.addConstructor(constructor);
-                    currentMethod = constructor;
-                } else if (tagname.equals(TAG_METHOD)) {
-                    currentMethod = CurrentApi.loadMethodInfo(currentClass.getClassName(), parser);
-                    currentClass.addMethod(currentMethod);
-                } else if (tagname.equals(TAG_PARAM)) {
-                    currentMethod.addParam(parser.getAttributeValue(null, ATTRIBUTE_TYPE));
-                } else if (tagname.equals(TAG_EXCEPTION)) {
-                    currentMethod.addException(parser.getAttributeValue(null, ATTRIBUTE_TYPE));
-                } else if (tagname.equals(TAG_FIELD)) {
-                    JDiffClassDescription.JDiffField field = CurrentApi.loadFieldInfo(currentClass.getClassName(), parser);
-                    currentClass.addField(field);
-                } else {
-                    throw new RuntimeException(
-                            "unknown tag exception:" + tagname);
-                }
-                if (currentPackage != null) {
-                    logd(String.format("currentPackage: %s", currentPackage));
-                }
-                if (currentClass != null) {
-                    logd(String.format("currentClass: %s", currentClass.toSignatureString()));
-                }
-                if (currentMethod != null) {
-                    logd(String.format("currentMethod: %s", currentMethod.toSignatureString()));
-                }
-            }
-
-            return null;
+    private ApiParser getApiParser(VirtualPath path) {
+        if (path.toString().endsWith(".api")) {
+            return new XmlApiParser(tag);
+        } else {
+            throw new IllegalStateException("Unrecognized file type: " + path);
         }
     }
 
-    private void logd(String msg) {
-        Log.d(tag, msg);
+    public Stream<JDiffClassDescription> parseAsStream(VirtualPath path) {
+        ApiParser parser = getApiParser(path);
+
+        return parser.parseAsStream(path);
     }
 }
diff --git a/tests/signature/lib/android/src/android/signature/cts/ApiParser.java b/tests/signature/lib/android/src/android/signature/cts/ApiParser.java
new file mode 100644
index 0000000..15444cc
--- /dev/null
+++ b/tests/signature/lib/android/src/android/signature/cts/ApiParser.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package android.signature.cts;
+
+import java.util.stream.Stream;
+
+/**
+ * Base class for parsers of API specification.
+ */
+abstract class ApiParser {
+
+    /**
+     * Parse the contents of the path and generate a stream of {@link JDiffClassDescription}
+     * instances.
+     *
+     * @param path the path to the API specification.
+     * @return the stream of {@link JDiffClassDescription} instances.
+     */
+    abstract Stream<JDiffClassDescription> parseAsStream(VirtualPath path);
+}
diff --git a/tests/signature/lib/android/src/android/signature/cts/CurrentApi.java b/tests/signature/lib/android/src/android/signature/cts/CurrentApi.java
index 611bcb5..c5e0d16 100644
--- a/tests/signature/lib/android/src/android/signature/cts/CurrentApi.java
+++ b/tests/signature/lib/android/src/android/signature/cts/CurrentApi.java
@@ -15,14 +15,6 @@
  */
 package android.signature.cts;
 
-import android.signature.cts.JDiffClassDescription.JDiffConstructor;
-import android.signature.cts.JDiffClassDescription.JDiffField;
-import android.signature.cts.JDiffClassDescription.JDiffMethod;
-
-import java.lang.reflect.Modifier;
-
-import org.xmlpull.v1.XmlPullParser;
-
 /**
  * Helper methods and constants used for parsing the current api file.
  */
@@ -32,159 +24,4 @@
 
     public static final String API_FILE_DIRECTORY = "/data/local/tmp/signature-test";
 
-    public static final String CURRENT_API_FILE =
-            API_FILE_DIRECTORY + "/current.api";
-    public static final String SYSTEM_CURRENT_API_FILE =
-            API_FILE_DIRECTORY + "/system-current.api";
-    public static final String SYSTEM_REMOVED_API_FILE =
-            API_FILE_DIRECTORY + "/system-removed.api";
-
-    static final String TAG_ROOT = "api";
-    static final String TAG_PACKAGE = "package";
-    static final String TAG_CLASS = "class";
-    static final String TAG_INTERFACE = "interface";
-    static final String TAG_IMPLEMENTS = "implements";
-    static final String TAG_CONSTRUCTOR = "constructor";
-    static final String TAG_METHOD = "method";
-    static final String TAG_PARAM = "parameter";
-    static final String TAG_EXCEPTION = "exception";
-    static final String TAG_FIELD = "field";
-
-    private static final String MODIFIER_ABSTRACT = "abstract";
-    private static final String MODIFIER_FINAL = "final";
-    private static final String MODIFIER_NATIVE = "native";
-    private static final String MODIFIER_PRIVATE = "private";
-    private static final String MODIFIER_PROTECTED = "protected";
-    private static final String MODIFIER_PUBLIC = "public";
-    private static final String MODIFIER_STATIC = "static";
-    private static final String MODIFIER_SYNCHRONIZED = "synchronized";
-    private static final String MODIFIER_TRANSIENT = "transient";
-    private static final String MODIFIER_VOLATILE = "volatile";
-    private static final String MODIFIER_VISIBILITY = "visibility";
-
-    static final String ATTRIBUTE_NAME = "name";
-    private static final String ATTRIBUTE_VALUE = "value";
-    private static final String ATTRIBUTE_EXTENDS = "extends";
-    static final String ATTRIBUTE_TYPE = "type";
-    private static final String ATTRIBUTE_RETURN = "return";
-
-    /**
-     * Load field information from xml to memory.
-     *
-     * @param className of the class being examined which will be shown in error messages
-     * @param parser The XmlPullParser which carries the xml information.
-     * @return the new field
-     */
-    static JDiffField loadFieldInfo(String className, XmlPullParser parser) {
-        String fieldName = parser.getAttributeValue(null, ATTRIBUTE_NAME);
-        String fieldType = parser.getAttributeValue(null, ATTRIBUTE_TYPE);
-        int modifier = jdiffModifierToReflectionFormat(className, parser);
-        String value = parser.getAttributeValue(null, ATTRIBUTE_VALUE);
-        return new JDiffField(fieldName, fieldType, modifier, value);
-    }
-
-    /**
-     * Load method information from xml to memory.
-     *
-     * @param className of the class being examined which will be shown in error messages
-     * @param parser The XmlPullParser which carries the xml information.
-     * @return the newly loaded method.
-     */
-    static JDiffMethod loadMethodInfo(String className, XmlPullParser parser) {
-        String methodName = parser.getAttributeValue(null, ATTRIBUTE_NAME);
-        String returnType = parser.getAttributeValue(null, ATTRIBUTE_RETURN);
-        int modifier = jdiffModifierToReflectionFormat(className, parser);
-        return new JDiffMethod(methodName, modifier, returnType);
-    }
-
-    /**
-     * Load constructor information from xml to memory.
-     *
-     * @param parser The XmlPullParser which carries the xml information.
-     * @param currentClass the current class being loaded.
-     * @return the new constructor
-     */
-    static JDiffConstructor loadConstructorInfo(
-            XmlPullParser parser, JDiffClassDescription currentClass) {
-        String name = currentClass.getClassName();
-        int modifier = jdiffModifierToReflectionFormat(name, parser);
-        return new JDiffConstructor(name, modifier);
-    }
-
-    /**
-     * Load class or interface information to memory.
-     *
-     * @param parser The XmlPullParser which carries the xml information.
-     * @param isInterface true if the current class is an interface, otherwise is false.
-     * @param pkg the name of the java package this class can be found in.
-     * @return the new class description.
-     */
-    static JDiffClassDescription loadClassInfo(
-            XmlPullParser parser, boolean isInterface, String pkg) {
-        String className = parser.getAttributeValue(null, ATTRIBUTE_NAME);
-        JDiffClassDescription currentClass = new JDiffClassDescription(pkg, className);
-
-        currentClass.setModifier(jdiffModifierToReflectionFormat(className, parser));
-        currentClass.setType(isInterface ? JDiffClassDescription.JDiffType.INTERFACE :
-                             JDiffClassDescription.JDiffType.CLASS);
-        currentClass.setExtendsClass(parser.getAttributeValue(null, ATTRIBUTE_EXTENDS));
-        return currentClass;
-    }
-
-    /**
-     * Convert string modifier to int modifier.
-     *
-     * @param name of the class/method/field being examined which will be shown in error messages
-     * @param key modifier name
-     * @param value modifier value
-     * @return converted modifier value
-     */
-    private static int modifierDescriptionToReflectedType(String name, String key, String value) {
-        if (key.equals(MODIFIER_ABSTRACT)) {
-            return value.equals("true") ? Modifier.ABSTRACT : 0;
-        } else if (key.equals(MODIFIER_FINAL)) {
-            return value.equals("true") ? Modifier.FINAL : 0;
-        } else if (key.equals(MODIFIER_NATIVE)) {
-            return value.equals("true") ? Modifier.NATIVE : 0;
-        } else if (key.equals(MODIFIER_STATIC)) {
-            return value.equals("true") ? Modifier.STATIC : 0;
-        } else if (key.equals(MODIFIER_SYNCHRONIZED)) {
-            return value.equals("true") ? Modifier.SYNCHRONIZED : 0;
-        } else if (key.equals(MODIFIER_TRANSIENT)) {
-            return value.equals("true") ? Modifier.TRANSIENT : 0;
-        } else if (key.equals(MODIFIER_VOLATILE)) {
-            return value.equals("true") ? Modifier.VOLATILE : 0;
-        } else if (key.equals(MODIFIER_VISIBILITY)) {
-            if (value.equals(MODIFIER_PRIVATE)) {
-                throw new RuntimeException("Private visibility found in API spec: " + name);
-            } else if (value.equals(MODIFIER_PROTECTED)) {
-                return Modifier.PROTECTED;
-            } else if (value.equals(MODIFIER_PUBLIC)) {
-                return Modifier.PUBLIC;
-            } else if ("".equals(value)) {
-                // If the visibility is "", it means it has no modifier.
-                // which is package private. We should return 0 for this modifier.
-                return 0;
-            } else {
-                throw new RuntimeException("Unknown modifier found in API spec: " + value);
-            }
-        }
-        return 0;
-    }
-
-    /**
-     * Transfer string modifier to int one.
-     *
-     * @param name of the class/method/field being examined which will be shown in error messages
-     * @param parser XML resource parser
-     * @return converted modifier
-     */
-    private static int jdiffModifierToReflectionFormat(String name, XmlPullParser parser){
-        int modifier = 0;
-        for (int i = 0;i < parser.getAttributeCount();i++) {
-            modifier |= modifierDescriptionToReflectedType(name, parser.getAttributeName(i),
-                    parser.getAttributeValue(i));
-        }
-        return modifier;
-    }
 }
diff --git a/tests/signature/lib/android/src/android/signature/cts/VirtualPath.java b/tests/signature/lib/android/src/android/signature/cts/VirtualPath.java
new file mode 100644
index 0000000..db87b69
--- /dev/null
+++ b/tests/signature/lib/android/src/android/signature/cts/VirtualPath.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package android.signature.cts;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+/**
+ * Workaround for the lack of a zip file system provider on Android.
+ */
+public abstract class VirtualPath {
+
+    /**
+     * Get a path to the local file system.
+     */
+    public static LocalFilePath get(String path) {
+        return new LocalFilePath(path);
+    }
+
+    /**
+     * Get a path to an entry in a zip file, i.e. a zip file system.
+     */
+    public static ZipEntryPath get(ZipFile zip, ZipEntry entry) {
+        return new ZipEntryPath(zip, entry);
+    }
+
+    public abstract InputStream newInputStream() throws IOException;
+
+    public static class LocalFilePath extends VirtualPath {
+        private final String path;
+
+        LocalFilePath(String path) {
+            this.path = path;
+        }
+
+        public File toFile() {
+            return new File(path);
+        }
+
+        public LocalFilePath resolve(String relative) {
+            return new LocalFilePath(path + "/" + relative);
+        }
+
+        @Override
+        public InputStream newInputStream() throws IOException {
+            return new FileInputStream(path);
+        }
+
+        @Override
+        public String toString() {
+            return path;
+        }
+    }
+
+    private static class ZipEntryPath extends VirtualPath {
+
+        private final ZipFile zip;
+
+        private final ZipEntry entry;
+
+        private ZipEntryPath(ZipFile zip, ZipEntry entry) {
+            this.zip = zip;
+            this.entry = entry;
+        }
+
+        @Override
+        public InputStream newInputStream() throws IOException {
+            return zip.getInputStream(entry);
+        }
+
+        @Override
+        public String toString() {
+            return "zip:file:" + zip.getName() + "!/" + entry.getName();
+        }
+    }
+}
diff --git a/tests/signature/lib/android/src/android/signature/cts/XmlApiParser.java b/tests/signature/lib/android/src/android/signature/cts/XmlApiParser.java
new file mode 100644
index 0000000..8e5d0bb
--- /dev/null
+++ b/tests/signature/lib/android/src/android/signature/cts/XmlApiParser.java
@@ -0,0 +1,617 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package android.signature.cts;
+
+import android.signature.cts.JDiffClassDescription.JDiffConstructor;
+import android.signature.cts.JDiffClassDescription.JDiffField;
+import android.signature.cts.JDiffClassDescription.JDiffMethod;
+import android.util.Log;
+import java.io.IOException;
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Spliterator;
+import java.util.function.Consumer;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+/**
+ * Parser for the XML representation of an API specification.
+ */
+class XmlApiParser extends ApiParser {
+
+    private static final String TAG_ROOT = "api";
+
+    private static final String TAG_PACKAGE = "package";
+
+    private static final String TAG_CLASS = "class";
+
+    private static final String TAG_INTERFACE = "interface";
+
+    private static final String TAG_IMPLEMENTS = "implements";
+
+    private static final String TAG_CONSTRUCTOR = "constructor";
+
+    private static final String TAG_METHOD = "method";
+
+    private static final String TAG_PARAM = "parameter";
+
+    private static final String TAG_EXCEPTION = "exception";
+
+    private static final String TAG_FIELD = "field";
+
+    private static final String ATTRIBUTE_NAME = "name";
+
+    private static final String ATTRIBUTE_TYPE = "type";
+
+    private static final String ATTRIBUTE_VALUE = "value";
+
+    private static final String ATTRIBUTE_EXTENDS = "extends";
+
+    private static final String ATTRIBUTE_RETURN = "return";
+
+    private static final String MODIFIER_ABSTRACT = "abstract";
+
+    private static final String MODIFIER_FINAL = "final";
+
+    private static final String MODIFIER_NATIVE = "native";
+
+    private static final String MODIFIER_PRIVATE = "private";
+
+    private static final String MODIFIER_PROTECTED = "protected";
+
+    private static final String MODIFIER_PUBLIC = "public";
+
+    private static final String MODIFIER_STATIC = "static";
+
+    private static final String MODIFIER_SYNCHRONIZED = "synchronized";
+
+    private static final String MODIFIER_TRANSIENT = "transient";
+
+    private static final String MODIFIER_VOLATILE = "volatile";
+
+    private static final String MODIFIER_VISIBILITY = "visibility";
+
+    private static final Set<String> KEY_TAG_SET;
+
+    static {
+        KEY_TAG_SET = new HashSet<>();
+        Collections.addAll(KEY_TAG_SET,
+                TAG_PACKAGE,
+                TAG_CLASS,
+                TAG_INTERFACE,
+                TAG_IMPLEMENTS,
+                TAG_CONSTRUCTOR,
+                TAG_METHOD,
+                TAG_PARAM,
+                TAG_EXCEPTION,
+                TAG_FIELD);
+    }
+
+    private final String tag;
+
+    private final XmlPullParserFactory factory;
+
+    XmlApiParser(String tag) {
+        this.tag = tag;
+        try {
+            factory = XmlPullParserFactory.newInstance();
+        } catch (XmlPullParserException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Load field information from xml to memory.
+     *
+     * @param className
+     *         of the class being examined which will be shown in error messages
+     * @param parser
+     *         The XmlPullParser which carries the xml information.
+     * @return the new field
+     */
+    private static JDiffField loadFieldInfo(String className, XmlPullParser parser) {
+        String fieldName = parser.getAttributeValue(null, ATTRIBUTE_NAME);
+        String fieldType = canonicalizeType(parser.getAttributeValue(null, ATTRIBUTE_TYPE));
+        int modifier = jdiffModifierToReflectionFormat(className, parser);
+        String value = parser.getAttributeValue(null, ATTRIBUTE_VALUE);
+
+        // Canonicalize the expected value to ensure that it is consistent with the values obtained
+        // using reflection by ApiComplianceChecker.getFieldValueAsString(...).
+        if (value != null) {
+
+            // An unquoted null String value actually means null. It cannot be confused with a
+            // String containing the word null as that would be surrounded with double quotes.
+            if (value.equals("null")) {
+                value = null;
+            } else {
+                switch (fieldType) {
+                    case "java.lang.String":
+                        value = unescapeFieldStringValue(value);
+                        break;
+
+                    case "char":
+                        // A character is encoded in XML as its numeric value. Convert it to a
+                        // string containing the single character.
+                        char c = (char) Integer.parseInt(value);
+                        value = String.valueOf(c);
+                        break;
+
+                    case "double":
+                        switch (value) {
+                            case "(-1.0/0.0)":
+                                value = "-Infinity";
+                                break;
+                            case "(0.0/0.0)":
+                                value = "NaN";
+                                break;
+                            case "(1.0/0.0)":
+                                value = "Infinity";
+                                break;
+                        }
+                        break;
+
+                    case "float":
+                        switch (value) {
+                            case "(-1.0f/0.0f)":
+                                value = "-Infinity";
+                                break;
+                            case "(0.0f/0.0f)":
+                                value = "NaN";
+                                break;
+                            case "(1.0f/0.0f)":
+                                value = "Infinity";
+                                break;
+                            default:
+                                // Remove the trailing f.
+                                if (value.endsWith("f")) {
+                                    value = value.substring(0, value.length() - 1);
+                                }
+                        }
+                        break;
+
+                    case "long":
+                        // Remove the trailing L.
+                        if (value.endsWith("L")) {
+                            value = value.substring(0, value.length() - 1);
+                        }
+                        break;
+                }
+            }
+        }
+
+        return new JDiffField(fieldName, fieldType, modifier, value);
+    }
+
+    /**
+     * Load method information from xml to memory.
+     *
+     * @param className
+     *         of the class being examined which will be shown in error messages
+     * @param parser
+     *         The XmlPullParser which carries the xml information.
+     * @return the newly loaded method.
+     */
+    private static JDiffMethod loadMethodInfo(String className, XmlPullParser parser) {
+        String methodName = parser.getAttributeValue(null, ATTRIBUTE_NAME);
+        String returnType = parser.getAttributeValue(null, ATTRIBUTE_RETURN);
+        int modifier = jdiffModifierToReflectionFormat(className, parser);
+        return new JDiffMethod(methodName, modifier, canonicalizeType(returnType));
+    }
+
+    /**
+     * Load constructor information from xml to memory.
+     *
+     * @param parser
+     *         The XmlPullParser which carries the xml information.
+     * @param currentClass
+     *         the current class being loaded.
+     * @return the new constructor
+     */
+    private static JDiffConstructor loadConstructorInfo(
+            XmlPullParser parser, JDiffClassDescription currentClass) {
+        String name = currentClass.getClassName();
+        int modifier = jdiffModifierToReflectionFormat(name, parser);
+        return new JDiffConstructor(name, modifier);
+    }
+
+    /**
+     * Load class or interface information to memory.
+     *
+     * @param parser
+     *         The XmlPullParser which carries the xml information.
+     * @param isInterface
+     *         true if the current class is an interface, otherwise is false.
+     * @param pkg
+     *         the name of the java package this class can be found in.
+     * @return the new class description.
+     */
+    private static JDiffClassDescription loadClassInfo(
+            XmlPullParser parser, boolean isInterface, String pkg) {
+        String className = parser.getAttributeValue(null, ATTRIBUTE_NAME);
+        JDiffClassDescription currentClass = new JDiffClassDescription(pkg, className);
+
+        currentClass.setModifier(jdiffModifierToReflectionFormat(className, parser));
+        currentClass.setType(isInterface ? JDiffClassDescription.JDiffType.INTERFACE :
+                JDiffClassDescription.JDiffType.CLASS);
+        currentClass.setExtendsClass(parser.getAttributeValue(null, ATTRIBUTE_EXTENDS));
+        return currentClass;
+    }
+
+    /**
+     * Transfer string modifier to int one.
+     *
+     * @param name
+     *         of the class/method/field being examined which will be shown in error messages
+     * @param parser
+     *         XML resource parser
+     * @return converted modifier
+     */
+    private static int jdiffModifierToReflectionFormat(String name, XmlPullParser parser) {
+        int modifier = 0;
+        for (int i = 0; i < parser.getAttributeCount(); i++) {
+            modifier |= modifierDescriptionToReflectedType(name, parser.getAttributeName(i),
+                    parser.getAttributeValue(i));
+        }
+        return modifier;
+    }
+
+    /**
+     * Convert string modifier to int modifier.
+     *
+     * @param name
+     *         of the class/method/field being examined which will be shown in error messages
+     * @param key
+     *         modifier name
+     * @param value
+     *         modifier value
+     * @return converted modifier value
+     */
+    private static int modifierDescriptionToReflectedType(String name, String key, String value) {
+        switch (key) {
+            case MODIFIER_ABSTRACT:
+                return value.equals("true") ? Modifier.ABSTRACT : 0;
+            case MODIFIER_FINAL:
+                return value.equals("true") ? Modifier.FINAL : 0;
+            case MODIFIER_NATIVE:
+                return value.equals("true") ? Modifier.NATIVE : 0;
+            case MODIFIER_STATIC:
+                return value.equals("true") ? Modifier.STATIC : 0;
+            case MODIFIER_SYNCHRONIZED:
+                return value.equals("true") ? Modifier.SYNCHRONIZED : 0;
+            case MODIFIER_TRANSIENT:
+                return value.equals("true") ? Modifier.TRANSIENT : 0;
+            case MODIFIER_VOLATILE:
+                return value.equals("true") ? Modifier.VOLATILE : 0;
+            case MODIFIER_VISIBILITY:
+                switch (value) {
+                    case MODIFIER_PRIVATE:
+                        throw new RuntimeException("Private visibility found in API spec: " + name);
+                    case MODIFIER_PROTECTED:
+                        return Modifier.PROTECTED;
+                    case MODIFIER_PUBLIC:
+                        return Modifier.PUBLIC;
+                    case "":
+                        // If the visibility is "", it means it has no modifier.
+                        // which is package private. We should return 0 for this modifier.
+                        return 0;
+                    default:
+                        throw new RuntimeException("Unknown modifier found in API spec: " + value);
+                }
+        }
+        return 0;
+    }
+
+    @Override
+    public Stream<JDiffClassDescription> parseAsStream(VirtualPath path) {
+        XmlPullParser parser;
+        try {
+            parser = factory.newPullParser();
+            parser.setInput(path.newInputStream(), null);
+            return StreamSupport
+                    .stream(new ClassDescriptionSpliterator(parser), false);
+        } catch (XmlPullParserException | IOException e) {
+            throw new RuntimeException("Could not parse " + path, e);
+        }
+    }
+
+    private class ClassDescriptionSpliterator implements Spliterator<JDiffClassDescription> {
+
+        private final XmlPullParser parser;
+
+        JDiffClassDescription currentClass = null;
+
+        String currentPackage = "";
+
+        JDiffMethod currentMethod = null;
+
+        ClassDescriptionSpliterator(XmlPullParser parser)
+                throws IOException, XmlPullParserException {
+            this.parser = parser;
+            logd(String.format("Name: %s", parser.getName()));
+            logd(String.format("Text: %s", parser.getText()));
+            logd(String.format("Namespace: %s", parser.getNamespace()));
+            logd(String.format("Line Number: %s", parser.getLineNumber()));
+            logd(String.format("Column Number: %s", parser.getColumnNumber()));
+            logd(String.format("Position Description: %s", parser.getPositionDescription()));
+            beginDocument(parser);
+        }
+
+        @Override
+        public boolean tryAdvance(Consumer<? super JDiffClassDescription> action) {
+            JDiffClassDescription classDescription;
+            try {
+                classDescription = next();
+            } catch (IOException | XmlPullParserException e) {
+                throw new RuntimeException(e);
+            }
+
+            if (classDescription == null) {
+                return false;
+            }
+            action.accept(classDescription);
+            return true;
+        }
+
+        @Override
+        public Spliterator<JDiffClassDescription> trySplit() {
+            return null;
+        }
+
+        @Override
+        public long estimateSize() {
+            return Long.MAX_VALUE;
+        }
+
+        @Override
+        public int characteristics() {
+            return ORDERED | DISTINCT | NONNULL | IMMUTABLE;
+        }
+
+        private void beginDocument(XmlPullParser parser)
+                throws XmlPullParserException, IOException {
+            int type;
+            do {
+                type = parser.next();
+            } while (type != XmlPullParser.START_TAG && type != XmlPullParser.END_DOCUMENT);
+
+            if (type != XmlPullParser.START_TAG) {
+                throw new XmlPullParserException("No start tag found");
+            }
+
+            if (!parser.getName().equals(TAG_ROOT)) {
+                throw new XmlPullParserException("Unexpected start tag: found " + parser.getName() +
+                        ", expected " + TAG_ROOT);
+            }
+        }
+
+        private JDiffClassDescription next() throws IOException, XmlPullParserException {
+            int type;
+            while (true) {
+                do {
+                    type = parser.next();
+                } while (type != XmlPullParser.START_TAG && type != XmlPullParser.END_DOCUMENT
+                        && type != XmlPullParser.END_TAG);
+
+                if (type == XmlPullParser.END_DOCUMENT) {
+                    logd("Reached end of document");
+                    break;
+                }
+
+                String tagname = parser.getName();
+                if (type == XmlPullParser.END_TAG) {
+                    if (TAG_CLASS.equals(tagname) || TAG_INTERFACE.equals(tagname)) {
+                        logd("Reached end of class: " + currentClass);
+                        return currentClass;
+                    } else if (TAG_PACKAGE.equals(tagname)) {
+                        currentPackage = "";
+                    }
+                    continue;
+                }
+
+                if (!KEY_TAG_SET.contains(tagname)) {
+                    continue;
+                }
+
+                switch (tagname) {
+                    case TAG_PACKAGE:
+                        currentPackage = parser.getAttributeValue(null, ATTRIBUTE_NAME);
+                        break;
+
+                    case TAG_CLASS:
+                        currentClass = loadClassInfo(parser, false, currentPackage);
+                        break;
+
+                    case TAG_INTERFACE:
+                        currentClass = loadClassInfo(parser, true, currentPackage);
+                        break;
+
+                    case TAG_IMPLEMENTS:
+                        currentClass
+                                .addImplInterface(parser.getAttributeValue(null, ATTRIBUTE_NAME));
+                        break;
+
+                    case TAG_CONSTRUCTOR:
+                        JDiffConstructor constructor =
+                                loadConstructorInfo(parser, currentClass);
+                        currentClass.addConstructor(constructor);
+                        currentMethod = constructor;
+                        break;
+
+                    case TAG_METHOD:
+                        currentMethod = loadMethodInfo(currentClass.getClassName(), parser);
+                        currentClass.addMethod(currentMethod);
+                        break;
+
+                    case TAG_PARAM:
+                        String paramType = parser.getAttributeValue(null, ATTRIBUTE_TYPE);
+                        currentMethod.addParam(canonicalizeType(paramType));
+                        break;
+
+                    case TAG_EXCEPTION:
+                        currentMethod.addException(parser.getAttributeValue(null, ATTRIBUTE_TYPE));
+                        break;
+
+                    case TAG_FIELD:
+                        JDiffField field = loadFieldInfo(currentClass.getClassName(), parser);
+                        currentClass.addField(field);
+                        break;
+
+                    default:
+                        throw new RuntimeException("unknown tag exception:" + tagname);
+                }
+
+                if (currentPackage != null) {
+                    logd(String.format("currentPackage: %s", currentPackage));
+                }
+                if (currentClass != null) {
+                    logd(String.format("currentClass: %s", currentClass.toSignatureString()));
+                }
+                if (currentMethod != null) {
+                    logd(String.format("currentMethod: %s", currentMethod.toSignatureString()));
+                }
+            }
+
+            return null;
+        }
+    }
+
+    private void logd(String msg) {
+        Log.d(tag, msg);
+    }
+
+    // This unescapes the string format used by doclava and so needs to be kept in sync with any
+    // changes made to that format.
+    private static String unescapeFieldStringValue(String str) {
+        // Skip over leading and trailing ".
+        int start = 0;
+        if (str.charAt(start) == '"') {
+            ++start;
+        }
+        int end = str.length();
+        if (str.charAt(end - 1) == '"') {
+            --end;
+        }
+
+        // If there's no special encoding strings in the string then just return it without the
+        // leading and trailing "s.
+        if (str.indexOf('\\') == -1) {
+            return str.substring(start, end);
+        }
+
+        final StringBuilder buf = new StringBuilder(str.length());
+        char escaped = 0;
+        final int START = 0;
+        final int CHAR1 = 1;
+        final int CHAR2 = 2;
+        final int CHAR3 = 3;
+        final int CHAR4 = 4;
+        final int ESCAPE = 5;
+        int state = START;
+
+        for (int i = start; i < end; i++) {
+            final char c = str.charAt(i);
+            switch (state) {
+                case START:
+                    if (c == '\\') {
+                        state = ESCAPE;
+                    } else {
+                        buf.append(c);
+                    }
+                    break;
+                case ESCAPE:
+                    switch (c) {
+                        case '\\':
+                            buf.append('\\');
+                            state = START;
+                            break;
+                        case 't':
+                            buf.append('\t');
+                            state = START;
+                            break;
+                        case 'b':
+                            buf.append('\b');
+                            state = START;
+                            break;
+                        case 'r':
+                            buf.append('\r');
+                            state = START;
+                            break;
+                        case 'n':
+                            buf.append('\n');
+                            state = START;
+                            break;
+                        case 'f':
+                            buf.append('\f');
+                            state = START;
+                            break;
+                        case '\'':
+                            buf.append('\'');
+                            state = START;
+                            break;
+                        case '\"':
+                            buf.append('\"');
+                            state = START;
+                            break;
+                        case 'u':
+                            state = CHAR1;
+                            escaped = 0;
+                            break;
+                    }
+                    break;
+                case CHAR1:
+                case CHAR2:
+                case CHAR3:
+                case CHAR4:
+                    escaped <<= 4;
+                    if (c >= '0' && c <= '9') {
+                        escaped |= c - '0';
+                    } else if (c >= 'a' && c <= 'f') {
+                        escaped |= 10 + (c - 'a');
+                    } else if (c >= 'A' && c <= 'F') {
+                        escaped |= 10 + (c - 'A');
+                    } else {
+                        throw new RuntimeException(
+                                "bad escape sequence: '" + c + "' at pos " + i + " in: \""
+                                        + str + "\"");
+                    }
+                    if (state == CHAR4) {
+                        buf.append(escaped);
+                        state = START;
+                    } else {
+                        state++;
+                    }
+                    break;
+            }
+        }
+        if (state != START) {
+            throw new RuntimeException("unfinished escape sequence: " + str);
+        }
+        return buf.toString();
+    }
+
+    /**
+     * Canonicalize a possibly generic type.
+     */
+    private static String canonicalizeType(String type) {
+        // Remove trailing spaces after commas.
+        return type.replace(", ", ",");
+    }
+}
diff --git a/tests/signature/lib/common/Android.bp b/tests/signature/lib/common/Android.bp
index 31fb149..81a9f8c 100644
--- a/tests/signature/lib/common/Android.bp
+++ b/tests/signature/lib/common/Android.bp
@@ -14,6 +14,9 @@
 
 java_library_static {
   name: "signature-common-javalib",
+  visibility: [
+      "//cts/tests/signature:__subpackages__",
+  ],
   host_supported: true,
   installable: false,
   srcs: ["src/**/*.java"],
diff --git a/tests/signature/lib/common/src/android/signature/cts/AbstractApiChecker.java b/tests/signature/lib/common/src/android/signature/cts/AbstractApiChecker.java
index 75632ac..03c4a85 100644
--- a/tests/signature/lib/common/src/android/signature/cts/AbstractApiChecker.java
+++ b/tests/signature/lib/common/src/android/signature/cts/AbstractApiChecker.java
@@ -19,7 +19,9 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * Base class for those that process a set of API definition files and perform some checking on
@@ -187,14 +189,22 @@
      */
     private void checkConstructorCompliance(JDiffClassDescription classDescription,
             Class<?> runtimeClass) {
+        Map<Constructor, String> mismatchReasons = new LinkedHashMap<>();
         for (JDiffClassDescription.JDiffConstructor con : classDescription.getConstructors()) {
             try {
-                Constructor<?> c = ReflectionHelper.findMatchingConstructor(runtimeClass, con);
+                Constructor<?> c = ReflectionHelper.findMatchingConstructor(runtimeClass, con,
+                        mismatchReasons);
                 if (c == null) {
                     resultObserver.notifyFailure(FailureType.MISSING_CONSTRUCTOR,
                             con.toReadableString(classDescription.getAbsoluteClassName()),
-                            "No constructor with correct signature found:" +
-                                    con.toSignatureString());
+                            String.format(
+                                    "No constructor with correct signature found. The following"
+                                            + " constructors were rejected:\n%s",
+                                    mismatchReasons.entrySet()
+                                            .stream()
+                                            .map(e -> String.format("\t\t%s - %s\n",
+                                                    e.getKey(), e.getValue()))
+                                            .collect(Collectors.joining())));
                 } else {
                     checkConstructor(classDescription, runtimeClass, con, c);
                 }
@@ -220,18 +230,27 @@
      */
     private void checkMethodCompliance(JDiffClassDescription classDescription,
             Class<?> runtimeClass) {
+        Map<Method, String> mismatchReasons = new LinkedHashMap<>();
         for (JDiffClassDescription.JDiffMethod method : classDescription.getMethods()) {
             try {
-
-                Method m = ReflectionHelper.findMatchingMethod(runtimeClass, method);
+                Method m = ReflectionHelper.findMatchingMethod(
+                        runtimeClass, method, mismatchReasons);
                 if (m == null) {
                     resultObserver.notifyFailure(FailureType.MISSING_METHOD,
                             method.toReadableString(classDescription.getAbsoluteClassName()),
-                            "No method with correct signature found, looking for:" +
-                                    method.toSignatureString());
+                            String.format(
+                                    "No method with correct signature found. The following methods"
+                                            + " with the same name were rejected:\n%s",
+                                    mismatchReasons.entrySet()
+                                            .stream()
+                                            .map(e -> String.format("\t\t%s - %s\n",
+                                                    e.getKey(), e.getValue()))
+                                            .collect(Collectors.joining())));
                 } else {
                     checkMethod(classDescription, runtimeClass, method, m);
                 }
+                // Clear the list.
+                mismatchReasons.clear();
             } catch (Exception e) {
                 LogHelper.loge("Got exception when checking method compliance", e);
                 resultObserver.notifyFailure(FailureType.CAUGHT_EXCEPTION,
diff --git a/tests/signature/lib/common/src/android/signature/cts/ApiComplianceChecker.java b/tests/signature/lib/common/src/android/signature/cts/ApiComplianceChecker.java
index b346648..df7c18b 100644
--- a/tests/signature/lib/common/src/android/signature/cts/ApiComplianceChecker.java
+++ b/tests/signature/lib/common/src/android/signature/cts/ApiComplianceChecker.java
@@ -15,11 +15,13 @@
  */
 package android.signature.cts;
 
+import android.signature.cts.JDiffClassDescription.JDiffField;
+import android.signature.cts.ReflectionHelper.DefaultTypeComparator;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
+import java.util.Formatter;
 import java.util.HashSet;
 import java.util.Objects;
 import java.util.Set;
@@ -99,14 +101,16 @@
             // check father class
             if (!checkClassExtendsCompliance(classDescription, runtimeClass)) {
                 resultObserver.notifyFailure(FailureType.mismatch(classDescription),
-                        classDescription.getAbsoluteClassName(), "Extends mismatch");
+                        classDescription.getAbsoluteClassName(),
+                        "Extends mismatch, expected " + classDescription.getExtendedClass());
                 return false;
             }
 
             // check implements interface
             if (!checkClassImplementsCompliance(classDescription, runtimeClass)) {
                 resultObserver.notifyFailure(FailureType.mismatch(classDescription),
-                        classDescription.getAbsoluteClassName(), "Implements mismatch");
+                        classDescription.getAbsoluteClassName(),
+                        "Implements mismatch, expected " + classDescription.getImplInterfaces());
                 return false;
             }
         }
@@ -162,7 +166,7 @@
             return null;
         } else {
             return String.format("modifier mismatch - description (%s), class (%s)",
-                    Modifier.toString(apiModifiers), Modifier.toString(reflectionModifiers));
+                    getModifierString(apiModifiers), getModifierString(reflectionModifiers));
         }
     }
 
@@ -254,33 +258,72 @@
 
     @Override
     protected void checkField(JDiffClassDescription classDescription, Class<?> runtimeClass,
-            JDiffClassDescription.JDiffField fieldDescription, Field field) {
-        if (field.getModifiers() != fieldDescription.mModifier) {
+            JDiffField fieldDescription, Field field) {
+        int expectedModifiers = fieldDescription.mModifier;
+        int actualModifiers = field.getModifiers();
+        if (actualModifiers != expectedModifiers) {
             resultObserver.notifyFailure(FailureType.MISMATCH_FIELD,
                     fieldDescription.toReadableString(classDescription.getAbsoluteClassName()),
-                    "Non-compatible field modifiers found when looking for " +
-                            fieldDescription.toSignatureString());
-        } else if (!checkFieldValueCompliance(fieldDescription, field)) {
-            resultObserver.notifyFailure(FailureType.MISMATCH_FIELD,
-                    fieldDescription.toReadableString(classDescription.getAbsoluteClassName()),
-                    "Incorrect field value found when looking for " +
-                            fieldDescription.toSignatureString());
-        } else if (!field.getType().getCanonicalName().equals(fieldDescription.mFieldType)) {
-            // type name does not match, but this might be a generic
-            String genericTypeName = null;
-            Type type = field.getGenericType();
-            if (type != null) {
-                genericTypeName = type instanceof Class ? ((Class<?>) type).getName() :
-                        type.toString().replace('$', '.');
-            }
-            if (genericTypeName == null || !genericTypeName.equals(fieldDescription.mFieldType)) {
-                resultObserver.notifyFailure(
-                        FailureType.MISMATCH_FIELD,
-                        fieldDescription.toReadableString(classDescription.getAbsoluteClassName()),
-                        "Non-compatible field type found when looking for " +
-                                fieldDescription.toSignatureString());
-            }
+                    String.format(
+                            "Incompatible field modifiers, expected %s, found %s",
+                            getModifierString(expectedModifiers),
+                            getModifierString(actualModifiers)));
         }
+
+        String expectedFieldType = fieldDescription.mFieldType;
+        String actualFieldType = ReflectionHelper.typeToString(field.getGenericType());
+        if (!DefaultTypeComparator.INSTANCE.compare(expectedFieldType, actualFieldType)) {
+            resultObserver.notifyFailure(
+                    FailureType.MISMATCH_FIELD,
+                    fieldDescription.toReadableString(classDescription.getAbsoluteClassName()),
+                    String.format("Incompatible field type found, expected %s, found %s",
+                            expectedFieldType, actualFieldType));
+        }
+
+        String message = checkFieldValueCompliance(fieldDescription, field);
+        if (message != null) {
+            resultObserver.notifyFailure(FailureType.MISMATCH_FIELD,
+                    fieldDescription.toReadableString(classDescription.getAbsoluteClassName()),
+                    message);
+        }
+    }
+
+    private static final int BRIDGE    = 0x00000040;
+    private static final int VARARGS   = 0x00000080;
+    private static final int SYNTHETIC = 0x00001000;
+    private static final int ANNOTATION  = 0x00002000;
+    private static final int ENUM      = 0x00004000;
+    private static final int MANDATED  = 0x00008000;
+
+    private static String getModifierString(int modifiers) {
+        Formatter formatter = new Formatter();
+        String m = Modifier.toString(modifiers);
+        formatter.format("<%s", m);
+        String sep = m.isEmpty() ? "" : " ";
+        if ((modifiers & BRIDGE) != 0) {
+            formatter.format("%senum", sep);
+            sep = " ";
+        }
+        if ((modifiers & VARARGS) != 0) {
+            formatter.format("%svarargs", sep);
+            sep = " ";
+        }
+        if ((modifiers & SYNTHETIC) != 0) {
+            formatter.format("%ssynthetic", sep);
+            sep = " ";
+        }
+        if ((modifiers & ANNOTATION) != 0) {
+            formatter.format("%sannotation", sep);
+            sep = " ";
+        }
+        if ((modifiers & ENUM) != 0) {
+            formatter.format("%senum", sep);
+            sep = " ";
+        }
+        if ((modifiers & MANDATED) != 0) {
+            formatter.format("%smandated", sep);
+        }
+        return formatter.format("> (0x%x)", modifiers).toString();
     }
 
     /**
@@ -289,76 +332,86 @@
      * @param apiField The field as defined by the platform API.
      * @param deviceField The field as defined by the device under test.
      */
-    private static boolean checkFieldValueCompliance(JDiffClassDescription.JDiffField apiField, Field deviceField) {
+    private static String checkFieldValueCompliance(JDiffField apiField, Field deviceField) {
         if ((apiField.mModifier & Modifier.FINAL) == 0 ||
                 (apiField.mModifier & Modifier.STATIC) == 0) {
             // Only final static fields can have fixed values.
-            return true;
+            return null;
         }
-        if (apiField.getValueString() == null) {
+        String apiFieldValue = apiField.getValueString();
+        if (apiFieldValue == null) {
             // If we don't define a constant value for it, then it can be anything.
-            return true;
+            return null;
         }
+
+        // Convert char into a number to match the value returned from device field. The device
+        // field does not
+        if (deviceField.getType() == char.class) {
+            apiFieldValue = convertCharToCanonicalValue(apiFieldValue.charAt(0));
+        }
+
+        String deviceFieldValue = getFieldValueAsString(deviceField);
+        if (!Objects.equals(apiFieldValue, deviceFieldValue)) {
+            return String.format("Incorrect field value, expected <%s>, found <%s>",
+                    apiFieldValue, deviceFieldValue);
+
+        }
+
+        return null;
+    }
+
+    private static String getFieldValueAsString(Field deviceField) {
         // Some fields may be protected or package-private
         deviceField.setAccessible(true);
         try {
-            switch (apiField.mFieldType) {
-                case "byte":
-                    return Objects.equals(apiField.getValueString(),
-                            Byte.toString(deviceField.getByte(null)));
-                case "char":
-                    return Objects.equals(apiField.getValueString(),
-                            Integer.toString(deviceField.getChar(null)));
-                case "short":
-                    return Objects.equals(apiField.getValueString(),
-                            Short.toString(deviceField.getShort(null)));
-                case "int":
-                    return Objects.equals(apiField.getValueString(),
-                            Integer.toString(deviceField.getInt(null)));
-                case "long":
-                    return Objects.equals(apiField.getValueString(),
-                            Long.toString(deviceField.getLong(null)) + "L");
-                case "float":
-                    return Objects.equals(apiField.getValueString(),
-                            canonicalizeFloatingPoint(
-                                    Float.toString(deviceField.getFloat(null)), "f"));
-                case "double":
-                    return Objects.equals(apiField.getValueString(),
-                            canonicalizeFloatingPoint(
-                                    Double.toString(deviceField.getDouble(null)), ""));
-                case "boolean":
-                    return Objects.equals(apiField.getValueString(),
-                            Boolean.toString(deviceField.getBoolean(null)));
-                case "java.lang.String":
-                    String value = apiField.getValueString();
-                    // Remove the quotes the value string is wrapped in
-                    value = unescapeFieldStringValue(value.substring(1, value.length() - 1));
-                    return Objects.equals(value, deviceField.get(null));
-                default:
-                    return true;
+            Class<?> fieldType = deviceField.getType();
+            if (fieldType == byte.class) {
+                return Byte.toString(deviceField.getByte(null));
+            } else if (fieldType == char.class) {
+                return convertCharToCanonicalValue(deviceField.getChar(null));
+            } else if (fieldType == short.class) {
+                return  Short.toString(deviceField.getShort(null));
+            } else if (fieldType == int.class) {
+                return  Integer.toString(deviceField.getInt(null));
+            } else if (fieldType == long.class) {
+                return Long.toString(deviceField.getLong(null));
+            } else if (fieldType == float.class) {
+                return  canonicalizeFloatingPoint(
+                                Float.toString(deviceField.getFloat(null)));
+            } else if (fieldType == double.class) {
+                return  canonicalizeFloatingPoint(
+                                Double.toString(deviceField.getDouble(null)));
+            } else if (fieldType == boolean.class) {
+                return  Boolean.toString(deviceField.getBoolean(null));
+            } else if (fieldType == java.lang.String.class) {
+                return (String) deviceField.get(null);
+            } else {
+                return null;
             }
         } catch (IllegalAccessException e) {
             throw new RuntimeException(e);
         }
     }
 
+    private static String convertCharToCanonicalValue(char c) {
+        return String.format("'%c' (0x%x)", c, (int) c);
+    }
+
     /**
      * Canonicalize the string representation of floating point numbers.
      *
      * This needs to be kept in sync with the doclava canonicalization.
      */
-    private static String canonicalizeFloatingPoint(String val, String suffix) {
+    private static String canonicalizeFloatingPoint(String val) {
         switch (val) {
             case "Infinity":
-                return "(1.0" + suffix + "/0.0" + suffix + ")";
             case "-Infinity":
-                return "(-1.0" + suffix + "/0.0" + suffix + ")";
             case "NaN":
-                return "(0.0" + suffix + "/0.0" + suffix + ")";
+                return val;
         }
 
         if (val.indexOf('E') != -1) {
-            return val + suffix;
+            return val;
         }
 
         // 1.0 is the only case where a trailing "0" is allowed.
@@ -368,108 +421,7 @@
         while (i >= d + 2 && val.charAt(i) == '0') {
             val = val.substring(0, i--);
         }
-        return val + suffix;
-    }
-
-    // This unescapes the string format used by doclava and so needs to be kept in sync with any
-    // changes made to that format.
-    private static String unescapeFieldStringValue(String str) {
-        final int N = str.length();
-
-        // If there's no special encoding strings in the string then just return it.
-        if (str.indexOf('\\') == -1) {
-            return str;
-        }
-
-        final StringBuilder buf = new StringBuilder(str.length());
-        char escaped = 0;
-        final int START = 0;
-        final int CHAR1 = 1;
-        final int CHAR2 = 2;
-        final int CHAR3 = 3;
-        final int CHAR4 = 4;
-        final int ESCAPE = 5;
-        int state = START;
-
-        for (int i = 0; i < N; i++) {
-            final char c = str.charAt(i);
-            switch (state) {
-                case START:
-                    if (c == '\\') {
-                        state = ESCAPE;
-                    } else {
-                        buf.append(c);
-                    }
-                    break;
-                case ESCAPE:
-                    switch (c) {
-                        case '\\':
-                            buf.append('\\');
-                            state = START;
-                            break;
-                        case 't':
-                            buf.append('\t');
-                            state = START;
-                            break;
-                        case 'b':
-                            buf.append('\b');
-                            state = START;
-                            break;
-                        case 'r':
-                            buf.append('\r');
-                            state = START;
-                            break;
-                        case 'n':
-                            buf.append('\n');
-                            state = START;
-                            break;
-                        case 'f':
-                            buf.append('\f');
-                            state = START;
-                            break;
-                        case '\'':
-                            buf.append('\'');
-                            state = START;
-                            break;
-                        case '\"':
-                            buf.append('\"');
-                            state = START;
-                            break;
-                        case 'u':
-                            state = CHAR1;
-                            escaped = 0;
-                            break;
-                    }
-                    break;
-                case CHAR1:
-                case CHAR2:
-                case CHAR3:
-                case CHAR4:
-                    escaped <<= 4;
-                    if (c >= '0' && c <= '9') {
-                        escaped |= c - '0';
-                    } else if (c >= 'a' && c <= 'f') {
-                        escaped |= 10 + (c - 'a');
-                    } else if (c >= 'A' && c <= 'F') {
-                        escaped |= 10 + (c - 'A');
-                    } else {
-                        throw new RuntimeException(
-                                "bad escape sequence: '" + c + "' at pos " + i + " in: \""
-                                        + str + "\"");
-                    }
-                    if (state == CHAR4) {
-                        buf.append(escaped);
-                        state = START;
-                    } else {
-                        state++;
-                    }
-                    break;
-            }
-        }
-        if (state != START) {
-            throw new RuntimeException("unfinished escape sequence: " + str);
-        }
-        return buf.toString();
+        return val;
     }
 
     @Override
@@ -553,7 +505,7 @@
             return null;
         } else {
             return String.format("modifier mismatch - description (%s), method (%s), for %s",
-                Modifier.toString(apiModifiers), Modifier.toString(reflectionModifiers), genericString);
+                    getModifierString(apiModifiers), getModifierString(reflectionModifiers), genericString);
         }
     }
 
diff --git a/tests/signature/lib/common/src/android/signature/cts/InterfaceChecker.java b/tests/signature/lib/common/src/android/signature/cts/InterfaceChecker.java
index 6be5f96..66492ff 100644
--- a/tests/signature/lib/common/src/android/signature/cts/InterfaceChecker.java
+++ b/tests/signature/lib/common/src/android/signature/cts/InterfaceChecker.java
@@ -20,6 +20,7 @@
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -112,8 +113,9 @@
     }
 
     private boolean findMethod(JDiffClassDescription classDescription, Method method) {
+        Map<Method, String> matchNameNotSignature = new LinkedHashMap<>();
         for (JDiffClassDescription.JDiffMethod jdiffMethod : classDescription.getMethods()) {
-            if (ReflectionHelper.matches(jdiffMethod, method)) {
+            if (ReflectionHelper.matchesSignature(jdiffMethod, method, matchNameNotSignature)) {
                 return true;
             }
         }
diff --git a/tests/signature/lib/common/src/android/signature/cts/JDiffClassDescription.java b/tests/signature/lib/common/src/android/signature/cts/JDiffClassDescription.java
index 30584c9..97f11d0 100644
--- a/tests/signature/lib/common/src/android/signature/cts/JDiffClassDescription.java
+++ b/tests/signature/lib/common/src/android/signature/cts/JDiffClassDescription.java
@@ -325,9 +325,9 @@
             StringBuilder sb = new StringBuilder();
 
             // access level
-            String accesLevel = convertModifiersToAccessLevel(mModifier);
-            if (!"".equals(accesLevel)) {
-                sb.append(accesLevel).append(" ");
+            String accessLevel = convertModifiersToAccessLevel(mModifier);
+            if (!"".equals(accessLevel)) {
+                sb.append(accessLevel).append(" ");
             }
 
             String modifierString = convertModifersToModifierString(mModifier);
diff --git a/tests/signature/lib/common/src/android/signature/cts/ReflectionHelper.java b/tests/signature/lib/common/src/android/signature/cts/ReflectionHelper.java
index 992b3fa..6b6140a 100644
--- a/tests/signature/lib/common/src/android/signature/cts/ReflectionHelper.java
+++ b/tests/signature/lib/common/src/android/signature/cts/ReflectionHelper.java
@@ -15,6 +15,8 @@
  */
 package android.signature.cts;
 
+import android.signature.cts.JDiffClassDescription.JDiffConstructor;
+import android.signature.cts.JDiffClassDescription.JDiffMethod;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
@@ -29,6 +31,7 @@
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 /**
@@ -123,10 +126,12 @@
      *
      * @param runtimeClass the class in which to search.
      * @param jdiffDes constructor description to find.
+     * @param mismatchReasons a map from rejected constructor to the reason it was rejected.
      * @return reflected constructor, or null if not found.
      */
     static Constructor<?> findMatchingConstructor(Class<?> runtimeClass,
-            JDiffClassDescription.JDiffConstructor jdiffDes) {
+            JDiffConstructor jdiffDes, Map<Constructor, String> mismatchReasons) {
+
         for (Constructor<?> c : runtimeClass.getDeclaredConstructors()) {
             Type[] params = c.getGenericParameterTypes();
             boolean isStaticClass = ((runtimeClass.getModifiers() & Modifier.STATIC) != 0);
@@ -148,8 +153,15 @@
                 int i = 0;
                 int j = startParamOffset;
                 while (i < jdiffParamList.size()) {
-                    if (!compareParam(jdiffParamList.get(i), params[j],
+                    String expectedParameter = jdiffParamList.get(i);
+                    Type actualParameter = params[j];
+                    if (!compareParam(expectedParameter, actualParameter,
                             DefaultTypeComparator.INSTANCE)) {
+                        mismatchReasons.put(c,
+                                String.format("parameter %d mismatch: expected (%s), found (%s)",
+                                        i,
+                                        expectedParameter,
+                                        actualParameter));
                         isFound = false;
                         break;
                     }
@@ -159,6 +171,11 @@
                 if (isFound) {
                     return c;
                 }
+            } else {
+                mismatchReasons.put(c,
+                        String.format("parameter list length mismatch: expected %d, found %d",
+                                jdiffParamList.size(),
+                                params.length));
             }
         }
         return null;
@@ -204,25 +221,33 @@
      *
      * @param runtimeClass the class in which to search.
      * @param method description of the method to find
+     * @param mismatchReasons a map from rejected method to the reason it was rejected, only
+     *     contains methods with the same name.
      * @return the reflected method, or null if not found.
      */
-    static Method findMatchingMethod(Class<?> runtimeClass,
-            JDiffClassDescription.JDiffMethod method) {
+    static Method findMatchingMethod(
+            Class<?> runtimeClass, JDiffMethod method, Map<Method, String> mismatchReasons) {
 
         // Search through the class to find the methods just in case the method was actually
         // declared in a superclass which is not part of the API and so was made to appear as if
         // it was declared in each of the hidden class' subclasses. Cannot use getMethods() as that
         // will only return public methods and the API includes protected methods.
-        while (runtimeClass != null) {
-            Method[] methods = runtimeClass.getDeclaredMethods();
+        Class<?> currentClass = runtimeClass;
+        while (currentClass != null) {
+            Method[] reflectedMethods = currentClass.getDeclaredMethods();
 
-            for (Method m : methods) {
-                if (matches(method, m)) {
-                    return m;
+            for (Method reflectedMethod : reflectedMethods) {
+                // If the method names aren't equal, the methods can't match.
+                if (!method.mName.equals(reflectedMethod.getName())) {
+                    continue;
+                }
+
+                if (matchesSignature(method, reflectedMethod, mismatchReasons)) {
+                    return reflectedMethod;
                 }
             }
 
-            runtimeClass = runtimeClass.getSuperclass();
+            currentClass = currentClass.getSuperclass();
         }
 
         return null;
@@ -233,15 +258,12 @@
      *
      * @param jDiffMethod the jDiffMethod to compare
      * @param reflectedMethod the reflected method to compare
+     * @param mismatchReasons map from method to reason it did not match, used when reporting
+     *     missing methods.
      * @return true, if both methods are the same
      */
-    static boolean matches(JDiffClassDescription.JDiffMethod jDiffMethod,
-            Method reflectedMethod) {
-        // If the method names aren't equal, the methods can't match.
-        if (!jDiffMethod.mName.equals(reflectedMethod.getName())) {
-            return false;
-        }
-
+    static boolean matchesSignature(JDiffMethod jDiffMethod, Method reflectedMethod,
+            Map<Method, String> mismatchReasons) {
         // If the method is a bridge then use a special comparator for comparing types as
         // bridge methods created for generic methods may not have generic signatures.
         // See b/123558763 for more information.
@@ -250,19 +272,26 @@
 
         String jdiffReturnType = jDiffMethod.mReturnType;
         String reflectionReturnType = typeToString(reflectedMethod.getGenericReturnType());
-        List<String> jdiffParamList = jDiffMethod.mParamList;
 
         // Next, compare the return types of the two methods.  If
         // they aren't equal, the methods can't match.
         if (!typeComparator.compare(jdiffReturnType, reflectionReturnType)) {
+            mismatchReasons.put(reflectedMethod,
+                    String.format("return type mismatch: expected %s, found %s", jdiffReturnType,
+                            reflectionReturnType));
             return false;
         }
 
+        List<String> jdiffParamList = jDiffMethod.mParamList;
         Type[] params = reflectedMethod.getGenericParameterTypes();
 
         // Next, check the method parameters.  If they have different
         // parameter lengths, the two methods can't match.
         if (jdiffParamList.size() != params.length) {
+            mismatchReasons.put(reflectedMethod,
+                    String.format("parameter list length mismatch: expected %s, found %s",
+                            jdiffParamList.size(),
+                            params.length));
             return false;
         }
 
@@ -290,15 +319,25 @@
         StringBuilder reflectedMethodParams = new StringBuilder("");
         StringBuilder jdiffMethodParams = new StringBuilder("");
 
+        String sep = "";
         for (int i = 0; i < jdiffParamList.size(); i++) {
-            jdiffMethodParams.append(jdiffParamList.get(i));
-            reflectedMethodParams.append(params[i]);
+            jdiffMethodParams.append(sep).append(jdiffParamList.get(i));
+            reflectedMethodParams.append(sep).append(params[i].getTypeName());
+            sep = ", ";
         }
 
         String jDiffFName = jdiffMethodParams.toString();
         String refName = reflectedMethodParams.toString();
 
-        return jDiffFName.equals(refName);
+        boolean signatureMatches = jDiffFName.equals(refName);
+        if (!signatureMatches) {
+            mismatchReasons.put(reflectedMethod,
+                    String.format("parameter signature mismatch: expected (%s), found (%s)",
+                            jDiffFName,
+                            refName));
+        }
+
+        return signatureMatches;
     }
 
     /**
@@ -328,7 +367,7 @@
      * @param type the type to convert.
      * @return the jdiff formatted string.
      */
-    private static String typeToString(Type type) {
+    public static String typeToString(Type type) {
         if (type instanceof ParameterizedType) {
             ParameterizedType pt = (ParameterizedType) type;
 
@@ -341,7 +380,9 @@
             for (Type t : types) {
                 sb.append(typeToString(t));
                 if (++elementNum < types.length) {
-                    sb.append(", ");
+                    // Must match separator used in
+                    // android.signature.cts.KtHelper.toDefaultTypeString.
+                    sb.append(",");
                 }
             }
 
diff --git a/tests/signature/tests/src/android/signature/cts/tests/ApiComplianceCheckerTest.java b/tests/signature/tests/src/android/signature/cts/tests/ApiComplianceCheckerTest.java
index dc3e446..0a4558e 100644
--- a/tests/signature/tests/src/android/signature/cts/tests/ApiComplianceCheckerTest.java
+++ b/tests/signature/tests/src/android/signature/cts/tests/ApiComplianceCheckerTest.java
@@ -259,7 +259,7 @@
         JDiffClassDescription clz = createClass(NormalClass.class.getSimpleName());
         JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
                 "VALUE_FIELD", "java.lang.String",
-                Modifier.PUBLIC | Modifier.FINAL | Modifier.STATIC, "\"\\u2708\"");
+                Modifier.PUBLIC | Modifier.FINAL | Modifier.STATIC, "\u2708");
         clz.addField(field);
         checkSignatureCompliance(clz);
         assertEquals(field.toSignatureString(), "public static final java.lang.String VALUE_FIELD");
diff --git a/tests/tests/accounts/Android.bp b/tests/tests/accounts/Android.bp
new file mode 100644
index 0000000..94f7c79
--- /dev/null
+++ b/tests/tests/accounts/Android.bp
@@ -0,0 +1,38 @@
+// Copyright (C) 2009 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.
+
+android_test {
+    name: "CtsAccountManagerTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "CtsAccountTestsCommon",
+        "ctstestrunner-axt",
+        "platform-test-annotations",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    certificate: ":cts-testkey1",
+    min_sdk_version: "1",
+    sdk_version: "current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/tests/tests/accounts/Android.mk b/tests/tests/accounts/Android.mk
deleted file mode 100644
index c559252..0000000
--- a/tests/tests/accounts/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (C) 2009 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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    CtsAccountTestsCommon ctstestrunner-axt platform-test-annotations
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_PACKAGE_NAME := CtsAccountManagerTestCases
-
-LOCAL_MIN_SDK_VERSION  := 1
-
-LOCAL_SDK_VERSION := current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_PACKAGE)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.bp b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.bp
new file mode 100644
index 0000000..a9bc0e8
--- /dev/null
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.bp
@@ -0,0 +1,34 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsUnaffiliatedAccountAuthenticators",
+    defaults: ["cts_support_defaults"],
+    min_sdk_version: "1",
+    sdk_version: "current",
+    static_libs: [
+        "ctstestrunner-axt",
+        "CtsAccountTestsCommon",
+    ],
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    certificate: ":cts-testkey2",
+}
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk
deleted file mode 100644
index 03479db..0000000
--- a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk
+++ /dev/null
@@ -1,46 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# LOCAL_MODULE_TAGS := tests
-
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_MIN_SDK_VERSION  := 1
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-	ctstestrunner-axt \
-	CtsAccountTestsCommon
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := CtsUnaffiliatedAccountAuthenticators
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/tests/accounts/common/Android.bp b/tests/tests/accounts/common/Android.bp
new file mode 100644
index 0000000..35d01fb
--- /dev/null
+++ b/tests/tests/accounts/common/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.
+
+java_library {
+    name: "CtsAccountTestsCommon",
+    // Includes all the java files, and explicitly declares any aidl files
+    srcs: [
+        "src/**/*.java",
+        "src/**/I*.aidl",
+    ],
+    aidl: {
+        local_include_dirs: ["src"],
+    },
+    min_sdk_version: "1",
+    sdk_version: "current",
+}
diff --git a/tests/tests/accounts/common/Android.mk b/tests/tests/accounts/common/Android.mk
deleted file mode 100644
index 0b208dd..0000000
--- a/tests/tests/accounts/common/Android.mk
+++ /dev/null
@@ -1,38 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Includes all the java files, and explicitly declares any aidl files
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src) \
-    $(call all-Iaidl-files-under, src)
-
-LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/src
-
-LOCAL_MODULE:= CtsAccountTestsCommon
-
-LOCAL_MIN_SDK_VERSION  := 1
-
-LOCAL_SDK_VERSION := current
-
-# Build the actual static library
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/tests/app.usage/Android.bp b/tests/tests/app.usage/Android.bp
new file mode 100644
index 0000000..d249a76
--- /dev/null
+++ b/tests/tests/app.usage/Android.bp
@@ -0,0 +1,39 @@
+// 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.
+
+android_test {
+    name: "CtsUsageStatsTestCases",
+    defaults: ["cts_defaults"],
+    platform_apis: true,
+    static_libs: [
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "cts-wm-util",
+        "junit",
+        "ub-uiautomator",
+    ],
+    libs: [
+        "android.test.base.stubs",
+        "android.test.runner.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/tests/tests/app.usage/Android.mk b/tests/tests/app.usage/Android.mk
deleted file mode 100644
index 0a6d005..0000000
--- a/tests/tests/app.usage/Android.mk
+++ /dev/null
@@ -1,44 +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_PACKAGE_NAME := CtsUsageStatsTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    cts-wm-util \
-    junit \
-    ub-uiautomator
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs android.test.runner.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_PACKAGE)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/app.usage/TestApp1/Android.bp b/tests/tests/app.usage/TestApp1/Android.bp
new file mode 100644
index 0000000..fc09db7
--- /dev/null
+++ b/tests/tests/app.usage/TestApp1/Android.bp
@@ -0,0 +1,39 @@
+// Copyright (C) 2019 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.
+
+android_test_helper_app {
+    name: "CtsUsageStatsTestApp1",
+    defaults: ["cts_defaults"],
+    platform_apis: true,
+    static_libs: [
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "cts-wm-util",
+        "junit",
+        "ub-uiautomator",
+    ],
+    libs: [
+        "android.test.base.stubs",
+        "android.test.runner.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/tests/tests/app.usage/TestApp1/Android.mk b/tests/tests/app.usage/TestApp1/Android.mk
deleted file mode 100644
index 3d3927c..0000000
--- a/tests/tests/app.usage/TestApp1/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (C) 2019 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_PACKAGE_NAME := CtsUsageStatsTestApp1
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    cts-wm-util \
-    junit \
-    ub-uiautomator
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs android.test.runner.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/app/Android.bp b/tests/tests/app/Android.bp
new file mode 100644
index 0000000..122dc6b
--- /dev/null
+++ b/tests/tests/app/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test {
+    name: "CtsAndroidAppTestCases",
+    defaults: ["cts_defaults"],
+    platform_apis: true,
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "junit",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/app/Android.mk b/tests/tests/app/Android.mk
deleted file mode 100644
index ea5d9e6..0000000
--- a/tests/tests/app/Android.mk
+++ /dev/null
@@ -1,40 +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_PACKAGE_NAME := CtsAndroidAppTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules \
-    junit
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/appcomponentfactory/Android.bp b/tests/tests/appcomponentfactory/Android.bp
new file mode 100644
index 0000000..b746d68
--- /dev/null
+++ b/tests/tests/appcomponentfactory/Android.bp
@@ -0,0 +1,35 @@
+// Copyright (C) 2018 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.
+
+android_test {
+    name: "CtsAppComponentFactoryTestCases",
+    defaults: ["cts_defaults"],
+    sdk_version: "current",
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "junit",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/appcomponentfactory/Android.mk b/tests/tests/appcomponentfactory/Android.mk
deleted file mode 100644
index c6434f5..0000000
--- a/tests/tests/appcomponentfactory/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (C) 2018 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_PACKAGE_NAME := CtsAppComponentFactoryTestCases
-LOCAL_SDK_VERSION := current
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules \
-    junit
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/assist/Android.bp b/tests/tests/assist/Android.bp
new file mode 100644
index 0000000..632c19e
--- /dev/null
+++ b/tests/tests/assist/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test {
+    name: "CtsAssistTestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    static_libs: [
+        "CtsAssistCommon",
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/assist/Android.mk b/tests/tests/assist/Android.mk
deleted file mode 100644
index 36ec735..0000000
--- a/tests/tests/assist/Android.mk
+++ /dev/null
@@ -1,38 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_STATIC_JAVA_LIBRARIES := CtsAssistCommon ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsAssistTestCases
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/assist/common/Android.bp b/tests/tests/assist/common/Android.bp
new file mode 100644
index 0000000..438178b
--- /dev/null
+++ b/tests/tests/assist/common/Android.bp
@@ -0,0 +1,19 @@
+// 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.
+
+java_library {
+    name: "CtsAssistCommon",
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/tests/assist/common/Android.mk b/tests/tests/assist/common/Android.mk
deleted file mode 100644
index 88c90ee..0000000
--- a/tests/tests/assist/common/Android.mk
+++ /dev/null
@@ -1,30 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := CtsAssistCommon
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/tests/assist/service/Android.bp b/tests/tests/assist/service/Android.bp
new file mode 100644
index 0000000..d3bb2b6
--- /dev/null
+++ b/tests/tests/assist/service/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsAssistService",
+    defaults: ["cts_support_defaults"],
+    static_libs: [
+        "CtsAssistCommon",
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/assist/service/Android.mk b/tests/tests/assist/service/Android.mk
deleted file mode 100644
index f989776..0000000
--- a/tests/tests/assist/service/Android.mk
+++ /dev/null
@@ -1,35 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := CtsAssistCommon ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsAssistService
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/tests/assist/testapp/Android.bp b/tests/tests/assist/testapp/Android.bp
new file mode 100644
index 0000000..ac2a2c9
--- /dev/null
+++ b/tests/tests/assist/testapp/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.
+
+android_test_helper_app {
+    name: "CtsAssistApp",
+    defaults: ["cts_support_defaults"],
+    static_libs: ["CtsAssistCommon"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/tests/tests/assist/testapp/Android.mk b/tests/tests/assist/testapp/Android.mk
deleted file mode 100644
index f179ec3..0000000
--- a/tests/tests/assist/testapp/Android.mk
+++ /dev/null
@@ -1,35 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := CtsAssistCommon
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsAssistApp
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/tests/background/Android.bp b/tests/tests/background/Android.bp
new file mode 100644
index 0000000..485914b
--- /dev/null
+++ b/tests/tests/background/Android.bp
@@ -0,0 +1,34 @@
+// 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.
+
+android_test {
+    name: "CtsBackgroundRestrictionsTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "androidx.legacy_legacy-support-v4",
+        "mockito-target-minus-junit4",
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ub-uiautomator",
+    ],
+    libs: ["android.test.runner.stubs"],
+    srcs: ["src/**/*.java"],
+    test_suites: [
+        "cts",
+        "vts",
+        "cts_instant",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/background/Android.mk b/tests/tests/background/Android.mk
deleted file mode 100755
index b2512ce..0000000
--- a/tests/tests/background/Android.mk
+++ /dev/null
@@ -1,43 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsBackgroundRestrictionsTestCases
-
-LOCAL_COMPATIBILITY_SUITE := cts vts cts_instant
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/batterysaving/Android.bp b/tests/tests/batterysaving/Android.bp
new file mode 100644
index 0000000..032d2bf
--- /dev/null
+++ b/tests/tests/batterysaving/Android.bp
@@ -0,0 +1,39 @@
+// Copyright (C) 2018 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.
+
+android_test {
+    name: "CtsBatterySavingTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "BatterySavingCtsCommon",
+        "androidx.test.rules",
+        "androidx.legacy_legacy-support-v4",
+        "mockito-target-minus-junit4",
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "truth-prebuilt",
+        "ub-uiautomator",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/batterysaving/Android.mk b/tests/tests/batterysaving/Android.mk
deleted file mode 100755
index 05cd50c..0000000
--- a/tests/tests/batterysaving/Android.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (C) 2018 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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    BatterySavingCtsCommon \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    truth-prebuilt \
-    ub-uiautomator
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsBatterySavingTestCases
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/batterysaving/apps/Android.mk b/tests/tests/batterysaving/apps/Android.mk
deleted file mode 100644
index 9aaa6ac..0000000
--- a/tests/tests/batterysaving/apps/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (C) 2018 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 $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/batterysaving/apps/app_target_api_25/Android.bp b/tests/tests/batterysaving/apps/app_target_api_25/Android.bp
new file mode 100644
index 0000000..de78337
--- /dev/null
+++ b/tests/tests/batterysaving/apps/app_target_api_25/Android.bp
@@ -0,0 +1,27 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsBatterySavingAppTargetApi25",
+    defaults: ["cts_defaults"],
+    static_libs: ["CtsBatterSavingAppTargetLib"],
+    sdk_version: "test_current",
+    min_sdk_version: "23",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/batterysaving/apps/app_target_api_25/Android.mk b/tests/tests/batterysaving/apps/app_target_api_25/Android.mk
deleted file mode 100644
index c704a29..0000000
--- a/tests/tests/batterysaving/apps/app_target_api_25/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2018 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_PACKAGE_NAME := CtsBatterySavingAppTargetApi25
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../app_target_api_current/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    BatterySavingCtsCommon \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ub-uiautomator
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 23
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/batterysaving/apps/app_target_api_current/Android.bp b/tests/tests/batterysaving/apps/app_target_api_current/Android.bp
new file mode 100644
index 0000000..8d385c6
--- /dev/null
+++ b/tests/tests/batterysaving/apps/app_target_api_current/Android.bp
@@ -0,0 +1,41 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsBatterySavingAppTargetApiCurrent",
+    defaults: ["cts_defaults"],
+    static_libs: ["CtsBatterSavingAppTargetLib"],
+    sdk_version: "test_current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
+
+java_library {
+    name: "CtsBatterSavingAppTargetLib",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "BatterySavingCtsCommon",
+        "androidx.test.rules",
+        "androidx.legacy_legacy-support-v4",
+        "mockito-target-minus-junit4",
+        "compatibility-device-util-axt",
+        "ub-uiautomator",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/batterysaving/apps/app_target_api_current/Android.mk b/tests/tests/batterysaving/apps/app_target_api_current/Android.mk
deleted file mode 100644
index 717ce3b..0000000
--- a/tests/tests/batterysaving/apps/app_target_api_current/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (C) 2018 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_PACKAGE_NAME := CtsBatterySavingAppTargetApiCurrent
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    BatterySavingCtsCommon \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ub-uiautomator
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/batterysaving/common/Android.bp b/tests/tests/batterysaving/common/Android.bp
new file mode 100644
index 0000000..6f99fda
--- /dev/null
+++ b/tests/tests/batterysaving/common/Android.bp
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+java_library {
+    name: "BatterySavingCtsCommon",
+    srcs: [
+        "src/**/*.java",
+        "proto/**/*.proto",
+    ],
+    libs: [
+        "androidx.test.rules",
+        "androidx.legacy_legacy-support-v4",
+        "mockito-target",
+        "compatibility-device-util-axt",
+        "android.test.runner.stubs",
+    ],
+    sdk_version: "test_current",
+    proto: {
+        type: "lite",
+    },
+}
diff --git a/tests/tests/batterysaving/common/Android.mk b/tests/tests/batterysaving/common/Android.mk
deleted file mode 100644
index 1328461..0000000
--- a/tests/tests/batterysaving/common/Android.mk
+++ /dev/null
@@ -1,36 +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_SRC_FILES := \
-    $(call all-java-files-under, src) \
-    $(call all-proto-files-under, proto)
-
-LOCAL_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target \
-    compatibility-device-util-axt \
-    android.test.runner.stubs
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := BatterySavingCtsCommon
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/tests/binder_ndk/OWNERS b/tests/tests/binder_ndk/OWNERS
new file mode 100644
index 0000000..531df84
--- /dev/null
+++ b/tests/tests/binder_ndk/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 1344
+smoreland@google.com
diff --git a/tests/tests/bluetooth/Android.bp b/tests/tests/bluetooth/Android.bp
new file mode 100644
index 0000000..1d24127
--- /dev/null
+++ b/tests/tests/bluetooth/Android.bp
@@ -0,0 +1,31 @@
+// Copyright (C) 2009 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.
+
+android_test {
+    name: "CtsBluetoothTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: ["ctstestrunner-axt"],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/bluetooth/Android.mk b/tests/tests/bluetooth/Android.mk
deleted file mode 100644
index ab06e93..0000000
--- a/tests/tests/bluetooth/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2009 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_PACKAGE_NAME := CtsBluetoothTestCases
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
-LOCAL_JAVA_LIBRARIES += android.test.runner.stubs
-LOCAL_JAVA_LIBRARIES += android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/calendarcommon/Android.bp b/tests/tests/calendarcommon/Android.bp
new file mode 100644
index 0000000..5b2504d
--- /dev/null
+++ b/tests/tests/calendarcommon/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.
+
+android_test {
+    name: "CtsCalendarcommon2TestCases",
+    defaults: ["cts_defaults"],
+    static_libs: ["ctstestrunner-axt"],
+    libs: ["android.test.base.stubs"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    min_sdk_version: "15",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/calendarcommon/Android.mk b/tests/tests/calendarcommon/Android.mk
deleted file mode 100644
index d3a8e87..0000000
--- a/tests/tests/calendarcommon/Android.mk
+++ /dev/null
@@ -1,40 +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)
-
-# Replace "Example" with your name.
-LOCAL_PACKAGE_NAME := CtsCalendarcommon2TestCases
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 15
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/car/Android.bp b/tests/tests/car/Android.bp
new file mode 100644
index 0000000..4db0f0a
--- /dev/null
+++ b/tests/tests/car/Android.bp
@@ -0,0 +1,36 @@
+// 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.
+
+android_test {
+    name: "CtsCarTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "truth-prebuilt",
+        "ctstestrunner-axt",
+        "android.car",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    //TODO(b/72620511) Apps should not use platform APIs directly
+    //sdk_version: "current"
+    platform_apis: true,
+}
diff --git a/tests/tests/car/Android.mk b/tests/tests/car/Android.mk
deleted file mode 100644
index 6fc7139..0000000
--- a/tests/tests/car/Android.mk
+++ /dev/null
@@ -1,44 +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_PACKAGE_NAME := CtsCarTestCases
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-	androidx.test.rules \
-	compatibility-device-util-axt \
-	truth-prebuilt\
-	ctstestrunner-axt
-
-LOCAL_JAVA_LIBRARIES := android.car android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-#TODO(b/72620511) Apps should not use platform APIs directly
-#LOCAL_SDK_VERSION := current
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/carrierapi/Android.bp b/tests/tests/carrierapi/Android.bp
new file mode 100644
index 0000000..be6215e
--- /dev/null
+++ b/tests/tests/carrierapi/Android.bp
@@ -0,0 +1,40 @@
+// 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.
+
+android_test {
+    name: "CtsCarrierApiTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+        "junit",
+    ],
+    srcs: ["src/**/*.java"],
+    sdk_version: "test_current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    // This  APK must be signed to match the test SIM's cert whitelist.
+    // While "testkey" is the default, there are different per-device testkeys, so
+    // hard-code the AOSP default key to ensure it is used regardless of build
+    // environment.
+    certificate: ":aosp-testkey",
+}
diff --git a/tests/tests/carrierapi/Android.mk b/tests/tests/carrierapi/Android.mk
deleted file mode 100644
index a9c5d8b..0000000
--- a/tests/tests/carrierapi/Android.mk
+++ /dev/null
@@ -1,52 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-    junit
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsCarrierApiTestCases
-LOCAL_SDK_VERSION := test_current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_JAVA_LIBRARIES += android.test.runner.stubs android.test.base.stubs
-
-# This APK must be signed to match the test SIM's cert whitelist.
-# While "testkey" is the default, there are different per-device testkeys, so
-# hard-code the AOSP default key to ensure it is used regardless of build
-# environment.
-LOCAL_CERTIFICATE := build/make/target/product/security/testkey
-
-# This APK must be signed to match the test SIM's cert whitelist.
-# While "testkey" is the default, there are different per-device testkeys, so
-# hard-code the AOSP default key to ensure it is used regardless of build
-# environment.
-LOCAL_CERTIFICATE := build/make/target/product/security/testkey
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/colormode/Android.bp b/tests/tests/colormode/Android.bp
new file mode 100644
index 0000000..02268ed
--- /dev/null
+++ b/tests/tests/colormode/Android.bp
@@ -0,0 +1,34 @@
+// 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.
+
+android_test {
+    name: "CtsColorModeTestCases",
+    defaults: ["cts_defaults"],
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    static_libs: ["ctstestrunner-axt"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "current",
+}
diff --git a/tests/tests/colormode/Android.mk b/tests/tests/colormode/Android.mk
deleted file mode 100644
index 1bce247..0000000
--- a/tests/tests/colormode/Android.mk
+++ /dev/null
@@ -1,38 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsColorModeTestCases
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/contactsproviderwipe/Android.bp b/tests/tests/contactsproviderwipe/Android.bp
new file mode 100644
index 0000000..e694239
--- /dev/null
+++ b/tests/tests/contactsproviderwipe/Android.bp
@@ -0,0 +1,37 @@
+// 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.
+
+android_test {
+    name: "CtsContactsProviderWipe",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "androidx.legacy_legacy-support-v4",
+        "mockito-target-minus-junit4",
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ub-uiautomator",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/contactsproviderwipe/Android.mk b/tests/tests/contactsproviderwipe/Android.mk
deleted file mode 100644
index e046fad..0000000
--- a/tests/tests/contactsproviderwipe/Android.mk
+++ /dev/null
@@ -1,43 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsContactsProviderWipe
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/content/BinderPermissionTestService/Android.bp b/tests/tests/content/BinderPermissionTestService/Android.bp
new file mode 100644
index 0000000..2b5d4d8
--- /dev/null
+++ b/tests/tests/content/BinderPermissionTestService/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2018 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.
+//
+
+android_test_helper_app {
+    name: "CtsBinderPermissionTestService",
+    defaults: ["cts_support_defaults"],
+    sdk_version: "current",
+    srcs: [
+        "src/**/*.java",
+        "aidl/**/I*.aidl",
+    ],
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    optimize: {
+        enabled: false,
+    },
+    dex_preopt: {
+        enabled: false,
+    },
+}
diff --git a/tests/tests/content/BinderPermissionTestService/Android.mk b/tests/tests/content/BinderPermissionTestService/Android.mk
deleted file mode 100644
index 697d8f6..0000000
--- a/tests/tests/content/BinderPermissionTestService/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Copyright (C) 2018 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_SDK_VERSION := current
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-Iaidl-files-under, aidl)
-
-LOCAL_PACKAGE_NAME := CtsBinderPermissionTestService
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.bp b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.bp
new file mode 100644
index 0000000..c6453bc
--- /dev/null
+++ b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.bp
@@ -0,0 +1,39 @@
+//
+// 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.
+//
+
+android_test {
+    name: "CtsSyncAccountAccessOtherCertTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "androidx.test.rules",
+        "ctstestrunner-axt",
+        "accountaccesslib",
+    ],
+    srcs: ["src/**/*.java"],
+    platform_apis: true,
+    certificate: ":cts-testkey2",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    optimize: {
+        enabled: false,
+    },
+    dex_preopt: {
+        enabled: false,
+    },
+}
diff --git a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.mk b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.mk
deleted file mode 100644
index 959fab5..0000000
--- a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.mk
+++ /dev/null
@@ -1,41 +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_TAGS := tests
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    ctstestrunner-axt \
-    accountaccesslib
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsSyncAccountAccessOtherCertTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/content/SyncAccountAccessStubs/Android.bp b/tests/tests/content/SyncAccountAccessStubs/Android.bp
new file mode 100644
index 0000000..5ef6d43
--- /dev/null
+++ b/tests/tests/content/SyncAccountAccessStubs/Android.bp
@@ -0,0 +1,34 @@
+//
+// 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.
+//
+
+android_test_helper_app {
+    name: "CtsSyncAccountAccessStubs",
+    defaults: ["cts_support_defaults"],
+    static_libs: ["android-support-annotations"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    optimize: {
+        enabled: false,
+    },
+    dex_preopt: {
+        enabled: false,
+    },
+}
diff --git a/tests/tests/content/SyncAccountAccessStubs/Android.mk b/tests/tests/content/SyncAccountAccessStubs/Android.mk
deleted file mode 100644
index d176ce7..0000000
--- a/tests/tests/content/SyncAccountAccessStubs/Android.mk
+++ /dev/null
@@ -1,37 +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_TAGS := tests
-
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsSyncAccountAccessStubs
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/tests/content/emptytestapp/Android.bp b/tests/tests/content/emptytestapp/Android.bp
new file mode 100644
index 0000000..e3a7872
--- /dev/null
+++ b/tests/tests/content/emptytestapp/Android.bp
@@ -0,0 +1,25 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsContentEmptyTestApp",
+    defaults: ["cts_defaults"],
+    sdk_version: "current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/content/emptytestapp/Android.mk b/tests/tests/content/emptytestapp/Android.mk
deleted file mode 100644
index ea4d35a..0000000
--- a/tests/tests/content/emptytestapp/Android.mk
+++ /dev/null
@@ -1,30 +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_PACKAGE_NAME := CtsContentEmptyTestApp
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/content/jni/Android.bp b/tests/tests/content/jni/Android.bp
new file mode 100644
index 0000000..2328276
--- /dev/null
+++ b/tests/tests/content/jni/Android.bp
@@ -0,0 +1,30 @@
+// 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_test_library {
+    name: "libnativecursorwindow_jni",
+    srcs: ["NativeCursorWindow.cpp"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-pointer-arith",
+        "-Wno-unused-parameter",
+        "-Wno-unused-variable",
+    ],
+    shared_libs: [
+        "libnativehelper_compat_libc++",
+        "liblog",
+    ],
+    stl: "libc++_static",
+}
diff --git a/tests/tests/content/jni/Android.mk b/tests/tests/content/jni/Android.mk
deleted file mode 100644
index bc934d5..0000000
--- a/tests/tests/content/jni/Android.mk
+++ /dev/null
@@ -1,32 +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 := libnativecursorwindow_jni
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := NativeCursorWindow.cpp
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-LOCAL_CFLAGS := -Wall -Werror -Wno-pointer-arith -Wno-unused-parameter -Wno-unused-variable
-
-LOCAL_SHARED_LIBRARIES := libnativehelper_compat_libc++ liblog
-LOCAL_CXX_STL := libc++_static
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/content/lib/Android.mk b/tests/tests/content/lib/Android.mk
deleted file mode 100644
index 9aaa6ac..0000000
--- a/tests/tests/content/lib/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (C) 2018 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 $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/content/lib/accountaccess/Android.bp b/tests/tests/content/lib/accountaccess/Android.bp
new file mode 100644
index 0000000..0773b86
--- /dev/null
+++ b/tests/tests/content/lib/accountaccess/Android.bp
@@ -0,0 +1,23 @@
+// Copyright (C) 2018 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.
+
+java_library {
+    name: "accountaccesslib",
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "mockito-target",
+        "ub-uiautomator",
+        "compatibility-device-util-axt",
+    ],
+}
diff --git a/tests/tests/content/lib/accountaccess/Android.mk b/tests/tests/content/lib/accountaccess/Android.mk
deleted file mode 100644
index 134eb40..0000000
--- a/tests/tests/content/lib/accountaccess/Android.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright (C) 2018 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_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := accountaccesslib
-
-LOCAL_STATIC_JAVA_LIBRARIES := mockito-target \
-                               ub-uiautomator \
-                               compatibility-device-util-axt
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
\ No newline at end of file
diff --git a/tests/tests/database/Android.bp b/tests/tests/database/Android.bp
new file mode 100644
index 0000000..aad02e9
--- /dev/null
+++ b/tests/tests/database/Android.bp
@@ -0,0 +1,40 @@
+// 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.
+
+android_test {
+    name: "CtsDatabaseTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "android-common",
+        "ctstestrunner-axt",
+        "ctstestrunner-axt",
+        "ub-uiautomator",
+        "junit",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    // Enforce public / test api only
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/database/Android.mk b/tests/tests/database/Android.mk
deleted file mode 100644
index 1a0a9b6..0000000
--- a/tests/tests/database/Android.mk
+++ /dev/null
@@ -1,44 +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)
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    android-common \
-    ctstestrunner-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    junit
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsDatabaseTestCases
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-# Enforce public / test api only
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/display/Android.bp b/tests/tests/display/Android.bp
new file mode 100644
index 0000000..ac6c955
--- /dev/null
+++ b/tests/tests/display/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test {
+    name: "CtsDisplayTestCases",
+    defaults: ["cts_defaults"],
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    srcs: ["src/**/*.java"],
+    static_libs: ["androidx.test.rules"],
+    libs: ["android.test.base.stubs"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/display/Android.mk b/tests/tests/display/Android.mk
deleted file mode 100644
index 99efc20..0000000
--- a/tests/tests/display/Android.mk
+++ /dev/null
@@ -1,41 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsDisplayTestCases
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/dpi/Android.bp b/tests/tests/dpi/Android.bp
new file mode 100644
index 0000000..88706bb
--- /dev/null
+++ b/tests/tests/dpi/Android.bp
@@ -0,0 +1,49 @@
+//
+// Copyright (C) 2009 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.
+//
+
+android_test {
+    name: "CtsDpiTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "junit",
+        "compatibility-device-util-axt",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    sdk_version: "test_current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
+
+// ============================================================
+
+// DefaultManifestAttributesTest can be used as a base class for other
+// CTS tests, so drop it into a library that other tests can use.
+java_library {
+    name: "android.cts.dpi",
+    libs: ["android.test.base.stubs"],
+    srcs: ["src/android/dpi/cts/DefaultManifestAttributesTest.java"],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/dpi/Android.mk b/tests/tests/dpi/Android.mk
deleted file mode 100644
index a4c3315..0000000
--- a/tests/tests/dpi/Android.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Copyright (C) 2009 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_STATIC_JAVA_LIBRARIES := ctstestrunner-axt junit compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsDpiTestCases
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SDK_VERSION := current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_PACKAGE)
-
-# ============================================================
-
-# DefaultManifestAttributesTest can be used as a base class for other
-# CTS tests, so drop it into a library that other tests can use.
-include $(CLEAR_VARS)
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := src/android/dpi/cts/DefaultManifestAttributesTest.java
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := android.cts.dpi
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/tests/dpi2/Android.bp b/tests/tests/dpi2/Android.bp
new file mode 100644
index 0000000..9af9055
--- /dev/null
+++ b/tests/tests/dpi2/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2009 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.
+//
+
+android_test {
+    name: "CtsDpiTestCases2",
+    defaults: ["cts_defaults"],
+    // We use the DefaultManifestAttributesTest from the android.cts.dpi package.
+    static_libs: [
+        "android.cts.dpi",
+        "ctstestrunner-axt",
+        "junit",
+    ],
+    libs: ["android.test.base.stubs"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "test_current",
+    min_sdk_version: "3",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/dpi2/Android.mk b/tests/tests/dpi2/Android.mk
deleted file mode 100644
index 641b217..0000000
--- a/tests/tests/dpi2/Android.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Copyright (C) 2009 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)
-
-# We use the DefaultManifestAttributesTest from the android.cts.dpi package.
-LOCAL_STATIC_JAVA_LIBRARIES := android.cts.dpi ctstestrunner-axt junit
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsDpiTestCases2
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 3
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/dreams/Android.bp b/tests/tests/dreams/Android.bp
new file mode 100644
index 0000000..d1ba152
--- /dev/null
+++ b/tests/tests/dreams/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test {
+    name: "CtsDreamsTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "junit",
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Need access to ServiceManager - see b/13307221
+    // sdk_version: "current",
+    platform_apis: true,
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+}
diff --git a/tests/tests/dreams/Android.mk b/tests/tests/dreams/Android.mk
deleted file mode 100644
index b27b989..0000000
--- a/tests/tests/dreams/Android.mk
+++ /dev/null
@@ -1,40 +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_PACKAGE_NAME := CtsDreamsTestCases
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt junit
-
-LOCAL_JAVA_LIBRARIES :=  android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Need access to ServiceManager - see b/13307221
-#LOCAL_SDK_VERSION := current
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/drm/Android.bp b/tests/tests/drm/Android.bp
new file mode 100644
index 0000000..57b9332
--- /dev/null
+++ b/tests/tests/drm/Android.bp
@@ -0,0 +1,37 @@
+// 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.
+
+android_test {
+    name: "CtsDrmTestCases",
+    defaults: ["cts_defaults"],
+    // Include both the 32 and 64 bit versions of libs
+    compile_multilib: "both",
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: ["android.test.base.stubs"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    jni_libs: [
+        "libctsdrm_jni",
+        "libdrmtestplugin",
+    ],
+    platform_apis: true,
+}
diff --git a/tests/tests/drm/Android.mk b/tests/tests/drm/Android.mk
deleted file mode 100644
index 0b47c85..0000000
--- a/tests/tests/drm/Android.mk
+++ /dev/null
@@ -1,46 +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)
-
-# Include both the 32 and 64 bit versions of libs
-LOCAL_MULTILIB := both
-
-LOCAL_MODULE_TAGS := tests
-
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsDrmTestCases
-
-LOCAL_JNI_SHARED_LIBRARIES := \
-	libctsdrm_jni \
-	libdrmtestplugin
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/drm/jni/Android.bp b/tests/tests/drm/jni/Android.bp
new file mode 100644
index 0000000..ce14d1e
--- /dev/null
+++ b/tests/tests/drm/jni/Android.bp
@@ -0,0 +1,32 @@
+// 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: "libctsdrm_jni",
+    srcs: [
+        "CtsDrmJniOnLoad.cpp",
+        "android_drm_cts_NativeCodeTest.cpp",
+    ],
+    gtest: false,
+    shared_libs: [
+        "liblog",
+        "libdl",
+    ],
+    sdk_version: "23",
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
+}
diff --git a/tests/tests/drm/jni/Android.mk b/tests/tests/drm/jni/Android.mk
deleted file mode 100644
index 113bef8..0000000
--- a/tests/tests/drm/jni/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 := libctsdrm_jni
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
-		CtsDrmJniOnLoad.cpp \
-		android_drm_cts_NativeCodeTest.cpp
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-LOCAL_SHARED_LIBRARIES := liblog libdl
-LOCAL_SDK_VERSION := 23
-
-LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/drm/lib/Android.bp b/tests/tests/drm/lib/Android.bp
new file mode 100644
index 0000000..2724d2b
--- /dev/null
+++ b/tests/tests/drm/lib/Android.bp
@@ -0,0 +1,31 @@
+// 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: "libdrmtestplugin",
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Wunused",
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
+    gtest: false,
+    srcs: ["TestPlugin.cpp"],
+    shared_libs: [
+        "liblog",
+        "libutils",
+    ],
+    static_libs: ["libdrmframeworkcommon"],
+}
diff --git a/tests/tests/drm/lib/Android.mk b/tests/tests/drm/lib/Android.mk
deleted file mode 100644
index 73d2fe5..0000000
--- a/tests/tests/drm/lib/Android.mk
+++ /dev/null
@@ -1,40 +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_CFLAGS := -Wall -Wextra -Wunused -Werror \
-	-Wno-unused-parameter
-
-LOCAL_MODULE := libdrmtestplugin
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
-		TestPlugin.cpp
-
-LOCAL_C_INCLUDES := \
-	$(JNI_H_INCLUDE) \
-	$(TOP)/frameworks/av/drm/libdrmframework/plugins/common/include
-
-LOCAL_SHARED_LIBRARIES := \
-	liblog \
-	libutils
-
-LOCAL_STATIC_LIBRARIES := \
-	libdrmframeworkcommon
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/dynamic_linker/Android.bp b/tests/tests/dynamic_linker/Android.bp
new file mode 100644
index 0000000..76b6603
--- /dev/null
+++ b/tests/tests/dynamic_linker/Android.bp
@@ -0,0 +1,58 @@
+// 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_test_library {
+    name: "libdynamiclinker_native_lib_a",
+    srcs: ["native_lib_a.cpp"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    strip: {
+        none: true,
+    },
+    stl: "libc++_static",
+}
+
+cc_test_library {
+    name: "libdynamiclinker_native_lib_b",
+    srcs: ["native_lib_b.cpp"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    strip: {
+        none: true,
+    },
+    stl: "libc++_static",
+}
+
+android_test {
+    name: "CtsDynamicLinkerTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: ["ctstestrunner-axt"],
+    srcs: ["**/*.java"],
+    compile_multilib: "both",
+    jni_libs: [
+        "libdynamiclinker_native_lib_a",
+        "libdynamiclinker_native_lib_b",
+    ],
+    manifest: "AndroidManifest.xml",
+    sdk_version: "current",
+    test_suites: [
+        "cts",
+        "vts",
+    ],
+    use_embedded_native_libs: true,
+}
diff --git a/tests/tests/dynamic_linker/Android.mk b/tests/tests/dynamic_linker/Android.mk
deleted file mode 100644
index 7d1d574..0000000
--- a/tests/tests/dynamic_linker/Android.mk
+++ /dev/null
@@ -1,50 +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 := libdynamiclinker_native_lib_a
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := native_lib_a.cpp
-LOCAL_CFLAGS := -Wall -Werror
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-LOCAL_SDK_VERSION := 25
-LOCAL_NDK_STL_VARIANT := c++_static
-LOCAL_STRIP_MODULE := false
-include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libdynamiclinker_native_lib_b
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := native_lib_b.cpp
-LOCAL_CFLAGS := -Wall -Werror
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-LOCAL_SDK_VERSION := 25
-LOCAL_NDK_STL_VARIANT := c++_static
-LOCAL_STRIP_MODULE := false
-include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
-LOCAL_SRC_FILES := $(call all-java-files-under, .)
-LOCAL_MULTILIB := both
-LOCAL_JNI_SHARED_LIBRARIES := libdynamiclinker_native_lib_a libdynamiclinker_native_lib_b
-LOCAL_MANIFEST_FILE := AndroidManifest.xml
-LOCAL_PACKAGE_NAME := CtsDynamicLinkerTestCases
-LOCAL_SDK_VERSION := current
-LOCAL_COMPATIBILITY_SUITE := cts vts
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/effect/Android.bp b/tests/tests/effect/Android.bp
new file mode 100644
index 0000000..5b62692
--- /dev/null
+++ b/tests/tests/effect/Android.bp
@@ -0,0 +1,27 @@
+// 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.
+
+android_test {
+    name: "CtsEffectTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: ["ctstestrunner-axt"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/tests/tests/effect/Android.mk b/tests/tests/effect/Android.mk
deleted file mode 100644
index f2fcc94..0000000
--- a/tests/tests/effect/Android.mk
+++ /dev/null
@@ -1,36 +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_PACKAGE_NAME := CtsEffectTestCases
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/externalservice/Android.bp b/tests/tests/externalservice/Android.bp
new file mode 100644
index 0000000..11a1d35
--- /dev/null
+++ b/tests/tests/externalservice/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+
+android_test {
+    name: "CtsExternalServiceTestCases",
+    defaults: ["cts_defaults"],
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    static_libs: [
+        "CtsExternalServiceCommon",
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+    ],
+    libs: ["android.test.base.stubs"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/externalservice/Android.mk b/tests/tests/externalservice/Android.mk
deleted file mode 100644
index d5513e3..0000000
--- a/tests/tests/externalservice/Android.mk
+++ /dev/null
@@ -1,42 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := CtsExternalServiceCommon compatibility-device-util-axt ctstestrunner-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsExternalServiceTestCases
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/externalservice/common/Android.bp b/tests/tests/externalservice/common/Android.bp
new file mode 100644
index 0000000..4348ace
--- /dev/null
+++ b/tests/tests/externalservice/common/Android.bp
@@ -0,0 +1,19 @@
+// 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.
+
+java_library {
+    name: "CtsExternalServiceCommon",
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/tests/externalservice/common/Android.mk b/tests/tests/externalservice/common/Android.mk
deleted file mode 100644
index 1ebf149..0000000
--- a/tests/tests/externalservice/common/Android.mk
+++ /dev/null
@@ -1,30 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := CtsExternalServiceCommon
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/tests/externalservice/service/Android.bp b/tests/tests/externalservice/service/Android.bp
new file mode 100644
index 0000000..29b48d1
--- /dev/null
+++ b/tests/tests/externalservice/service/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsExternalServiceService",
+    defaults: ["cts_support_defaults"],
+    static_libs: [
+        "CtsExternalServiceCommon",
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/externalservice/service/Android.mk b/tests/tests/externalservice/service/Android.mk
deleted file mode 100644
index 400891e..0000000
--- a/tests/tests/externalservice/service/Android.mk
+++ /dev/null
@@ -1,39 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    CtsExternalServiceCommon \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsExternalServiceService
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/tests/gesture/Android.bp b/tests/tests/gesture/Android.bp
new file mode 100644
index 0000000..9344bb6
--- /dev/null
+++ b/tests/tests/gesture/Android.bp
@@ -0,0 +1,28 @@
+// 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.
+
+android_test {
+    name: "CtsGestureTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    static_libs: ["androidx.test.runner"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    sdk_version: "current",
+}
diff --git a/tests/tests/gesture/Android.mk b/tests/tests/gesture/Android.mk
deleted file mode 100755
index 56e3b10..0000000
--- a/tests/tests/gesture/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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.runner
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsGestureTestCases
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/graphics/Android.bp b/tests/tests/graphics/Android.bp
new file mode 100644
index 0000000..beed115
--- /dev/null
+++ b/tests/tests/graphics/Android.bp
@@ -0,0 +1,44 @@
+// 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.
+
+android_test {
+    name: "CtsGraphicsTestCases",
+    defaults: ["cts_defaults"],
+    compile_multilib: "both",
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "androidx.test.rules",
+        "mockito-target-minus-junit4",
+        "compatibility-device-util-axt",
+        "ctsdeviceutillegacy-axt",
+        "ctstestrunner-axt",
+        "androidx.annotation_annotation",
+        "junit",
+        "testng",
+        "androidx.core_core",
+    ],
+    jni_libs: ["libctsgraphics_jni"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    // Enforce public / test api only
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/graphics/Android.mk b/tests/tests/graphics/Android.mk
deleted file mode 100644
index 74cecda..0000000
--- a/tests/tests/graphics/Android.mk
+++ /dev/null
@@ -1,52 +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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MULTILIB := both
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES += \
-    androidx.test.rules \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctsdeviceutillegacy-axt \
-    ctstestrunner-axt \
-    androidx.annotation_annotation \
-    junit \
-    testng
-
-LOCAL_STATIC_ANDROID_LIBRARIES += \
-    androidx.core_core
-
-LOCAL_JNI_SHARED_LIBRARIES := libctsgraphics_jni
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsGraphicsTestCases
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# Enforce public / test api only
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/graphics/jni/Android.bp b/tests/tests/graphics/jni/Android.bp
new file mode 100644
index 0000000..305ced3
--- /dev/null
+++ b/tests/tests/graphics/jni/Android.bp
@@ -0,0 +1,61 @@
+// Copyright 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_test_library {
+    name: "libctsgraphics_jni",
+    gtest: false,
+    srcs: [
+        "CtsGraphicsJniOnLoad.cpp",
+        "android_graphics_cts_ANativeWindowTest.cpp",
+        "android_graphics_cts_ASurfaceTextureTest.cpp",
+        "android_graphics_cts_BasicVulkanGpuTest.cpp",
+        "android_graphics_cts_BitmapTest.cpp",
+        "android_graphics_cts_SyncTest.cpp",
+        "android_graphics_cts_CameraGpuCtsActivity.cpp",
+        "android_graphics_cts_CameraVulkanGpuTest.cpp",
+        "android_graphics_cts_MediaVulkanGpuTest.cpp",
+        "android_graphics_cts_VulkanFeaturesTest.cpp",
+        "android_graphics_cts_VulkanPreTransformCtsActivity.cpp",
+        "android_graphics_cts_VulkanSurfaceSupportTest.cpp",
+        "android_graphics_fonts_cts_SystemFonts.cpp",
+        "CameraTestHelpers.cpp",
+        "ImageReaderTestHelpers.cpp",
+        "MediaTestHelpers.cpp",
+        "NativeTestHelpers.cpp",
+        "VulkanPreTransformTestHelpers.cpp",
+        "VulkanTestHelpers.cpp",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-DGL_GLEXT_PROTOTYPES",
+        "-DEGL_EGLEXT_PROTOTYPES",
+    ],
+    static_libs: ["libvkjson_ndk"],
+    shared_libs: [
+        "libandroid",
+        "libvulkan",
+        "libnativewindow",
+        "libsync",
+        "liblog",
+        "libdl",
+        "libjnigraphics",
+        "libcamera2ndk",
+        "libmediandk",
+        "libEGL",
+        "libGLESv2",
+    ],
+    stl: "c++_static",
+    sdk_version: "current",
+}
diff --git a/tests/tests/graphics/jni/Android.mk b/tests/tests/graphics/jni/Android.mk
deleted file mode 100644
index af76936..0000000
--- a/tests/tests/graphics/jni/Android.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 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 := libctsgraphics_jni
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
-	CtsGraphicsJniOnLoad.cpp \
-	android_graphics_cts_ANativeWindowTest.cpp \
-	android_graphics_cts_ASurfaceTextureTest.cpp \
-	android_graphics_cts_BasicVulkanGpuTest.cpp \
-	android_graphics_cts_BitmapTest.cpp \
-	android_graphics_cts_SyncTest.cpp \
-	android_graphics_cts_CameraGpuCtsActivity.cpp \
-	android_graphics_cts_CameraVulkanGpuTest.cpp \
-	android_graphics_cts_MediaVulkanGpuTest.cpp \
-	android_graphics_cts_VulkanFeaturesTest.cpp \
-	android_graphics_cts_VulkanPreTransformCtsActivity.cpp \
-	android_graphics_cts_VulkanSurfaceSupportTest.cpp \
-        android_graphics_fonts_cts_SystemFonts.cpp \
-	CameraTestHelpers.cpp \
-	ImageReaderTestHelpers.cpp \
-	MediaTestHelpers.cpp \
-	NativeTestHelpers.cpp \
-	VulkanPreTransformTestHelpers.cpp \
-	VulkanTestHelpers.cpp
-
-LOCAL_CFLAGS += -Wall -Werror -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-
-LOCAL_STATIC_LIBRARIES := libvkjson_ndk
-LOCAL_SHARED_LIBRARIES := libandroid libvulkan libnativewindow libsync liblog libdl libjnigraphics \
-                          libcamera2ndk libmediandk libEGL libGLESv2
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java
index f8d49ef..3f5c692 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java
@@ -387,6 +387,9 @@
                 drawable.start();
             });
 
+            cb.waitForStart();
+            cb.assertStarted(true);
+
             // The animation runs repeatCount + 1 total times.
             cb.waitForEnd(DURATION * repeatCount);
             cb.assertEnded(false);
diff --git a/tests/tests/hardware/Android.bp b/tests/tests/hardware/Android.bp
new file mode 100644
index 0000000..1915b00
--- /dev/null
+++ b/tests/tests/hardware/Android.bp
@@ -0,0 +1,45 @@
+// 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.
+
+android_test {
+    name: "CtsHardwareTestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    compile_multilib: "both",
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "androidx.annotation_annotation",
+        "androidx.test.ext.junit",
+        "compatibility-device-util-axt",
+        "cts-input-lib",
+        "ctstestrunner-axt",
+        "mockito-target-minus-junit4",
+        "platform-test-annotations",
+        "ub-uiautomator",
+    ],
+    jni_libs: [
+        "libctshardware_jni",
+        "libnativehelper_compat_libc++",
+    ],
+    srcs: ["src/**/*.java"],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/hardware/Android.mk b/tests/tests/hardware/Android.mk
deleted file mode 100644
index 9bacb2c..0000000
--- a/tests/tests/hardware/Android.mk
+++ /dev/null
@@ -1,50 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MULTILIB := both
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.annotation_annotation \
-    androidx.test.ext.junit \
-    compatibility-device-util-axt \
-    cts-input-lib \
-    ctstestrunner-axt \
-    mockito-target-minus-junit4 \
-    platform-test-annotations \
-    ub-uiautomator
-
-LOCAL_JNI_SHARED_LIBRARIES := libctshardware_jni libnativehelper_compat_libc++
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsHardwareTestCases
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/hardware/jni/Android.bp b/tests/tests/hardware/jni/Android.bp
new file mode 100644
index 0000000..f1a04c3
--- /dev/null
+++ b/tests/tests/hardware/jni/Android.bp
@@ -0,0 +1,31 @@
+// 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_test_library {
+    name: "libctshardware_jni",
+    cflags: ["-Werror"],
+    gtest: false,
+    srcs: [
+        "CtsHardwareJniOnLoad.cpp",
+        "android_hardware_cts_HardwareBufferTest.cpp",
+    ],
+    shared_libs: [
+        "libandroid",
+        "libnativehelper_compat_libc++",
+        "liblog",
+    ],
+    stl: "none",
+    sdk_version: "current",
+    clang: true,
+}
diff --git a/tests/tests/hardware/jni/Android.mk b/tests/tests/hardware/jni/Android.mk
deleted file mode 100644
index 6df6667..0000000
--- a/tests/tests/hardware/jni/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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libctshardware_jni
-
-LOCAL_CFLAGS += -Werror
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
-		CtsHardwareJniOnLoad.cpp \
-		android_hardware_cts_HardwareBufferTest.cpp
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-LOCAL_SHARED_LIBRARIES := libandroid libnativehelper_compat_libc++ liblog
-
-LOCAL_NDK_STL_VARIANT := none
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_CLANG := true
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/icu/Android.bp b/tests/tests/icu/Android.bp
new file mode 100644
index 0000000..69f358f
--- /dev/null
+++ b/tests/tests/icu/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+android_test {
+    name: "CtsIcuTestCases",
+    defaults: ["cts_support_defaults"],
+    java_resource_dirs: ["resources"],
+    static_libs: [
+        "cts-core-test-runner-axt",
+        "android-icu4j-tests",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    platform_apis: true,
+}
diff --git a/tests/tests/icu/Android.mk b/tests/tests/icu/Android.mk
deleted file mode 100644
index 204d97f..0000000
--- a/tests/tests/icu/Android.mk
+++ /dev/null
@@ -1,43 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_JAVA_RESOURCE_DIRS := resources
-
-# The aim of this package is to run tests against the implementation in use by
-# the current android system.
-LOCAL_STATIC_JAVA_LIBRARIES := \
-	cts-core-test-runner-axt \
-	android-icu4j-tests
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsIcuTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
diff --git a/tests/tests/icu/OWNERS b/tests/tests/icu/OWNERS
new file mode 100644
index 0000000..2d36574
--- /dev/null
+++ b/tests/tests/icu/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 24949
+include platform/libcore:/OWNERS
diff --git a/tests/tests/jni/Android.bp b/tests/tests/jni/Android.bp
new file mode 100644
index 0000000..aff9682
--- /dev/null
+++ b/tests/tests/jni/Android.bp
@@ -0,0 +1,94 @@
+// Copyright (C) 2009 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.
+
+android_test {
+    name: "CtsJniTestCases",
+    defaults: ["cts_defaults"],
+    // Include both the 32 and 64 bit versions
+    compile_multilib: "both",
+    // When built, explicitly put it in the data partition.
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+    ],
+    jni_libs: [
+        "libjni_test_dlclose",
+        "libjninamespacea1",
+        "libjninamespacea2",
+        "libjninamespaceb",
+        "libjnicommon",
+        "libjnitest",
+        "libnativehelper_compat_libc++",
+    ],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    use_embedded_native_libs: false,
+}
+
+cc_test_library {
+    name: "libjninamespacea1",
+    srcs: ["libjninamespacea1/namespacea1.cpp"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    local_include_dirs: ["libjnicommon"],
+    host_ldlibs: ["-llog"],
+    shared_libs: [
+        "liblog",
+        "libjnicommon",
+    ],
+    sdk_version: "23",
+    gtest: false,
+}
+
+cc_test_library {
+    name: "libjninamespacea2",
+    srcs: ["libjninamespacea2/namespacea2.cpp"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    local_include_dirs: ["libjnicommon"],
+    host_ldlibs: ["-llog"],
+    shared_libs: [
+        "liblog",
+        "libjnicommon",
+    ],
+    sdk_version: "23",
+    gtest: false,
+}
+
+cc_test_library {
+    name: "libjninamespaceb",
+    srcs: ["libjninamespaceb/namespaceb.cpp"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    local_include_dirs: ["libjnicommon"],
+    host_ldlibs: ["-llog"],
+    shared_libs: [
+        "liblog",
+        "libjnicommon",
+    ],
+    sdk_version: "23",
+    gtest: false,
+}
diff --git a/tests/tests/jni/Android.mk b/tests/tests/jni/Android.mk
deleted file mode 100644
index 440758a..0000000
--- a/tests/tests/jni/Android.mk
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright (C) 2009 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_PACKAGE_NAME := CtsJniTestCases
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# Include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
-
-LOCAL_JNI_SHARED_LIBRARIES := \
-  libjni_test_dlclose \
-  libjninamespacea1 \
-  libjninamespacea2 \
-  libjninamespaceb \
-  libjnicommon \
-  libjnitest \
-  libnativehelper_compat_libc++
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_NDK_STL_VARIANT := c++_shared
-
-LOCAL_USE_EMBEDDED_NATIVE_LIBS := false
-
-include $(BUILD_CTS_PACKAGE)
-
-# Include the associated library's makefile.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/jni/libjnicommon/Android.bp b/tests/tests/jni/libjnicommon/Android.bp
new file mode 100644
index 0000000..15756f6
--- /dev/null
+++ b/tests/tests/jni/libjnicommon/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.
+
+//
+// This is the shared library included by the JNI test app.
+//
+
+cc_test_library {
+    name: "libjnicommon",
+    srcs: ["common.cpp"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    sdk_version: "23",
+    gtest: false,
+}
diff --git a/tests/tests/jni/libjnicommon/Android.mk b/tests/tests/jni/libjnicommon/Android.mk
deleted file mode 100644
index 14406f3..0000000
--- a/tests/tests/jni/libjnicommon/Android.mk
+++ /dev/null
@@ -1,39 +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.
-
-#
-# This is the shared library included by the JNI test app.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libjnicommon
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := common.cpp
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-LOCAL_SHARED_LIBRARIES := libdl liblog libnativehelper_compat_libc++
-
-LOCAL_SDK_VERSION := 23
-LOCAL_NDK_STL_VARIANT := c++_shared
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/jni/libjninamespacea1/Android.mk b/tests/tests/jni/libjninamespacea1/Android.mk
deleted file mode 100644
index 419db82..0000000
--- a/tests/tests/jni/libjninamespacea1/Android.mk
+++ /dev/null
@@ -1,40 +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.
-
-#
-# This is the shared library included by the JNI test app.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libjninamespacea1
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := namespacea1.cpp
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE) $(LOCAL_PATH)/../libjnicommon/
-
-LOCAL_LDLIBS += -llog
-LOCAL_SHARED_LIBRARIES := libdl liblog libnativehelper_compat_libc++ libjnicommon
-
-LOCAL_SDK_VERSION := 23
-LOCAL_NDK_STL_VARIANT := c++_shared
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/jni/libjninamespacea1/namespacea1.cpp b/tests/tests/jni/libjninamespacea1/namespacea1.cpp
index 8a79c3c..a1eddb1 100644
--- a/tests/tests/jni/libjninamespacea1/namespacea1.cpp
+++ b/tests/tests/jni/libjninamespacea1/namespacea1.cpp
@@ -18,7 +18,6 @@
 
 #include <android/log.h>
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
 
 #define  LOGI(...)  __android_log_print(ANDROID_LOG_INFO,"namespacea1",__VA_ARGS__)
 
diff --git a/tests/tests/jni/libjninamespacea2/Android.mk b/tests/tests/jni/libjninamespacea2/Android.mk
deleted file mode 100644
index 2781a81..0000000
--- a/tests/tests/jni/libjninamespacea2/Android.mk
+++ /dev/null
@@ -1,40 +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.
-
-#
-# This is the shared library included by the JNI test app.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libjninamespacea2
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := namespacea2.cpp
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE) $(LOCAL_PATH)/../libjnicommon/
-
-LOCAL_LDLIBS += -llog
-LOCAL_SHARED_LIBRARIES := libdl liblog libnativehelper_compat_libc++ libjnicommon
-
-LOCAL_SDK_VERSION := 23
-LOCAL_NDK_STL_VARIANT := c++_shared
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/jni/libjninamespacea2/namespacea2.cpp b/tests/tests/jni/libjninamespacea2/namespacea2.cpp
index 49f055e..0ac9695 100644
--- a/tests/tests/jni/libjninamespacea2/namespacea2.cpp
+++ b/tests/tests/jni/libjninamespacea2/namespacea2.cpp
@@ -18,7 +18,6 @@
 
 #include <android/log.h>
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
 
 #define  LOGI(...)  __android_log_print(ANDROID_LOG_INFO,"namespacea2",__VA_ARGS__)
 
diff --git a/tests/tests/jni/libjninamespaceb/Android.mk b/tests/tests/jni/libjninamespaceb/Android.mk
deleted file mode 100644
index e91ba59..0000000
--- a/tests/tests/jni/libjninamespaceb/Android.mk
+++ /dev/null
@@ -1,40 +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.
-
-#
-# This is the shared library included by the JNI test app.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libjninamespaceb
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := namespaceb.cpp
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE) $(LOCAL_PATH)/../libjnicommon/
-
-LOCAL_LDLIBS += -llog
-LOCAL_SHARED_LIBRARIES := libdl liblog libnativehelper_compat_libc++ libjnicommon
-
-LOCAL_SDK_VERSION := 23
-LOCAL_NDK_STL_VARIANT := c++_shared
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/jni/libjninamespaceb/namespaceb.cpp b/tests/tests/jni/libjninamespaceb/namespaceb.cpp
index 4c48627..e9ef300 100644
--- a/tests/tests/jni/libjninamespaceb/namespaceb.cpp
+++ b/tests/tests/jni/libjninamespaceb/namespaceb.cpp
@@ -18,7 +18,6 @@
 
 #include <android/log.h>
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
 
 #define  LOGI(...)  __android_log_print(ANDROID_LOG_INFO,"namespaceb",__VA_ARGS__)
 
diff --git a/tests/tests/jni/libjnitest/Android.bp b/tests/tests/jni/libjnitest/Android.bp
new file mode 100644
index 0000000..d7206c4
--- /dev/null
+++ b/tests/tests/jni/libjnitest/Android.bp
@@ -0,0 +1,60 @@
+// Copyright (C) 2009 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 is the shared library included by the JNI test app.
+//
+
+cc_test_library {
+    name: "libjnitest",
+    srcs: [
+        "android_jni_cts_BasicLoaderTest.cpp",
+        "android_jni_cts_InstanceNonce.c",
+        "android_jni_cts_JniCTest.c",
+        "android_jni_cts_JniCppTest.cpp",
+        "android_jni_cts_JniStaticTest.cpp",
+        "android_jni_cts_LinkerNamespacesTest.cpp",
+        "android_jni_cts_StaticNonce.c",
+        "helper.c",
+        "register.c",
+    ],
+    static_libs: ["libbase_ndk"],
+    shared_libs: [
+        "libdl",
+        "liblog",
+        "libnativehelper_compat_libc++",
+    ],
+    sdk_version: "current",
+    stl: "c++_static",
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+
+        "-Wno-format",
+        "-Wno-gnu-designator",
+    ],
+    gtest: false,
+}
+
+cc_test_library {
+    name: "libjni_test_dlclose",
+    srcs: ["taxicab_number.cpp"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    sdk_version: "23",
+    gtest: false,
+}
diff --git a/tests/tests/jni/libjnitest/Android.mk b/tests/tests/jni/libjnitest/Android.mk
deleted file mode 100644
index d2db74d..0000000
--- a/tests/tests/jni/libjnitest/Android.mk
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright (C) 2009 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 is the shared library included by the JNI test app.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libjnitest
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
-	android_jni_cts_BasicLoaderTest.cpp \
-	android_jni_cts_InstanceNonce.c \
-	android_jni_cts_JniCTest.c \
-	android_jni_cts_JniCppTest.cpp \
-	android_jni_cts_JniStaticTest.cpp \
-	android_jni_cts_LinkerNamespacesTest.cpp \
-	android_jni_cts_StaticNonce.c \
-	helper.c \
-	register.c
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-LOCAL_STATIC_LIBRARIES := libbase_ndk
-
-LOCAL_SHARED_LIBRARIES := libdl liblog libnativehelper_compat_libc++
-
-LOCAL_SDK_VERSION := current
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter
-LOCAL_CFLAGS += -Wno-format -Wno-gnu-designator
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libjni_test_dlclose
-
-LOCAL_SRC_FILES := taxicab_number.cpp
-
-LOCAL_CFLAGS += -Wall -Werror
-
-LOCAL_SDK_VERSION := 23
-
-LOCAL_NDK_STL_VARIANT := c++_static
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/jni_vendor/Android.bp b/tests/tests/jni_vendor/Android.bp
new file mode 100644
index 0000000..544257b
--- /dev/null
+++ b/tests/tests/jni_vendor/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.
+
+android_test {
+    name: "CtsVendorJniTestCases",
+    defaults: ["cts_defaults"],
+
+    compile_multilib: "both",
+    static_libs: [
+        "androidx.test.rules",
+        "ctstestrunner-axt",
+    ],
+    jni_libs: ["libvendorjnitest"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    // TODO(jiyong) make this really a part of CTS
+    // This can't be done right now since VNDK runtime restriction is optional
+    // at least for O-MR1.
+    // Tag this module as a cts test artifact
+    // test_suites: ["cts", "vts", "general-tests"],
+}
diff --git a/tests/tests/jni_vendor/Android.mk b/tests/tests/jni_vendor/Android.mk
deleted file mode 100644
index 6b9bfb3..0000000
--- a/tests/tests/jni_vendor/Android.mk
+++ /dev/null
@@ -1,47 +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_PACKAGE_NAME := CtsVendorJniTestCases
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# Include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-# When built, explicitly put it in the vendor partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules ctstestrunner-axt
-
-LOCAL_JNI_SHARED_LIBRARIES := libvendorjnitest
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-# TODO(jiyong) make this really a part of CTS
-# This can't be done right now since VNDK runtime restriction is optional
-# at least for O-MR1.
-# Tag this module as a cts test artifact
-#LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
-
-# Include the associated library's makefile.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/jni_vendor/libvendorjnitest/Android.bp b/tests/tests/jni_vendor/libvendorjnitest/Android.bp
new file mode 100644
index 0000000..0589010
--- /dev/null
+++ b/tests/tests/jni_vendor/libvendorjnitest/Android.bp
@@ -0,0 +1,31 @@
+// 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 is the shared library included by the JNI test app.
+//
+
+cc_test_library {
+    name: "libvendorjnitest",
+    srcs: ["android_jni_vendor_cts_VendorJniTest.cpp"],
+    shared_libs: [
+        "libdl",
+        "liblog",
+    ],
+    sdk_version: "current",
+    stl: "c++_static",
+    cflags: ["-Wno-unused-parameter"],
+    vendor: true,
+    gtest: false,
+}
diff --git a/tests/tests/jni_vendor/libvendorjnitest/Android.mk b/tests/tests/jni_vendor/libvendorjnitest/Android.mk
deleted file mode 100644
index c9e9205..0000000
--- a/tests/tests/jni_vendor/libvendorjnitest/Android.mk
+++ /dev/null
@@ -1,41 +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 is the shared library included by the JNI test app.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvendorjnitest
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := android_jni_vendor_cts_VendorJniTest.cpp
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-LOCAL_SHARED_LIBRARIES := libdl liblog
-
-LOCAL_SDK_VERSION := current
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_CFLAGS := -Wno-unused-parameter
-
-LOCAL_VENDOR_MODULE := true
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/jvmti/Android.mk b/tests/tests/jvmti/Android.mk
deleted file mode 100644
index 8facc9f..0000000
--- a/tests/tests/jvmti/Android.mk
+++ /dev/null
@@ -1,18 +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 the associated library's makefile.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/jvmti/attaching/Android.bp b/tests/tests/jvmti/attaching/Android.bp
new file mode 100644
index 0000000..36f94a7
--- /dev/null
+++ b/tests/tests/jvmti/attaching/Android.bp
@@ -0,0 +1,36 @@
+// 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.
+
+android_test {
+    name: "CtsJvmtiAttachingTestCases",
+    defaults: ["cts_defaults"],
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+    ],
+    compile_multilib: "both",
+    jni_libs: [
+        "libjvmtiattachingtestagent1",
+        "libjvmtiattachingtestagent2",
+        "libjvmtiattachingtestagent3",
+        "libjvmtiattachingtestagent4",
+    ],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/tests/jvmti/attaching/Android.mk b/tests/tests/jvmti/attaching/Android.mk
deleted file mode 100644
index fb2a765..0000000
--- a/tests/tests/jvmti/attaching/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)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsJvmtiAttachingTestCases
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
-
-LOCAL_MULTILIB := both
-LOCAL_JNI_SHARED_LIBRARIES := libjvmtiattachingtestagent1 \
-                              libjvmtiattachingtestagent2 \
-                              libjvmtiattachingtestagent3 \
-                              libjvmtiattachingtestagent4 \
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/jvmti/attaching/OWNERS b/tests/tests/jvmti/attaching/OWNERS
new file mode 100644
index 0000000..6e06299
--- /dev/null
+++ b/tests/tests/jvmti/attaching/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 86431
+include /hostsidetests/jvmti/run-tests/OWNERS
diff --git a/tests/tests/jvmti/attaching/jni/Android.bp b/tests/tests/jvmti/attaching/jni/Android.bp
new file mode 100644
index 0000000..8e26f86
--- /dev/null
+++ b/tests/tests/jvmti/attaching/jni/Android.bp
@@ -0,0 +1,69 @@
+// 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 is the shared library included by the JNI test app.
+//
+
+cc_test_library {
+    name: "libjvmtiattachingtestagent1",
+    gtest: false,
+    srcs: ["agent.c"],
+    sdk_version: "current",
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+        "-DAGENT_NR=1",
+    ],
+}
+
+cc_test_library {
+    name: "libjvmtiattachingtestagent2",
+    gtest: false,
+    srcs: ["agent.c"],
+    sdk_version: "current",
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+        "-DAGENT_NR=2",
+    ],
+}
+
+cc_test_library {
+    name: "libjvmtiattachingtestagent3",
+    gtest: false,
+    srcs: ["agent.c"],
+    sdk_version: "current",
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+        "-DAGENT_NR=3",
+    ],
+}
+
+cc_test_library {
+    name: "libjvmtiattachingtestagent4",
+    gtest: false,
+    srcs: ["agent.c"],
+    sdk_version: "current",
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+        "-DAGENT_NR=4",
+    ],
+}
diff --git a/tests/tests/jvmti/attaching/jni/Android.mk b/tests/tests/jvmti/attaching/jni/Android.mk
deleted file mode 100644
index b0d8376..0000000
--- a/tests/tests/jvmti/attaching/jni/Android.mk
+++ /dev/null
@@ -1,44 +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 is the shared library included by the JNI test app.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-define jvmti-attaching-test-agent
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libjvmtiattachingtestagent$1
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := agent.c
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter
-
-LOCAL_CFLAGS += -DAGENT_NR=$1
-
-include $(BUILD_SHARED_LIBRARY)
-endef
-
-$(eval $(call jvmti-attaching-test-agent,1))
-$(eval $(call jvmti-attaching-test-agent,2))
-$(eval $(call jvmti-attaching-test-agent,3))
-$(eval $(call jvmti-attaching-test-agent,4))
diff --git a/tests/tests/keystore/Android.bp b/tests/tests/keystore/Android.bp
new file mode 100644
index 0000000..1122dab
--- /dev/null
+++ b/tests/tests/keystore/Android.bp
@@ -0,0 +1,50 @@
+// Copyright 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.
+
+android_test {
+    name: "CtsKeystoreTestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    libs: [
+        "bouncycastle-unbundled",
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "androidx.test.rules",
+        "core-tests-support",
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "hamcrest-library",
+        "guava",
+        "junit",
+        "cts-security-test-support-library",
+        "platformprotosnano",
+    ],
+    srcs: ["src/**/*.java"],
+    // Can't use public/test API only because some tests use hidden API
+    // (e.g. device-provided Bouncy Castle).
+    //
+    // The comment below is not particularly accurate, but it's copied from other
+    // tests that do the same thing, so anyone grepping for it will find it here.
+    //
+    // Uncomment when b/13282254 is fixed.
+    // sdk_version: "current"
+    platform_apis: true,
+}
diff --git a/tests/tests/keystore/Android.mk b/tests/tests/keystore/Android.mk
deleted file mode 100644
index 9359403..0000000
--- a/tests/tests/keystore/Android.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright 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_TAGS := tests
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_JAVA_LIBRARIES := bouncycastle-unbundled
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-        androidx.test.rules \
-        core-tests-support \
-        compatibility-device-util-axt \
-        ctstestrunner-axt \
-	hamcrest-library \
-        guava \
-        junit \
-        cts-security-test-support-library \
-        platformprotosnano
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JACK_FLAGS := --multi-dex native
-
-LOCAL_PACKAGE_NAME := CtsKeystoreTestCases
-
-# Can't use public/test API only because some tests use hidden API
-# (e.g. device-provided Bouncy Castle).
-#
-# The comment below is not particularly accurate, but it's copied from other
-# tests that do the same thing, so anyone grepping for it will find it here.
-#
-# Uncomment when b/13282254 is fixed.
-# LOCAL_SDK_VERSION := current
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_JAVA_LIBRARIES += android.test.runner.stubs
-LOCAL_JAVA_LIBRARIES += android.test.base.stubs
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/libcoreapievolution/Android.bp b/tests/tests/libcoreapievolution/Android.bp
new file mode 100644
index 0000000..cabb0c9
--- /dev/null
+++ b/tests/tests/libcoreapievolution/Android.bp
@@ -0,0 +1,31 @@
+// Copyright (C) 2018 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.
+
+android_test {
+    name: "CtsLibcoreApiEvolutionTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "junit",
+    ],
+    libs: ["android.test.base.stubs"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/libcoreapievolution/Android.mk b/tests/tests/libcoreapievolution/Android.mk
deleted file mode 100644
index 04e0a1b..0000000
--- a/tests/tests/libcoreapievolution/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (C) 2018 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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt junit
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsLibcoreApiEvolutionTestCases
-LOCAL_SDK_VERSION := current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/libcorefileio/Android.bp b/tests/tests/libcorefileio/Android.bp
new file mode 100644
index 0000000..8a599e7
--- /dev/null
+++ b/tests/tests/libcorefileio/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+android_test {
+    name: "CtsLibcoreFileIOTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "junit",
+    ],
+    libs: ["android.test.base.stubs"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/libcorefileio/Android.mk b/tests/tests/libcorefileio/Android.mk
deleted file mode 100644
index 9af3751..0000000
--- a/tests/tests/libcorefileio/Android.mk
+++ /dev/null
@@ -1,36 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt junit
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsLibcoreFileIOTestCases
-LOCAL_SDK_VERSION := current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/libcorefileio/src/android/cts/FileChannelInterProcessLockTest.java b/tests/tests/libcorefileio/src/android/cts/FileChannelInterProcessLockTest.java
index b47cf2a..9f78d25 100644
--- a/tests/tests/libcorefileio/src/android/cts/FileChannelInterProcessLockTest.java
+++ b/tests/tests/libcorefileio/src/android/cts/FileChannelInterProcessLockTest.java
@@ -20,6 +20,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
+import android.os.Debug;
 import android.os.Environment;
 import android.test.AndroidTestCase;
 
diff --git a/tests/tests/libcorelegacy22/Android.bp b/tests/tests/libcorelegacy22/Android.bp
new file mode 100644
index 0000000..e28a800
--- /dev/null
+++ b/tests/tests/libcorelegacy22/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.
+
+android_test {
+    name: "CtsLibcoreLegacy22TestCases",
+    defaults: ["cts_defaults"],
+    static_libs: ["ctstestrunner-axt"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "22",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/libcorelegacy22/Android.mk b/tests/tests/libcorelegacy22/Android.mk
deleted file mode 100644
index 0295b89..0000000
--- a/tests/tests/libcorelegacy22/Android.mk
+++ /dev/null
@@ -1,35 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsLibcoreLegacy22TestCases
-
-LOCAL_SDK_VERSION := 22
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/location/Android.bp b/tests/tests/location/Android.bp
new file mode 100644
index 0000000..9d9e6c0
--- /dev/null
+++ b/tests/tests/location/Android.bp
@@ -0,0 +1,66 @@
+// 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.
+
+// Reusable Location test classes and helpers
+
+java_test_helper_library {
+    name: "cts-location-tests",
+    libs: [
+        "telephony-common",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "apache-commons-math",
+        "platform-test-annotations",
+    ],
+    srcs: [
+        "src/android/location/cts/**/*.java",
+        "protos/**/*.proto",
+    ],
+    proto: {
+        type: "nano",
+    },
+}
+
+// CtsLocationTestCases package
+android_test {
+    name: "CtsLocationTestCases",
+    defaults: ["cts_defaults"],
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    libs: [
+        "telephony-common",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "apache-commons-math",
+    ],
+    proto: {
+        type: "nano",
+    },
+    srcs: [
+        "src/**/*.java",
+        "protos/**/*.proto",
+    ],
+    platform_apis: true,
+    dxflags: ["--multi-dex"],
+}
diff --git a/tests/tests/location/Android.mk b/tests/tests/location/Android.mk
deleted file mode 100644
index 6d88a4d..0000000
--- a/tests/tests/location/Android.mk
+++ /dev/null
@@ -1,68 +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)
-
-include $(CLEAR_VARS)
-
-# Reusable Location test classes and helpers
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := cts-location-tests
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_JAVA_LIBRARIES := telephony-common android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt ctstestrunner-axt apache-commons-math platform-test-annotations
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src/android/location/cts) \
-   $(call all-proto-files-under, protos)
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := nano
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-# CtsLocationTestCases package
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_JAVA_LIBRARIES := telephony-common android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt  apache-commons-math
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := nano
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-   $(call all-proto-files-under, protos)
-
-LOCAL_PACKAGE_NAME := CtsLocationTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_JACK_FLAGS := --multi-dex native
-LOCAL_DX_FLAGS := --multi-dex
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/location2/Android.bp b/tests/tests/location2/Android.bp
new file mode 100644
index 0000000..5cc43b1
--- /dev/null
+++ b/tests/tests/location2/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.
+
+android_test {
+    name: "CtsLocation2TestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "junit",
+    ],
+    libs: ["android.test.base.stubs"],
+    srcs: ["src/**/*.java"],
+    // uncomment when Location.EXTRA_NO_GPS_LOCATION is removed
+    // sdk_version: "current",
+    platform_apis: true,
+}
diff --git a/tests/tests/location2/Android.mk b/tests/tests/location2/Android.mk
deleted file mode 100644
index 3d22bb7..0000000
--- a/tests/tests/location2/Android.mk
+++ /dev/null
@@ -1,39 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt junit
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsLocation2TestCases
-
-# uncomment when Location.EXTRA_NO_GPS_LOCATION is removed
-#LOCAL_SDK_VERSION := current
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/media/Android.bp b/tests/tests/media/Android.bp
new file mode 100644
index 0000000..e8be516
--- /dev/null
+++ b/tests/tests/media/Android.bp
@@ -0,0 +1,79 @@
+// 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.
+
+java_library {
+    name: "ctsmediautil",
+    srcs: [
+        "src/android/media/cts/CodecImage.java",
+        "src/android/media/cts/YUVImage.java",
+        "src/android/media/cts/CodecUtils.java",
+    ],
+    sdk_version: "current",
+}
+
+android_test {
+    name: "CtsMediaTestCases",
+    defaults: ["cts_defaults"],
+    // include both the 32 and 64 bit versions
+    compile_multilib: "both",
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctsdeviceutillegacy-axt",
+        "ctsmediautil",
+        "ctstestrunner-axt",
+        "hamcrest-library",
+        "ctstestserver",
+        "junit",
+        "ndkaudio",
+        "testng",
+        "truth-prebuilt",
+        "mockito-target-minus-junit4",
+        "androidx.heifwriter_heifwriter",
+        "androidx.media2_media2",
+    ],
+    jni_libs: [
+        "libaudio_jni",
+        "libc++",
+        "libctscodecutils_jni",
+        "libctsimagereader_jni",
+        "libctsmediadrm_jni",
+        "libctsmediacodec_jni",
+        "libnativehelper_compat_libc++",
+        "libndkaudioLib",
+    ],
+    // do not compress VP9 video files
+    aaptflags: [
+        "-0 .vp9",
+        "-0 .ts",
+        "-0 .heic",
+        "-0 .trp",
+    ],
+    srcs: ["src/**/*.java"],
+    // This test uses private APIs
+    //sdk_version: "current",
+    platform_apis: true,
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+        "android.test.runner.stubs",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    host_required: ["cts-dynamic-config"],
+}
diff --git a/tests/tests/media/Android.mk b/tests/tests/media/Android.mk
deleted file mode 100644
index cda9bfd..0000000
--- a/tests/tests/media/Android.mk
+++ /dev/null
@@ -1,98 +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)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
-  src/android/media/cts/CodecImage.java \
-  src/android/media/cts/YUVImage.java \
-  src/android/media/cts/CodecUtils.java
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := ctsmediautil
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-# include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctsdeviceutillegacy-axt \
-    ctsmediautil \
-    ctstestrunner-axt \
-    hamcrest-library \
-    ctstestserver \
-    junit \
-    ndkaudio \
-    testng \
-    truth-prebuilt \
-    mockito-target-minus-junit4 \
-    androidx.heifwriter_heifwriter \
-    androidx.media2_media2 \
-
-LOCAL_JNI_SHARED_LIBRARIES := \
-    libaudio_jni \
-    libc++ \
-    libctscodecutils_jni \
-    libctsimagereader_jni \
-    libctsmediadrm_jni \
-    libctsmediacodec_jni \
-    libnativehelper_compat_libc++ \
-    libndkaudioLib
-
-# do not compress VP9 video files
-LOCAL_AAPT_FLAGS := -0 .vp9
-LOCAL_AAPT_FLAGS += -0 .ts
-LOCAL_AAPT_FLAGS += -0 .heic
-LOCAL_AAPT_FLAGS += -0 .trp
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsMediaTestCases
-
-# This test uses private APIs
-#LOCAL_SDK_VERSION := current
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_JAVA_LIBRARIES += \
-    org.apache.http.legacy \
-    android.test.base.stubs \
-    android.test.runner.stubs
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_HOST_REQUIRED_MODULES := cts-dynamic-config
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/media/libaudiojni/Android.bp b/tests/tests/media/libaudiojni/Android.bp
new file mode 100644
index 0000000..6e1805c
--- /dev/null
+++ b/tests/tests/media/libaudiojni/Android.bp
@@ -0,0 +1,38 @@
+// 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_test_library {
+    name: "libaudio_jni",
+    srcs: [
+        "appendix-b-1-1-buffer-queue.cpp",
+        "appendix-b-1-2-recording.cpp",
+        "audio-record-native.cpp",
+        "audio-track-native.cpp",
+        "sl-utils.cpp",
+    ],
+    include_dirs: ["system/core/include"],
+    shared_libs: [
+        "libandroid",
+        "liblog",
+        "libnativehelper_compat_libc++",
+        "libOpenSLES",
+    ],
+    stl: "libc++_static",
+    cflags: [
+        "-Werror",
+        "-Wall",
+    ],
+    gtest: false,
+}
diff --git a/tests/tests/media/libaudiojni/Android.mk b/tests/tests/media/libaudiojni/Android.mk
deleted file mode 100644
index af9d989..0000000
--- a/tests/tests/media/libaudiojni/Android.mk
+++ /dev/null
@@ -1,42 +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    := libaudio_jni
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
-	appendix-b-1-1-buffer-queue.cpp \
-	appendix-b-1-2-recording.cpp \
-	audio-record-native.cpp \
-	audio-track-native.cpp \
-	sl-utils.cpp
-
-LOCAL_C_INCLUDES := \
-	$(JNI_H_INCLUDE) \
-	system/core/include
-
-LOCAL_C_INCLUDES += $(call include-path-for, libaudiojni) \
-	$(call include-path-for, wilhelm)
-
-LOCAL_SHARED_LIBRARIES := libandroid liblog libnativehelper_compat_libc++ libOpenSLES
-LOCAL_CXX_STL := libc++
-
-LOCAL_CFLAGS := -Werror -Wall
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/media/libimagereaderjni/Android.bp b/tests/tests/media/libimagereaderjni/Android.bp
new file mode 100644
index 0000000..9dd0988
--- /dev/null
+++ b/tests/tests/media/libimagereaderjni/Android.bp
@@ -0,0 +1,32 @@
+// Copyright 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.
+
+// Build the unit tests.
+
+cc_test_library {
+    name: "libctsimagereader_jni",
+    srcs: ["AImageReaderCts.cpp"],
+    shared_libs: [
+        "libandroid",
+        "libcamera2ndk",
+        "libmediandk",
+        "libnativewindow",
+        "liblog",
+    ],
+    cflags: [
+        "-Werror",
+        "-Wall",
+    ],
+    gtest: false,
+}
diff --git a/tests/tests/media/libimagereaderjni/Android.mk b/tests/tests/media/libimagereaderjni/Android.mk
deleted file mode 100644
index 6ce591c..0000000
--- a/tests/tests/media/libimagereaderjni/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 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.
-
-# Build the unit tests.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libctsimagereader_jni
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
-    AImageReaderCts.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-    libandroid \
-    libcamera2ndk \
-    libmediandk \
-    libnativewindow \
-    liblog
-
-LOCAL_CXX_STL := libc++
-
-LOCAL_CFLAGS := -Werror -Wall
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/media/libmediandkjni/Android.bp b/tests/tests/media/libmediandkjni/Android.bp
new file mode 100644
index 0000000..109a488
--- /dev/null
+++ b/tests/tests/media/libmediandkjni/Android.bp
@@ -0,0 +1,94 @@
+// 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.
+//
+
+//------------------------------------------------------------------------------
+// Builds libctscodecutils_jni.so
+//
+cc_test_library {
+    name: "libctscodecutils_jni",
+    srcs: [
+        "codec-utils-jni.cpp",
+        "md5_utils.cpp",
+    ],
+    include_dirs: ["system/core/include"],
+    shared_libs: [
+        "libnativehelper_compat_libc++",
+        "liblog",
+    ],
+    sdk_version: "current",
+    cflags: [
+        "-Werror",
+        "-Wall",
+        "-DEGL_EGLEXT_PROTOTYPES",
+    ],
+    gtest: false,
+}
+
+//------------------------------------------------------------------------------
+// Builds libctsmediacodec_jni.so
+//
+cc_test_library {
+    name: "libctsmediacodec_jni",
+    srcs: [
+        "native-media-jni.cpp",
+        "native_media_utils.cpp",
+        "native_media_decoder_source.cpp",
+        "native_media_encoder_jni.cpp",
+    ],
+    include_dirs: ["system/core/include"],
+    shared_libs: [
+        "libandroid",
+        "libnativehelper_compat_libc++",
+        "liblog",
+        "libmediandk",
+        "libEGL",
+    ],
+    stl: "libc++_static",
+    cflags: [
+        "-Werror",
+        "-Wall",
+        "-DEGL_EGLEXT_PROTOTYPES",
+    ],
+    gtest: false,
+}
+
+//------------------------------------------------------------------------------
+// Builds libctsmediadrm_jni.so
+//
+cc_test_library {
+    name: "libctsmediadrm_jni",
+    srcs: [
+        "CtsMediaDrmJniOnLoad.cpp",
+        "codec-utils-jni.cpp",
+        "md5_utils.cpp",
+        "native-mediadrm-jni.cpp",
+    ],
+    include_dirs: ["system/core/include"],
+    shared_libs: [
+        "libandroid",
+        "libnativehelper_compat_libc++",
+        "liblog",
+        "libmediandk",
+        "libdl",
+        "libEGL",
+    ],
+    cflags: [
+        "-Werror",
+        "-Wall",
+        "-DEGL_EGLEXT_PROTOTYPES",
+    ],
+    stl: "libc++_static",
+    gtest: false,
+}
diff --git a/tests/tests/media/libmediandkjni/Android.mk b/tests/tests/media/libmediandkjni/Android.mk
deleted file mode 100644
index 993f177..0000000
--- a/tests/tests/media/libmediandkjni/Android.mk
+++ /dev/null
@@ -1,111 +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)
-
-#------------------------------------------------------------------------------
-# Builds libctscodecutils_jni.so
-#
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libctscodecutils_jni
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
-  codec-utils-jni.cpp \
-  md5_utils.cpp
-
-LOCAL_C_INCLUDES := \
-  $(JNI_H_INCLUDE) \
-  system/core/include
-
-LOCAL_C_INCLUDES += $(call include-path-for, mediandk)
-
-LOCAL_SHARED_LIBRARIES := \
-  libnativehelper_compat_libc++ \
-  liblog
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_NDK_STL_VARIANT := system
-
-LOCAL_CFLAGS := -Werror -Wall -DEGL_EGLEXT_PROTOTYPES
-
-include $(BUILD_SHARED_LIBRARY)
-
-#------------------------------------------------------------------------------
-# Builds libctsmediacodec_jni.so
-#
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libctsmediacodec_jni
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
-  native-media-jni.cpp \
-  native_media_utils.cpp \
-  native_media_decoder_source.cpp \
-  native_media_encoder_jni.cpp
-
-LOCAL_C_INCLUDES := \
-  $(JNI_H_INCLUDE) \
-  system/core/include
-
-LOCAL_C_INCLUDES += $(call include-path-for, mediandk)
-
-LOCAL_SHARED_LIBRARIES := \
-  libandroid libnativehelper_compat_libc++ \
-  liblog libmediandk libEGL
-
-LOCAL_CXX_STL := libc++
-
-LOCAL_CFLAGS := -Werror -Wall -DEGL_EGLEXT_PROTOTYPES
-
-include $(BUILD_SHARED_LIBRARY)
-
-
-#------------------------------------------------------------------------------
-# Builds libctsmediadrm_jni.so
-#
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libctsmediadrm_jni
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
-  CtsMediaDrmJniOnLoad.cpp \
-  codec-utils-jni.cpp  \
-  md5_utils.cpp \
-  native-mediadrm-jni.cpp \
-
-LOCAL_C_INCLUDES := \
-  $(JNI_H_INCLUDE) \
-  system/core/include
-
-
-LOCAL_C_INCLUDES += $(call include-path-for, mediandk)
-
-LOCAL_SHARED_LIBRARIES := \
-  libandroid libnativehelper_compat_libc++ \
-  liblog libmediandk libdl libEGL
-
-LOCAL_CFLAGS := -Werror -Wall -DEGL_EGLEXT_PROTOTYPES
-
-LOCAL_CXX_STL := libc++
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/media/libndkaudio/Android.bp b/tests/tests/media/libndkaudio/Android.bp
new file mode 100644
index 0000000..2746f0d
--- /dev/null
+++ b/tests/tests/media/libndkaudio/Android.bp
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test_library {
+    name: "libndkaudioLib",
+    include_dirs: [
+        "frameworks/wilhelm/include",
+        "frameworks/wilhelm/src/android",
+    ],
+    srcs: [
+        "OpenSLESUtils.cpp",
+        "AudioPlayer.cpp",
+        "AudioSource.cpp",
+        "PeriodicAudioSource.cpp",
+        "SystemParams.cpp",
+        "WaveTableGenerator.cpp",
+        "WaveTableOscillator.cpp",
+        "com_android_ndkaudio_AudioPlayer.cpp",
+        "AudioRecorder.cpp",
+        "com_android_ndkaudio_AudioRecorder.cpp",
+    ],
+    stl: "libc++_static",
+    shared_libs: [
+        "liblog",
+        "libOpenSLES",
+    ],
+    cflags: [
+        "-Werror",
+        "-Wall",
+    ],
+    gtest: false,
+}
+
+//
+// ndkaudio - java
+//
+java_library {
+    name: "ndkaudio",
+    srcs: ["**/*.java"],
+    sdk_version: "current",
+    min_sdk_version: "23",
+}
diff --git a/tests/tests/media/libndkaudio/Android.mk b/tests/tests/media/libndkaudio/Android.mk
deleted file mode 100644
index 9480dcd..0000000
--- a/tests/tests/media/libndkaudio/Android.mk
+++ /dev/null
@@ -1,62 +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    := libndkaudioLib
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_C_INCLUDES := \
-  frameworks/wilhelm/include \
-  frameworks/wilhelm/src/android \
-  $(call include-path-for, wilhelm)
-
-LOCAL_SRC_FILES := \
-  OpenSLESUtils.cpp \
-  AudioPlayer.cpp \
-  AudioSource.cpp \
-  PeriodicAudioSource.cpp \
-  SystemParams.cpp \
-  WaveTableGenerator.cpp \
-  WaveTableOscillator.cpp \
-  com_android_ndkaudio_AudioPlayer.cpp \
-  AudioRecorder.cpp \
-  com_android_ndkaudio_AudioRecorder.cpp
-
-LOCAL_CXX_STL := libc++
-
-LOCAL_SHARED_LIBRARIES := liblog libOpenSLES
-
-LOCAL_CFLAGS := -Werror -Wall
-
-include $(BUILD_SHARED_LIBRARY)
-
-#
-# ndkaudio - java
-#
-include $(CLEAR_VARS)
-
-LOCAL_MODULE  := ndkaudio
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_CERTIFICATE := platform
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 23
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/tests/mediastress/Android.bp b/tests/tests/mediastress/Android.bp
new file mode 100644
index 0000000..491fff3
--- /dev/null
+++ b/tests/tests/mediastress/Android.bp
@@ -0,0 +1,41 @@
+// 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.
+
+android_test {
+    name: "CtsMediaStressTestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    // Include both the 32 and 64 bit versions
+    compile_multilib: "both",
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    jni_libs: [
+        "libctsmediastress_jni",
+        "libnativehelper_compat_libc++",
+    ],
+    srcs: ["src/**/*.java"],
+    host_required: ["cts-dynamic-config"],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/mediastress/Android.mk b/tests/tests/mediastress/Android.mk
deleted file mode 100644
index e41ebc6..0000000
--- a/tests/tests/mediastress/Android.mk
+++ /dev/null
@@ -1,48 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# Include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_HOST_SHARED_LIBRARIES := compatibility-device-media-preconditions
-
-LOCAL_JNI_SHARED_LIBRARIES := libctsmediastress_jni libnativehelper_compat_libc++
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsMediaStressTestCases
-
-LOCAL_HOST_REQUIRED_MODULES := cts-dynamic-config
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
-
diff --git a/tests/tests/mediastress/jni/Android.bp b/tests/tests/mediastress/jni/Android.bp
new file mode 100644
index 0000000..192746e
--- /dev/null
+++ b/tests/tests/mediastress/jni/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: "libctsmediastress_jni",
+    srcs: ["native-media-jni.cpp"],
+    include_dirs: ["frameworks/wilhelm/include"],
+    shared_libs: [
+        "libandroid",
+        "libnativehelper_compat_libc++",
+        "liblog",
+        "libOpenMAXAL",
+    ],
+    stl: "none",
+    sdk_version: "current",
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+        "-Wno-unused-variable",
+    ],
+}
diff --git a/tests/tests/mediastress/jni/Android.mk b/tests/tests/mediastress/jni/Android.mk
deleted file mode 100644
index 66ca05e..0000000
--- a/tests/tests/mediastress/jni/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    := libctsmediastress_jni
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := native-media-jni.cpp
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-LOCAL_C_INCLUDES += $(call include-path-for, wilhelm)
-
-LOCAL_SHARED_LIBRARIES := libandroid libnativehelper_compat_libc++ liblog libOpenMAXAL
-LOCAL_NDK_STL_VARIANT := none
-LOCAL_SDK_VERSION := current
-
-LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter -Wno-unused-variable
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/multiuser/Android.bp b/tests/tests/multiuser/Android.bp
new file mode 100644
index 0000000..51d6315
--- /dev/null
+++ b/tests/tests/multiuser/Android.bp
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test {
+    name: "CtsMultiUserTestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: ["android.test.base.stubs"],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/multiuser/Android.mk b/tests/tests/multiuser/Android.mk
deleted file mode 100644
index dfbdf1d..0000000
--- a/tests/tests/multiuser/Android.mk
+++ /dev/null
@@ -1,36 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsMultiUserTestCases
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/ndef/Android.bp b/tests/tests/ndef/Android.bp
new file mode 100644
index 0000000..b69d7a6
--- /dev/null
+++ b/tests/tests/ndef/Android.bp
@@ -0,0 +1,27 @@
+// 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.
+
+android_test {
+    name: "CtsNdefTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: ["ctstestrunner-axt"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/ndef/Android.mk b/tests/tests/ndef/Android.mk
deleted file mode 100644
index df28c7b..0000000
--- a/tests/tests/ndef/Android.mk
+++ /dev/null
@@ -1,36 +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_PACKAGE_NAME := CtsNdefTestCases
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/net/Android.bp b/tests/tests/net/Android.bp
new file mode 100644
index 0000000..779d5c4
--- /dev/null
+++ b/tests/tests/net/Android.bp
@@ -0,0 +1,64 @@
+// 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.
+
+android_test {
+    name: "CtsNetTestCases",
+    defaults: ["cts_defaults"],
+
+    // Include both the 32 and 64 bit versions
+    compile_multilib: "both",
+
+    libs: [
+        "voip-common",
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+
+    jni_libs: [
+        "libcts_jni",
+        "libnativedns_jni",
+        "libnativemultinetwork_jni",
+        "libnativehelper_compat_libc++",
+    ],
+
+    // include CtsTestServer as a temporary hack to free net.cts from cts.stub.
+    srcs: [
+        "src/**/*.java",
+        "src/**/*.kt",
+    ],
+
+    static_libs: [
+        "FrameworksNetCommonTests",
+        "core-tests-support",
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ctstestserver",
+        "mockwebserver",
+        "junit",
+        "junit-params",
+        "truth-prebuilt",
+    ],
+
+    // uncomment when b/13249961 is fixed
+    // sdk_version: "current",
+    platform_apis: true,
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+
+}
diff --git a/tests/tests/net/Android.mk b/tests/tests/net/Android.mk
deleted file mode 100644
index 0497470..0000000
--- a/tests/tests/net/Android.mk
+++ /dev/null
@@ -1,62 +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)
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-LOCAL_JAVA_LIBRARIES := \
-    voip-common \
-    org.apache.http.legacy \
-    android.test.base.stubs \
-
-
-LOCAL_JNI_SHARED_LIBRARIES := libcts_jni libnativedns_jni \
-                              libnativemultinetwork_jni libnativehelper_compat_libc++
-
-# include CtsTestServer as a temporary hack to free net.cts from cts.stub.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsNetTestCases
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    FrameworksNetCommonTests \
-    core-tests-support \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ctstestserver \
-    mockwebserver \
-    junit \
-    junit-params \
-    truth-prebuilt \
-
-
-# uncomment when b/13249961 is fixed
-#LOCAL_SDK_VERSION := current
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/net/appForApi23/Android.bp b/tests/tests/net/appForApi23/Android.bp
new file mode 100644
index 0000000..82e2a08
--- /dev/null
+++ b/tests/tests/net/appForApi23/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+android_test {
+    name: "CtsNetTestAppForApi23",
+    defaults: ["cts_defaults"],
+
+    // Include both the 32 and 64 bit versions
+    compile_multilib: "both",
+
+    srcs: ["src/**/*.java"],
+
+    sdk_version: "23",
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+
+}
diff --git a/tests/tests/net/appForApi23/Android.mk b/tests/tests/net/appForApi23/Android.mk
deleted file mode 100644
index 54b60a0..0000000
--- a/tests/tests/net/appForApi23/Android.mk
+++ /dev/null
@@ -1,38 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsNetTestAppForApi23
-
-LOCAL_SDK_VERSION := 23
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/net/jni/Android.bp b/tests/tests/net/jni/Android.bp
new file mode 100644
index 0000000..baed48d
--- /dev/null
+++ b/tests/tests/net/jni/Android.bp
@@ -0,0 +1,49 @@
+// 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: "libnativedns_jni",
+
+    srcs: ["NativeDnsJni.c"],
+
+    shared_libs: [
+        "libnativehelper_compat_libc++",
+        "liblog",
+    ],
+    stl: "libc++_static",
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
+
+}
+
+cc_library_shared {
+    name: "libnativemultinetwork_jni",
+
+    srcs: ["NativeMultinetworkJni.cpp"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-format",
+    ],
+    shared_libs: [
+        "libandroid",
+        "libnativehelper_compat_libc++",
+        "liblog",
+    ],
+    stl: "libc++_static",
+}
diff --git a/tests/tests/net/jni/Android.mk b/tests/tests/net/jni/Android.mk
deleted file mode 100644
index ccb1278..0000000
--- a/tests/tests/net/jni/Android.mk
+++ /dev/null
@@ -1,44 +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 := libnativedns_jni
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := NativeDnsJni.c
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-LOCAL_SHARED_LIBRARIES := libnativehelper_compat_libc++ liblog
-LOCAL_CXX_STL := libc++_static
-
-LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libnativemultinetwork_jni
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := NativeMultinetworkJni.cpp
-LOCAL_CFLAGS := -Wall -Werror -Wno-format
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-LOCAL_SHARED_LIBRARIES := libandroid libnativehelper_compat_libc++ liblog
-LOCAL_CXX_STL := libc++_static
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/net/native/Android.mk b/tests/tests/net/native/Android.mk
deleted file mode 100644
index b798d87..0000000
--- a/tests/tests/net/native/Android.mk
+++ /dev/null
@@ -1,15 +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 $(call all-subdir-makefiles)
diff --git a/tests/tests/net/native/qtaguid/Android.bp b/tests/tests/net/native/qtaguid/Android.bp
new file mode 100644
index 0000000..c0f0613
--- /dev/null
+++ b/tests/tests/net/native/qtaguid/Android.bp
@@ -0,0 +1,53 @@
+// 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.
+
+// Build the unit tests.
+
+cc_test {
+    name: "CtsNativeNetTestCases",
+
+    compile_multilib: "both",
+    multilib: {
+        lib32: {
+            suffix: "32",
+        },
+        lib64: {
+            suffix: "64",
+        },
+    },
+
+    srcs: ["src/NativeQtaguidTest.cpp"],
+
+    shared_libs: [
+        "libutils",
+        "liblog",
+    ],
+
+    static_libs: [
+        "libgtest",
+        "libqtaguid",
+    ],
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+    ],
+
+    cflags: [
+        "-Werror",
+        "-Wall",
+    ],
+
+}
diff --git a/tests/tests/net/native/qtaguid/Android.mk b/tests/tests/net/native/qtaguid/Android.mk
deleted file mode 100644
index bf89e5f..0000000
--- a/tests/tests/net/native/qtaguid/Android.mk
+++ /dev/null
@@ -1,43 +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.
-
-# Build the unit tests.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := CtsNativeNetTestCases
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
-LOCAL_MULTILIB := both
-LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
-LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
-
-LOCAL_SRC_FILES := \
-    src/NativeQtaguidTest.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-    libutils \
-    liblog \
-
-LOCAL_STATIC_LIBRARIES := \
-    libgtest \
-    libqtaguid \
-
-LOCAL_CTS_TEST_PACKAGE := android.net.native
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts
-
-LOCAL_CFLAGS := -Werror -Wall
-
-include $(BUILD_CTS_EXECUTABLE)
diff --git a/tests/tests/net/src/android/net/cts/DnsResolverTest.java b/tests/tests/net/src/android/net/cts/DnsResolverTest.java
index 40d64cf..945f51d 100644
--- a/tests/tests/net/src/android/net/cts/DnsResolverTest.java
+++ b/tests/tests/net/src/android/net/cts/DnsResolverTest.java
@@ -144,9 +144,8 @@
         private DnsAnswer mDnsAnswer;
 
         VerifyCancelCallback(@NonNull String msg, @Nullable CancellationSignal cancel) {
-            this.mMsg = msg;
-            this.mCancelSignal = cancel;
-            this.mDnsAnswer = null;
+            mMsg = msg;
+            mCancelSignal = cancel;
         }
 
         VerifyCancelCallback(@NonNull String msg) {
@@ -187,15 +186,15 @@
         }
 
         private void assertValidAnswer() {
-            assertTrue(mMsg + "No valid answer", mDnsAnswer != null);
-            assertTrue(mMsg + " Unexpected error: reported rcode" + mRcode +
-                    " blob's rcode " + mDnsAnswer.getRcode(), mRcode == mDnsAnswer.getRcode());
+            assertNotNull(mMsg + " No valid answer", mDnsAnswer);
+            assertEquals(mMsg + " Unexpected error: reported rcode" + mRcode +
+                    " blob's rcode " + mDnsAnswer.getRcode(), mRcode, mDnsAnswer.getRcode());
         }
 
         public void assertHasAnswer() {
             assertValidAnswer();
             // Check rcode field.(0, No error condition).
-            assertTrue(mMsg + " Response error, rcode: " + mRcode, mRcode == 0);
+            assertEquals(mMsg + " Response error, rcode: " + mRcode, mRcode, 0);
             // Check answer counts.
             assertGreaterThan(mMsg + " No answer found", mDnsAnswer.getANCount(), 0);
             // Check question counts.
@@ -205,9 +204,9 @@
         public void assertNXDomain() {
             assertValidAnswer();
             // Check rcode field.(3, NXDomain).
-            assertTrue(mMsg + " Unexpected rcode: " + mRcode, mRcode == NXDOMAIN);
+            assertEquals(mMsg + " Unexpected rcode: " + mRcode, mRcode, NXDOMAIN);
             // Check answer counts. Expect 0 answer.
-            assertTrue(mMsg + " Not an empty answer", mDnsAnswer.getANCount() == 0);
+            assertEquals(mMsg + " Not an empty answer", mDnsAnswer.getANCount(), 0);
             // Check question counts.
             assertGreaterThan(mMsg + " No question found", mDnsAnswer.getQDCount(), 0);
         }
@@ -215,9 +214,9 @@
         public void assertEmptyAnswer() {
             assertValidAnswer();
             // Check rcode field.(0, No error condition).
-            assertTrue(mMsg + " Response error, rcode: " + mRcode, mRcode == 0);
+            assertEquals(mMsg + " Response error, rcode: " + mRcode, mRcode, 0);
             // Check answer counts. Expect 0 answer.
-            assertTrue(mMsg + " Not an empty answer", mDnsAnswer.getANCount() == 0);
+            assertEquals(mMsg + " Not an empty answer", mDnsAnswer.getANCount(), 0);
             // Check question counts.
             assertGreaterThan(mMsg + " No question found", mDnsAnswer.getQDCount(), 0);
         }
@@ -279,10 +278,10 @@
             try {
                 assertTrue(msg + " but no answer after " + TIMEOUT_MS + "ms.",
                         callback.waitForAnswer());
-                // Except no answer record because of querying with empty dname(ROOT)
+                // Except no answer record because the root does not have AAAA records.
                 callback.assertEmptyAnswer();
             } catch (InterruptedException e) {
-                fail(msg + "Waiting for DNS lookup was interrupted");
+                fail(msg + " Waiting for DNS lookup was interrupted");
             }
         }
     }
@@ -331,7 +330,7 @@
                     assertTrue(msg + " query was not cancelled",
                             latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
                 } catch (InterruptedException e) {
-                    fail(msg + "Waiting for DNS lookup was interrupted");
+                    fail(msg + " Waiting for DNS lookup was interrupted");
                 }
             } while (retry);
         }
@@ -508,7 +507,7 @@
                     assertTrue(msg + " query was not cancelled",
                             latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
                 } catch (InterruptedException e) {
-                    fail(msg + "Waiting for DNS lookup was interrupted");
+                    fail(msg + " Waiting for DNS lookup was interrupted");
                 }
             } while (retry);
         }
diff --git a/tests/tests/netpermission/OWNERS b/tests/tests/netpermission/OWNERS
new file mode 100644
index 0000000..370c20c
--- /dev/null
+++ b/tests/tests/netpermission/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 31808
+include ../net/OWNERS
diff --git a/tests/tests/netsecpolicy/Android.mk b/tests/tests/netsecpolicy/Android.mk
deleted file mode 100644
index 137672e..0000000
--- a/tests/tests/netsecpolicy/Android.mk
+++ /dev/null
@@ -1,17 +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 $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.bp b/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.bp
new file mode 100644
index 0000000..65218dd
--- /dev/null
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+
+android_test {
+    name: "CtsNetSecPolicyUsesCleartextTrafficFalseTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "ctstestserver",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "common/**/*.java",
+    ],
+    instrumentation_for: "CtsNetSecPolicyUsesCleartextTrafficFalse",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk b/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
deleted file mode 100644
index 0cb1260..0000000
--- a/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
+++ /dev/null
@@ -1,40 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    ctstestserver
-
-LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src common)
-
-LOCAL_PACKAGE_NAME := CtsNetSecPolicyUsesCleartextTrafficFalseTestCases
-
-LOCAL_INSTRUMENTATION_FOR := CtsNetSecPolicyUsesCleartextTrafficFalse
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.bp b/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.bp
new file mode 100644
index 0000000..00d0af8
--- /dev/null
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+
+android_test {
+    name: "CtsNetSecPolicyUsesCleartextTrafficTrueTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "ctstestserver",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "common/**/*.java",
+    ],
+    instrumentation_for: "CtsNetSecPolicyUsesCleartextTrafficTrue",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk b/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
deleted file mode 100644
index ec4dab3..0000000
--- a/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
+++ /dev/null
@@ -1,40 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    ctstestserver
-
-LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src common)
-
-LOCAL_PACKAGE_NAME := CtsNetSecPolicyUsesCleartextTrafficTrueTestCases
-
-LOCAL_INSTRUMENTATION_FOR := CtsNetSecPolicyUsesCleartextTrafficTrue
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.bp b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.bp
new file mode 100644
index 0000000..945a2ca
--- /dev/null
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+
+android_test {
+    name: "CtsNetSecPolicyUsesCleartextTrafficUnspecifiedTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "ctstestserver",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "common/**/*.java",
+    ],
+    instrumentation_for: "CtsNetSecPolicyUsesCleartextTrafficUnspecified",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "current",
+}
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
deleted file mode 100644
index fba1086..0000000
--- a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
+++ /dev/null
@@ -1,40 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    ctstestserver
-
-LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src common)
-
-LOCAL_PACKAGE_NAME := CtsNetSecPolicyUsesCleartextTrafficUnspecifiedTestCases
-
-LOCAL_INSTRUMENTATION_FOR := CtsNetSecPolicyUsesCleartextTrafficUnspecified
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/Android.bp b/tests/tests/networksecurityconfig/Android.bp
new file mode 100644
index 0000000..df15d2b
--- /dev/null
+++ b/tests/tests/networksecurityconfig/Android.bp
@@ -0,0 +1,25 @@
+// 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.
+//
+
+java_library {
+    name: "tests-tests-networksecurityconfig-lib",
+    srcs: ["src/**/*.java"],
+    defaults: ["cts_defaults"],
+    libs: [
+        "compatibility-device-util-axt",
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+}
diff --git a/tests/tests/networksecurityconfig/Android.mk b/tests/tests/networksecurityconfig/Android.mk
deleted file mode 100644
index 4312beb..0000000
--- a/tests/tests/networksecurityconfig/Android.mk
+++ /dev/null
@@ -1,15 +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.
-#
-include $(call all-subdir-makefiles)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.bp b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.bp
new file mode 100644
index 0000000..021cc36
--- /dev/null
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+//
+
+android_test {
+    name: "CtsNetSecConfigAttributeTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "tests-tests-networksecurityconfig-lib",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res/"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk
deleted file mode 100644
index 856b89a..0000000
--- a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk
+++ /dev/null
@@ -1,39 +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_PACKAGE_NAME := CtsNetSecConfigAttributeTestCases
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules \
-    compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SRC_FILES += $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.bp b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.bp
new file mode 100644
index 0000000..a0b4ebe
--- /dev/null
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+//
+
+android_test {
+    name: "CtsNetSecConfigBasicDomainConfigTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "tests-tests-networksecurityconfig-lib",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res/"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk
deleted file mode 100644
index 8fc8c18..0000000
--- a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk
+++ /dev/null
@@ -1,39 +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_PACKAGE_NAME := CtsNetSecConfigBasicDomainConfigTestCases
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules \
-    compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SRC_FILES += $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.bp b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.bp
new file mode 100644
index 0000000..d32ea4d
--- /dev/null
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.bp
@@ -0,0 +1,39 @@
+// 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.
+//
+
+android_test {
+    name: "CtsNetSecConfigPrePCleartextTrafficTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "tests-tests-networksecurityconfig-lib",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res/"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+    min_sdk_version: "26",
+}
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.mk
deleted file mode 100644
index 375b782..0000000
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.mk
+++ /dev/null
@@ -1,41 +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_PACKAGE_NAME := CtsNetSecConfigPrePCleartextTrafficTestCases
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules \
-    compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SRC_FILES += $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 26
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.bp b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.bp
new file mode 100644
index 0000000..46978c4
--- /dev/null
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+//
+
+android_test {
+    name: "CtsNetSecConfigCleartextTrafficTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "tests-tests-networksecurityconfig-lib",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res/"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk
deleted file mode 100644
index 5e02714..0000000
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk
+++ /dev/null
@@ -1,39 +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_PACKAGE_NAME := CtsNetSecConfigCleartextTrafficTestCases
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules \
-    compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SRC_FILES += $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.bp b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.bp
new file mode 100644
index 0000000..e0e810f
--- /dev/null
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+//
+
+android_test {
+    name: "CtsNetSecConfigBasicDebugDisabledTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "tests-tests-networksecurityconfig-lib",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res/"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk
deleted file mode 100644
index 3ff44e9..0000000
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk
+++ /dev/null
@@ -1,39 +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_PACKAGE_NAME := CtsNetSecConfigBasicDebugDisabledTestCases
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules \
-    compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SRC_FILES += $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.bp b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.bp
new file mode 100644
index 0000000..68744b8
--- /dev/null
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+//
+
+android_test {
+    name: "CtsNetSecConfigBasicDebugEnabledTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "tests-tests-networksecurityconfig-lib",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res/"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk
deleted file mode 100644
index dcbf3d8..0000000
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk
+++ /dev/null
@@ -1,39 +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_PACKAGE_NAME := CtsNetSecConfigBasicDebugEnabledTestCases
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules \
-    compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SRC_FILES += $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.bp b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.bp
new file mode 100644
index 0000000..f00e1cc
--- /dev/null
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+//
+
+android_test {
+    name: "CtsNetSecConfigDownloadManagerTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "tests-tests-networksecurityconfig-lib",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res/"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk
deleted file mode 100644
index 65edbca..0000000
--- a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk
+++ /dev/null
@@ -1,39 +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_PACKAGE_NAME := CtsNetSecConfigDownloadManagerTestCases
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules \
-    compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SRC_FILES += $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.bp b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.bp
new file mode 100644
index 0000000..d920f6a
--- /dev/null
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+//
+
+android_test {
+    name: "CtsNetSecConfigInvalidPinTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "tests-tests-networksecurityconfig-lib",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res/"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk
deleted file mode 100644
index 4eb0c93..0000000
--- a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk
+++ /dev/null
@@ -1,39 +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_PACKAGE_NAME := CtsNetSecConfigInvalidPinTestCases
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules \
-    compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SRC_FILES += $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.bp b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.bp
new file mode 100644
index 0000000..abfa355
--- /dev/null
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+//
+
+android_test {
+    name: "CtsNetSecConfigNestedDomainConfigTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "tests-tests-networksecurityconfig-lib",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res/"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk
deleted file mode 100644
index 40350eb..0000000
--- a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk
+++ /dev/null
@@ -1,39 +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_PACKAGE_NAME := CtsNetSecConfigNestedDomainConfigTestCases
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules \
-    compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SRC_FILES += $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.bp b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.bp
new file mode 100644
index 0000000..35b85e8
--- /dev/null
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.bp
@@ -0,0 +1,39 @@
+// 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.
+//
+
+android_test {
+    name: "CtsNetSecConfigResourcesSrcTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "tests-tests-networksecurityconfig-lib",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    resource_dirs: ["res/"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk
deleted file mode 100644
index b8556a1..0000000
--- a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk
+++ /dev/null
@@ -1,43 +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_PACKAGE_NAME := CtsNetSecConfigResourcesSrcTestCases
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules \
-    compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := \
-    org.apache.http.legacy \
-    android.test.runner.stubs \
-    android.test.base.stubs \
-
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SRC_FILES += $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/opengl/Android.bp b/tests/tests/opengl/Android.bp
new file mode 100644
index 0000000..39148e0
--- /dev/null
+++ b/tests/tests/opengl/Android.bp
@@ -0,0 +1,37 @@
+// 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.
+
+android_test {
+    name: "CtsOpenGLTestCases",
+    defaults: ["cts_defaults"],
+    compile_multilib: "both",
+    jni_libs: ["libopengltest_jni"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Using EGL_RECORDABLE_ANDROID requires latest
+    sdk_version: "test_current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/opengl/Android.mk b/tests/tests/opengl/Android.mk
deleted file mode 100644
index 0b75847..0000000
--- a/tests/tests/opengl/Android.mk
+++ /dev/null
@@ -1,47 +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_PACKAGE_NAME := CtsOpenGLTestCases
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# Include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_JNI_SHARED_LIBRARIES := libopengltest_jni
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Using EGL_RECORDABLE_ANDROID requires latest
-LOCAL_SDK_VERSION := current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
-
-# Include the associated library's makefile.
-include $(LOCAL_PATH)/libopengltest/Android.mk
diff --git a/tests/tests/opengl/libopengltest/Android.bp b/tests/tests/opengl/libopengltest/Android.bp
new file mode 100644
index 0000000..bdff5f0
--- /dev/null
+++ b/tests/tests/opengl/libopengltest/Android.bp
@@ -0,0 +1,51 @@
+// 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.
+
+//
+// This is the shared library included by the JNI test app.
+//
+
+cc_test_library {
+    name: "libopengltest_jni",
+    srcs: [
+        "common.cpp",
+        "gl2_jni_libone.cpp",
+        "attach_shader_one.cpp",
+        "attach_shader_two.cpp",
+        "attach_shader_three.cpp",
+        "attach_shader_four.cpp",
+        "attach_shader_five.cpp",
+        "attach_shader_six.cpp",
+        "attach_shader_seven.cpp",
+        "attach_shader_eight.cpp",
+        "attach_shader_nine.cpp",
+        "attach_shader_ten.cpp",
+        "attach_shader_eleven.cpp",
+        "color_one.cpp",
+    ],
+    sdk_version: "current",
+    stl: "none",
+    shared_libs: [
+        "libGLESv2",
+        "liblog",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+        "-Wno-sign-compare",
+        "-Wno-unused-function",
+        "-Wno-unused-variable",
+    ],
+}
diff --git a/tests/tests/opengl/libopengltest/Android.mk b/tests/tests/opengl/libopengltest/Android.mk
deleted file mode 100755
index aed011a..0000000
--- a/tests/tests/opengl/libopengltest/Android.mk
+++ /dev/null
@@ -1,50 +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.
-
-#
-# This is the shared library included by the JNI test app.
-#
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_MODULE := libopengltest_jni
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := common.cpp \
-                   gl2_jni_libone.cpp \
-                   attach_shader_one.cpp \
-                   attach_shader_two.cpp \
-                   attach_shader_three.cpp \
-                   attach_shader_four.cpp \
-                   attach_shader_five.cpp \
-                   attach_shader_six.cpp \
-                   attach_shader_seven.cpp \
-                   attach_shader_eight.cpp \
-                   attach_shader_nine.cpp \
-                   attach_shader_ten.cpp \
-                   attach_shader_eleven.cpp \
-                   color_one.cpp
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-LOCAL_SDK_VERSION := current
-LOCAL_NDK_STL_VARIANT := none
-
-LOCAL_SHARED_LIBRARIES := libGLESv2 liblog
-
-LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter
-LOCAL_CFLAGS += -Wno-sign-compare -Wno-unused-function -Wno-unused-variable
-
-include $(BUILD_SHARED_LIBRARY)
-
-
-
diff --git a/tests/tests/openglperf/Android.bp b/tests/tests/openglperf/Android.bp
new file mode 100644
index 0000000..8960491
--- /dev/null
+++ b/tests/tests/openglperf/Android.bp
@@ -0,0 +1,41 @@
+// 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.
+
+android_test {
+    name: "CtsOpenGlPerfTestCases",
+    defaults: ["cts_defaults"],
+    // Include both the 32 and 64 bit versions
+    compile_multilib: "both",
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    jni_libs: [
+        "libctsopenglperf_jni",
+        "libnativehelper_compat_libc++",
+    ],
+    srcs: ["src/**/*.java"],
+    instrumentation_for: "com.replica.replicaisland",
+    sdk_version: "test_current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/openglperf/Android.mk b/tests/tests/openglperf/Android.mk
deleted file mode 100644
index 03ba008..0000000
--- a/tests/tests/openglperf/Android.mk
+++ /dev/null
@@ -1,46 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_JNI_SHARED_LIBRARIES := libctsopenglperf_jni libnativehelper_compat_libc++
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsOpenGlPerfTestCases
-
-LOCAL_INSTRUMENTATION_FOR := com.replica.replicaisland
-
-LOCAL_SDK_VERSION := current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/openglperf/jni/Android.bp b/tests/tests/openglperf/jni/Android.bp
new file mode 100644
index 0000000..6b9987d
--- /dev/null
+++ b/tests/tests/openglperf/jni/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_test_library {
+    name: "libctsopenglperf_jni",
+    srcs: ["OpenGlPerfNativeJni.cpp"],
+    include_dirs: [
+        "system/core/include",
+        "frameworks/native/opengl/include",
+    ],
+    shared_libs: [
+        "libnativehelper_compat_libc++",
+        "liblog",
+        "libEGL",
+    ],
+    sdk_version: "19",
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
+}
diff --git a/tests/tests/openglperf/jni/Android.mk b/tests/tests/openglperf/jni/Android.mk
deleted file mode 100644
index fef30a1..0000000
--- a/tests/tests/openglperf/jni/Android.mk
+++ /dev/null
@@ -1,33 +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    := libctsopenglperf_jni
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := OpenGlPerfNativeJni.cpp
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE) $(call include-path-for, system-core) frameworks/native/opengl/include
-
-LOCAL_SHARED_LIBRARIES := libnativehelper_compat_libc++ liblog libEGL
-
-LOCAL_SDK_VERSION := 14
-
-LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/os/Android.bp b/tests/tests/os/Android.bp
new file mode 100644
index 0000000..6aeb886
--- /dev/null
+++ b/tests/tests/os/Android.bp
@@ -0,0 +1,56 @@
+// 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.
+
+android_test {
+    name: "CtsOsTestCases",
+    defaults: ["cts_defaults"],
+    compile_multilib: "both",
+    static_libs: [
+        "android.hidl.manager-V1.0-java",
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "truth-prebuilt",
+        "guava",
+        "junit",
+    ],
+    jni_libs: [
+        "libcts_jni",
+        "libctsos_jni",
+        "libnativehelper_compat_libc++",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "src/android/os/cts/IParcelFileDescriptorPeer.aidl",
+        "src/android/os/cts/IEmptyService.aidl",
+        "src/android/os/cts/ISeccompIsolatedService.aidl",
+        "src/android/os/cts/ISecondary.aidl",
+        "src/android/os/cts/ISharedMemoryService.aidl",
+    ],
+    // Set its own test config to prevent sharing with cts-platform-version-check
+    test_config: "CtsOsTestCases.xml",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    platform_apis: true,
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    // Do not compress minijail policy files.
+    aaptflags: ["-0 .policy"],
+}
diff --git a/tests/tests/os/Android.mk b/tests/tests/os/Android.mk
index aca23e3..8d3faaf 100644
--- a/tests/tests/os/Android.mk
+++ b/tests/tests/os/Android.mk
@@ -12,58 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    android.hidl.manager-V1.0-java \
-    androidx.test.rules \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    truth-prebuilt \
-    guava \
-    junit
-
-LOCAL_JNI_SHARED_LIBRARIES := libcts_jni libctsos_jni libnativehelper_compat_libc++
-
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src) \
-    src/android/os/cts/IParcelFileDescriptorPeer.aidl \
-    src/android/os/cts/IEmptyService.aidl \
-    src/android/os/cts/ISeccompIsolatedService.aidl \
-    src/android/os/cts/ISecondary.aidl \
-    src/android/os/cts/ISharedMemoryService.aidl
-
-LOCAL_PACKAGE_NAME := CtsOsTestCases
-
-# Set its own test config to prevent sharing with cts-platform-version-check
-LOCAL_TEST_CONFIG := CtsOsTestCases.xml
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_JAVA_LIBRARIES += android.test.runner.stubs
-LOCAL_JAVA_LIBRARIES += android.test.base.stubs
-
-# Do not compress minijail policy files.
-LOCAL_AAPT_FLAGS := -0 .policy
-
-LOCAL_USE_AAPT2 := true
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
-
 # platform version check (b/32056228)
 # ============================================================
 include $(CLEAR_VARS)
diff --git a/tests/tests/os/TEST_MAPPING b/tests/tests/os/TEST_MAPPING
index 78469e8..ad2a688 100644
--- a/tests/tests/os/TEST_MAPPING
+++ b/tests/tests/os/TEST_MAPPING
@@ -4,13 +4,13 @@
       "name": "CtsOsTestCases",
       "options": [
         {
-          "exclude-filter": "android.os.cts.UsbDebuggingTest#testUsbDebugging"
+          "exclude-filter": "android.os.cts.BuildTest#testSdkInt"
         },
         {
           "exclude-filter": "android.os.cts.StrictModeTest#testNonSdkApiUsage"
         },
         {
-          "exclude-filter": "android.os.cts.BuildTest#testSdkInt"
+          "exclude-filter": "android.os.cts.UsbDebuggingTest#testUsbDebugging"
         }
       ]
     }
diff --git a/tests/tests/os/assets/platform_versions.txt b/tests/tests/os/assets/platform_versions.txt
index f599e28..331bae0 100644
--- a/tests/tests/os/assets/platform_versions.txt
+++ b/tests/tests/os/assets/platform_versions.txt
@@ -1 +1 @@
-10
+R
diff --git a/tests/tests/os/src/android/os/cts/BuildTest.java b/tests/tests/os/src/android/os/cts/BuildTest.java
index 7ff9bcd..00cb97d 100644
--- a/tests/tests/os/src/android/os/cts/BuildTest.java
+++ b/tests/tests/os/src/android/os/cts/BuildTest.java
@@ -16,7 +16,7 @@
 
 package android.os.cts;
 
-import static android.os.Build.VERSION.CODENAME;
+import static android.os.Build.VERSION.ACTIVE_CODENAMES;
 import static android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
 
 import android.os.Build;
@@ -264,6 +264,7 @@
 
         // CUR_DEVELOPMENT must be larger than any released version.
         Field[] fields = Build.VERSION_CODES.class.getDeclaredFields();
+        List<String> codenames = Arrays.asList(ACTIVE_CODENAMES);
         for (Field field : fields) {
             if (field.getType().equals(int.class) && Modifier.isStatic(field.getModifiers())) {
                 String fieldName = field.getName();
@@ -277,7 +278,7 @@
                     // It should be okay to change the value of this constant in future, but it
                     // should at least be a conscious decision.
                     assertEquals(10000, fieldValue);
-                } else if (fieldName.equals(CODENAME) && !CODENAME.equals("REL")) {
+                } else if (codenames.contains(fieldName)) {
                     // This is the current development version. Note that fieldName can
                     // become < CUR_DEVELOPMENT before CODENAME becomes "REL", so we
                     // can't assertEquals(CUR_DEVELOPMENT, fieldValue) here.
diff --git a/tests/tests/os/src/android/os/cts/EnvironmentTest.java b/tests/tests/os/src/android/os/cts/EnvironmentTest.java
index dfbef8a..b00e1f2 100644
--- a/tests/tests/os/src/android/os/cts/EnvironmentTest.java
+++ b/tests/tests/os/src/android/os/cts/EnvironmentTest.java
@@ -110,7 +110,12 @@
         final long maxInodes = maxsize / 4096;
         // Assuming the smallest storage would be 4GB, min # of free inodes
         // in EXT4/F2FS must be larger than 128k for Android to work properly.
-        final long minInodes = 128 * 1024;
+        long minInodes = 128 * 1024;
+        final long size4GB = 4294967296l;
+        //If the storage size is smaller than 4GB, let's consider 32k for 1GB.
+        if (maxsize < size4GB) {
+            minInodes = 32 * 1024;
+        }
 
         if (stat.f_ffree >= minInodes && stat.f_ffree <= maxInodes
             && stat.f_favail <= stat.f_ffree) {
diff --git a/tests/tests/os/src/android/os/cts/SecurityFeaturesTest.java b/tests/tests/os/src/android/os/cts/SecurityFeaturesTest.java
index 2e7130d..64b6fd4 100644
--- a/tests/tests/os/src/android/os/cts/SecurityFeaturesTest.java
+++ b/tests/tests/os/src/android/os/cts/SecurityFeaturesTest.java
@@ -74,7 +74,7 @@
     public void testPrctlDumpable() throws Exception {
         boolean userBuild = "user".equals(Build.TYPE);
         int prctl_dumpable = Os.prctl(PR_GET_DUMPABLE, 0, 0, 0, 0);
-        int expected  = userBuild ? 0 : 1;
+        int expected = userBuild ? 0 : 1;
         assertEquals(expected, prctl_dumpable);
     }
 }
diff --git a/tests/tests/permission2/Android.bp b/tests/tests/permission2/Android.bp
index 2ad4e7b..ddc237d 100644
--- a/tests/tests/permission2/Android.bp
+++ b/tests/tests/permission2/Android.bp
@@ -17,7 +17,6 @@
 android_test {
     name: "CtsPermission2TestCases",
     defaults: ["cts_defaults"],
-
     // Tag this module as a cts test artifact
     test_suites: [
         "cts",
@@ -25,19 +24,14 @@
         "general-tests",
         "cts_instant",
     ],
-
     libs: ["android.test.base.stubs"],
-
     static_libs: [
-        "androidx.test.core",
         "compatibility-device-util-axt",
         "ctstestrunner-axt",
         "guava",
         "androidx.test.ext.junit-nodeps",
         "truth-prebuilt"
     ],
-
     srcs: ["src/**/*.java"],
-
     sdk_version: "test_current",
 }
diff --git a/tests/tests/print/Android.bp b/tests/tests/print/Android.bp
new file mode 100644
index 0000000..1e610b3
--- /dev/null
+++ b/tests/tests/print/Android.bp
@@ -0,0 +1,28 @@
+// 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.
+
+android_test {
+    name: "CtsPrintTestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    srcs: ["src/**/*.java"],
+    static_libs: ["print-test-util-lib"],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/print/Android.mk b/tests/tests/print/Android.mk
deleted file mode 100644
index c44943d..0000000
--- a/tests/tests/print/Android.mk
+++ /dev/null
@@ -1,35 +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_TAGS := tests
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsPrintTestCases
-
-LOCAL_STATIC_JAVA_LIBRARIES := print-test-util-lib
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
-include $(call all-makefiles-under,$(LOCAL_PATH))
\ No newline at end of file
diff --git a/tests/tests/proto/Android.bp b/tests/tests/proto/Android.bp
new file mode 100644
index 0000000..cd57f37
--- /dev/null
+++ b/tests/tests/proto/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test {
+    name: "CtsProtoTestCases",
+    defaults: ["cts_defaults"],
+    srcs: [
+        "src/**/*.java",
+        "src/**/*.proto",
+    ],
+    proto: {
+        type: "nano",
+    },
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    //sdl_version: "current",
+    platform_apis: true,
+    libs: ["android.test.runner.stubs"],
+    static_libs: ["ctstestrunner-axt"],
+}
diff --git a/tests/tests/proto/Android.mk b/tests/tests/proto/Android.mk
deleted file mode 100644
index e937e0c..0000000
--- a/tests/tests/proto/Android.mk
+++ /dev/null
@@ -1,42 +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)
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src) \
-    $(call all-proto-files-under, src)
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := nano
-
-LOCAL_PACKAGE_NAME := CtsProtoTestCases
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-#LOCAL_SDK_VERSION := current
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_JAVA_LIBRARIES += android.test.runner.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-        ctstestrunner-axt
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/provider/Android.mk b/tests/tests/provider/Android.mk
deleted file mode 100644
index 6361f9b..0000000
--- a/tests/tests/provider/Android.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/provider/preconditions/Android.bp b/tests/tests/provider/preconditions/Android.bp
new file mode 100644
index 0000000..78b7457
--- /dev/null
+++ b/tests/tests/provider/preconditions/Android.bp
@@ -0,0 +1,17 @@
+java_test_helper_library {
+    name: "compatibility-host-provider-preconditions",
+    srcs: ["src/**/*.java"],
+    libs: [
+        "compatibility-host-util",
+        "cts-tradefed",
+        "tradefed",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    host_supported: true,
+    device_supported: false,
+}
diff --git a/tests/tests/provider/preconditions/Android.mk b/tests/tests/provider/preconditions/Android.mk
deleted file mode 100644
index f4063c4..0000000
--- a/tests/tests/provider/preconditions/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := compatibility-host-util cts-tradefed tradefed
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := compatibility-host-provider-preconditions
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/rcs/Android.bp b/tests/tests/rcs/Android.bp
new file mode 100644
index 0000000..07b4d3b
--- /dev/null
+++ b/tests/tests/rcs/Android.bp
@@ -0,0 +1,36 @@
+// Copyright (C) 2019 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.
+
+android_test {
+    name: "CtsRcsTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "androidx.test.rules",
+        "truth-prebuilt",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    platform_apis: true,
+}
diff --git a/tests/tests/rcs/Android.mk b/tests/tests/rcs/Android.mk
deleted file mode 100755
index af2bf4b..0000000
--- a/tests/tests/rcs/Android.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (C) 2019 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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    androidx.test.rules \
-    truth-prebuilt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsRcsTestCases
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/renderscript/libcoremathtestcpp/Android.bp b/tests/tests/renderscript/libcoremathtestcpp/Android.bp
new file mode 100644
index 0000000..98717ea
--- /dev/null
+++ b/tests/tests/renderscript/libcoremathtestcpp/Android.bp
@@ -0,0 +1,37 @@
+// 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.
+
+//
+// This is the shared library included by the JNI test app.
+//
+
+cc_test_library {
+    name: "libcoremathtestcpp_jni",
+    srcs: ["CoreMathTestJni.cpp"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    sdk_version: "21",
+    stl: "c++_static",
+    include_dirs: [
+        "frameworks/rs/cpp",
+        "frameworks/rs",
+    ],
+    shared_libs: [
+        "liblog",
+        "libdl",
+    ],
+    static_libs: ["libRScpp_static"],
+}
diff --git a/tests/tests/renderscript/libcoremathtestcpp/Android.mk b/tests/tests/renderscript/libcoremathtestcpp/Android.mk
deleted file mode 100644
index 52e19a6..0000000
--- a/tests/tests/renderscript/libcoremathtestcpp/Android.mk
+++ /dev/null
@@ -1,36 +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.
-
-#
-# This is the shared library included by the JNI test app.
-#
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-LOCAL_MODULE := libcoremathtestcpp_jni
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := CoreMathTestJni.cpp
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_SDK_VERSION := 21
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-LOCAL_C_INCLUDES += frameworks/rs/cpp
-LOCAL_C_INCLUDES += frameworks/rs
-
-LOCAL_LDFLAGS := -llog -ldl
-LOCAL_STATIC_LIBRARIES := libRScpp_static
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/rsblas/libbnnmdata/Android.bp b/tests/tests/rsblas/libbnnmdata/Android.bp
new file mode 100644
index 0000000..ec6a524
--- /dev/null
+++ b/tests/tests/rsblas/libbnnmdata/Android.bp
@@ -0,0 +1,25 @@
+// 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: "libbnnmdata_jni",
+    srcs: ["test_data.cpp"],
+    sdk_version: "23",
+    stl: "c++_static",
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-const-variable",
+    ],
+}
diff --git a/tests/tests/rsblas/libbnnmdata/Android.mk b/tests/tests/rsblas/libbnnmdata/Android.mk
deleted file mode 100644
index 6a5e542..0000000
--- a/tests/tests/rsblas/libbnnmdata/Android.mk
+++ /dev/null
@@ -1,27 +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 := libbnnmdata_jni
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := test_data.cpp
-LOCAL_SDK_VERSION := 23
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_CFLAGS := -Wall -Werror -Wno-unused-const-variable
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/sax/Android.bp b/tests/tests/sax/Android.bp
new file mode 100644
index 0000000..37e9357
--- /dev/null
+++ b/tests/tests/sax/Android.bp
@@ -0,0 +1,28 @@
+// 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.
+
+android_test {
+    name: "CtsSaxTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: ["ctstestrunner-axt"],
+    libs: ["android.test.base.stubs"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/sax/Android.mk b/tests/tests/sax/Android.mk
deleted file mode 100644
index b7e4b80..0000000
--- a/tests/tests/sax/Android.mk
+++ /dev/null
@@ -1,37 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsSaxTestCases
-
-LOCAL_SDK_VERSION := current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/security/AndroidManifest.xml b/tests/tests/security/AndroidManifest.xml
index df94dfe..b2412f69 100644
--- a/tests/tests/security/AndroidManifest.xml
+++ b/tests/tests/security/AndroidManifest.xml
@@ -56,6 +56,10 @@
                      android:label="CTS tests of android.security.cts">
         <meta-data android:name="listener"
             android:value="com.android.cts.runner.CtsTestRunListener" />
+    </instrumentation>
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+                     android:targetPackage="android.security.cts"
+                     android:label="CTS tests of android.security.cts">
         <meta-data android:name="listener"
             android:value="com.android.cts.runner.CrashParserRunListener" />
     </instrumentation>
diff --git a/tests/tests/security/jni/Android.bp b/tests/tests/security/jni/Android.bp
index 7193aba..27f6289 100644
--- a/tests/tests/security/jni/Android.bp
+++ b/tests/tests/security/jni/Android.bp
@@ -30,10 +30,4 @@
         "cpufeatures",
         "libcutils",
     ],
-    cflags: [
-        "-Wno-unused-parameter",
-        "-Wno-sign-compare",
-        "-Wno-unused-label",
-        "-Wno-unused-variable",
-    ],
 }
diff --git a/tests/tests/security/jni/CtsSecurityJniOnLoad.cpp b/tests/tests/security/jni/CtsSecurityJniOnLoad.cpp
index 68a600b..7490d1a 100644
--- a/tests/tests/security/jni/CtsSecurityJniOnLoad.cpp
+++ b/tests/tests/security/jni/CtsSecurityJniOnLoad.cpp
@@ -23,7 +23,7 @@
 extern int register_android_security_cts_MMapExecutableTest(JNIEnv* env);
 extern int register_android_security_cts_EncryptionTest(JNIEnv* env);
 
-jint JNI_OnLoad(JavaVM *vm, void *reserved) {
+jint JNI_OnLoad(JavaVM *vm, void *) {
     JNIEnv *env = NULL;
 
     if (vm->GetEnv((void **) &env, JNI_VERSION_1_4) != JNI_OK) {
diff --git a/tests/tests/security/jni/android_security_cts_LinuxRngTest.cpp b/tests/tests/security/jni/android_security_cts_LinuxRngTest.cpp
index 8514f8b..f928f2f 100644
--- a/tests/tests/security/jni/android_security_cts_LinuxRngTest.cpp
+++ b/tests/tests/security/jni/android_security_cts_LinuxRngTest.cpp
@@ -43,7 +43,7 @@
 }
 
 jint android_security_cts_LinuxRngTest_getCharDeviceMajor(JNIEnv* env,
-        jobject thiz, jstring name)
+        jobject, jstring name)
 {
     const char* nameStr = env->GetStringUTFChars(name, NULL);
 
@@ -69,7 +69,7 @@
 }
 
 jint android_security_cts_LinuxRngTest_getCharDeviceMinor(JNIEnv* env,
-        jobject thiz, jstring name)
+        jobject, jstring name)
 {
     const char* nameStr = env->GetStringUTFChars(name, NULL);
 
diff --git a/tests/tests/security/jni/android_security_cts_NativeCodeTest.cpp b/tests/tests/security/jni/android_security_cts_NativeCodeTest.cpp
index 4c2f61c..ce9169d 100644
--- a/tests/tests/security/jni/android_security_cts_NativeCodeTest.cpp
+++ b/tests/tests/security/jni/android_security_cts_NativeCodeTest.cpp
@@ -41,12 +41,12 @@
 #define SHMEMSIZE 0x1 /* request one page */
 static jboolean android_security_cts_NativeCodeTest_doSysVipcTest(JNIEnv*, jobject)
 {
-    key_t key = 0x1a25;
-
 #if defined(__i386__) || (_MIPS_SIM == _MIPS_SIM_ABI32)
     /* system call does not exist for x86 or mips 32 */
     return true;
 #else
+    key_t key = 0x1a25;
+
     /*
      * Not supported in bionic. Must directly invoke syscall
      * Only acceptable errno is ENOSYS: shmget syscall
diff --git a/tests/tests/selinux/Android.mk b/tests/tests/selinux/Android.mk
deleted file mode 100644
index cddf11e..0000000
--- a/tests/tests/selinux/Android.mk
+++ /dev/null
@@ -1,17 +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 $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/selinux/OWNERS b/tests/tests/selinux/OWNERS
new file mode 100644
index 0000000..8824b03
--- /dev/null
+++ b/tests/tests/selinux/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 85141
+jeffv@google.com
+jgalenson@google.com
+nnk@google.com
diff --git a/tests/tests/selinux/common/Android.mk b/tests/tests/selinux/common/Android.mk
deleted file mode 100644
index a177b5c..0000000
--- a/tests/tests/selinux/common/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2018 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 $(call all-makefiles-under,$(LOCAL_PATH))
-
diff --git a/tests/tests/selinux/common/jni/Android.bp b/tests/tests/selinux/common/jni/Android.bp
new file mode 100644
index 0000000..275b0ce
--- /dev/null
+++ b/tests/tests/selinux/common/jni/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.
+
+cc_test_library {
+    name: "libctsselinux_jni",
+    srcs: [
+        "CtsSecurityJniOnLoad.cpp",
+        "android_security_SELinuxTargetSdkTest.cpp",
+    ],
+    shared_libs: [
+        "libbase",
+        "libc++",
+        "libcrypto",
+        "liblog",
+        "libnativehelper",
+        "libpackagelistparser",
+        "libpcre2",
+        "libselinux",
+    ],
+    gtest: false,
+}
diff --git a/tests/tests/selinux/common/jni/Android.mk b/tests/tests/selinux/common/jni/Android.mk
deleted file mode 100644
index 8f9234c..0000000
--- a/tests/tests/selinux/common/jni/Android.mk
+++ /dev/null
@@ -1,37 +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 := libctsselinux_jni
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
-    CtsSecurityJniOnLoad.cpp \
-    android_security_SELinuxTargetSdkTest.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-    libc++ \
-    libcrypto \
-    liblog \
-    libnativehelper \
-    libpackagelistparser \
-    libpcre2 \
-    libselinux \
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/selinux/selinuxEphemeral/Android.bp b/tests/tests/selinux/selinuxEphemeral/Android.bp
new file mode 100644
index 0000000..c3e6459
--- /dev/null
+++ b/tests/tests/selinux/selinuxEphemeral/Android.bp
@@ -0,0 +1,51 @@
+//
+// Copyright (C) 2019 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.
+
+android_test {
+    name: "CtsSelinuxEphemeralTestCases",
+    defaults: ["cts_defaults"],
+    compile_multilib: "both",
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: [
+        "android.test.base.stubs",
+        "android.test.runner.stubs",
+    ],
+    jni_libs: [
+        "libbase",
+        "libc++",
+        "libcrypto",
+        "libcts_jni",
+        "libctsselinux_jni",
+        "libnativehelper",
+        "libnativehelper_compat_libc++",
+        "libpackagelistparser",
+        "libpcre2",
+        "libselinux",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "common/**/*.java",
+    ],
+    platform_apis: true,
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    min_sdk_version: "21",
+}
diff --git a/tests/tests/selinux/selinuxEphemeral/Android.mk b/tests/tests/selinux/selinuxEphemeral/Android.mk
deleted file mode 100644
index fa29b49..0000000
--- a/tests/tests/selinux/selinuxEphemeral/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Copyright (C) 2019 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_TAGS := tests
-LOCAL_MULTILIB := both
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs android.test.runner.stubs
-
-LOCAL_JNI_SHARED_LIBRARIES := \
-    libc++ \
-    libcrypto \
-    libcts_jni \
-    libctsselinux_jni \
-    libnativehelper \
-    libnativehelper_compat_libc++ \
-    libpackagelistparser \
-    libpcre2 \
-    libselinux \
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src common)
-LOCAL_PACKAGE_NAME := CtsSelinuxEphemeralTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MIN_SDK_VERSION := 21
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/selinux/selinuxEphemeral/AndroidTest.xml b/tests/tests/selinux/selinuxEphemeral/AndroidTest.xml
index 46dcab0..fa2b1b9 100644
--- a/tests/tests/selinux/selinuxEphemeral/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxEphemeral/AndroidTest.xml
@@ -17,7 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="security" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/selinux/selinuxTargetSdk25/Android.bp b/tests/tests/selinux/selinuxTargetSdk25/Android.bp
new file mode 100644
index 0000000..f48a8a0
--- /dev/null
+++ b/tests/tests/selinux/selinuxTargetSdk25/Android.bp
@@ -0,0 +1,51 @@
+//
+// 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.
+
+android_test {
+    name: "CtsSelinuxTargetSdk25TestCases",
+    defaults: ["cts_defaults"],
+    compile_multilib: "both",
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: [
+        "android.test.base.stubs",
+        "android.test.runner.stubs",
+    ],
+    jni_libs: [
+        "libbase",
+        "libc++",
+        "libcrypto",
+        "libcts_jni",
+        "libctsselinux_jni",
+        "libnativehelper",
+        "libnativehelper_compat_libc++",
+        "libpackagelistparser",
+        "libpcre2",
+        "libselinux",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "common/**/*.java",
+    ],
+    platform_apis: true,
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    min_sdk_version: "21",
+}
diff --git a/tests/tests/selinux/selinuxTargetSdk25/Android.mk b/tests/tests/selinux/selinuxTargetSdk25/Android.mk
deleted file mode 100644
index eadeb45..0000000
--- a/tests/tests/selinux/selinuxTargetSdk25/Android.mk
+++ /dev/null
@@ -1,48 +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_TAGS := tests
-LOCAL_MULTILIB := both
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs android.test.runner.stubs
-
-LOCAL_JNI_SHARED_LIBRARIES := \
-    libc++ \
-    libcrypto \
-    libcts_jni \
-    libctsselinux_jni \
-    libnativehelper \
-    libnativehelper_compat_libc++ \
-    libpackagelistparser \
-    libpcre2 \
-    libselinux \
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src common)
-LOCAL_PACKAGE_NAME := CtsSelinuxTargetSdk25TestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MIN_SDK_VERSION := 21
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/selinux/selinuxTargetSdk25/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdk25/AndroidTest.xml
index ae9576e..cdca38c 100644
--- a/tests/tests/selinux/selinuxTargetSdk25/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk25/AndroidTest.xml
@@ -17,7 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="security" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/selinux/selinuxTargetSdk27/Android.bp b/tests/tests/selinux/selinuxTargetSdk27/Android.bp
new file mode 100644
index 0000000..0187bbd
--- /dev/null
+++ b/tests/tests/selinux/selinuxTargetSdk27/Android.bp
@@ -0,0 +1,51 @@
+//
+// 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.
+
+android_test {
+    name: "CtsSelinuxTargetSdk27TestCases",
+    defaults: ["cts_defaults"],
+    compile_multilib: "both",
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: [
+        "android.test.base.stubs",
+        "android.test.runner.stubs",
+    ],
+    jni_libs: [
+        "libbase",
+        "libc++",
+        "libcrypto",
+        "libcts_jni",
+        "libctsselinux_jni",
+        "libnativehelper",
+        "libnativehelper_compat_libc++",
+        "libpackagelistparser",
+        "libpcre2",
+        "libselinux",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "common/**/*.java",
+    ],
+    platform_apis: true,
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    min_sdk_version: "21",
+}
diff --git a/tests/tests/selinux/selinuxTargetSdk27/Android.mk b/tests/tests/selinux/selinuxTargetSdk27/Android.mk
deleted file mode 100644
index 00973b5..0000000
--- a/tests/tests/selinux/selinuxTargetSdk27/Android.mk
+++ /dev/null
@@ -1,48 +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_TAGS := tests
-LOCAL_MULTILIB := both
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs android.test.runner.stubs
-
-LOCAL_JNI_SHARED_LIBRARIES := \
-    libc++ \
-    libcrypto \
-    libcts_jni \
-    libctsselinux_jni \
-    libnativehelper \
-    libnativehelper_compat_libc++ \
-    libpackagelistparser \
-    libpcre2 \
-    libselinux \
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src common)
-LOCAL_PACKAGE_NAME := CtsSelinuxTargetSdk27TestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MIN_SDK_VERSION := 21
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/selinux/selinuxTargetSdk27/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdk27/AndroidTest.xml
index 78e5ad4..ac816b2 100644
--- a/tests/tests/selinux/selinuxTargetSdk27/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk27/AndroidTest.xml
@@ -17,7 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="security" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/selinux/selinuxTargetSdk28/Android.bp b/tests/tests/selinux/selinuxTargetSdk28/Android.bp
new file mode 100644
index 0000000..f4af775
--- /dev/null
+++ b/tests/tests/selinux/selinuxTargetSdk28/Android.bp
@@ -0,0 +1,51 @@
+//
+// Copyright (C) 2018 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.
+
+android_test {
+    name: "CtsSelinuxTargetSdk28TestCases",
+    defaults: ["cts_defaults"],
+    compile_multilib: "both",
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: [
+        "android.test.base.stubs",
+        "android.test.runner.stubs",
+    ],
+    jni_libs: [
+        "libbase",
+        "libc++",
+        "libcrypto",
+        "libcts_jni",
+        "libctsselinux_jni",
+        "libnativehelper",
+        "libnativehelper_compat_libc++",
+        "libpackagelistparser",
+        "libpcre2",
+        "libselinux",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "common/**/*.java",
+    ],
+    platform_apis: true,
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    min_sdk_version: "21",
+}
diff --git a/tests/tests/selinux/selinuxTargetSdk28/Android.mk b/tests/tests/selinux/selinuxTargetSdk28/Android.mk
deleted file mode 100644
index b43086b..0000000
--- a/tests/tests/selinux/selinuxTargetSdk28/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Copyright (C) 2018 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_TAGS := tests
-LOCAL_MULTILIB := both
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs android.test.runner.stubs
-
-LOCAL_JNI_SHARED_LIBRARIES := \
-    libc++ \
-    libcrypto \
-    libcts_jni \
-    libctsselinux_jni \
-    libnativehelper \
-    libnativehelper_compat_libc++ \
-    libpackagelistparser \
-    libpcre2 \
-    libselinux \
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src common)
-LOCAL_PACKAGE_NAME := CtsSelinuxTargetSdk28TestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MIN_SDK_VERSION := 21
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/selinux/selinuxTargetSdk28/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdk28/AndroidTest.xml
index 71453c9..6a53a30 100644
--- a/tests/tests/selinux/selinuxTargetSdk28/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk28/AndroidTest.xml
@@ -17,7 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="security" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/selinux/selinuxTargetSdkCurrent/Android.bp b/tests/tests/selinux/selinuxTargetSdkCurrent/Android.bp
new file mode 100644
index 0000000..cbe4b8b
--- /dev/null
+++ b/tests/tests/selinux/selinuxTargetSdkCurrent/Android.bp
@@ -0,0 +1,51 @@
+//
+// 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.
+
+android_test {
+    name: "CtsSelinuxTargetSdkCurrentTestCases",
+    defaults: ["cts_defaults"],
+    compile_multilib: "both",
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: [
+        "android.test.base.stubs",
+        "android.test.runner.stubs",
+    ],
+    jni_libs: [
+        "libbase",
+        "libc++",
+        "libcrypto",
+        "libcts_jni",
+        "libctsselinux_jni",
+        "libnativehelper",
+        "libnativehelper_compat_libc++",
+        "libpackagelistparser",
+        "libpcre2",
+        "libselinux",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "common/**/*.java",
+    ],
+    platform_apis: true,
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    min_sdk_version: "21",
+}
diff --git a/tests/tests/selinux/selinuxTargetSdkCurrent/Android.mk b/tests/tests/selinux/selinuxTargetSdkCurrent/Android.mk
deleted file mode 100644
index 09115a4..0000000
--- a/tests/tests/selinux/selinuxTargetSdkCurrent/Android.mk
+++ /dev/null
@@ -1,48 +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_TAGS := tests
-LOCAL_MULTILIB := both
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt \
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs android.test.runner.stubs
-
-LOCAL_JNI_SHARED_LIBRARIES := \
-    libc++ \
-    libcrypto \
-    libcts_jni \
-    libctsselinux_jni \
-    libnativehelper \
-    libnativehelper_compat_libc++ \
-    libpackagelistparser \
-    libpcre2 \
-    libselinux \
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src common)
-LOCAL_PACKAGE_NAME := CtsSelinuxTargetSdkCurrentTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MIN_SDK_VERSION := 21
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidTest.xml
index f3f7d84..f4b6aa9 100644
--- a/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidTest.xml
@@ -17,7 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="security" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/shortcutmanager/Android.bp b/tests/tests/shortcutmanager/Android.bp
new file mode 100644
index 0000000..6b45de3
--- /dev/null
+++ b/tests/tests/shortcutmanager/Android.bp
@@ -0,0 +1,240 @@
+// 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.
+
+android_test {
+    name: "CtsShortcutManagerTestCases",
+    defaults: [
+        "cts_defaults",
+        "CtsShortcutManagerDefaults",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
+
+//-----------------------------------------------------------
+android_test_helper_app {
+    name: "CtsShortcutManagerLauncher1",
+    defaults: [
+        "cts_defaults",
+        "CtsShortcutManagerDefaults",
+    ],
+    srcs: ["packages/src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    aaptflags: [
+        "--rename-manifest-package",
+        "android.content.pm.cts.shortcutmanager.packages.launcher1",
+    ],
+    manifest: "packages/launchermanifest/AndroidManifest.xml",
+}
+
+//-----------------------------------------------------------
+android_test_helper_app {
+    name: "CtsShortcutManagerLauncher2",
+    defaults: [
+        "cts_defaults",
+        "CtsShortcutManagerDefaults",
+    ],
+    srcs: ["packages/src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    aaptflags: [
+        "--rename-manifest-package",
+        "android.content.pm.cts.shortcutmanager.packages.launcher2",
+    ],
+    manifest: "packages/launchermanifest/AndroidManifest.xml",
+}
+
+//-----------------------------------------------------------
+android_test_helper_app {
+    name: "CtsShortcutManagerLauncher3",
+    defaults: [
+        "cts_defaults",
+        "CtsShortcutManagerDefaults",
+    ],
+    srcs: ["packages/src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    aaptflags: [
+        "--rename-manifest-package",
+        "android.content.pm.cts.shortcutmanager.packages.launcher3",
+    ],
+    manifest: "packages/launchermanifest/AndroidManifest.xml",
+}
+
+android_test_helper_app {
+    name: "CtsShortcutManagerLauncher4",
+    defaults: [
+        "cts_defaults",
+        "CtsShortcutManagerDefaults",
+    ],
+    srcs: ["packages/src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    aaptflags: [
+        "--rename-manifest-package",
+        "android.content.pm.cts.shortcutmanager.packages.launcher4",
+    ],
+    manifest: "packages/launchermanifest_nonshared/AndroidManifest.xml",
+}
+
+android_test_helper_app {
+    name: "CtsShortcutManagerPackage1",
+    defaults: [
+        "cts_defaults",
+        "CtsShortcutManagerDefaults",
+    ],
+    srcs: ["packages/src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    aaptflags: [
+        "--rename-manifest-package",
+        "android.content.pm.cts.shortcutmanager.packages.package1",
+    ],
+    manifest: "packages/packagemanifest/AndroidManifest.xml",
+    resource_dirs: ["packages/packagemanifest/res"],
+}
+
+//-----------------------------------------------------------
+android_test_helper_app {
+    name: "CtsShortcutManagerPackage2",
+    defaults: [
+        "cts_defaults",
+        "CtsShortcutManagerDefaults",
+    ],
+    srcs: ["packages/src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    aaptflags: [
+        "--rename-manifest-package",
+        "android.content.pm.cts.shortcutmanager.packages.package2",
+    ],
+    manifest: "packages/packagemanifest/AndroidManifest.xml",
+    resource_dirs: ["packages/packagemanifest/res"],
+}
+
+//-----------------------------------------------------------
+android_test_helper_app {
+    name: "CtsShortcutManagerPackage3",
+    defaults: [
+        "cts_defaults",
+        "CtsShortcutManagerDefaults",
+    ],
+    srcs: ["packages/src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    aaptflags: [
+        "--rename-manifest-package",
+        "android.content.pm.cts.shortcutmanager.packages.package3",
+    ],
+    manifest: "packages/packagemanifest/AndroidManifest.xml",
+    resource_dirs: ["packages/packagemanifest/res"],
+}
+
+android_test_helper_app {
+    name: "CtsShortcutManagerPackage4",
+    defaults: [
+        "cts_defaults",
+        "CtsShortcutManagerDefaults",
+    ],
+    srcs: ["packages/src/**/*.java"],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    aaptflags: [
+        "--rename-manifest-package",
+        "android.content.pm.cts.shortcutmanager.packages.package4",
+    ],
+    manifest: "packages/packagemanifest_nonshared/AndroidManifest.xml",
+}
+
+android_test_helper_app {
+    name: "CtsShortcutManagerThrottlingTest",
+    defaults: [
+        "cts_defaults",
+        "CtsShortcutManagerDefaults",
+    ],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    srcs: ["throttling/src/**/*.java"],
+    min_sdk_version: "25",
+    manifest: "throttling/AndroidManifest.xml",
+}
+
+java_library {
+    name: "CtsShortcutManagerLib",
+    srcs: ["common/src/**/*.java"],
+    static_libs: [
+        "androidx.test.rules",
+        "ShortcutManagerTestUtils",
+    ],
+}
+
+java_defaults {
+    name: "CtsShortcutManagerDefaults",
+    sdk_version: "test_current",
+    static_libs: [
+        "androidx.test.rules",
+        "androidx.legacy_legacy-support-v4",
+        "mockito-target-minus-junit4",
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ub-uiautomator",
+        "ShortcutManagerTestUtils",
+        "CtsShortcutManagerLib",
+    ],
+}
diff --git a/tests/tests/shortcutmanager/Android.mk b/tests/tests/shortcutmanager/Android.mk
deleted file mode 100755
index 56a81a9..0000000
--- a/tests/tests/shortcutmanager/Android.mk
+++ /dev/null
@@ -1,45 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-java-files-under, common/src)
-
-LOCAL_PACKAGE_NAME := CtsShortcutManagerTestCases
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/shortcutmanager/packages/Android.mk b/tests/tests/shortcutmanager/packages/Android.mk
deleted file mode 100644
index 3d02f9c..0000000
--- a/tests/tests/shortcutmanager/packages/Android.mk
+++ /dev/null
@@ -1,17 +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 $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk b/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk
deleted file mode 100644
index 426bb89..0000000
--- a/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk
+++ /dev/null
@@ -1,105 +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_PACKAGE_NAME := CtsShortcutManagerLauncher1
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src) \
-        $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.launcher1
-
-include $(BUILD_CTS_PACKAGE)
-
-#-----------------------------------------------------------
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsShortcutManagerLauncher2
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src) \
-        $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.launcher2
-
-include $(BUILD_CTS_PACKAGE)
-
-#-----------------------------------------------------------
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsShortcutManagerLauncher3
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src) \
-        $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.launcher3
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk b/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk
deleted file mode 100644
index b894f13..0000000
--- a/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk
+++ /dev/null
@@ -1,44 +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_PACKAGE_NAME := CtsShortcutManagerLauncher4
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src) \
-        $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.launcher4
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk b/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk
deleted file mode 100644
index e645177..0000000
--- a/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk
+++ /dev/null
@@ -1,104 +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_PACKAGE_NAME := CtsShortcutManagerPackage1
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src) \
-        $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.package1
-
-include $(BUILD_CTS_PACKAGE)
-
-#-----------------------------------------------------------
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsShortcutManagerPackage2
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src) \
-        $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.package2
-
-include $(BUILD_CTS_PACKAGE)
-
-#-----------------------------------------------------------
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsShortcutManagerPackage3
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src) \
-        $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.package3
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk b/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk
deleted file mode 100644
index aa0112a..0000000
--- a/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk
+++ /dev/null
@@ -1,44 +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_PACKAGE_NAME := CtsShortcutManagerPackage4
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src) \
-        $(call all-java-files-under, ../../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.package4
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/shortcutmanager/throttling/Android.mk b/tests/tests/shortcutmanager/throttling/Android.mk
deleted file mode 100644
index 0300b15..0000000
--- a/tests/tests/shortcutmanager/throttling/Android.mk
+++ /dev/null
@@ -1,43 +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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsShortcutManagerThrottlingTest
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../common/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator \
-    ShortcutManagerTestUtils
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 25
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/simpleperf/CtsSimpleperfDebuggableApp/Android.bp b/tests/tests/simpleperf/CtsSimpleperfDebuggableApp/Android.bp
new file mode 100644
index 0000000..9513ecd
--- /dev/null
+++ b/tests/tests/simpleperf/CtsSimpleperfDebuggableApp/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsSimpleperfDebuggableApp",
+    defaults: ["cts_defaults"],
+    srcs: ["./**/*.java"],
+    manifest: "AndroidManifest.xml",
+    sdk_version: "current",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/simpleperf/CtsSimpleperfDebuggableApp/Android.mk b/tests/tests/simpleperf/CtsSimpleperfDebuggableApp/Android.mk
deleted file mode 100644
index 9b7821d..0000000
--- a/tests/tests/simpleperf/CtsSimpleperfDebuggableApp/Android.mk
+++ /dev/null
@@ -1,33 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, .)
-
-LOCAL_MANIFEST_FILE := AndroidManifest.xml
-
-LOCAL_PACKAGE_NAME := CtsSimpleperfDebuggableApp
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/simpleperf/CtsSimpleperfProfileableApp/Android.bp b/tests/tests/simpleperf/CtsSimpleperfProfileableApp/Android.bp
new file mode 100644
index 0000000..fef633c
--- /dev/null
+++ b/tests/tests/simpleperf/CtsSimpleperfProfileableApp/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsSimpleperfProfileableApp",
+    defaults: ["cts_defaults"],
+    srcs: ["./**/*.java"],
+    manifest: "AndroidManifest.xml",
+    sdk_version: "current",
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/simpleperf/CtsSimpleperfProfileableApp/Android.mk b/tests/tests/simpleperf/CtsSimpleperfProfileableApp/Android.mk
deleted file mode 100644
index d957ea8..0000000
--- a/tests/tests/simpleperf/CtsSimpleperfProfileableApp/Android.mk
+++ /dev/null
@@ -1,33 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, .)
-
-LOCAL_MANIFEST_FILE := AndroidManifest.xml
-
-LOCAL_PACKAGE_NAME := CtsSimpleperfProfileableApp
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/simpleperf/OWNERS b/tests/tests/simpleperf/OWNERS
new file mode 100644
index 0000000..dad033d
--- /dev/null
+++ b/tests/tests/simpleperf/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 14890
+yabinc@google.com
diff --git a/tests/tests/slice/Android.bp b/tests/tests/slice/Android.bp
new file mode 100644
index 0000000..a721b6f
--- /dev/null
+++ b/tests/tests/slice/Android.bp
@@ -0,0 +1,40 @@
+// 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.
+
+android_test {
+    name: "CtsSliceTestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    libs: ["android.test.runner.stubs"],
+    static_libs: [
+        "androidx.test.rules",
+        "ctstestrunner-axt",
+        "metrics-helper-lib",
+        "mockito-target-inline-minus-junit4",
+        "platform-test-annotations",
+        "ub-uiautomator",
+    ],
+    compile_multilib: "both",
+    jni_libs: [
+        "libdexmakerjvmtiagent",
+        "libmultiplejvmtiagentsinterferenceagent",
+    ],
+    srcs: ["src/**/*.java"],
+    platform_apis: true,
+}
diff --git a/tests/tests/slice/Android.mk b/tests/tests/slice/Android.mk
deleted file mode 100644
index b440d19..0000000
--- a/tests/tests/slice/Android.mk
+++ /dev/null
@@ -1,52 +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)
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    compatibility-device-util-axt \
-    ctsdeviceutillegacy-axt \
-    ctstestrunner-axt \
-    metrics-helper-lib \
-    mockito-target-inline-minus-junit4 \
-    platform-test-annotations \
-    ub-uiautomator
-
-LOCAL_MULTILIB := both
-
-LOCAL_JNI_SHARED_LIBRARIES := \
-    libdexmakerjvmtiagent \
-    libmultiplejvmtiagentsinterferenceagent
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsSliceTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/speech/Android.bp b/tests/tests/speech/Android.bp
new file mode 100644
index 0000000..ee5d124
--- /dev/null
+++ b/tests/tests/speech/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+android_test {
+    name: "CtsSpeechTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+    ],
+    libs: ["android.test.base.stubs"],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    // Needed for testing O API
+    //sdk_version: "test_current",
+    platform_apis: true,
+}
diff --git a/tests/tests/speech/Android.mk b/tests/tests/speech/Android.mk
deleted file mode 100755
index 24576d6..0000000
--- a/tests/tests/speech/Android.mk
+++ /dev/null
@@ -1,41 +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)
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsSpeechTestCases
-
-# Needed for testing O API
-#LOCAL_SDK_VERSION := test_current
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/syncmanager/Android.bp b/tests/tests/syncmanager/Android.bp
new file mode 100644
index 0000000..e14b629
--- /dev/null
+++ b/tests/tests/syncmanager/Android.bp
@@ -0,0 +1,38 @@
+// Copyright (C) 2018 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.
+
+android_test {
+    name: "CtsSyncManagerTestsCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "CtsSyncManagerCommon",
+        "androidx.test.rules",
+        "androidx.legacy_legacy-support-v4",
+        "mockito-target-minus-junit4",
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ub-uiautomator",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/syncmanager/Android.mk b/tests/tests/syncmanager/Android.mk
deleted file mode 100755
index ab16ed9..0000000
--- a/tests/tests/syncmanager/Android.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (C) 2018 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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    CtsSyncManagerCommon \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    ub-uiautomator
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsSyncManagerTestsCases
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/syncmanager/apps/Android.bp b/tests/tests/syncmanager/apps/Android.bp
new file mode 100644
index 0000000..9dfe862
--- /dev/null
+++ b/tests/tests/syncmanager/apps/Android.bp
@@ -0,0 +1,59 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "CtsSyncManagerApp1",
+    defaults: ["cts_defaults"],
+    srcs: ["app1/src/**/*.java"],
+    static_libs: [
+        "CtsSyncManagerCommon",
+        "androidx.test.rules",
+        "androidx.legacy_legacy-support-v4",
+        "mockito-target-minus-junit4",
+        "compatibility-device-util-axt",
+        "ub-uiautomator",
+    ],
+    sdk_version: "test_current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    manifest: "app1/AndroidManifest.xml",
+    resource_dirs: ["app1/res"],
+}
+
+android_test_helper_app {
+    name: "CtsSyncManagerApp2",
+    defaults: ["cts_defaults"],
+    srcs: ["app1/src/**/*.java"],
+    static_libs: [
+        "CtsSyncManagerCommon",
+        "androidx.test.rules",
+        "androidx.legacy_legacy-support-v4",
+        "mockito-target-minus-junit4",
+        "compatibility-device-util-axt",
+        "ub-uiautomator",
+    ],
+    sdk_version: "test_current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    manifest: "app2/AndroidManifest.xml",
+    resource_dirs: ["app2/res"],
+}
diff --git a/tests/tests/syncmanager/apps/Android.mk b/tests/tests/syncmanager/apps/Android.mk
deleted file mode 100644
index 9aaa6ac..0000000
--- a/tests/tests/syncmanager/apps/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (C) 2018 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 $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/syncmanager/apps/app1/Android.mk b/tests/tests/syncmanager/apps/app1/Android.mk
deleted file mode 100644
index c619fe3..0000000
--- a/tests/tests/syncmanager/apps/app1/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (C) 2018 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_PACKAGE_NAME := CtsSyncManagerApp1
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    CtsSyncManagerCommon \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ub-uiautomator
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/syncmanager/apps/app2/Android.mk b/tests/tests/syncmanager/apps/app2/Android.mk
deleted file mode 100644
index 50bc2f3..0000000
--- a/tests/tests/syncmanager/apps/app2/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (C) 2018 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_PACKAGE_NAME := CtsSyncManagerApp2
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../app1/src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    CtsSyncManagerCommon \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target-minus-junit4 \
-    compatibility-device-util-axt \
-    ub-uiautomator
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/syncmanager/common/Android.bp b/tests/tests/syncmanager/common/Android.bp
new file mode 100644
index 0000000..cba51fc
--- /dev/null
+++ b/tests/tests/syncmanager/common/Android.bp
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+java_library {
+    name: "CtsSyncManagerCommon",
+    srcs: [
+        "src/**/*.java",
+        "proto/**/*.proto",
+    ],
+    proto: {
+        type: "lite",
+    },
+    libs: [
+        "androidx.test.rules",
+        "androidx.legacy_legacy-support-v4",
+        "mockito-target",
+        "compatibility-device-util-axt",
+        "android.test.runner.stubs",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/syncmanager/common/Android.mk b/tests/tests/syncmanager/common/Android.mk
deleted file mode 100644
index c908b19..0000000
--- a/tests/tests/syncmanager/common/Android.mk
+++ /dev/null
@@ -1,36 +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_SRC_FILES := \
-    $(call all-java-files-under, src) \
-    $(call all-proto-files-under, proto)
-
-LOCAL_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    androidx.legacy_legacy-support-v4 \
-    mockito-target \
-    compatibility-device-util-axt \
-    android.test.runner.stubs
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := CtsSyncManagerCommon
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/tests/systemintents/Android.bp b/tests/tests/systemintents/Android.bp
new file mode 100644
index 0000000..37c4c24
--- /dev/null
+++ b/tests/tests/systemintents/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+android_test {
+    name: "CtsSystemIntentTestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/systemintents/Android.mk b/tests/tests/systemintents/Android.mk
deleted file mode 100644
index c68aaf1..0000000
--- a/tests/tests/systemintents/Android.mk
+++ /dev/null
@@ -1,34 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsSystemIntentTestCases
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/systemui/Android.bp b/tests/tests/systemui/Android.bp
new file mode 100644
index 0000000..884efb4
--- /dev/null
+++ b/tests/tests/systemui/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+android_test {
+    name: "CtsSystemUiTestCases",
+    defaults: ["cts_defaults"],
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    libs: ["android.test.runner.stubs"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "ub-uiautomator",
+    ],
+    srcs: ["src/**/*.java"],
+    platform_apis: true,
+}
diff --git a/tests/tests/systemui/Android.mk b/tests/tests/systemui/Android.mk
deleted file mode 100644
index 5b519b2..0000000
--- a/tests/tests/systemui/Android.mk
+++ /dev/null
@@ -1,39 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    androidx.test.rules \
-    ub-uiautomator
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsSystemUiTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/telecom/Android.bp b/tests/tests/telecom/Android.bp
new file mode 100644
index 0000000..11cac38
--- /dev/null
+++ b/tests/tests/telecom/Android.bp
@@ -0,0 +1,86 @@
+// 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.
+
+android_test {
+    name: "CtsTelecomTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "androidx.test.core",
+        "androidx.test.rules",
+        "CtsTelecomUtilLib",
+    ],
+    libs: [
+        "android.test.base.stubs",
+        "android.test.runner.stubs",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "CallScreeningServiceTestApp/**/*.java",
+        "CallScreeningServiceTestApp/**/I*.aidl",
+        "ThirdPtyInCallServiceTestApp/**/*.java",
+        "ThirdPtyInCallServiceTestApp/**/I*.aidl",
+        "CallRedirectionServiceTestApp/**/*.java",
+        "CallRedirectionServiceTestApp/**/I*.aidl",
+    ],
+    exclude_srcs: [
+        "src/android/telecom/cts/SelfManagedConnection.java",
+        "src/android/telecom/cts/CtsSelfManagedConnectionService.java",
+        "src/android/telecom/cts/TestUtils.java",
+    ],
+    aidl: {
+        local_include_dirs: [
+            "ThirdPtyInCallServiceTestApp/aidl/",
+            "CallRedirectionServiceTestApp/aidl/",
+            "CallScreeningServiceTestApp/aidl/",
+        ],
+    },
+    sdk_version: "test_current",
+    min_sdk_version: "21",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
+
+java_library {
+    name: "CtsTelecomMockLib",
+    srcs: [
+        "src/android/telecom/cts/MockInCallService.java",
+        "src/android/telecom/cts/MockVideoCallCallback.java",
+        "src/android/telecom/cts/MockVideoProvider.java",
+        "src/android/telecom/cts/MockConnection.java",
+    ],
+    static_libs: ["CtsTelecomUtilLib"],
+    libs: [
+        "androidx.test.core",
+        "androidx.test.rules",
+    ],
+}
+
+java_library {
+    name: "CtsTelecomUtilLib",
+    srcs: [
+        "src/android/telecom/cts/SelfManagedConnection.java",
+        "src/android/telecom/cts/CtsSelfManagedConnectionService.java",
+        "src/android/telecom/cts/TestUtils.java",
+    ],
+    libs: [
+        "androidx.test.core",
+        "androidx.test.rules",
+    ],
+}
diff --git a/tests/tests/telecom/Android.mk b/tests/tests/telecom/Android.mk
deleted file mode 100644
index ddf5518..0000000
--- a/tests/tests/telecom/Android.mk
+++ /dev/null
@@ -1,55 +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_PACKAGE_NAME := CtsTelecomTestCases
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-	compatibility-device-util-axt \
-	ctstestrunner-axt \
-	androidx.test.core \
-	androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-	           $(call all-java-files-under, CallScreeningServiceTestApp) \
-                   $(call all-Iaidl-files-under, CallScreeningServiceTestApp) \
-                   $(call all-java-files-under, ThirdPtyInCallServiceTestApp) \
-                   $(call all-Iaidl-files-under, ThirdPtyInCallServiceTestApp) \
-                   $(call all-java-files-under, CallRedirectionServiceTestApp) \
-                   $(call all-Iaidl-files-under, CallRedirectionServiceTestApp)
-
-LOCAL_AIDL_INCLUDES := ThirdPtyInCallServiceTestApp/aidl/ \
-                       CallRedirectionServiceTestApp/aidl/ \
-	               CallScreeningServiceTestApp/aidl/
-
-LOCAL_SDK_VERSION := test_current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_JAVA_LIBRARIES += android.test.runner.stubs
-
-include $(BUILD_CTS_PACKAGE)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/telecom/CallRedirectionServiceTestApp/Android.bp b/tests/tests/telecom/CallRedirectionServiceTestApp/Android.bp
new file mode 100644
index 0000000..822534f
--- /dev/null
+++ b/tests/tests/telecom/CallRedirectionServiceTestApp/Android.bp
@@ -0,0 +1,32 @@
+// Copyright (C) 2019 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.
+
+android_test_helper_app {
+    name: "CallRedirectionServiceTestApp",
+    srcs: [
+        "src/**/*.java",
+        "aidl/**/I*.aidl",
+    ],
+    aidl: {
+        local_include_dirs: ["aidl/"],
+    },
+    sdk_version: "test_current",
+    test_suites: [
+        "cts",
+        "vts",
+    ],
+    optimize: {
+        enabled: false,
+    },
+}
diff --git a/tests/tests/telecom/CallRedirectionServiceTestApp/Android.mk b/tests/tests/telecom/CallRedirectionServiceTestApp/Android.mk
deleted file mode 100644
index 5b89784..0000000
--- a/tests/tests/telecom/CallRedirectionServiceTestApp/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2019 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)
-
-src_dirs := src
-
-LOCAL_SRC_FILES := $(call all-java-files-under, $(src_dirs)) \
-                   $(call all-Iaidl-files-under, aidl)
-
-LOCAL_AIDL_INCLUDES := aidl/
-
-LOCAL_PACKAGE_NAME := CallRedirectionServiceTestApp
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_SDK_VERSION := test_current
-LOCAL_COMPATIBILITY_SUITE := cts vts
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-include $(BUILD_PACKAGE)
diff --git a/tests/tests/telecom/CallScreeningServiceTestApp/Android.bp b/tests/tests/telecom/CallScreeningServiceTestApp/Android.bp
new file mode 100644
index 0000000..a8ff58c
--- /dev/null
+++ b/tests/tests/telecom/CallScreeningServiceTestApp/Android.bp
@@ -0,0 +1,34 @@
+// Copyright (C) 2018 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 the Call Screening test app.
+// This is intentionally packaged separately so that the app can use its own
+// package name which does not conflict with the CallScreeningService
+// associated with the CTS InCallService.
+
+android_test_helper_app {
+    name: "CallScreeningServiceTestApp",
+    srcs: [
+        "src/**/*.java",
+        "aidl/**/I*.aidl",
+    ],
+    sdk_version: "test_current",
+    test_suites: [
+        "cts",
+        "vts",
+    ],
+    optimize: {
+        enabled: false,
+    },
+}
diff --git a/tests/tests/telecom/CallScreeningServiceTestApp/Android.mk b/tests/tests/telecom/CallScreeningServiceTestApp/Android.mk
deleted file mode 100644
index ae09720..0000000
--- a/tests/tests/telecom/CallScreeningServiceTestApp/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2018 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 the Call Screening test app.
-# This is intentionally packaged separately so that the app can use its own
-# package name which does not conflict with the CallScreeningService
-# associated with the CTS InCallService.
-include $(CLEAR_VARS)
-
-src_dirs := src
-
-LOCAL_AIDL_INCLUDES := $(call all-Iaidl-files-under, aidl)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, $(src_dirs)) \
-                   $(call all-Iaidl-files-under, aidl)
-
-LOCAL_PACKAGE_NAME := CallScreeningServiceTestApp
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_SDK_VERSION := test_current
-LOCAL_COMPATIBILITY_SUITE := cts vts
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-include $(BUILD_PACKAGE)
diff --git a/tests/tests/telecom/ThirdPtyInCallServiceTestApp/Android.bp b/tests/tests/telecom/ThirdPtyInCallServiceTestApp/Android.bp
new file mode 100644
index 0000000..92a3c42
--- /dev/null
+++ b/tests/tests/telecom/ThirdPtyInCallServiceTestApp/Android.bp
@@ -0,0 +1,33 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "ThirdPtyInCallServiceTestApp",
+    defaults: ["cts_defaults"],
+    srcs: [
+        "src/**/*.java",
+        "aidl/**/I*.aidl",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+        "CtsTelecomMockLib",
+    ],
+    sdk_version: "test_current",
+    test_suites: [
+        "cts",
+        "vts",
+    ],
+}
diff --git a/tests/tests/telecom/ThirdPtyInCallServiceTestApp/Android.mk b/tests/tests/telecom/ThirdPtyInCallServiceTestApp/Android.mk
deleted file mode 100644
index 9152435..0000000
--- a/tests/tests/telecom/ThirdPtyInCallServiceTestApp/Android.mk
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (C) 2018 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)
-
-src_dirs := src \
-    ../src/android/telecom/cts/MockInCallService.java \
-    ../src/android/telecom/cts/MockVideoCallCallback.java \
-    ../src/android/telecom/cts/MockVideoProvider.java \
-    ../src/android/telecom/cts/TestUtils.java \
-    ../src/android/telecom/cts/MockConnection.java \
-    ../src/android/telecom/cts/SelfManagedConnection.java \
-    ../src/android/telecom/cts/CtsSelfManagedConnectionService.java
-
-LOCAL_SRC_FILES := $(call all-java-files-under, $(src_dirs)) \
-                   $(call all-Iaidl-files-under, aidl)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-	compatibility-device-util-axt \
-	ctstestrunner-axt \
-	androidx.test.rules
-
-LOCAL_AIDL_INCLUDES := aidl/
-
-LOCAL_PACKAGE_NAME := ThirdPtyInCallServiceTestApp
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_SDK_VERSION := test_current
-LOCAL_COMPATIBILITY_SUITE := cts vts
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_PROGUARD_ENABLED := disabled
-include $(BUILD_CTS_PACKAGE)
\ No newline at end of file
diff --git a/tests/tests/telecom/ThirdPtyInCallServiceTestApp/AndroidManifest.xml b/tests/tests/telecom/ThirdPtyInCallServiceTestApp/AndroidManifest.xml
index 4f439fb..eb509ec 100644
--- a/tests/tests/telecom/ThirdPtyInCallServiceTestApp/AndroidManifest.xml
+++ b/tests/tests/telecom/ThirdPtyInCallServiceTestApp/AndroidManifest.xml
@@ -35,6 +35,8 @@
             <intent-filter>
                 <action android:name="android.telecom.InCallService"/>
             </intent-filter>
+            <meta-data android:name="android.telecom.IN_CALL_SERVICE_CAR_MODE_UI"
+                       android:value="true" />
             <meta-data android:name="android.telecom.INCLUDE_EXTERNAL_CALLS"
                        android:value="true" />
         </service>
@@ -45,18 +47,6 @@
                     android:name="android.telecom.cts.thirdptyincallservice.ACTION_THIRDPTY_CTRL"/>
             </intent-filter>
         </service>
-        <service android:name=".CtsThirdPartyInCallService"
-                 android:permission="android.permission.BIND_INCALL_SERVICE"
-                 android:launchMode="singleInstance"
-                 android:exported="true">
-            <intent-filter>
-                <action android:name="android.telecom.InCallService"/>
-            </intent-filter>
-            <meta-data android:name="android.telecom.IN_CALL_SERVICE_CAR_MODE_UI"
-                       android:value="true" />
-            <meta-data android:name="android.telecom.INCLUDE_EXTERNAL_CALLS"
-                       android:value="true" />
-        </service>
     </application>
 
 </manifest>
diff --git a/tests/tests/telecom2/Android.bp b/tests/tests/telecom2/Android.bp
new file mode 100644
index 0000000..b80bb47
--- /dev/null
+++ b/tests/tests/telecom2/Android.bp
@@ -0,0 +1,41 @@
+// 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.
+
+android_test {
+    name: "CtsTelecomTestCases2",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "CtsTelecomUtilLib",
+    ],
+    libs: ["android.test.base.stubs"],
+    srcs: [
+        "src/**/*.java",
+    ],
+    aaptflags: [
+        "--auto-add-overlay",
+        "--extra-packages",
+        "android.telecom.cts",
+        "--rename-manifest-package",
+        "android.telecom2.cts",
+    ],
+    sdk_version: "test_current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/telecom2/Android.mk b/tests/tests/telecom2/Android.mk
deleted file mode 100644
index 1a207b7..0000000
--- a/tests/tests/telecom2/Android.mk
+++ /dev/null
@@ -1,55 +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_PACKAGE_NAME := CtsTelecomTestCases2
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-	compatibility-device-util-axt \
-	ctstestrunner-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-src_dirs := src \
-    ../telecom/src/android/telecom/cts/SelfManagedConnection.java \
-    ../telecom/src/android/telecom/cts/CtsSelfManagedConnectionService.java \
-    ../telecom/src/android/telecom/cts/TestUtils.java
-
-res_dirs := res \
-    ../telecom/res
-
-LOCAL_SRC_FILES := $(call all-java-files-under, $(src_dirs))
-
-LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs))
-
-LOCAL_AAPT_FLAGS := \
-    --auto-add-overlay \
-    --extra-packages android.telecom.cts \
-    --rename-manifest-package android.telecom2.cts \
-
-LOCAL_SDK_VERSION := test_current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/telecom3/Android.bp b/tests/tests/telecom3/Android.bp
new file mode 100644
index 0000000..bfc580f
--- /dev/null
+++ b/tests/tests/telecom3/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+
+res_dirs = ["../telecom/res"]
+android_test {
+    name: "CtsTelecomTestCases3",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "CtsTelecomUtilLib",
+    ],
+    libs: ["android.test.base.stubs"],
+    srcs: ["src/**/*.java"],
+    aaptflags: [
+        "--auto-add-overlay",
+        "--extra-packages android.telecom.cts",
+        "--rename-manifest-package android.telecom3.cts",
+    ],
+    sdk_version: "test_current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/tests/telecom3/Android.mk b/tests/tests/telecom3/Android.mk
deleted file mode 100644
index ff195bd..0000000
--- a/tests/tests/telecom3/Android.mk
+++ /dev/null
@@ -1,52 +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_PACKAGE_NAME := CtsTelecomTestCases3
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-src_dirs := src \
-    ../telecom/src/android/telecom/cts/SelfManagedConnection.java \
-    ../telecom/src/android/telecom/cts/CtsSelfManagedConnectionService.java \
-    ../telecom/src/android/telecom/cts/TestUtils.java
-
-res_dirs := ../telecom/res
-
-LOCAL_SRC_FILES := $(call all-java-files-under, $(src_dirs))
-
-LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs))
-
-LOCAL_AAPT_FLAGS := \
-    --auto-add-overlay \
-    --extra-packages android.telecom.cts \
-    --rename-manifest-package android.telecom3.cts \
-
-LOCAL_SDK_VERSION := test_current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
index 57394d7..f927395 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
@@ -46,9 +46,12 @@
 import android.telecom.TelecomManager;
 import android.telephony.AccessNetworkConstants;
 import android.telephony.AvailableNetworkInfo;
+import android.telephony.CallAttributes;
+import android.telephony.CallQuality;
 import android.telephony.CellLocation;
 import android.telephony.NetworkRegistrationInfo;
 import android.telephony.PhoneStateListener;
+import android.telephony.PreciseCallState;
 import android.telephony.ServiceState;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
@@ -1183,7 +1186,7 @@
      * Tests that a SecurityException is thrown when trying to access UiccCardsInfo.
      */
     @Test
-    public void testGetUiccCardsInfo() {
+    public void testGetUiccCardsInfoException() {
         try {
             // Requires READ_PRIVILEGED_PHONE_STATE or carrier privileges
             List<UiccCardInfo> infos = mTelephonyManager.getUiccCardsInfo();
@@ -1192,6 +1195,27 @@
         }
     }
 
+    /**
+     * Tests that UiccCardsInfo methods don't crash.
+     */
+    @Test
+    public void testGetUiccCardsInfo() {
+        // Requires READ_PRIVILEGED_PHONE_STATE or carrier privileges
+        List<UiccCardInfo> infos =
+                ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+                (tm) -> tm.getUiccCardsInfo());
+        // test that these methods don't crash
+        if (infos.size() > 0) {
+            UiccCardInfo info = infos.get(0);
+            info.getIccId();
+            info.getEid();
+            info.isRemovable();
+            info.isEuicc();
+            info.getCardId();
+            info.getSlotIndex();
+        }
+    }
+
     private static Context getContext() {
         return InstrumentationRegistry.getContext();
     }
@@ -1233,6 +1257,38 @@
     }
 
     /**
+     * Construct a CallAttributes object and test getters.
+     */
+    @Test
+    public void testCallAttributes() {
+        CallQuality cq = new CallQuality();
+        PreciseCallState pcs = new PreciseCallState();
+        CallAttributes ca = new CallAttributes(pcs, TelephonyManager.NETWORK_TYPE_UNKNOWN, cq);
+        assertEquals(pcs, ca.getPreciseCallState());
+        assertEquals(TelephonyManager.NETWORK_TYPE_UNKNOWN, ca.getNetworkType());
+        assertEquals(cq, ca.getCallQuality());
+    }
+
+    /**
+     * Checks that a zeroed-out default CallQuality object can be created
+     */
+    @Test
+    public void testCallQuality() {
+        CallQuality cq = new CallQuality();
+        assertEquals(0, cq.getDownlinkCallQualityLevel());
+        assertEquals(0, cq.getUplinkCallQualityLevel());
+        assertEquals(0, cq.getCallDuration());
+        assertEquals(0, cq.getNumRtpPacketsTransmitted());
+        assertEquals(0, cq.getNumRtpPacketsReceived());
+        assertEquals(0, cq.getNumRtpPacketsTransmittedLost());
+        assertEquals(0, cq.getNumRtpPacketsNotReceived());
+        assertEquals(0, cq.getAverageRelativeJitter());
+        assertEquals(0, cq.getMaxRelativeJitter());
+        assertEquals(0, cq.getAverageRoundTripTime());
+        assertEquals(0, cq.getCodecType());
+    }
+
+    /**
      * Tests TelephonyManager.getEmergencyNumberList.
      */
     @Test
diff --git a/tests/tests/telephony/current/src/android/telephony/euicc/cts/EuiccProfileInfoTest.java b/tests/tests/telephony/current/src/android/telephony/euicc/cts/EuiccProfileInfoTest.java
new file mode 100644
index 0000000..ca203f8
--- /dev/null
+++ b/tests/tests/telephony/current/src/android/telephony/euicc/cts/EuiccProfileInfoTest.java
@@ -0,0 +1,238 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+package android.telephony.euicc.cts;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
+import android.os.Parcel;
+import android.service.carrier.CarrierIdentifier;
+import android.service.euicc.EuiccProfileInfo;
+import android.telephony.UiccAccessRule;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Arrays;
+
+/**
+ * This class is an exact copy of
+ * frameworks/base/core/tests/coretests/src/android/service/euicc/EuiccProfileInfoTest.java, except
+ * {@link #testBuilderBuild_IllegalIccid}
+ */
+@RunWith(AndroidJUnit4.class)
+public class EuiccProfileInfoTest {
+    @Test
+    public void testWriteToParcel() {
+        EuiccProfileInfo p =
+                new EuiccProfileInfo.Builder("21430000000000006587")
+                        .setNickname("profile nickname")
+                        .setServiceProviderName("service provider")
+                        .setProfileName("profile name")
+                        .setProfileClass(EuiccProfileInfo.PROFILE_CLASS_OPERATIONAL)
+                        .setState(EuiccProfileInfo.PROFILE_STATE_ENABLED)
+                        .setCarrierIdentifier(
+                                new CarrierIdentifier(
+                                        new byte[] {0x23, 0x45, 0x67},
+                                        "123",
+                                        "45"))
+                        .setPolicyRules(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE)
+                        .setUiccAccessRule(
+                                Arrays.asList(new UiccAccessRule(new byte[] {}, "package", 12345L)))
+                        .build();
+
+        Parcel parcel = Parcel.obtain();
+        assertTrue(parcel != null);
+        p.writeToParcel(parcel, 0);
+
+        parcel.setDataPosition(0);
+        EuiccProfileInfo fromParcel = EuiccProfileInfo.CREATOR.createFromParcel(parcel);
+
+        assertEquals(p, fromParcel);
+    }
+
+    @Test
+    public void testWriteToParcelNullCarrierId() {
+        EuiccProfileInfo p =
+                new EuiccProfileInfo.Builder("21430000000000006587")
+                        .setNickname("profile nickname")
+                        .setServiceProviderName("service provider")
+                        .setProfileName("profile name")
+                        .setProfileClass(EuiccProfileInfo.PROFILE_CLASS_OPERATIONAL)
+                        .setState(EuiccProfileInfo.PROFILE_STATE_ENABLED)
+                        .setPolicyRules(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE)
+                        .setUiccAccessRule(
+                                Arrays.asList(new UiccAccessRule(new byte[] {}, "package", 12345L))
+                        )
+                        .build();
+
+        Parcel parcel = Parcel.obtain();
+        assertTrue(parcel != null);
+        p.writeToParcel(parcel, 0);
+
+        parcel.setDataPosition(0);
+        EuiccProfileInfo fromParcel = EuiccProfileInfo.CREATOR.createFromParcel(parcel);
+
+        assertEquals(p, fromParcel);
+    }
+
+    @Test
+    public void testBuilderAndGetters() {
+        EuiccProfileInfo p =
+                new EuiccProfileInfo.Builder("21430000000000006587")
+                        .setNickname("profile nickname")
+                        .setProfileName("profile name")
+                        .setServiceProviderName("service provider")
+                        .setCarrierIdentifier(
+                                new CarrierIdentifier(
+                                        new byte[] {0x23, 0x45, 0x67},
+                                        "123",
+                                        "45"))
+                        .setState(EuiccProfileInfo.PROFILE_STATE_ENABLED)
+                        .setProfileClass(EuiccProfileInfo.PROFILE_CLASS_OPERATIONAL)
+                        .setPolicyRules(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE)
+                        .setUiccAccessRule(Arrays.asList(new UiccAccessRule(new byte[0], null, 0)))
+                        .build();
+
+        assertEquals("21430000000000006587", p.getIccid());
+        assertEquals("profile nickname", p.getNickname());
+        assertEquals("profile name", p.getProfileName());
+        assertEquals("service provider", p.getServiceProviderName());
+        assertEquals("325", p.getCarrierIdentifier().getMcc());
+        assertEquals("764", p.getCarrierIdentifier().getMnc());
+        assertEquals("123", p.getCarrierIdentifier().getGid1());
+        assertEquals("45", p.getCarrierIdentifier().getGid2());
+        assertEquals(EuiccProfileInfo.PROFILE_STATE_ENABLED, p.getState());
+        assertEquals(EuiccProfileInfo.PROFILE_CLASS_OPERATIONAL, p.getProfileClass());
+        assertEquals(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE, p.getPolicyRules());
+        assertTrue(p.hasPolicyRules());
+        assertTrue(p.hasPolicyRule(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE));
+        assertFalse(p.hasPolicyRule(EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE));
+        assertArrayEquals(
+                new UiccAccessRule[] {new UiccAccessRule(new byte[0], null, 0)},
+                p.getUiccAccessRules().toArray());
+    }
+
+    @Test
+    public void testBuilder_BasedOnAnotherProfile() {
+        EuiccProfileInfo p =
+                new EuiccProfileInfo.Builder("21430000000000006587")
+                        .setNickname("profile nickname")
+                        .setProfileName("profile name")
+                        .setServiceProviderName("service provider")
+                        .setCarrierIdentifier(
+                                new CarrierIdentifier(
+                                        new byte[] {0x23, 0x45, 0x67},
+                                        "123",
+                                        "45"))
+                        .setState(EuiccProfileInfo.PROFILE_STATE_ENABLED)
+                        .setProfileClass(EuiccProfileInfo.PROFILE_CLASS_OPERATIONAL)
+                        .setPolicyRules(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE)
+                        .setUiccAccessRule(
+                                Arrays.asList(new UiccAccessRule(new byte[] {}, "package", 12345L)))
+                        .build();
+
+        EuiccProfileInfo copied = new EuiccProfileInfo.Builder(p).build();
+
+        assertEquals(p, copied);
+        assertEquals(p.hashCode(), copied.hashCode());
+    }
+
+    @Test
+    public void testEqualsHashCode() {
+        EuiccProfileInfo p =
+                new EuiccProfileInfo.Builder("21430000000000006587")
+                        .setNickname("profile nickname")
+                        .setProfileName("profile name")
+                        .setServiceProviderName("service provider")
+                        .setCarrierIdentifier(
+                                new CarrierIdentifier(
+                                        new byte[] {0x23, 0x45, 0x67},
+                                        "123",
+                                        "45"))
+                        .setState(EuiccProfileInfo.PROFILE_STATE_ENABLED)
+                        .setProfileClass(EuiccProfileInfo.PROFILE_STATE_ENABLED)
+                        .setPolicyRules(EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE)
+                        .setUiccAccessRule(Arrays.asList(new UiccAccessRule(new byte[0], null, 0)))
+                        .build();
+
+        assertTrue(p.equals(p));
+        assertFalse(p.equals(new Object()));
+
+        EuiccProfileInfo t = null;
+        assertFalse(p.equals(t));
+
+        t = new EuiccProfileInfo.Builder(p).setIccid("21").build();
+        assertFalse(p.equals(t));
+        assertNotEquals(p.hashCode(), t.hashCode());
+
+        t = new EuiccProfileInfo.Builder(p).setNickname(null).build();
+        assertFalse(p.equals(t));
+        assertNotEquals(p.hashCode(), t.hashCode());
+
+        t = new EuiccProfileInfo.Builder(p).setProfileName(null).build();
+        assertFalse(p.equals(t));
+        assertNotEquals(p.hashCode(), t.hashCode());
+
+        t = new EuiccProfileInfo.Builder(p).setServiceProviderName(null).build();
+        assertFalse(p.equals(t));
+        assertNotEquals(p.hashCode(), t.hashCode());
+
+        t = new EuiccProfileInfo.Builder(p).setCarrierIdentifier(null).build();
+        assertFalse(p.equals(t));
+        assertNotEquals(p.hashCode(), t.hashCode());
+
+        t = new EuiccProfileInfo.Builder(p)
+                .setState(EuiccProfileInfo.PROFILE_STATE_DISABLED).build();
+        assertFalse(p.equals(t));
+        assertNotEquals(p.hashCode(), t.hashCode());
+
+        t = new EuiccProfileInfo.Builder(p)
+                .setProfileClass(EuiccProfileInfo.PROFILE_CLASS_TESTING).build();
+        assertFalse(p.equals(t));
+        assertNotEquals(p.hashCode(), t.hashCode());
+
+        t = new EuiccProfileInfo.Builder(p).setPolicyRules(0).build();
+        assertFalse(p.equals(t));
+        assertNotEquals(p.hashCode(), t.hashCode());
+
+        t = new EuiccProfileInfo.Builder(p).setUiccAccessRule(null).build();
+        assertFalse(p.equals(t));
+        assertNotEquals(p.hashCode(), t.hashCode());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testBuilderBuild_IllegalIccid() {
+        new EuiccProfileInfo.Builder("abc").build();
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testBuilderSetOperatorMccMnc_Illegal() {
+        new EuiccProfileInfo.Builder("21430000000000006587")
+                .setCarrierIdentifier(new CarrierIdentifier(new byte[] {1, 2, 3, 4}, null, null));
+    }
+
+    @Test
+    public void testCreatorNewArray() {
+        EuiccProfileInfo[] profiles = EuiccProfileInfo.CREATOR.newArray(123);
+        assertEquals(123, profiles.length);
+    }
+}
diff --git a/tests/tests/telephony2/Android.bp b/tests/tests/telephony2/Android.bp
new file mode 100644
index 0000000..def3a75
--- /dev/null
+++ b/tests/tests/telephony2/Android.bp
@@ -0,0 +1,34 @@
+// 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.
+
+android_test {
+    name: "CtsTelephony2TestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    sdk_version: "test_current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+}
diff --git a/tests/tests/telephony2/Android.mk b/tests/tests/telephony2/Android.mk
deleted file mode 100644
index 90cfe97..0000000
--- a/tests/tests/telephony2/Android.mk
+++ /dev/null
@@ -1,40 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner-axt \
-    compatibility-device-util-axt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsTelephony2TestCases
-LOCAL_SDK_VERSION := current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_JAVA_LIBRARIES += android.test.runner.stubs
-LOCAL_JAVA_LIBRARIES += android.test.base.stubs
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/SmsConversationTest.java b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/SmsConversationTest.java
new file mode 100644
index 0000000..69f3ce6
--- /dev/null
+++ b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/SmsConversationTest.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+package android.telephonyprovider.cts;
+
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.Telephony;
+import android.provider.Telephony.Sms.Conversations;
+
+import androidx.test.filters.SmallTest;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@SmallTest
+public class SmsConversationTest {
+
+    private static final String TEST_ADDRESS = "+19998880001";
+    private static final String TEST_SMS_BODY = "TEST_SMS_BODY";
+    private Context mContext;
+    private ContentResolver mContentResolver;
+
+    @BeforeClass
+    public static void ensureDefaultSmsApp() {
+        DefaultSmsAppHelper.ensureDefaultSmsApp();
+    }
+
+    @AfterClass
+    public static void cleanup() {
+        ContentResolver contentResolver = getInstrumentation().getContext().getContentResolver();
+        contentResolver.delete(Telephony.Sms.CONTENT_URI, null, null);
+    }
+
+    @Before
+    public void setupTestEnvironment() {
+        cleanup();
+        mContentResolver = getInstrumentation().getContext().getContentResolver();
+    }
+
+    /**
+     * The purpose of this test is to check most recent insert sms body equals to the Conversation
+     * Snippet
+     */
+    @Test
+    public void testQueryConversation_snippetEqualsMostRecentMessageBody() {
+        String testSmsMostRecent = "TEST_SMS_MOST_RECENT";
+
+        saveToTelephony(TEST_SMS_BODY, TEST_ADDRESS);
+        saveToTelephony(testSmsMostRecent, TEST_ADDRESS);
+
+        Cursor cursor = mContentResolver
+                .query(Telephony.Sms.CONTENT_URI, null, null, null);
+        assertThat(cursor.getCount()).isEqualTo(2);
+
+        Cursor conversationCursor = mContentResolver
+                .query(Conversations.CONTENT_URI, null, null, null);
+        assertThat(conversationCursor.getCount()).isEqualTo(1);
+        conversationCursor.moveToNext();
+
+        assertThat(
+            conversationCursor.getString(conversationCursor.getColumnIndex(Conversations.SNIPPET)))
+            .isEqualTo(testSmsMostRecent);
+    }
+
+    /**
+     * The purpose of this test is to check Conversation message count is equal to the number of sms
+     * inserted.
+     */
+    @Test
+    public void testQueryConversation_returnsCorrectMessageCount() {
+        String testSecondSmsBody = "TEST_SECOND_SMS_BODY";
+
+        saveToTelephony(TEST_SMS_BODY, TEST_ADDRESS);
+        saveToTelephony(testSecondSmsBody, TEST_ADDRESS);
+
+        Cursor cursor = mContentResolver
+                .query(Telephony.Sms.CONTENT_URI, null, null, null);
+        assertThat(cursor.getCount()).isEqualTo(2);
+
+        Cursor conversationCursor = mContentResolver
+                .query(Conversations.CONTENT_URI, null, null, null);
+        assertThat(conversationCursor.getCount()).isEqualTo(1);
+        conversationCursor.moveToNext();
+
+        assertThat(conversationCursor
+            .getInt(conversationCursor.getColumnIndex(Conversations.MESSAGE_COUNT)))
+            .isEqualTo(2);
+    }
+
+    public void saveToTelephony(String messageBody, String address) {
+        ContentValues values = new ContentValues();
+        values.put(Telephony.Sms.BODY, messageBody);
+        values.put(Telephony.Sms.ADDRESS, address);
+        Uri uri1 = mContentResolver.insert(Telephony.Sms.CONTENT_URI, values);
+    }
+}
+
diff --git a/tests/tests/text/Android.bp b/tests/tests/text/Android.bp
index bd65797..26a60ee 100644
--- a/tests/tests/text/Android.bp
+++ b/tests/tests/text/Android.bp
@@ -36,6 +36,14 @@
         "android.test.base.stubs",
     ],
 
+    jni_libs: [
+        "libctstext_jni",
+        "libc++",
+    ],
+    // Include both the 32 and 64 bit versions of libctstext_jni, where
+    // applicable.
+    compile_multilib: "both",
+
     test_suites: [
         "cts",
         "vts",
diff --git a/tests/tests/text/jni/Android.bp b/tests/tests/text/jni/Android.bp
new file mode 100644
index 0000000..8055f40
--- /dev/null
+++ b/tests/tests/text/jni/Android.bp
@@ -0,0 +1,22 @@
+// Copyright (C) 2019 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 {
+    name: "libctstext_jni",
+    srcs: [
+        "CtsTextJniOnLoad.cpp",
+        "android_text_format_cts_NativeTimeFunctions.cpp",
+    ],
+    static_libs: ["libnativehelper"],
+}
diff --git a/tests/tests/text/jni/CtsTextJniOnLoad.cpp b/tests/tests/text/jni/CtsTextJniOnLoad.cpp
new file mode 100644
index 0000000..04e14f5
--- /dev/null
+++ b/tests/tests/text/jni/CtsTextJniOnLoad.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2019 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 <jni.h>
+#include <stdio.h>
+
+extern int register_android_text_format_cts_NativeTimeFunctions(JNIEnv*);
+
+jint JNI_OnLoad(JavaVM *vm, void *) {
+    JNIEnv *env = NULL;
+
+    if (vm->GetEnv((void **) &env, JNI_VERSION_1_4) != JNI_OK) {
+        return JNI_ERR;
+    }
+
+    if (register_android_text_format_cts_NativeTimeFunctions(env)) {
+        return JNI_ERR;
+    }
+
+    return JNI_VERSION_1_4;
+}
diff --git a/tests/tests/text/jni/android_text_format_cts_NativeTimeFunctions.cpp b/tests/tests/text/jni/android_text_format_cts_NativeTimeFunctions.cpp
new file mode 100644
index 0000000..0c85c1e
--- /dev/null
+++ b/tests/tests/text/jni/android_text_format_cts_NativeTimeFunctions.cpp
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2019 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 <jni.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include "nativehelper/scoped_utf_chars.h"
+
+// Information about the Java StructTm class.
+static struct {
+    jclass clazz;
+    jmethodID ctor;
+    jfieldID tm_sec;
+    jfieldID tm_min;
+    jfieldID tm_hour;
+    jfieldID tm_mday;
+    jfieldID tm_mon;
+    jfieldID tm_year;
+    jfieldID tm_wday;
+    jfieldID tm_yday;
+    jfieldID tm_isdst;
+    jfieldID tm_gmtoff;
+    jfieldID tm_zone;
+} gStructTmClassInfo;
+
+// The following is not threadsafe but that's a problem with getenv(), setenv(), mktime() it
+// would be impractical to get around. Luckily, tests are single threaded.
+#define SET_TZ(jni_env, javaTzId) \
+    char _originalTz[64]; \
+    char* _tzEnv = getenv("TZ"); \
+    if (_tzEnv != nullptr) { \
+        strncpy(_originalTz, _tzEnv, sizeof(_originalTz)); \
+        _originalTz[sizeof(_originalTz) - 1] = 0; \
+    } \
+    ScopedUtfChars _tzId(jni_env, javaTzId); \
+    setenv("TZ", _tzId.c_str(), 1);
+
+#define UNSET_TZ() \
+    if (_tzEnv != nullptr) { \
+        setenv("TZ", _originalTz, 1); \
+    }
+
+
+static jobject android_text_format_cts_NativeTimeFunctions_localtime_tz(
+        JNIEnv* env, jclass, jint javaTimep, jstring javaTzId)
+{
+    // Call localtime_r
+    struct tm out_tm;
+    {
+        SET_TZ(env, javaTzId);
+
+        const time_t timep = javaTimep;
+        localtime_r(&timep, &out_tm);
+
+        UNSET_TZ();
+    }
+
+    // Copy the results to a StructTm object.
+    jobject javaTm = env->NewObject(gStructTmClassInfo.clazz, gStructTmClassInfo.ctor);
+    env->SetIntField(javaTm, gStructTmClassInfo.tm_sec, out_tm.tm_sec);
+    env->SetIntField(javaTm, gStructTmClassInfo.tm_min, out_tm.tm_min);
+    env->SetIntField(javaTm, gStructTmClassInfo.tm_hour, out_tm.tm_hour);
+    env->SetIntField(javaTm, gStructTmClassInfo.tm_mday, out_tm.tm_mday);
+    env->SetIntField(javaTm, gStructTmClassInfo.tm_mon, out_tm.tm_mon);
+    env->SetIntField(javaTm, gStructTmClassInfo.tm_year, out_tm.tm_year);
+    env->SetIntField(javaTm, gStructTmClassInfo.tm_wday, out_tm.tm_wday);
+    env->SetIntField(javaTm, gStructTmClassInfo.tm_yday, out_tm.tm_yday);
+    env->SetIntField(javaTm, gStructTmClassInfo.tm_isdst, out_tm.tm_isdst);
+    env->SetLongField(javaTm, gStructTmClassInfo.tm_gmtoff, out_tm.tm_gmtoff);
+    env->SetObjectField(javaTm, gStructTmClassInfo.tm_zone, env->NewStringUTF(out_tm.tm_zone));
+    return javaTm;
+}
+
+static jint android_text_format_cts_NativeTimeFunctions_mktime_tz(
+        JNIEnv* env, jclass, jobject javaTm, jstring javaTzId)
+{
+    // Populate a tm struct from the Java StructTm object.
+    struct tm in_tm;
+    in_tm.tm_sec = env->GetIntField(javaTm, gStructTmClassInfo.tm_sec);
+    in_tm.tm_min = env->GetIntField(javaTm, gStructTmClassInfo.tm_min);
+    in_tm.tm_hour = env->GetIntField(javaTm, gStructTmClassInfo.tm_hour);
+    in_tm.tm_mday = env->GetIntField(javaTm, gStructTmClassInfo.tm_mday);
+    in_tm.tm_mon = env->GetIntField(javaTm, gStructTmClassInfo.tm_mon);
+    in_tm.tm_year = env->GetIntField(javaTm, gStructTmClassInfo.tm_year);
+    in_tm.tm_wday = env->GetIntField(javaTm, gStructTmClassInfo.tm_wday);
+    in_tm.tm_yday = env->GetIntField(javaTm, gStructTmClassInfo.tm_yday);
+    in_tm.tm_isdst = env->GetIntField(javaTm, gStructTmClassInfo.tm_isdst);
+    in_tm.tm_gmtoff = env->GetLongField(javaTm, gStructTmClassInfo.tm_gmtoff);
+
+    jstring javaTmZone =
+            static_cast<jstring>(env->GetObjectField(javaTm, gStructTmClassInfo.tm_zone));
+    const char* tmZone = nullptr;
+    if (javaTmZone != nullptr) {
+        tmZone = env->GetStringUTFChars(javaTmZone, nullptr);
+        in_tm.tm_zone = tmZone;
+    }
+
+    // Call mktime
+    jint result = -1;
+    {
+        SET_TZ(env, javaTzId);
+
+        result = mktime(&in_tm);
+
+        UNSET_TZ();
+    }
+
+    if (javaTmZone != nullptr) {
+        env->ReleaseStringUTFChars(javaTmZone, tmZone);
+    }
+
+    return result;
+}
+
+static JNINativeMethod gMethods[] = {
+    { "localtime_tz", "(ILjava/lang/String;)Landroid/text/format/cts/NativeTimeFunctions$StructTm;",
+        (void *) android_text_format_cts_NativeTimeFunctions_localtime_tz },
+    { "mktime_tz", "(Landroid/text/format/cts/NativeTimeFunctions$StructTm;Ljava/lang/String;)I",
+        (void *) android_text_format_cts_NativeTimeFunctions_mktime_tz },
+};
+
+int register_android_text_format_cts_NativeTimeFunctions(JNIEnv* env)
+{
+    jclass javaTmClass = env->FindClass("android/text/format/cts/NativeTimeFunctions$StructTm");
+    gStructTmClassInfo.clazz = (jclass) env->NewGlobalRef(javaTmClass);
+    gStructTmClassInfo.ctor = env->GetMethodID(javaTmClass, "<init>", "()V");
+    gStructTmClassInfo.tm_sec = env->GetFieldID(javaTmClass, "tm_sec", "I");
+    gStructTmClassInfo.tm_min = env->GetFieldID(javaTmClass, "tm_min", "I");
+    gStructTmClassInfo.tm_hour = env->GetFieldID(javaTmClass, "tm_hour", "I");
+    gStructTmClassInfo.tm_mday = env->GetFieldID(javaTmClass, "tm_mday", "I");
+    gStructTmClassInfo.tm_mon = env->GetFieldID(javaTmClass, "tm_mon", "I");
+    gStructTmClassInfo.tm_year = env->GetFieldID(javaTmClass, "tm_year", "I");
+    gStructTmClassInfo.tm_wday = env->GetFieldID(javaTmClass, "tm_wday", "I");
+    gStructTmClassInfo.tm_yday = env->GetFieldID(javaTmClass, "tm_yday", "I");
+    gStructTmClassInfo.tm_isdst = env->GetFieldID(javaTmClass, "tm_isdst", "I");
+    gStructTmClassInfo.tm_gmtoff = env->GetFieldID(javaTmClass, "tm_gmtoff", "J");
+    gStructTmClassInfo.tm_zone = env->GetFieldID(javaTmClass, "tm_zone", "Ljava/lang/String;");
+
+    jclass clazz = env->FindClass("android/text/format/cts/NativeTimeFunctions");
+    return env->RegisterNatives(clazz, gMethods,
+            sizeof(gMethods) / sizeof(JNINativeMethod));
+}
diff --git a/tests/tests/text/src/android/text/format/cts/NativeTimeFunctions.java b/tests/tests/text/src/android/text/format/cts/NativeTimeFunctions.java
new file mode 100644
index 0000000..628ceb0
--- /dev/null
+++ b/tests/tests/text/src/android/text/format/cts/NativeTimeFunctions.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+package android.text.format.cts;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.time.LocalDateTime;
+
+/**
+ * A test helper class for calling localtime_r() and mktime() for a given time zone.
+ */
+class NativeTimeFunctions {
+    static {
+        System.loadLibrary("ctstext_jni");
+    }
+
+    private NativeTimeFunctions() {}
+
+    private static native StructTm localtime_tz(int timep, String tzId);
+    private static native int mktime_tz(StructTm tm, String tzId);
+
+    /**
+     * Tries native time functions to see if they produce expected results.
+     *
+     * <p>localtime() is called with {tzId + localDateTime} and the result is checked against
+     * timeMillis. mktime() is called with {tzId + timeMillis} and the result is checked against
+     * localDateTime.
+     *
+     * <p>This method only works to second precision in the range of times that Android's
+     * localtime() / mktime() work across all architectures; signed int32 seconds (because time_t
+     * is dependent on word-size on Android). It may not work for ambiguous local times, i.e. local
+     * times that don't exist (because of a "skip forward") or are duplicated (because of a "fall
+     * back"). This method is not threadsafe as it uses the TZ environment variable.
+     */
+    static void assertNativeTimeResults(String tzId, LocalDateTime localDateTime, long timeMillis) {
+        assertLocaltimeResult(tzId, timeMillis, localDateTime);
+        assertMktimeResult(tzId, localDateTime, timeMillis);
+    }
+
+    private static void assertLocaltimeResult(String tzId, long timeMillis,
+            LocalDateTime expected) {
+        StructTm structTm = localtime_tz((int) (timeMillis / 1000), tzId);
+
+        LocalDateTime actual = LocalDateTime.of(
+                structTm.tm_year + 1900,
+                structTm.tm_mon + 1,
+                structTm.tm_mday,
+                structTm.tm_hour,
+                structTm.tm_min,
+                structTm.tm_sec);
+        assertEquals(timeMillis + " in " + tzId, expected, actual);
+    }
+
+    private static void assertMktimeResult(String tzId, LocalDateTime localDateTime,
+            long expectedTimeMillis) {
+
+        // Create a StructTm from the (second precision) information held in the LocalDateTime.
+        StructTm tm = new StructTm();
+        tm.tm_sec = localDateTime.getSecond();
+        tm.tm_min = localDateTime.getMinute();
+        tm.tm_hour = localDateTime.getHour();
+        tm.tm_mday = localDateTime.getDayOfMonth();
+        tm.tm_mon = localDateTime.getMonthValue() - 1;
+        tm.tm_year = localDateTime.getYear() - 1900;
+        tm.tm_isdst = -1;
+        int actualTimeMillis = mktime_tz(tm, tzId);
+        assertEquals(localDateTime + " in " + tzId,
+                expectedTimeMillis, actualTimeMillis * 1000L);
+    }
+
+    /**
+     * A basic Java representation of bionic's struct tm.
+     */
+    static class StructTm {
+        public int tm_sec;    /* Seconds (0-60) */
+        public int tm_min;    /* Minutes (0-59) */
+        public int tm_hour;   /* Hours (0-23) */
+        public int tm_mday;   /* Day of the month (1-31) */
+        public int tm_mon;    /* Month (0-11) */
+        public int tm_year;   /* Year - 1900 */
+        public int tm_wday;   /* Day of the week (0-6, Sunday = 0) */
+        public int tm_yday;   /* Day in the year (0-365, 1 Jan = 0) */
+        public int tm_isdst;  /* Daylight saving time */
+        public long tm_gmtoff;
+        public String tm_zone;
+    }
+}
diff --git a/tests/tests/text/src/android/text/format/cts/TimeTest.java b/tests/tests/text/src/android/text/format/cts/TimeTest.java
index 631f6f8..ad5c3bf 100644
--- a/tests/tests/text/src/android/text/format/cts/TimeTest.java
+++ b/tests/tests/text/src/android/text/format/cts/TimeTest.java
@@ -1572,7 +1572,7 @@
     }
 
     @Test
-    public void testToMillis_beforeTzRecords() {
+    public void testToMillis_before32BitSeconds() {
         int[] timeFields = new int[] { 1900, 0, 1, 2, 3, 4, -999 /* not used */, 9, 9, 9 };
         verifyToMillisInvalid(timeFields, PstPdt.ID);
         verifyToMillisInvalid(timeFields, Time.TIMEZONE_UTC);
@@ -1613,7 +1613,7 @@
     }
 
     @Test
-    public void testToMillis_afterTzRecords() {
+    public void testToMillis_after32BitSeconds() {
         int[] timeFields = new int[] { 2039, 0, 1, 2, 3, 4, -999 /* not used */, 9, 9, 9 };
         verifyToMillisInvalid(timeFields, PstPdt.ID);
         verifyToMillisInvalid(timeFields, Time.TIMEZONE_UTC);
@@ -2515,7 +2515,7 @@
     }
 
     @Test
-    public void testNormalize_beforeTzRecords() {
+    public void testNormalize_before32BitSeconds() {
         int[] timeFields = new int[] { 1900, 0, 1, 2, 3, 4, -999 /* not used */, 9, 9, 9 };
         verifyNormalizeInvalid(timeFields, PstPdt.ID);
         verifyNormalizeInvalid(timeFields, Time.TIMEZONE_UTC);
@@ -2569,7 +2569,7 @@
     }
 
     @Test
-    public void testNormalize_afterTzRecords() {
+    public void testNormalize_after32BitSeconds() {
         int[] timeFields = new int[] { 2039, 0, 1, 2, 3, 4, -999 /* not used */, 9, 9, 9 };
         verifyNormalizeInvalid(timeFields, PstPdt.ID);
         verifyNormalizeInvalid(timeFields, Time.TIMEZONE_UTC);
@@ -2843,7 +2843,7 @@
         LocalDateTime localDateTime = LocalDateTime.of(2018, Month.OCTOBER, 30, 12, 48, 32);
         assertLocalTimeMillis("Asia/Singapore", localDateTime, 1540874912000L);
 
-        // The following tests check the upper limits of what we support. There's no guarantee
+        // The following tests check the upper limits of what Time supports. There's no guarantee
         // we can't deal with values higher that this but the exact value depends on the version of
         // zic being used as a transition at exactly Integer.MAX_VALUE can affect our ability to
         // deal with times. So, we just assert what we know we must be able to do to catch major
@@ -2861,16 +2861,21 @@
         // Negative offset, has no MAX_VALUE transition with zic 2018e.
         checkUpperSupportedLimit("America/Los_Angeles");
 
-        // See comment above, but for Integer.MIN_VALUE / lower bound. Most zones have a MIN_VALUE
-        // transition with zic 2018e so it is harder to test zones without them so we just cover the
-        // same ones as we do for upper bound above.
+        // See comment above, but for Integer.MIN_VALUE / lower bound. Most zones do not have an
+        // explicit MIN_VALUE transition with zic 2018e 64-bit data but some zones differ around
+        // whether there are known transitions before Integer.MIN_VALUE.
 
-        // Positive offset, has MIN_VALUE transition with zic 2018e.
+        // Positive offset zones with first transition before Integer.MIN_VALUE.
         checkLowerSupportedLimit("Asia/Singapore");
         checkLowerSupportedLimit("Asia/Shanghai");
-        // Negative offset, has MIN_VALUE transition with zic 2018e.
+        // Negative offset zones with first transition before Integer.MIN_VALUE.
         checkLowerSupportedLimit("America/Argentina/Buenos_Aires");
         checkLowerSupportedLimit("America/Los_Angeles");
+
+        // Positive offset zone with first transition after Integer.MIN_VALUE.
+        checkLowerSupportedLimit("Asia/Kathmandu");
+        // Negative offset zone with first transition after Integer.MIN_VALUE.
+        checkLowerSupportedLimit("America/Yellowknife");
     }
 
     private static void checkUpperSupportedLimit(String timeZoneId) {
@@ -2930,6 +2935,9 @@
                 testLocalTime.getSecond(),
                 0 /* isDst */, 0, 0, 0);
         assertEquals(expectedMillis, t.toMillis(true /* ignoreDst */));
+
+        // Check that Time agrees with native localtime / mktime.
+        NativeTimeFunctions.assertNativeTimeResults(timeZoneId, testLocalTime, expectedMillis);
     }
 
     /**
@@ -2965,10 +2973,28 @@
                         + time, timeZone.inDaylightTime(new Date(timeInMillis)), (time.isDst != 0));
                 assertEquals(timeZone.getOffset(timeInMillis),
                         Duration.ofSeconds(time.gmtoff).toMillis());
+
+                // Check that Time agrees with native localtime / mktime.
+                NativeTimeFunctions.assertNativeTimeResults(
+                        tzId, createLocalDateTime(calendar), timeInMillis);
             }
         }
     }
 
+    /**
+     * Creates a LocalDateTime from a Calendar by reading out the current date/time (to second
+     * precision only!).
+     */
+    private static LocalDateTime createLocalDateTime(Calendar calendar) {
+        return LocalDateTime.of(
+                calendar.get(Calendar.YEAR),
+                calendar.get(Calendar.MONTH) + 1,
+                calendar.get(Calendar.DAY_OF_MONTH),
+                calendar.get(Calendar.HOUR_OF_DAY),
+                calendar.get(Calendar.MINUTE),
+                calendar.get(Calendar.SECOND));
+    }
+
     private static List<Long> calculateToMillisTestTimes(String tzId) {
         List<Long> times = new ArrayList<>();
 
@@ -3042,7 +3068,8 @@
         // should pass regardless of zic version used as the Android behavior is stable for this
         // zone as we have fixed the logic used to determine the offset before the first transition
         // AND the first transition for the zone is after Integer.MIN_VALUE.
-        Time t = new Time("Africa/Abidjan");
+        String tzId = "Africa/Abidjan";
+        Time t = new Time(tzId);
         // Jan 1, 1912 12:16:08 AM UTC / Jan 1, 1912 00:00:00 local time
         Instant oldEarliestTransition = Instant.ofEpochSecond(-1830383032);
         Instant beforeOldEarliestTransition = oldEarliestTransition.minus(Duration.ofDays(1));
@@ -3050,10 +3077,14 @@
 
         // The expected local time equivalent to the oldEarliestTransition time minus 1 day and
         // offset by -968 seconds.
-        Time expected = new Time("Africa/Abidjan");
+        Time expected = new Time(tzId);
         Fields.set(expected, 1911, 11, 31, 0, 0, 0, 0 /* isDst */, -968, 364, 0);
-
         Fields.verifyTimeEquals(expected, t);
+
+        // Check that Time agrees with native localtime / mktime.
+        NativeTimeFunctions.assertNativeTimeResults(
+                tzId, LocalDateTime.of(1911, Month.DECEMBER, 31, 0, 0, 0),
+                beforeOldEarliestTransition.toEpochMilli());
     }
 
     private static void verifyNormalizeResult(boolean normalizeArgument, Time toNormalize,
diff --git a/tests/tests/toast/Android.bp b/tests/tests/toast/Android.bp
new file mode 100644
index 0000000..72c785f
--- /dev/null
+++ b/tests/tests/toast/Android.bp
@@ -0,0 +1,38 @@
+//
+// 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.
+//
+
+android_test {
+    name: "CtsToastTestCases",
+    defaults: ["cts_defaults"],
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    static_libs: [
+        "androidx.test.rules",
+        "ctstestrunner-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+    min_sdk_version: "25",
+}
+
+filegroup {
+    name: "CtsToastBaseToastTest",
+    srcs: ["src/android/widget/toast/cts/BaseToastTest.java"],
+}
diff --git a/tests/tests/toast/Android.mk b/tests/tests/toast/Android.mk
deleted file mode 100644
index 20a2dab..0000000
--- a/tests/tests/toast/Android.mk
+++ /dev/null
@@ -1,35 +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_TAGS := tests
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsToastTestCases
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 25
-
-include $(BUILD_CTS_PACKAGE)
-
diff --git a/tests/tests/toastlegacy/Android.bp b/tests/tests/toastlegacy/Android.bp
new file mode 100644
index 0000000..f2fac30
--- /dev/null
+++ b/tests/tests/toastlegacy/Android.bp
@@ -0,0 +1,35 @@
+//
+// 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.
+//
+
+android_test {
+    name: "CtsToastLegacyTestCases",
+    defaults: ["cts_defaults"],
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "androidx.test.rules",
+    ],
+    srcs: [
+        "src/**/*.java",
+        ":CtsToastBaseToastTest",
+    ],
+    sdk_version: "current",
+    min_sdk_version: "25",
+}
diff --git a/tests/tests/toastlegacy/Android.mk b/tests/tests/toastlegacy/Android.mk
deleted file mode 100644
index da3924d..0000000
--- a/tests/tests/toastlegacy/Android.mk
+++ /dev/null
@@ -1,36 +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_TAGS := tests
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-    ../toast/src/android/widget/toast/cts/BaseToastTest.java
-
-LOCAL_PACKAGE_NAME := CtsToastLegacyTestCases
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 25
-
-include $(BUILD_CTS_PACKAGE)
-
diff --git a/tests/tests/tv/Android.bp b/tests/tests/tv/Android.bp
new file mode 100644
index 0000000..640b963
--- /dev/null
+++ b/tests/tests/tv/Android.bp
@@ -0,0 +1,34 @@
+// 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.
+
+android_test {
+    name: "CtsTvTestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    srcs: ["src/**/*.java"],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/tv/Android.mk b/tests/tests/tv/Android.mk
deleted file mode 100644
index 072d800..0000000
--- a/tests/tests/tv/Android.mk
+++ /dev/null
@@ -1,36 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsTvTestCases
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/uiautomation/Android.bp b/tests/tests/uiautomation/Android.bp
new file mode 100644
index 0000000..22dd8f6
--- /dev/null
+++ b/tests/tests/uiautomation/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+android_test {
+    name: "CtsUiAutomationTestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ub-uiautomator",
+    ],
+    libs: ["android.test.base.stubs"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/uiautomation/Android.mk b/tests/tests/uiautomation/Android.mk
deleted file mode 100644
index 85db3b3..0000000
--- a/tests/tests/uiautomation/Android.mk
+++ /dev/null
@@ -1,37 +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_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt ub-uiautomator
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsUiAutomationTestCases
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
-
diff --git a/tests/tests/uidisolation/Android.bp b/tests/tests/uidisolation/Android.bp
new file mode 100644
index 0000000..80059bc
--- /dev/null
+++ b/tests/tests/uidisolation/Android.bp
@@ -0,0 +1,36 @@
+// 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.
+
+android_test {
+    name: "CtsUidIsolationTestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+        "cts_instant",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "ctstestserver",
+    ],
+    libs: [
+        "org.apache.http.legacy",
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/tests/uidisolation/Android.mk b/tests/tests/uidisolation/Android.mk
deleted file mode 100644
index de39ac6..0000000
--- a/tests/tests/uidisolation/Android.mk
+++ /dev/null
@@ -1,41 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt ctstestserver
-
-LOCAL_JAVA_LIBRARIES := \
-    org.apache.http.legacy \
-    android.test.runner.stubs \
-    android.test.base.stubs \
-
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsUidIsolationTestCases
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/util/Android.bp b/tests/tests/util/Android.bp
new file mode 100644
index 0000000..3533502
--- /dev/null
+++ b/tests/tests/util/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.
+
+android_test {
+    name: "CtsUtilTestCases",
+    defaults: ["cts_defaults"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    libs: ["android.test.runner.stubs"],
+    static_libs: [
+        "androidx.annotation_annotation",
+        "androidx.test.rules",
+        "ctstestrunner-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    platform_apis: true,
+}
diff --git a/tests/tests/util/Android.mk b/tests/tests/util/Android.mk
deleted file mode 100644
index 3aadfa1..0000000
--- a/tests/tests/util/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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_JAVA_LIBRARIES += android.test.runner.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.annotation_annotation \
-    androidx.test.rules \
-    ctstestrunner-axt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsUtilTestCases
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/voiceinteraction/Android.bp b/tests/tests/voiceinteraction/Android.bp
new file mode 100644
index 0000000..bd04cce
--- /dev/null
+++ b/tests/tests/voiceinteraction/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+android_test {
+    name: "CtsVoiceInteractionTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "CtsVoiceInteractionCommon",
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+	"androidx.test.ext.junit",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/voiceinteraction/Android.mk b/tests/tests/voiceinteraction/Android.mk
deleted file mode 100644
index ac78196..0000000
--- a/tests/tests/voiceinteraction/Android.mk
+++ /dev/null
@@ -1,44 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-  CtsVoiceInteractionCommon \
-  ctstestrunner-axt \
-  compatibility-device-util-axt \
-  androidx.test.ext.junit
-
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsVoiceInteractionTestCases
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/voiceinteraction/common/Android.bp b/tests/tests/voiceinteraction/common/Android.bp
new file mode 100644
index 0000000..904dce6
--- /dev/null
+++ b/tests/tests/voiceinteraction/common/Android.bp
@@ -0,0 +1,19 @@
+// 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.
+
+java_library {
+    name: "CtsVoiceInteractionCommon",
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+}
diff --git a/tests/tests/voiceinteraction/common/Android.mk b/tests/tests/voiceinteraction/common/Android.mk
deleted file mode 100644
index 8b994c9..0000000
--- a/tests/tests/voiceinteraction/common/Android.mk
+++ /dev/null
@@ -1,30 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := CtsVoiceInteractionCommon
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/tests/voiceinteraction/service/Android.bp b/tests/tests/voiceinteraction/service/Android.bp
new file mode 100644
index 0000000..2ceeef8
--- /dev/null
+++ b/tests/tests/voiceinteraction/service/Android.bp
@@ -0,0 +1,31 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsVoiceInteractionService",
+    defaults: ["cts_support_defaults"],
+    static_libs: [
+        "CtsVoiceInteractionCommon",
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/voiceinteraction/service/Android.mk b/tests/tests/voiceinteraction/service/Android.mk
deleted file mode 100644
index abae526..0000000
--- a/tests/tests/voiceinteraction/service/Android.mk
+++ /dev/null
@@ -1,35 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := CtsVoiceInteractionCommon ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsVoiceInteractionService
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/DirectActionsTest.java b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/DirectActionsTest.java
index 55b367f..c4c4b24 100644
--- a/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/DirectActionsTest.java
+++ b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/DirectActionsTest.java
@@ -136,7 +136,7 @@
             mActivityControl.finishActivity();
         }
     }
-
+    
     private class SessionControl {
         private @Nullable RemoteCallback mControl;
 
diff --git a/tests/tests/voiceinteraction/testapp/Android.bp b/tests/tests/voiceinteraction/testapp/Android.bp
new file mode 100644
index 0000000..a7123f2
--- /dev/null
+++ b/tests/tests/voiceinteraction/testapp/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.
+
+android_test_helper_app {
+    name: "CtsVoiceInteractionApp",
+    defaults: ["cts_support_defaults"],
+    static_libs: ["CtsVoiceInteractionCommon", "androidx.core_core"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "test_current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
\ No newline at end of file
diff --git a/tests/tests/voiceinteraction/testapp/Android.mk b/tests/tests/voiceinteraction/testapp/Android.mk
deleted file mode 100644
index 0191d61..0000000
--- a/tests/tests/voiceinteraction/testapp/Android.mk
+++ /dev/null
@@ -1,36 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := CtsVoiceInteractionCommon \
-      androidx.core_core \
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsVoiceInteractionApp
-
-LOCAL_SDK_VERSION := test_current
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/tests/voicesettings/Android.bp b/tests/tests/voicesettings/Android.bp
new file mode 100644
index 0000000..cf3daad
--- /dev/null
+++ b/tests/tests/voicesettings/Android.bp
@@ -0,0 +1,34 @@
+// 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.
+
+android_test {
+    name: "CtsVoiceSettingsTestCases",
+    defaults: ["cts_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/voicesettings/Android.mk b/tests/tests/voicesettings/Android.mk
deleted file mode 100644
index f81afaa..0000000
--- a/tests/tests/voicesettings/Android.mk
+++ /dev/null
@@ -1,38 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsVoiceSettingsTestCases
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/voicesettings/service/Android.bp b/tests/tests/voicesettings/service/Android.bp
new file mode 100644
index 0000000..8550417
--- /dev/null
+++ b/tests/tests/voicesettings/service/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+android_test_helper_app {
+    name: "CtsVoiceSettingsService",
+    defaults: ["cts_support_defaults"],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/voicesettings/service/Android.mk b/tests/tests/voicesettings/service/Android.mk
deleted file mode 100644
index 0d86bf8..0000000
--- a/tests/tests/voicesettings/service/Android.mk
+++ /dev/null
@@ -1,35 +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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsVoiceSettingsService
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/tests/webkit/Android.bp b/tests/tests/webkit/Android.bp
new file mode 100644
index 0000000..afe9f2b
--- /dev/null
+++ b/tests/tests/webkit/Android.bp
@@ -0,0 +1,40 @@
+// 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.
+
+android_test {
+    name: "CtsWebkitTestCases",
+    defaults: ["cts_defaults"],
+    libs: [
+        "android.test.runner.stubs",
+        "org.apache.http.legacy",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctsdeviceutillegacy-axt",
+        "ctstestserver",
+        "ctstestrunner-axt",
+        "hamcrest-library",
+    ],
+    srcs: ["src/**/*.java"],
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+    // uncomment when dalvik.annotation.Test* are removed or part of SDK
+    //sdk_version: "current"
+    platform_apis: true,
+}
diff --git a/tests/tests/webkit/Android.mk b/tests/tests/webkit/Android.mk
deleted file mode 100644
index d638588..0000000
--- a/tests/tests/webkit/Android.mk
+++ /dev/null
@@ -1,48 +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)
-
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_JAVA_LIBRARIES := \
-    android.test.runner.stubs \
-    org.apache.http.legacy \
-    android.test.base.stubs \
-
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctsdeviceutillegacy-axt \
-    ctstestserver \
-    ctstestrunner-axt \
-    hamcrest-library
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsWebkitTestCases
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# uncomment when dalvik.annotation.Test* are removed or part of SDK
-#LOCAL_SDK_VERSION := current
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/wrap/OWNERS b/tests/tests/wrap/OWNERS
new file mode 100644
index 0000000..6ea7640
--- /dev/null
+++ b/tests/tests/wrap/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 86431
+yabinc@google.com
diff --git a/tests/vr/Android.bp b/tests/vr/Android.bp
new file mode 100644
index 0000000..4ba27ad
--- /dev/null
+++ b/tests/vr/Android.bp
@@ -0,0 +1,43 @@
+// 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.
+
+android_test {
+    name: "CtsVrTestCases",
+    defaults: ["cts_defaults"],
+    compile_multilib: "both",
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+    ],
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+    jni_libs: [
+        "libctsvrextensions_jni",
+        "libnativehelper_compat_libc++",
+    ],
+    srcs: [
+        "src/**/*.java",
+        ":CtsVerifierMockVrListenerServiceFiles",
+    ],
+    sdk_version: "test_current",
+    min_sdk_version: "14",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "general-tests",
+    ],
+}
diff --git a/tests/vr/Android.mk b/tests/vr/Android.mk
deleted file mode 100644
index e945e04..0000000
--- a/tests/vr/Android.mk
+++ /dev/null
@@ -1,46 +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_PACKAGE_NAME := CtsVrTestCases
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# Include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_JNI_SHARED_LIBRARIES := libctsvrextensions_jni libnativehelper_compat_libc++
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) ../../apps/CtsVerifier/src/com/android/cts/verifier/vr/MockVrListenerService.java
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 14
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/vr/jni/Android.bp b/tests/vr/jni/Android.bp
new file mode 100644
index 0000000..1bdc092
--- /dev/null
+++ b/tests/vr/jni/Android.bp
@@ -0,0 +1,37 @@
+// 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: "libctsvrextensions_jni",
+    cflags: [
+        "-Werror",
+        "-Wall",
+        "-Wextra",
+    ],
+    srcs: ["VrExtensionsJni.cpp"],
+    include_dirs: [
+        "system/core/include",
+        "frameworks/native/opengl/include",
+    ],
+    shared_libs: [
+        "libandroid",
+        "libnativehelper_compat_libc++",
+        "liblog",
+        "libEGL",
+        "libGLESv2",
+    ],
+    sdk_version: "current",
+    stl: "c++_static",
+}
diff --git a/tests/vr/jni/Android.mk b/tests/vr/jni/Android.mk
deleted file mode 100644
index 3b62b8a..0000000
--- a/tests/vr/jni/Android.mk
+++ /dev/null
@@ -1,35 +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    := libctsvrextensions_jni
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS += -Werror -Wall -Wextra
-
-LOCAL_SRC_FILES := VrExtensionsJni.cpp
-
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE) $(call include-path-for, system-core) frameworks/native/opengl/include
-
-LOCAL_SHARED_LIBRARIES := libandroid libnativehelper_compat_libc++ liblog libEGL libGLESv2
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_NDK_STL_VARIANT := c++_static
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tools/cts-api-coverage/Android.bp b/tools/cts-api-coverage/Android.bp
index ed802ca..b0df7f1 100644
--- a/tools/cts-api-coverage/Android.bp
+++ b/tools/cts-api-coverage/Android.bp
@@ -27,7 +27,6 @@
     },
 
     java_resource_dirs: ["res"],
-    manifest: "MANIFEST.mf",
 
     static_libs: [
         "compatibility-host-util",
@@ -45,10 +44,13 @@
     name: "cts-api-coverage",
     wrapper: "etc/cts-api-coverage",
     static_libs: ["api-coverage"],
+    manifest: "MANIFEST.mf",
 }
 
+
 java_binary_host {
     name: "ndk-api-report",
     wrapper: "etc/ndk-api-report",
     static_libs: ["api-coverage"],
+    manifest: "MANIFEST.mf",
 }