1// Copyright (C) 2024 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
19soong_config_module_type {
20    name: "cf_apex",
21    module_type: "apex",
22    config_namespace: "cvd",
23    bool_variables: [
24        "RELEASE_SM_OPEN_DECLARED_PASSTHROUGH_HAL",
25    ],
26    properties: [
27        "defaults",
28    ],
29}
30
31cf_apex {
32    name: "com.google.cf.gralloc",
33    manifest: "apex_manifest.json",
34    key: "com.google.cf.apex.key",
35    certificate: ":com.google.cf.apex.certificate",
36    file_contexts: "apex_file_contexts",
37    updatable: false,
38    vendor: true,
39
40    binaries: [
41        "android.hardware.graphics.allocator-service.minigbm",
42    ],
43    prebuilts: [
44        "allocator.minigbm.xml", // vintf
45        "com.google.cf.gralloc.rc", // init_rc
46    ],
47    overrides: [
48        "android.hardware.graphics.allocator-service.minigbm",
49    ],
50
51    soong_config_variables: {
52        RELEASE_SM_OPEN_DECLARED_PASSTHROUGH_HAL: {
53            defaults: [
54                "com.google.cf.gralloc-mapper-defaults",
55            ],
56        },
57    },
58}
59
60apex_defaults {
61    name: "com.google.cf.gralloc-mapper-defaults",
62
63    // for app_process32 apps
64    compile_multilib: "both",
65
66    native_shared_libs: [
67        "mapper.minigbm",
68    ],
69    prebuilts: [
70        "com.google.cf.gralloc-linker-config", // make the apex namespace visible for mapper library
71        "mapper.minigbm.xml", // vintf
72    ],
73    overrides: [
74        "mapper.minigbm",
75    ],
76}
77
78linker_config {
79    name: "com.google.cf.gralloc-linker-config",
80    src: "apex_linkerconfig.json",
81    installable: false,
82}
83
84genrule {
85    name: "gen-com.google.cf.gralloc.rc",
86    srcs: [":allocator.minigbm.rc"],
87    out: ["com.google.cf.gralloc.rc"],
88    cmd: "sed -E 's%/vendor/bin/%/apex/com.google.cf.gralloc/bin/%' $(in) > $(out)",
89}
90
91prebuilt_etc {
92    name: "com.google.cf.gralloc.rc",
93    src: ":gen-com.google.cf.gralloc.rc",
94    installable: false,
95}
96