1// Copyright (C) 2022 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
19filegroup {
20    name: "healthConnectController-sources",
21    srcs: [
22        "src/**/*.java",
23        "src/**/*.kt",
24    ],
25    exclude_srcs: [
26        ":healthconnectController-permissions-apis",
27        ":healthconnectController-migration-apis",
28        ":healthconnectController-exportimport-apis",
29        "src/**/HealthConnectApplication.kt",
30    ],
31}
32
33filegroup {
34    name: "healthconnectController-permissions-apis",
35    srcs: [
36        "src/com/android/healthconnect/controller/permissions/api/**/*.kt",
37    ],
38}
39
40filegroup {
41    name: "healthconnectController-migration-apis",
42    srcs: [
43        "src/com/android/healthconnect/controller/migration/api/**/*.kt",
44    ],
45}
46
47filegroup {
48    name: "healthconnectController-exportimport-apis",
49    srcs: [
50        "src/com/android/healthconnect/controller/exportimport/api/**/*.kt",
51    ],
52}
53
54java_library {
55    name: "HealthConnectPermissionsApis",
56    srcs: [":healthconnectController-permissions-apis"],
57    sdk_version: "module_current",
58    min_sdk_version: "34",
59    libs: [
60        "kotlin-annotations",
61        "framework-healthfitness.impl", // permissions ui needs access to healthfitness hidden apis.
62    ],
63    static_libs: [
64        "kotlin-stdlib",
65        "hilt_android",
66        "guava",
67    ],
68    kotlincflags: ["-Xjvm-default=all"],
69    apex_available: ["com.android.healthfitness"],
70}
71
72java_library {
73    name: "HealthConnectMigrationApis",
74    srcs: [":healthconnectController-migration-apis"],
75    sdk_version: "module_current",
76    min_sdk_version: "34",
77    libs: [
78        "kotlin-annotations",
79        "framework-healthfitness.impl", // migration ui needs access to healthfitness hidden apis.
80    ],
81    static_libs: [
82        "kotlin-stdlib",
83        "hilt_android",
84        "kotlinx-coroutines-android",
85        "guava",
86    ],
87    kotlincflags: ["-Xjvm-default=all"],
88    apex_available: ["com.android.healthfitness"],
89}
90
91java_library {
92    name: "HealthConnectExportApis",
93    srcs: [":healthconnectController-exportimport-apis"],
94    sdk_version: "module_current",
95    min_sdk_version: "34",
96    libs: [
97        "kotlin-annotations",
98        "framework-healthfitness.impl", // export ui needs access to healthfitness hidden apis.
99    ],
100    static_libs: [
101        "kotlin-stdlib",
102        "hilt_android",
103        "kotlinx-coroutines-android",
104        "guava",
105    ],
106    kotlincflags: ["-Xjvm-default=all"],
107    apex_available: ["com.android.healthfitness"],
108}
109
110// To generate HealthFitnessUiStatsLog for logging.
111// DO NOT CHANGE
112genrule {
113    name: "statslog-healthfitness-ui-java-gen",
114    tools: ["stats-log-api-gen"],
115    cmd: "$(location stats-log-api-gen) --java $(out) --module healthfitness" +
116        " --javaPackage com.android.healthconnect.controller" +
117        " --javaClass HealthFitnessUiStatsLog --minApiLevel 34",
118    out: ["com/android/healthconnect/controller/HealthFitnessUiStatsLog.java"],
119}
120
121// To disable NewApi checks on the generated HealthFitnessUiStatsLog.
122// DO NOT CHANGE
123java_library {
124    name: "healthfitness-ui-statsd",
125    sdk_version: "module_current",
126    min_sdk_version: "34",
127    srcs: [
128        ":statslog-healthfitness-ui-java-gen",
129    ],
130    libs: [
131        // needed for restricted atoms
132        "androidx.annotation_annotation",
133        // To add StatsLog as a dependency of the generated file.
134        "framework-statsd.stubs.module_lib",
135    ],
136    apex_available: ["com.android.healthfitness"],
137}
138
139android_app_certificate {
140    name: "com.android.healthconnect.controller.certificate",
141    certificate: "com.android.healthconnect.controller",
142}
143
144android_library {
145    name: "HealthConnectLibrary",
146    srcs: [":healthConnectController-sources"],
147    sdk_version: "module_current",
148    min_sdk_version: "34",
149    libs: [
150        "kotlin-annotations",
151        "framework-healthfitness",
152        "framework-configinfrastructure",
153        "framework-permission-s",
154    ],
155    static_libs: [
156        "com.google.android.material_material",
157        "healthfitness-aconfig-flags-lib",
158        "HealthConnectPermissionsApis",
159        "HealthConnectMigrationApis",
160        "HealthConnectExportApis",
161        "SettingsLibSettingsTheme",
162        "kotlin-stdlib",
163        "kotlinx-coroutines-android",
164        "androidx.navigation_navigation-common-ktx",
165        "androidx.navigation_navigation-fragment-ktx",
166        "androidx.navigation_navigation-runtime-ktx",
167        "androidx.navigation_navigation-ui-ktx",
168        "androidx.annotation_annotation",
169        "androidx.lifecycle_lifecycle-extensions",
170        "androidx.core_core-ktx",
171        "SettingsLibCollapsingToolbarBaseActivity",
172        "SettingsLibFooterPreference",
173        "SettingsLibHelpUtils",
174        "SettingsLibTopIntroPreference",
175        "SettingsLibMainSwitchPreference",
176        "SettingsLibAppPreference",
177        "SettingsLibActivityEmbedding",
178        "SettingsLibSettingsSpinner",
179        "androidx.core_core",
180        "guava",
181        "hilt_android",
182        "healthfitness-ui-statsd",
183        "healthfitness-aconfig-flags-helper",
184    ],
185    kotlincflags: ["-Xjvm-default=all"],
186    apex_available: ["com.android.healthfitness"],
187    lint: {
188        baseline_filename: "lint-baseline.xml",
189        error_checks: ["NewApi"],
190    },
191}
192
193android_app {
194    name: "HealthConnectController",
195    srcs: ["src/**/HealthConnectApplication.kt"],
196    sdk_version: "module_current",
197    min_sdk_version: "34",
198    privileged: true,
199    privapp_allowlist: ":privapp_allowlist_com.android.healthconnect.controller.xml",
200    rename_resources_package: false,
201    updatable: true,
202    additional_manifests: [
203        "HealthPermissionsManifest.xml",
204        "ManageHealthPermissionsManifest.xml",
205        "ManageHealthDataManifest.xml",
206        "StartOnboardingManifest.xml",
207    ],
208    certificate: ":com.android.healthconnect.controller.certificate",
209    static_libs: [
210        "HealthConnectLibrary",
211        "HealthConnectPermissionsApis",
212        "HealthConnectMigrationApis",
213        "HealthConnectExportApis",
214        "hilt_android",
215    ],
216    libs: [
217        "framework-healthfitness",
218    ],
219    apex_available: ["com.android.healthfitness"],
220}
221