1// Copyright (C) 2019 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15//
16
17// Build the Car service.
18
19package {
20    default_applicable_licenses: ["Android-Apache-2.0"],
21}
22
23genrule {
24    name: "statslog-Car-java-gen",
25    tools: ["stats-log-api-gen"],
26    cmd: "$(location stats-log-api-gen) --java $(out) --module car --javaPackage com.android.car"
27        + " --javaClass CarStatsLog",
28    out: ["com/android/car/CarStatsLog.java"],
29}
30
31car_service_sources = [
32    ":iscriptexecutor_aidl",
33    "src/**/*.java",
34    ":statslog-Car-java-gen",
35]
36
37common_lib_deps = [
38    "android.automotive.telemetry.internal-java",  // ICarTelemetryInternal
39    "android.car.cluster.navigation",
40    "android.car.userlib",
41    "android.car.watchdoglib",
42    "android.frameworks.automotive.powerpolicy.internal-java",
43    "android.hidl.base-V1.0-java",
44    "android.hardware.automotive.audiocontrol-V1.0-java",
45    "android.hardware.automotive.audiocontrol-V2.0-java",
46    "android.hardware.automotive.audiocontrol-V1-java",
47    "android.hardware.automotive.vehicle-V2.0-java",
48    "android.hardware.health-V1.0-java",
49    "android.hardware.health-V2.0-java",
50    "android.hardware.automotive.occupant_awareness-V1-java",
51    "vehicle-hal-support-lib",
52    "car-systemtest",
53    "com.android.car.procfsinspector-client",
54    "blestream-protos",
55    "SettingsLib",
56    "androidx.preference_preference",
57    // TODO(b/171603586): remove this after moving NewUserDisclaimerActivity
58    // to CarSettings
59    "car-admin-ui-lib",
60    "Slogf",
61    "cartelemetry-protos",
62    "carwatchdog-protos",
63]
64
65android_app {
66    name: "CarService",
67
68    srcs: car_service_sources,
69
70    resource_dirs: ["res"],
71
72    platform_apis: true,
73
74    // Each update should be signed by OEMs
75    certificate: "platform",
76    privileged: true,
77
78    optimize: {
79        proguard_flags_files: ["proguard.flags"],
80        enabled: false,
81    },
82
83    libs: ["android.car"],
84
85    static_libs: common_lib_deps + [
86        "com.android.car.internal.system",
87    ],
88
89    jni_libs: [
90        "libcarservicejni",
91    ],
92
93    aidl: {
94        include_dirs: [
95	    "frameworks/native/aidl/binder", // For PersistableBundle.aidl
96	],
97    },
98
99    required: ["allowed_privapp_com.android.car"],
100
101    // Disable build in PDK, missing aidl import breaks build
102    product_variables: {
103        pdk: {
104            enabled: false,
105        },
106    },
107}
108
109java_library {
110
111    name: "car-service-common-util-static-lib",
112
113    srcs: [
114        "src/com/android/car/CarServiceBase.java",
115        "src/com/android/car/CarServiceUtils.java",
116        "src/com/android/car/CarLog.java",
117        "src/com/android/car/Utils.java",
118    ],
119
120    static_libs: [
121        "com.android.car.internal.common",
122    ],
123
124    product_variables: {
125            pdk: {
126                enabled: false,
127            },
128    },
129}
130
131//####################################################################################
132// Build a static library to help mocking various car services in testing. This is meant to be used
133// for internal unit tests around the car service.
134//####################################################################################
135android_library {
136    name: "car-service-test-static-lib",
137
138    srcs: car_service_sources,
139
140    resource_dirs: ["res"],
141
142    libs: [
143        "android.car",
144        "car-frameworks-service",
145    ],
146
147    static_libs: common_lib_deps,
148
149    aidl: {
150        include_dirs: [
151	    "frameworks/native/aidl/binder", // For PersistableBundle.aidl
152	],
153    },
154
155    product_variables: {
156        pdk: {
157            enabled: false,
158        },
159    },
160}
161
162//####################################################################################
163// Build a library to help generate a testing library for external apps.
164// We do not want to use statically linked libraries, as this will bloat the output jar with classes
165// that can conflict with the user's environment.
166//####################################################################################
167android_library {
168    name: "car-service-test-lib",
169
170    srcs: car_service_sources,
171
172    resource_dirs: ["res"],
173
174    libs: common_lib_deps + [
175        "android.car",
176        "car-frameworks-service",
177    ],
178
179    aidl: {
180        include_dirs: [
181	    "frameworks/native/aidl/binder", // For PersistableBundle.aidl
182	],
183    },
184
185    product_variables: {
186        pdk: {
187            enabled: false,
188        },
189    },
190}
191
192filegroup {
193    name: "iscriptexecutor_aidl",
194    srcs: [
195        "src/com/android/car/telemetry/scriptexecutorinterface/IScriptExecutor.aidl",
196        "src/com/android/car/telemetry/scriptexecutorinterface/IScriptExecutorListener.aidl",
197    ],
198    path: "src",
199}
200