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
15package {
16    default_applicable_licenses: ["Android-Apache-2.0"],
17}
18
19genrule {
20    name: "statslog-carsettings-java-gen",
21    tools: ["stats-log-api-gen"],
22    cmd: "$(location stats-log-api-gen) --java $(out) --module carsettings" +
23        " --javaPackage com.android.car.settings --javaClass CarSettingsStatsLog",
24    out: ["com/android/car/settings/CarSettingsStatsLog.java"],
25}
26
27carsettings_srcs = [
28    "src/**/*.kt",
29    "src/**/*.java",
30    ":statslog-carsettings-java-gen",
31]
32
33android_library {
34    name: "CarSettings-core",
35    platform_apis: true,
36    defaults: [
37        "SettingsLibDefaults",
38        "SettingsLib-search-defaults",
39    ],
40
41    srcs: carsettings_srcs,
42
43    static_libs: [
44        "androidx.lifecycle_lifecycle-common-java8",
45        "androidx.lifecycle_lifecycle-extensions",
46        "androidx.preference_preference",
47        "androidx.window_window",
48        "androidx-constraintlayout_constraintlayout",
49        "androidx.test.core",
50        "car-apps-common",
51        "car-setup-wizard-lib-utils",
52        "WifiTrackerLib",
53        "SettingsLib",
54        "SettingsLib-search",
55        "androidx-constraintlayout_constraintlayout-solver",
56        "jsr305",
57        "car-ui-lib",
58        "car-admin-ui-lib",
59        "car-helper-lib",
60        "car-qc-lib",
61        "com_android_car_settings_flags_lib",
62        "services.core",
63        "car-data-subscription-lib",
64        "car-resource-common",
65    ],
66
67    libs: [
68        "android.car",
69    ],
70
71    manifest: "AndroidManifest.xml",
72    resource_dirs: ["res"],
73    // TODO(b/319708040): re-enable use_resource_processor
74    use_resource_processor: false,
75    lint: {
76        warning_checks: [
77            "FlaggedApi",
78        ],
79    },
80}
81
82android_app {
83    name: "CarSettings",
84    overrides: ["Settings"],
85    platform_apis: true,
86
87    static_libs: [
88        "CarSettings-core",
89    ],
90
91    libs: [
92        "android.car",
93    ],
94
95    certificate: "platform",
96
97    optimize: {
98        proguard_flags_files: ["proguard.flags"],
99    },
100
101    privileged: true,
102
103    dex_preopt: {
104        enabled: false,
105    },
106
107    required: ["allowed_privapp_com.android.car.settings"],
108
109    dxflags: ["--multi-dex"],
110    // TODO(b/319708040): re-enable use_resource_processor
111    use_resource_processor: false,
112}
113
114// Testing app (not lib) is required for deviceless testing (Robolectric) to
115// include testing only resources.This is an app and not a library due to
116// resource processing differences.
117android_app {
118    name: "CarSettingsAppForTesting",
119    platform_apis: true,
120    defaults: [
121        "SettingsLibDefaults",
122        "SettingsLib-search-defaults",
123    ],
124
125    srcs: carsettings_srcs,
126
127    libs: [
128        "android.car",
129    ],
130
131    static_libs: [
132        "CarSettings-core",
133    ],
134
135    // Testing only resources must be applied last so they take precedence.
136    resource_dirs: [
137        "res",
138        "tests/deviceless/res",
139    ],
140
141    certificate: "platform",
142
143    optimize: {
144        enabled: false,
145    },
146
147    privileged: true,
148
149    dex_preopt: {
150        enabled: false,
151    },
152
153    dxflags: ["--multi-dex"],
154    // TODO(b/319708040): re-enable use_resource_processor
155    use_resource_processor: false,
156    lint: {
157        warning_checks: [
158            "FlaggedApi",
159        ],
160    },
161}
162
163// Testing app (not lib) is required for deviceless testing (Robolectric).
164// This is an app and not a library due to resource processing differences.
165android_app {
166    name: "CarSettingsAppForMultivalentTesting",
167    platform_apis: true,
168    defaults: [
169        "SettingsLibDefaults",
170        "SettingsLib-search-defaults",
171    ],
172
173    srcs: [
174        "src/**/*.kt",
175        "src/**/*.java",
176    ],
177
178    libs: [
179        "android.car",
180    ],
181
182    static_libs: [
183        "CarSettings-core",
184    ],
185
186    // Testing only resources must be applied last so they take precedence.
187    resource_dirs: [
188        "res",
189        "tests/multivalent/res",
190    ],
191
192    certificate: "platform",
193
194    optimize: {
195        enabled: false,
196    },
197
198    privileged: true,
199
200    dex_preopt: {
201        enabled: false,
202    },
203
204    dxflags: ["--multi-dex"],
205    // TODO(b/319708040): re-enable use_resource_processor
206    use_resource_processor: false,
207    lint: {
208        warning_checks: [
209            "FlaggedApi",
210        ],
211    },
212}
213
214android_library {
215    name: "CarSettingsLibForDeviceTesting",
216    platform_apis: true,
217    defaults: [
218        "SettingsLibDefaults",
219        "SettingsLib-search-defaults",
220    ],
221
222    manifest: "tests/multivalent/AndroidManifest.xml",
223    srcs: carsettings_srcs,
224
225    libs: [
226        "android.car",
227    ],
228
229    static_libs: [
230        "androidx.lifecycle_lifecycle-common-java8",
231        "androidx.lifecycle_lifecycle-extensions",
232        "androidx.preference_preference",
233        "androidx-constraintlayout_constraintlayout",
234        "car-apps-common",
235        "car-setup-wizard-lib-utils",
236        "WifiTrackerLib",
237        "SettingsLib",
238        "SettingsLib-search",
239        "androidx-constraintlayout_constraintlayout-solver",
240        "jsr305",
241        "car-admin-ui-lib",
242        "car-helper-lib",
243        "car-qc-lib",
244        "com_android_car_settings_flags_lib",
245        "car-data-subscription-lib",
246    ],
247
248    // Testing only resources must be applied last so they take precedence.
249    resource_dirs: [
250        "res",
251        "tests/multivalent/res",
252    ],
253
254    optimize: {
255        enabled: false,
256    },
257
258    dex_preopt: {
259        enabled: false,
260    },
261
262    dxflags: ["--multi-dex"],
263
264    aaptflags: ["--extra-packages com.android.car.settings"],
265    // TODO(b/319708040): re-enable use_resource_processor
266    use_resource_processor: false,
267    lint: {
268        warning_checks: [
269            "FlaggedApi",
270        ],
271    },
272}
273
274filegroup {
275    name: "CarSettings_proguard_flags",
276    srcs: ["proguard.flags"],
277}
278
279filegroup {
280    name: "CarSettingsShadows-srcs",
281    srcs: ["tests/helpers/src/com/android/car/settings/testutils/Shadow*.java"],
282}
283