Convert Android.mk file to Android.bp

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

Bug: 122332723
Test: treehugger
Change-Id: I16795323c51914fffcb4be86445da00adfa62fbf
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..8ee7754
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,77 @@
+// Build the Telecom service.
+android_app {
+    name: "Telecom",
+    libs: ["telephony-common"],
+    srcs: [
+        "src/**/*.java",
+        "proto/**/*.proto",
+    ],
+    resource_dirs: ["res"],
+    proto: {
+        type: "nano",
+        local_include_dirs: ["proto/"],
+        output_params: ["optional_field_style=accessors"],
+    },
+    platform_apis: true,
+    certificate: "platform",
+    privileged: true,
+    optimize: {
+        proguard_flags_files: ["proguard.flags"],
+    },
+    defaults: ["SettingsLibDefaults"],
+}
+
+android_test {
+    name: "TelecomUnitTests",
+    static_libs: [
+        "android-ex-camera2",
+        "guava",
+        "mockito-target-inline",
+        "android-support-test",
+        "platform-test-annotations",
+        "androidx.legacy_legacy-support-core-ui",
+        "androidx.legacy_legacy-support-core-utils",
+        "androidx.core_core",
+        "androidx.fragment_fragment",
+    ],
+    srcs: [
+        "tests/src/**/*.java",
+        "src/**/*.java",
+        "proto/**/*.proto",
+    ],
+    proto: {
+        type: "nano",
+        local_include_dirs: ["proto/"],
+        output_params: ["optional_field_style=accessors"],
+    },
+    resource_dirs: [
+        "tests/res",
+        "res",
+    ],
+    libs: [
+        "android.test.mock",
+        "android.test.base",
+        "android.test.runner",
+        "telephony-common",
+    ],
+
+    jni_libs: ["libdexmakerjvmtiagent"],
+
+    aaptflags: [
+        "--auto-add-overlay",
+        "--extra-packages",
+        "com.android.server.telecom",
+    ],
+    manifest: "tests/AndroidManifest.xml",
+    optimize: {
+        enabled: false,
+    },
+    platform_apis: true,
+    certificate: "platform",
+    jacoco: {
+        include_filter: ["com.android.server.telecom.*"],
+        exclude_filter: ["com.android.server.telecom.tests.*"],
+    },
+    test_suites: ["device-tests"],
+    defaults: ["SettingsLibDefaults"],
+}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 4e5eeff..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-# Build the Telecom service.
-include $(CLEAR_VARS)
-
-LOCAL_JAVA_LIBRARIES := telephony-common
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-proto-files-under, proto)
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-LOCAL_USE_AAPT2 := true
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := nano
-LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/proto/
-LOCAL_PROTO_JAVA_OUTPUT_PARAMS := optional_field_style=accessors
-
-LOCAL_PACKAGE_NAME := Telecom
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-LOCAL_PRIVILEGED_MODULE := true
-
-LOCAL_PROGUARD_FLAG_FILES := proguard.flags
-
-include frameworks/base/packages/SettingsLib/common.mk
-
-include $(BUILD_PACKAGE)
-
-# Build the test package.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/testapps/Android.bp b/testapps/Android.bp
new file mode 100644
index 0000000..26347fe
--- /dev/null
+++ b/testapps/Android.bp
@@ -0,0 +1,27 @@
+//
+// 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 {
+    name: "TelecomTestApps",
+    static_libs: [
+        "androidx.legacy_legacy-support-v4",
+        "android-ex-camera2",
+        "guava",
+    ],
+    srcs: ["src/**/*.java"],
+    platform_apis: true,
+    certificate: "platform",
+}
diff --git a/testapps/Android.mk b/testapps/Android.mk
deleted file mode 100644
index 0651a87..0000000
--- a/testapps/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)
-
-LOCAL_USE_AAPT2 := true
-LOCAL_STATIC_ANDROID_LIBRARIES := androidx.legacy_legacy-support-v4
-LOCAL_STATIC_JAVA_LIBRARIES := \
-        android-ex-camera2 \
-        guava
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := TelecomTestApps
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_CERTIFICATE := platform
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/Android.mk b/tests/Android.mk
deleted file mode 100644
index 5abf999..0000000
--- a/tests/Android.mk
+++ /dev/null
@@ -1,75 +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_STATIC_JAVA_LIBRARIES := \
-    android-ex-camera2 \
-    guava \
-    mockito-target-inline \
-    android-support-test \
-    platform-test-annotations
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
-    androidx.legacy_legacy-support-core-ui \
-    androidx.legacy_legacy-support-core-utils \
-    androidx.core_core \
-    androidx.fragment_fragment
-
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src) \
-    $(call all-java-files-under, ../src) \
-    $(call all-proto-files-under, ../proto)
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := nano
-LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/../proto/
-LOCAL_PROTO_JAVA_OUTPUT_PARAMS := optional_field_style=accessors
-
-LOCAL_RESOURCE_DIR := \
-    $(LOCAL_PATH)/res \
-    $(LOCAL_PATH)/../res
-
-LOCAL_JAVA_LIBRARIES := \
-    android.test.mock \
-    android.test.base \
-    android.test.runner \
-    telephony-common
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_JNI_SHARED_LIBRARIES := \
-    libdexmakerjvmtiagent \
-
-LOCAL_AAPT_FLAGS := \
-    --auto-add-overlay \
-    --extra-packages com.android.server.telecom
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_PACKAGE_NAME := TelecomUnitTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_CERTIFICATE := platform
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_JACK_COVERAGE_INCLUDE_FILTER := com.android.server.telecom.*
-LOCAL_JACK_COVERAGE_EXCLUDE_FILTER := com.android.server.telecom.tests.*
-
-LOCAL_COMPATIBILITY_SUITE := device-tests
-include frameworks/base/packages/SettingsLib/common.mk
-
-include $(BUILD_PACKAGE)