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
19genrule {
20    name: "statslog-Car-java-gen",
21    tools: ["stats-log-api-gen"],
22    cmd: "$(location stats-log-api-gen) --java $(out) --module car --javaPackage com.android.car"
23        + " --javaClass CarStatsLog",
24    out: ["com/android/car/CarStatsLog.java"],
25}
26
27car_service_sources = [
28    "src/**/*.java",
29    ":statslog-Car-java-gen",
30]
31
32common_lib_deps = [
33    "android.car.userlib",
34    "android.car.watchdoglib",
35    "android.hidl.base-V1.0-java",
36    "android.hardware.automotive.audiocontrol-V1.0-java",
37    "android.hardware.automotive.audiocontrol-V2.0-java",
38    "android.hardware.automotive.vehicle-V2.0-java",
39    "android.hardware.health-V1.0-java",
40    "android.hardware.health-V2.0-java",
41    "android.hardware.automotive.occupant_awareness-java",
42    "vehicle-hal-support-lib",
43    "car-systemtest",
44    "com.android.car.procfsinspector-client",
45    "blestream-protos",
46    "SettingsLib",
47    "androidx.preference_preference",
48    "EncryptionRunner",
49]
50
51android_app {
52    name: "CarService",
53
54    srcs: car_service_sources,
55
56    resource_dirs: ["res"],
57
58    platform_apis: true,
59
60    // Each update should be signed by OEMs
61    certificate: "platform",
62    privileged: true,
63
64    optimize: {
65        proguard_flags_files: ["proguard.flags"],
66        enabled: false,
67    },
68
69    libs: ["android.car"],
70
71    static_libs: common_lib_deps + [
72        "car-frameworks-service",
73    ],
74
75    required: ["privapp_whitelist_com.android.car"],
76
77    // Disable build in PDK, missing aidl import breaks build
78    product_variables: {
79        pdk: {
80            enabled: false,
81        },
82    },
83}
84
85java_library {
86
87    name: "car-service-common-util-static-lib",
88
89    srcs: [
90        "src/com/android/car/CarServiceBase.java",
91        "src/com/android/car/CarServiceUtils.java",
92        "src/com/android/car/CarLog.java",
93        "src/com/android/car/Utils.java",
94    ],
95
96    product_variables: {
97            pdk: {
98                enabled: false,
99            },
100    },
101}
102
103//####################################################################################
104// Build a static library to help mocking various car services in testing. This is meant to be used
105// for internal unit tests around the car service.
106//####################################################################################
107android_library {
108    name: "car-service-test-static-lib",
109
110    srcs: car_service_sources,
111
112    resource_dirs: ["res"],
113
114    libs: [
115        "android.car",
116        "car-frameworks-service",
117    ],
118
119    static_libs: common_lib_deps,
120
121    min_sdk_version: "25",
122
123    product_variables: {
124        pdk: {
125            enabled: false,
126        },
127    },
128}
129
130//####################################################################################
131// Build a library to help generate a testing library for external apps.
132// We do not want to use statically linked libraries, as this will bloat the output jar with classes
133// that can conflict with the user's environment.
134//####################################################################################
135android_library {
136    name: "car-service-test-lib",
137
138    srcs: car_service_sources,
139
140    resource_dirs: ["res"],
141
142    libs: common_lib_deps + [
143        "android.car",
144        "car-frameworks-service",
145    ],
146
147    min_sdk_version: "25",
148
149    product_variables: {
150        pdk: {
151            enabled: false,
152        },
153    },
154}
155
156