1// Copyright (C) 2023 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_team: "trendy_team_fwk_nfc",
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20apex_key {
21    name: "com.android.nfcservices.key",
22    public_key: "com.android.nfcservices.avbpubkey",
23    private_key: "com.android.nfcservices.pem",
24}
25
26android_app_certificate {
27    name: "com.android.nfcservices.certificate",
28    certificate: "com.android.nfcservices",
29}
30
31soong_config_module_type {
32    name: "custom_apex",
33    module_type: "apex",
34    config_namespace: "bootclasspath",
35    bool_variables: [
36        "nfc_apex_bootclasspath_fragment",
37    ],
38    properties: [
39        "bootclasspath_fragments",
40    ],
41}
42
43custom_apex {
44    name: "com.android.nfcservices",
45    manifest: "manifest.json",
46    apps: ["NfcNciApex"],
47    multilib: {
48        first: {
49            // Extractor process runs only with the primary ABI.
50            jni_libs: [
51                "libnfc_nci_jni",
52            ],
53        },
54    },
55    soong_config_variables: {
56        nfc_apex_bootclasspath_fragment: {
57            bootclasspath_fragments: ["com.android.nfcservices-bootclasspath-fragment"],
58        },
59    },
60
61    required: [
62        // Provide a default libnfc-nci.conf in /system/etc for devices that
63        // does not ship one in /product
64        "libnfc-nci.conf-default",
65    ],
66    key: "com.android.nfcservices.key",
67    certificate: ":com.android.nfcservices.certificate",
68    updatable: false,
69}
70
71soong_config_module_type {
72    name: "custom_bootclasspath_fragment",
73    module_type: "bootclasspath_fragment",
74    config_namespace: "bootclasspath",
75    bool_variables: [
76        "nfc_apex_bootclasspath_fragment",
77    ],
78    properties: [
79        "enabled",
80    ],
81}
82
83// Encapsulate the contributions made by the com.android.nfc to the bootclasspath.
84custom_bootclasspath_fragment {
85    name: "com.android.nfcservices-bootclasspath-fragment",
86    contents: ["framework-nfc"],
87    apex_available: ["com.android.nfcservices"],
88    // This is disabled for now since the build system does not allow for adding a bootclasspath
89    // fragment and conditionally adding it to PRODUCT_APEX_BOOT_JARS.
90    // When `RELEASE_PACKAGE_NFC_STACK` is set to `com.android.nfcservices`, this needs to be
91    // set to true.
92    enabled: false,
93    soong_config_variables: {
94        nfc_apex_bootclasspath_fragment: {
95            enabled: true,
96        },
97    },
98
99    // The bootclasspath_fragments that provide APIs on which this depends.
100    fragments: [
101        // Needed to access core java APIs.
102        {
103            apex: "com.android.art",
104            module: "art-bootclasspath-fragment",
105        },
106    ],
107
108    // Additional stubs libraries that this fragment's contents use which are
109    // not provided by another bootclasspath_fragment.
110    additional_stubs: [
111        // Needed to access platform APIs.
112        "android-non-updatable",
113    ],
114    hidden_api: {
115        // Additional hidden API flag files to override the defaults. This must only be
116        // modified by the Soong or platform compat team.
117        max_target_o_low_priority: ["hiddenapi/hiddenapi-max-target-o.txt"],
118        max_target_r_low_priority: ["hiddenapi/hiddenapi-max-target-r-loprio.txt"],
119
120        // The following packages contain classes from other modules on the
121        // bootclasspath. That means that the hidden API flags for this module
122        // has to explicitly list every single class this module provides in
123        // that package to differentiate them from the classes provided by other
124        // modules. That can include private classes that are not part of the
125        // API.
126        split_packages: [
127            "android.nfc",
128            "android.nfc.cardemulation",
129        ],
130
131        // The following packages and all their subpackages currently only
132        // contain classes from this bootclasspath_fragment. Listing a package
133        // here won't prevent other bootclasspath modules from adding classes in
134        // any of those packages but it will prevent them from adding those
135        // classes into an API surface, e.g. public, system, etc.. Doing so will
136        // result in a build failure due to inconsistent flags.
137        package_prefixes: [
138            "android.nfc.dta",
139            "android.nfc.tech",
140            "com.android.nfc",
141        ],
142    },
143}
144