Convert DirectRenderingCluster to Android.bp

See build/soong/README.md for more information.

Fixes: 144289989
Test: m checkbuild
Test: m RunDirectRenderingClusterRoboTests
Change-Id: I79a7d5122c7a99261a4b5b9b0d9a3140bf5e26ee
Merged-In: I79a7d5122c7a99261a4b5b9b0d9a3140bf5e26ee
Exempt-From-Owner-Approval: cherry-pick
(cherry picked from commit 4cb5652eb6fc9205d4096a736a7d5efaad2262a0)
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..2103020
--- /dev/null
+++ b/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_app {
+    name: "DirectRenderingCluster",
+
+    srcs: ["src/**/*.java"],
+
+    platform_apis: true,
+
+    // Each update should be signed by OEMs
+    certificate: "platform",
+    privileged: true,
+
+    optimize: {
+        proguard_flags_files: ["proguard.flags"],
+        enabled: false,
+    },
+
+    resource_dirs: ["res"],
+
+    static_libs: [
+        "android.car.cluster.navigation",
+        "androidx.legacy_legacy-support-v4",
+        "androidx-constraintlayout_constraintlayout",
+        "car-arch-common",
+        "car-media-common",
+        "car-telephony-common",
+        "car-apps-common",
+    ],
+
+    libs: ["android.car"],
+
+    required: ["privapp_whitelist_android.car.cluster"],
+
+    product_variables: {
+        pdk: {
+            enabled: false,
+        },
+    },
+}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index ef92d7e..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,59 +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.
-#
-#
-ifneq ($(TARGET_BUILD_PDK), true)
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := DirectRenderingCluster
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-# Each update should be signed by OEMs
-LOCAL_CERTIFICATE := platform
-LOCAL_PRIVILEGED_MODULE := true
-
-LOCAL_PROGUARD_FLAG_FILES := proguard.flags
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    android.car.cluster.navigation
-
-LOCAL_JAVA_LIBRARIES += android.car
-LOCAL_STATIC_ANDROID_LIBRARIES += \
-    androidx.legacy_legacy-support-v4 \
-    androidx-constraintlayout_constraintlayout \
-    car-arch-common \
-    car-media-common \
-    car-telephony-common \
-    car-apps-common
-
-LOCAL_REQUIRED_MODULES := privapp_whitelist_android.car.cluster
-
-include $(BUILD_PACKAGE)
-
-# Use the following include to make our test apk.
-ifeq (,$(ONE_SHOT_MAKEFILE))
-include $(call all-makefiles-under,$(LOCAL_PATH))
-endif
-
-endif
diff --git a/tests/robotests/Android.bp b/tests/robotests/Android.bp
new file mode 100644
index 0000000..b5bc314
--- /dev/null
+++ b/tests/robotests/Android.bp
@@ -0,0 +1,18 @@
+//############################################
+// Messenger Robolectric test target. #
+//############################################
+
+android_robolectric_test {
+    name: "DirectRenderingClusterTests",
+
+    srcs: ["src/**/*.java"],
+
+    java_resource_dirs: ["config"],
+
+    // Include the testing libraries
+    libs: [
+        "android.car",
+    ],
+
+    instrumentation_for: "DirectRenderingCluster",
+}
diff --git a/tests/robotests/Android.mk b/tests/robotests/Android.mk
deleted file mode 100644
index 631a403..0000000
--- a/tests/robotests/Android.mk
+++ /dev/null
@@ -1,46 +0,0 @@
-#############################################
-# Messenger Robolectric test target. #
-#############################################
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := DirectRenderingClusterTests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Include the testing libraries
-LOCAL_JAVA_LIBRARIES := \
-    robolectric_android-all-stub \
-    Robolectric_all-target \
-    mockito-robolectric-prebuilt \
-    truth-prebuilt \
-    android.car
-
-LOCAL_INSTRUMENTATION_FOR := DirectRenderingCluster
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-#############################################################
-# Messenger runner target to run the previous target. #
-#############################################################
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := RunDirectRenderingClusterTests
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_JAVA_LIBRARIES := \
-    DirectRenderingClusterTests \
-    robolectric_android-all-stub \
-    Robolectric_all-target \
-    mockito-robolectric-prebuilt \
-    truth-prebuilt \
-    android.car
-
-LOCAL_TEST_PACKAGE := DirectRenderingCluster
-
-LOCAL_INSTRUMENT_SOURCE_DIRS := $(dir $(LOCAL_PATH))../src
-
-include external/robolectric-shadows/run_robotests.mk
diff --git a/tests/Android.mk b/tests/robotests/config/robolectric.properties
similarity index 72%
rename from tests/Android.mk
rename to tests/robotests/config/robolectric.properties
index 9f0a4e8..cb4cb3e 100644
--- a/tests/Android.mk
+++ b/tests/robotests/config/robolectric.properties
@@ -1,4 +1,4 @@
-# Copyright (C) 2019 The Android Open Source Project
+# Copyright (C) 2020 The Android Open Source Project
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -11,9 +11,5 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+sdk=NEWEST_SDK
 
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# Include all makefiles in subdirectories
-include $(call all-makefiles-under,$(LOCAL_PATH))