Convert Android.mk file to Android.bp

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

Fixes: 122331932
Test: treehugger
Change-Id: Iab00f22da9e813d14ced471878d8e3a35024eb38
Merged-In: Iabca84a02451ac57774e4e7263f9de5ff0e38c4e
diff --git a/rcs/Android.mk b/rcs/Android.mk
deleted file mode 100644
index 7f1f7eb..0000000
--- a/rcs/Android.mk
+++ /dev/null
@@ -1,17 +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 $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/rcs/presencepolling/Android.bp b/rcs/presencepolling/Android.bp
new file mode 100644
index 0000000..0d4607f
--- /dev/null
+++ b/rcs/presencepolling/Android.bp
@@ -0,0 +1,51 @@
+// Copyright (c) 2015, Motorola Mobility LLC
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//     - Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     - Redistributions in binary form must reproduce the above copyright
+//       notice, this list of conditions and the following disclaimer in the
+//       documentation and/or other materials provided with the distribution.
+//     - Neither the name of Motorola Mobility nor the
+//       names of its contributors may be used to endorse or promote products
+//       derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA MOBILITY LLC BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+// DAMAGE.
+
+java_defaults {
+    name: "presence_polling_defaults",
+    srcs: ["src/**/*.java"],
+    libs: [
+        "ims-common",
+        "telephony-common",
+    ],
+    static_libs: ["com.android.ims.rcsmanager"],
+    platform_apis: true,
+    certificate: "platform",
+    optimize: {
+        proguard_flags_files: ["proguard.flags"],
+    },
+}
+
+android_app {
+    name: "PresencePolling",
+    defaults: ["presence_polling_defaults"],
+}
+
+android_test_helper_app {
+    name: "PresencePollingTestHelper",
+    defaults: ["presence_polling_defaults"],
+    test_suites: ["device-tests"],
+}
diff --git a/rcs/presencepolling/Android.mk b/rcs/presencepolling/Android.mk
deleted file mode 100644
index a02a18b..0000000
--- a/rcs/presencepolling/Android.mk
+++ /dev/null
@@ -1,49 +0,0 @@
- # Copyright (c) 2015, Motorola Mobility LLC
- # All rights reserved.
- #
- # Redistribution and use in source and binary forms, with or without
- # modification, are permitted provided that the following conditions are met:
- #     - Redistributions of source code must retain the above copyright
- #       notice, this list of conditions and the following disclaimer.
- #     - Redistributions in binary form must reproduce the above copyright
- #       notice, this list of conditions and the following disclaimer in the
- #       documentation and/or other materials provided with the distribution.
- #     - Neither the name of Motorola Mobility nor the
- #       names of its contributors may be used to endorse or promote products
- #       derived from this software without specific prior written permission.
- #
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA MOBILITY LLC BE LIABLE
- # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- # DAMAGE.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := ims-common \
-                        telephony-common
-
-LOCAL_STATIC_JAVA_LIBRARIES := com.android.ims.rcsmanager
-
-LOCAL_PACKAGE_NAME := PresencePolling
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_CERTIFICATE := platform
-#LOCAL_MODULE_TAGS := optional
-
-LOCAL_COMPATIBILITY_SUITE := device-tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)
-
-LOCAL_PROGUARD_FLAG_FILES := proguard.flags
-
-include $(BUILD_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/rcs/presencepolling/tests/Android.bp b/rcs/presencepolling/tests/Android.bp
new file mode 100644
index 0000000..f86cd38
--- /dev/null
+++ b/rcs/presencepolling/tests/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 {
+    name: "PresencePollingTests",
+    srcs: ["src/**/*.java"],
+    libs: [
+        "mockito-target",
+        "android.test.base",
+        "android.test.runner",
+    ],
+    static_libs: [
+        "android-support-test",
+        "mockito-target-minus-junit4",
+    ],
+    platform_apis: true,
+    instrumentation_for: "PresencePolling",
+    certificate: "platform",
+    test_suites: ["device-tests"],
+}
diff --git a/rcs/presencepolling/tests/Android.mk b/rcs/presencepolling/tests/Android.mk
deleted file mode 100644
index b2825f3..0000000
--- a/rcs/presencepolling/tests/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_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := mockito-target \
-                        android.test.base \
-                        android.test.runner
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-        android-support-test \
-        mockito-target-minus-junit4
-
-LOCAL_PACKAGE_NAME := PresencePollingTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_INSTRUMENTATION_FOR := PresencePolling
-LOCAL_CERTIFICATE := platform
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_COMPATIBILITY_SUITE := device-tests
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
-
diff --git a/rcs/rcsmanager/Android.bp b/rcs/rcsmanager/Android.bp
new file mode 100644
index 0000000..663f42a
--- /dev/null
+++ b/rcs/rcsmanager/Android.bp
@@ -0,0 +1,38 @@
+// Copyright (c) 2015, Motorola Mobility LLC
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//     - Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     - Redistributions in binary form must reproduce the above copyright
+//       notice, this list of conditions and the following disclaimer in the
+//       documentation and/or other materials provided with the distribution.
+//     - Neither the name of Motorola Mobility nor the
+//       names of its contributors may be used to endorse or promote products
+//       derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA MOBILITY LLC BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+// DAMAGE.
+
+java_library {
+    name: "com.android.ims.rcsmanager",
+    aidl: {
+        local_include_dirs: ["src/java"],
+    },
+    srcs: ["src/java/**/*.java"] + [
+        "src/java/com/android/ims/internal/IRcsService.aidl",
+        "src/java/com/android/ims/internal/IRcsPresence.aidl",
+        "src/java/com/android/ims/IRcsPresenceListener.aidl",
+    ],
+    libs: ["ims-common"],
+}
diff --git a/rcs/rcsmanager/Android.mk b/rcs/rcsmanager/Android.mk
deleted file mode 100644
index 839039d..0000000
--- a/rcs/rcsmanager/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
- # Copyright (c) 2015, Motorola Mobility LLC
- # All rights reserved.
- #
- # Redistribution and use in source and binary forms, with or without
- # modification, are permitted provided that the following conditions are met:
- #     - Redistributions of source code must retain the above copyright
- #       notice, this list of conditions and the following disclaimer.
- #     - Redistributions in binary form must reproduce the above copyright
- #       notice, this list of conditions and the following disclaimer in the
- #       documentation and/or other materials provided with the distribution.
- #     - Neither the name of Motorola Mobility nor the
- #       names of its contributors may be used to endorse or promote products
- #       derived from this software without specific prior written permission.
- #
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA MOBILITY LLC BE LIABLE
- # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- # DAMAGE.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/src/java
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src/java)
-LOCAL_SRC_FILES += src/java/com/android/ims/internal/IRcsService.aidl \
-        src/java/com/android/ims/internal/IRcsPresence.aidl \
-        src/java/com/android/ims/IRcsPresenceListener.aidl
-
-LOCAL_JAVA_LIBRARIES += ims-common
-
-#LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE := com.android.ims.rcsmanager
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/rcs/rcsservice/Android.bp b/rcs/rcsservice/Android.bp
new file mode 100644
index 0000000..dd965c8
--- /dev/null
+++ b/rcs/rcsservice/Android.bp
@@ -0,0 +1,43 @@
+// Copyright (c) 2015, Motorola Mobility LLC
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//     - Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     - Redistributions in binary form must reproduce the above copyright
+//       notice, this list of conditions and the following disclaimer in the
+//       documentation and/or other materials provided with the distribution.
+//     - Neither the name of Motorola Mobility nor the
+//       names of its contributors may be used to endorse or promote products
+//       derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA MOBILITY LLC BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+// DAMAGE.
+
+//#########################################################################
+// Build the application : Presence.apk
+//#########################################################################
+
+android_app {
+    // This is the target being built. (Name of APK)
+    name: "RcsService",
+    platform_apis: true,
+    // Only compile source java files in this apk.
+    srcs: ["src/**/*.java"],
+    libs: [
+        "telephony-common",
+        "ims-common",
+    ],
+    static_libs: ["com.android.ims.rcsmanager"],
+    certificate: "platform",
+}
diff --git a/rcs/rcsservice/Android.mk b/rcs/rcsservice/Android.mk
deleted file mode 100644
index 5b0aa04..0000000
--- a/rcs/rcsservice/Android.mk
+++ /dev/null
@@ -1,50 +0,0 @@
- # Copyright (c) 2015, Motorola Mobility LLC
- # All rights reserved.
- #
- # Redistribution and use in source and binary forms, with or without
- # modification, are permitted provided that the following conditions are met:
- #     - Redistributions of source code must retain the above copyright
- #       notice, this list of conditions and the following disclaimer.
- #     - Redistributions in binary form must reproduce the above copyright
- #       notice, this list of conditions and the following disclaimer in the
- #       documentation and/or other materials provided with the distribution.
- #     - Neither the name of Motorola Mobility nor the
- #       names of its contributors may be used to endorse or promote products
- #       derived from this software without specific prior written permission.
- #
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA MOBILITY LLC BE LIABLE
- # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- # DAMAGE.
-
-LOCAL_PATH := $(call my-dir)
-
-##########################################################################
-# Build the application : Presence.apk
-##########################################################################
-
-include $(CLEAR_VARS)
-# This is the target being built. (Name of APK)
-LOCAL_PACKAGE_NAME := RcsService
-LOCAL_PRIVATE_PLATFORM_APIS := true
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := telephony-common ims-common
-
-LOCAL_STATIC_JAVA_LIBRARIES := com.android.ims.rcsmanager
-
-#LOCAL_MODULE_TAGS := optional
-LOCAL_CERTIFICATE := platform
-
-# Tell it to build an APK
-include $(BUILD_PACKAGE)
-