1/*
2 * Copyright 2019 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    // Inherits all licenses from parent to get Apache 2.0 and package name
19    default_applicable_licenses: [
20        "packages_modules_NeuralNetworks_license",
21    ],
22}
23
24apex_key {
25    name: "com.android.neuralnetworks.key",
26    public_key: "com.android.neuralnetworks.avbpubkey",
27    private_key: "com.android.neuralnetworks.pem",
28}
29
30android_app_certificate {
31    name: "com.android.neuralnetworks.certificate",
32    certificate: "com.android.neuralnetworks",
33}
34
35filegroup {
36    name: "com.android.neuralnetworks-androidManifest",
37    srcs: ["AndroidManifest.xml"],
38}
39
40apex_defaults {
41    name: "com.android.neuralnetworks-defaults",
42    defaults: ["r-launched-apex-module"],
43    androidManifest: ":com.android.neuralnetworks-androidManifest",
44    native_shared_libs: [
45        "libneuralnetworks",
46    ],
47    compile_multilib: "both",
48    key: "com.android.neuralnetworks.key",
49    certificate: ":com.android.neuralnetworks.certificate",
50    // Indicates that pre-installed version of this apex can be compressed.
51    // Whether it actually will be compressed is controlled on per-device basis.
52    compressible: true,
53}
54
55apex {
56    name: "com.android.neuralnetworks",
57    defaults: [
58        "com.android.neuralnetworks-defaults",
59    ],
60    manifest: "manifest.json",
61    prebuilts: ["current_sdkinfo"],
62    bootclasspath_fragments: select(release_flag("RELEASE_ONDEVICE_INTELLIGENCE_MODULE"), {
63        true: ["com.android.ondeviceintelligence-bootclasspath-fragment"],
64        default: [],
65    }),
66    systemserverclasspath_fragments: select(release_flag("RELEASE_ONDEVICE_INTELLIGENCE_MODULE"), {
67        true: ["com.android.ondeviceintelligence-systemserverclasspath-fragment"],
68        default: [],
69    }),
70}
71
72sdk {
73    enabled: select(release_flag("RELEASE_ONDEVICE_INTELLIGENCE_MODULE"), {
74        true: true,
75        default: false,
76    }),
77    name: "neuralnetworks-module-sdk",
78    apexes: [
79        // Adds exportable dependencies of the APEX to the sdk,
80        // e.g. *classpath_fragments.
81        "com.android.neuralnetworks",
82    ],
83}
84
85// Encapsulate the contributions made by com.android.neuralnetworks to the bootclasspath.
86bootclasspath_fragment {
87    enabled: select(release_flag("RELEASE_ONDEVICE_INTELLIGENCE_MODULE"), {
88        true: true,
89        default: false,
90    }),
91    name: "com.android.ondeviceintelligence-bootclasspath-fragment",
92    contents: ["framework-ondeviceintelligence"],
93    apex_available: ["com.android.neuralnetworks"],
94    hidden_api: {
95        split_packages: ["*"],
96    },
97    additional_stubs: [
98        "android-non-updatable",
99    ],
100    // The bootclasspath_fragments that provide APIs on which this depends.
101    fragments: [
102        {
103            apex: "com.android.art",
104            module: "art-bootclasspath-fragment",
105        },
106    ],
107}
108
109// Encapsulate the contributions made by the com.android.crashrecovery to the systemserverclasspath.
110systemserverclasspath_fragment {
111    // This fragment will be enabled using release_crashrecovery_module flag
112    enabled: select(release_flag("RELEASE_ONDEVICE_INTELLIGENCE_MODULE"), {
113        true: true,
114        default: false,
115    }),
116
117    name: "com.android.ondeviceintelligence-systemserverclasspath-fragment",
118    contents: ["service-ondeviceintelligence"],
119    apex_available: ["com.android.neuralnetworks"],
120}
121