1//
2// Copyright (C) 2021 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17package {
18    default_team: "trendy_team_fwk_uwb",
19    default_applicable_licenses: ["Android-Apache-2.0"],
20}
21
22apex_defaults {
23    name: "com.android.uwb-defaults",
24    bootclasspath_fragments: ["com.android.uwb-bootclasspath-fragment"],
25    systemserverclasspath_fragments: ["com.android.uwb-systemserverclasspath-fragment"],
26    multilib: {
27        both: {
28            jni_libs: [
29                "libuwb_uci_jni_rust",
30            ],
31        },
32    },
33    apps: [
34        "ServiceUwbResources",
35    ],
36    key: "com.android.uwb.key",
37    certificate: ":com.android.uwb.certificate",
38    defaults: ["t-launched-apex-module"],
39}
40
41// Mainline uwb apex module.
42apex {
43    name: "com.android.uwb",
44    defaults: ["com.android.uwb-defaults"],
45    manifest: "apex_manifest.json",
46    visibility: ["//packages/modules/common/build"],
47}
48
49apex_key {
50    name: "com.android.uwb.key",
51    public_key: "com.android.uwb.avbpubkey",
52    private_key: "com.android.uwb.pem",
53}
54
55android_app_certificate {
56    name: "com.android.uwb.certificate",
57    certificate: "com.android.uwb",
58}
59
60sdk {
61    name: "uwb-module-sdk",
62    apexes: [
63        // Adds exportable dependencies of the APEX to the sdk,
64        // e.g. *classpath_fragments.
65        "com.android.uwb",
66    ],
67}
68
69soong_config_module_type {
70    name: "custom_bootclasspath_fragment",
71    module_type: "bootclasspath_fragment",
72    config_namespace: "bootclasspath",
73    bool_variables: [
74        "release_ranging_stack",
75    ],
76    properties: [
77        "contents",
78    ],
79}
80
81// Encapsulate the contributions made by the com.android.uwb to the bootclasspath.
82custom_bootclasspath_fragment {
83    name: "com.android.uwb-bootclasspath-fragment",
84    soong_config_variables: {
85        release_ranging_stack: {
86            contents: [
87                "framework-uwb",
88                "framework-ranging",
89            ],
90            conditions_default: {
91                contents: [
92                    "framework-uwb",
93                ],
94            },
95        },
96    },
97    apex_available: ["com.android.uwb"],
98
99    // The bootclasspath_fragments that provide APIs on which this depends.
100    fragments: [
101        {
102            apex: "com.android.art",
103            module: "art-bootclasspath-fragment",
104        },
105    ],
106
107    // Additional stubs libraries that this fragment's contents use which are
108    // not provided by another bootclasspath_fragment.
109    additional_stubs: [
110        "android-non-updatable",
111    ],
112
113    hidden_api: {
114
115        // The following packages contain classes from other modules on the
116        // bootclasspath. That means that the hidden API flags for this module
117        // has to explicitly list every single class this module provides in
118        // that package to differentiate them from the classes provided by other
119        // modules. That can include private classes that are not part of the
120        // API.
121        split_packages: [
122            "android.uwb",
123            "android.ranging",
124        ],
125
126        // The following packages and all their subpackages currently only
127        // contain classes from this bootclasspath_fragment. Listing a package
128        // here won't prevent other bootclasspath modules from adding classes in
129        // any of those packages but it will prevent them from adding those
130        // classes into an API surface, e.g. public, system, etc.. Doing so will
131        // result in a build failure due to inconsistent flags.
132        package_prefixes: [
133            "com.android.x",
134            "android.uwb.util",
135        ],
136    },
137}
138
139soong_config_module_type {
140    name: "custom_systemserverclasspath_fragment",
141    module_type: "systemserverclasspath_fragment",
142    config_namespace: "bootclasspath",
143    bool_variables: [
144        "release_ranging_stack",
145    ],
146    properties: [
147        "standalone_contents",
148    ],
149}
150
151custom_systemserverclasspath_fragment {
152    name: "com.android.uwb-systemserverclasspath-fragment",
153    soong_config_variables: {
154        release_ranging_stack: {
155            standalone_contents: [
156                "service-uwb",
157                "service-ranging",
158            ],
159            conditions_default: {
160                standalone_contents: [
161                    "service-uwb",
162                ],
163            },
164        },
165    },
166    apex_available: ["com.android.uwb"],
167}
168