Build Telecom sources once
Put all the Telecom sources and resources into an android_library
so that they are only built once and can always use a single package
name to refer to the resources once use_resource_processor: true is
enabled.
Bug: 294256649
Test: mmma packages/services/Telecomm
Change-Id: I0b2917e795757fdec0f9b12fb7c19a0a0c95a838
diff --git a/Android.bp b/Android.bp
index f46c206..7e57a3f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -10,19 +10,12 @@
out: ["com/android/server/telecom/TelecomStatsLog.java"],
}
-filegroup {
- name: "Telecom-srcs",
+android_library {
+ name: "TelecomLib",
+ manifest: "AndroidManifestLib.xml",
srcs: [
"src/**/*.java",
":statslog-telecom-java-gen",
- ],
-}
-
-// Build the Telecom service.
-android_app {
- name: "Telecom",
- srcs: [
- ":Telecom-srcs",
"proto/**/*.proto",
],
static_libs: [
@@ -30,9 +23,6 @@
"androidx.core_core",
"telecom_flags_core_java_lib",
],
- libs: [
- "services",
- ],
resource_dirs: ["res"],
proto: {
type: "nano",
@@ -40,6 +30,22 @@
output_params: ["optional_field_style=accessors"],
},
platform_apis: true,
+}
+
+
+// Build the Telecom service.
+android_app {
+ name: "Telecom",
+ srcs: [
+ ],
+ static_libs: [
+ "TelecomLib",
+ ],
+ libs: [
+ "services",
+ ],
+ resource_dirs: [],
+ platform_apis: true,
certificate: "platform",
privileged: true,
optimize: {
@@ -50,6 +56,7 @@
android_test {
name: "TelecomUnitTests",
static_libs: [
+ "TelecomLib",
"android-ex-camera2",
"flag-junit",
"guava",
@@ -58,25 +65,15 @@
"platform-test-annotations",
"androidx.legacy_legacy-support-core-ui",
"androidx.legacy_legacy-support-core-utils",
- "androidx.core_core",
"androidx.fragment_fragment",
"androidx.test.ext.junit",
"platform-compat-test-rules",
- "telecom_flags_core_java_lib",
],
srcs: [
"tests/src/**/*.java",
- ":Telecom-srcs",
- "proto/**/*.proto",
],
- proto: {
- type: "nano",
- local_include_dirs: ["proto/"],
- output_params: ["optional_field_style=accessors"],
- },
resource_dirs: [
"tests/res",
- "res",
],
libs: [
"android.test.mock",
@@ -89,11 +86,6 @@
"libstaticjvmtiagent",
],
- aaptflags: [
- "--auto-add-overlay",
- "--extra-packages",
- "com.android.server.telecom",
- ],
manifest: "tests/AndroidManifest.xml",
optimize: {
enabled: false,
diff --git a/AndroidManifestLib.xml b/AndroidManifestLib.xml
new file mode 100644
index 0000000..9b40f6b
--- /dev/null
+++ b/AndroidManifestLib.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2024 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest package="com.android.server.telecom">
+</manifest>