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: "service-healthfitness-sources",
21    srcs: [
22        "java/**/*.java",
23    ],
24    path: "java",
25}
26
27java_sdk_library {
28    name: "service-healthfitness",
29    permitted_packages: [
30        "com.android.server.healthconnect",
31        "com.android.healthfitness.flags",
32    ],
33    srcs: [":service-healthfitness-sources"],
34    sdk_version: "system_server_current",
35    min_sdk_version: "34",
36    defaults: [
37        "framework-system-server-module-defaults",
38        "framework-system-server-module-optimize-defaults",
39    ],
40    apex_available: ["com.android.healthfitness"],
41    libs: [
42        "framework-healthfitness.impl",
43        "androidx.annotation_annotation",
44        "framework-sdkextensions.stubs.module_lib",
45        "framework-configinfrastructure.stubs.module_lib",
46        "keepanno-annotations",
47        "modules-utils-preconditions",
48        // Keeping aconfig lib deps in "libs" instead of "static_libs" because we already have them
49        // in the framework jar which is included in this service jar.
50        // See go/fixing-strict-java-packages.
51        "healthfitness-aconfig-flags-lib",
52        "healthfitness-aconfig-flags-helper",
53    ],
54    static_libs: [
55        "modules-utils-backgroundthread",
56        "fhirspec-java-proto-lite",
57    ],
58    jarjar_rules: "jarjar-rules.txt",
59    installable: true,
60    optimize: {
61        proguard_flags_files: ["proguard.flags"],
62    },
63    visibility: [
64        "//packages/modules/HealthFitness/tests:__subpackages__",
65    ],
66    impl_library_visibility: [
67        "//packages/modules/HealthFitness/tests/unittests",
68        "//packages/modules/HealthFitness/tests/integrationtests",
69    ],
70    errorprone: {
71        extra_check_modules: [
72            "//external/nullaway:nullaway_plugin",
73        ],
74        javacflags: [
75            "-Xep:NullAway:ERROR",
76            "-XepOpt:NullAway:AnnotatedPackages=com.android.server.healthconnect",
77        ],
78    },
79    java_resources: select(release_flag("RELEASE_HC_PHR_FHIR_STRUCTURAL_VALIDATION"), {
80        true: [":generate-fhir-spec-r4-binarypb"],
81        default: [],
82    }),
83}
84