xref: /aosp_15_r20/hardware/libhardware/Android.bp (revision e01b6f769022e40d0923dee176e8dc7cd1d52984)
1*e01b6f76SAndroid Build Coastguard Worker// Copyright 2006 The Android Open Source Project
2*e01b6f76SAndroid Build Coastguard Worker
3*e01b6f76SAndroid Build Coastguard Workerpackage {
4*e01b6f76SAndroid Build Coastguard Worker    default_applicable_licenses: ["hardware_libhardware_license"],
5*e01b6f76SAndroid Build Coastguard Worker}
6*e01b6f76SAndroid Build Coastguard Worker
7*e01b6f76SAndroid Build Coastguard Worker// Added automatically by a large-scale-change that took the approach of
8*e01b6f76SAndroid Build Coastguard Worker// 'apply every license found to every target'. While this makes sure we respect
9*e01b6f76SAndroid Build Coastguard Worker// every license restriction, it may not be entirely correct.
10*e01b6f76SAndroid Build Coastguard Worker//
11*e01b6f76SAndroid Build Coastguard Worker// e.g. GPL in an MIT project might only apply to the contrib/ directory.
12*e01b6f76SAndroid Build Coastguard Worker//
13*e01b6f76SAndroid Build Coastguard Worker// Please consider splitting the single license below into multiple licenses,
14*e01b6f76SAndroid Build Coastguard Worker// taking care not to lose any license_kind information, and overriding the
15*e01b6f76SAndroid Build Coastguard Worker// default license using the 'licenses: [...]' property on targets as needed.
16*e01b6f76SAndroid Build Coastguard Worker//
17*e01b6f76SAndroid Build Coastguard Worker// For unused files, consider creating a 'fileGroup' with "//visibility:private"
18*e01b6f76SAndroid Build Coastguard Worker// to attach the license to, and including a comment whether the files may be
19*e01b6f76SAndroid Build Coastguard Worker// used in the current project.
20*e01b6f76SAndroid Build Coastguard Worker// See: http://go/android-license-faq
21*e01b6f76SAndroid Build Coastguard Workerlicense {
22*e01b6f76SAndroid Build Coastguard Worker    name: "hardware_libhardware_license",
23*e01b6f76SAndroid Build Coastguard Worker    visibility: [":__subpackages__"],
24*e01b6f76SAndroid Build Coastguard Worker    license_kinds: [
25*e01b6f76SAndroid Build Coastguard Worker        "SPDX-license-identifier-Apache-2.0",
26*e01b6f76SAndroid Build Coastguard Worker        "SPDX-license-identifier-BSD",
27*e01b6f76SAndroid Build Coastguard Worker    ],
28*e01b6f76SAndroid Build Coastguard Worker    license_text: [
29*e01b6f76SAndroid Build Coastguard Worker        "NOTICE",
30*e01b6f76SAndroid Build Coastguard Worker    ],
31*e01b6f76SAndroid Build Coastguard Worker}
32*e01b6f76SAndroid Build Coastguard Worker
33*e01b6f76SAndroid Build Coastguard Workercc_library_headers {
34*e01b6f76SAndroid Build Coastguard Worker    name: "libhardware_headers",
35*e01b6f76SAndroid Build Coastguard Worker
36*e01b6f76SAndroid Build Coastguard Worker    header_libs: [
37*e01b6f76SAndroid Build Coastguard Worker        "libaudio_system_headers",
38*e01b6f76SAndroid Build Coastguard Worker        "libsystem_headers",
39*e01b6f76SAndroid Build Coastguard Worker        "libcutils_headers",
40*e01b6f76SAndroid Build Coastguard Worker    ],
41*e01b6f76SAndroid Build Coastguard Worker    export_header_lib_headers: [
42*e01b6f76SAndroid Build Coastguard Worker        "libaudio_system_headers",
43*e01b6f76SAndroid Build Coastguard Worker        "libsystem_headers",
44*e01b6f76SAndroid Build Coastguard Worker        "libcutils_headers",
45*e01b6f76SAndroid Build Coastguard Worker    ],
46*e01b6f76SAndroid Build Coastguard Worker
47*e01b6f76SAndroid Build Coastguard Worker    recovery_available: true,
48*e01b6f76SAndroid Build Coastguard Worker    vendor_available: true,
49*e01b6f76SAndroid Build Coastguard Worker    // TODO(b/153609531): remove when no longer needed.
50*e01b6f76SAndroid Build Coastguard Worker    native_bridge_supported: true,
51*e01b6f76SAndroid Build Coastguard Worker
52*e01b6f76SAndroid Build Coastguard Worker    // There are three include directories currently:
53*e01b6f76SAndroid Build Coastguard Worker    // - include: this directory is the original location of libhardware headers. It is globally
54*e01b6f76SAndroid Build Coastguard Worker    //       available (even if you do not depend on libhardware). Many locations also use
55*e01b6f76SAndroid Build Coastguard Worker    //       LOCAL_C_INCLUDES or include_dirs to access these from a global namespace. These processes
56*e01b6f76SAndroid Build Coastguard Worker    //       should replace this dependency with a direct dependency on libhardware(_headers)?.
57*e01b6f76SAndroid Build Coastguard Worker    // - include_all: this directory is for system and vendor include files. Gradually, the number of
58*e01b6f76SAndroid Build Coastguard Worker    //       files here should be reduced to 0 by moving them to vendor as old code is phased out.
59*e01b6f76SAndroid Build Coastguard Worker    // - include_vendor: this directory is the current designated resting place for these headers.
60*e01b6f76SAndroid Build Coastguard Worker    //       They are kept around to try to help insure existing codebases can function.
61*e01b6f76SAndroid Build Coastguard Worker    export_include_dirs: ["include_all"],
62*e01b6f76SAndroid Build Coastguard Worker
63*e01b6f76SAndroid Build Coastguard Worker    target: {
64*e01b6f76SAndroid Build Coastguard Worker        recovery: {
65*e01b6f76SAndroid Build Coastguard Worker            exclude_header_libs: [
66*e01b6f76SAndroid Build Coastguard Worker                "libaudio_system_headers",
67*e01b6f76SAndroid Build Coastguard Worker            ],
68*e01b6f76SAndroid Build Coastguard Worker        },
69*e01b6f76SAndroid Build Coastguard Worker        windows: {
70*e01b6f76SAndroid Build Coastguard Worker            enabled: true,
71*e01b6f76SAndroid Build Coastguard Worker        },
72*e01b6f76SAndroid Build Coastguard Worker        vendor: {
73*e01b6f76SAndroid Build Coastguard Worker            override_export_include_dirs: [
74*e01b6f76SAndroid Build Coastguard Worker                "include_all",
75*e01b6f76SAndroid Build Coastguard Worker                "include_vendor",
76*e01b6f76SAndroid Build Coastguard Worker            ],
77*e01b6f76SAndroid Build Coastguard Worker        },
78*e01b6f76SAndroid Build Coastguard Worker    },
79*e01b6f76SAndroid Build Coastguard Worker    apex_available: [
80*e01b6f76SAndroid Build Coastguard Worker        "//apex_available:platform",
81*e01b6f76SAndroid Build Coastguard Worker        "com.android.btservices",
82*e01b6f76SAndroid Build Coastguard Worker        "com.android.media",
83*e01b6f76SAndroid Build Coastguard Worker        "com.android.media.swcodec",
84*e01b6f76SAndroid Build Coastguard Worker    ],
85*e01b6f76SAndroid Build Coastguard Worker    min_sdk_version: "29",
86*e01b6f76SAndroid Build Coastguard Worker    host_supported: true,
87*e01b6f76SAndroid Build Coastguard Worker
88*e01b6f76SAndroid Build Coastguard Worker}
89*e01b6f76SAndroid Build Coastguard Worker
90*e01b6f76SAndroid Build Coastguard Workercc_library_shared {
91*e01b6f76SAndroid Build Coastguard Worker    name: "libhardware",
92*e01b6f76SAndroid Build Coastguard Worker
93*e01b6f76SAndroid Build Coastguard Worker    srcs: ["hardware.c"],
94*e01b6f76SAndroid Build Coastguard Worker    shared_libs: [
95*e01b6f76SAndroid Build Coastguard Worker        "libapexsupport",
96*e01b6f76SAndroid Build Coastguard Worker        "libcutils",
97*e01b6f76SAndroid Build Coastguard Worker        "liblog",
98*e01b6f76SAndroid Build Coastguard Worker        "libvndksupport",
99*e01b6f76SAndroid Build Coastguard Worker    ],
100*e01b6f76SAndroid Build Coastguard Worker    cflags: [
101*e01b6f76SAndroid Build Coastguard Worker        "-DQEMU_HARDWARE",
102*e01b6f76SAndroid Build Coastguard Worker        "-Wall",
103*e01b6f76SAndroid Build Coastguard Worker        "-Werror",
104*e01b6f76SAndroid Build Coastguard Worker    ],
105*e01b6f76SAndroid Build Coastguard Worker
106*e01b6f76SAndroid Build Coastguard Worker    header_libs: ["libhardware_headers"],
107*e01b6f76SAndroid Build Coastguard Worker    export_header_lib_headers: ["libhardware_headers"],
108*e01b6f76SAndroid Build Coastguard Worker
109*e01b6f76SAndroid Build Coastguard Worker    host_supported: true,
110*e01b6f76SAndroid Build Coastguard Worker    recovery_available: true,
111*e01b6f76SAndroid Build Coastguard Worker    vendor_available: true,
112*e01b6f76SAndroid Build Coastguard Worker    double_loadable: true,
113*e01b6f76SAndroid Build Coastguard Worker    target: {
114*e01b6f76SAndroid Build Coastguard Worker        host: {
115*e01b6f76SAndroid Build Coastguard Worker            exclude_shared_libs: [
116*e01b6f76SAndroid Build Coastguard Worker                "libapexsupport",
117*e01b6f76SAndroid Build Coastguard Worker                "libvndksupport",
118*e01b6f76SAndroid Build Coastguard Worker            ],
119*e01b6f76SAndroid Build Coastguard Worker        },
120*e01b6f76SAndroid Build Coastguard Worker        recovery: {
121*e01b6f76SAndroid Build Coastguard Worker            exclude_shared_libs: [
122*e01b6f76SAndroid Build Coastguard Worker                "libapexsupport",
123*e01b6f76SAndroid Build Coastguard Worker                "libvndksupport",
124*e01b6f76SAndroid Build Coastguard Worker            ],
125*e01b6f76SAndroid Build Coastguard Worker        },
126*e01b6f76SAndroid Build Coastguard Worker        non_apex: {
127*e01b6f76SAndroid Build Coastguard Worker            exclude_shared_libs: [
128*e01b6f76SAndroid Build Coastguard Worker                "libapexsupport",
129*e01b6f76SAndroid Build Coastguard Worker            ],
130*e01b6f76SAndroid Build Coastguard Worker        },
131*e01b6f76SAndroid Build Coastguard Worker    },
132*e01b6f76SAndroid Build Coastguard Worker    min_sdk_version: "29",
133*e01b6f76SAndroid Build Coastguard Worker}
134*e01b6f76SAndroid Build Coastguard Worker
135*e01b6f76SAndroid Build Coastguard Workerdirgroup {
136*e01b6f76SAndroid Build Coastguard Worker    name: "trusty_dirgroup_hardware_libhardware",
137*e01b6f76SAndroid Build Coastguard Worker    dirs: ["."],
138*e01b6f76SAndroid Build Coastguard Worker    visibility: ["//trusty/vendor/google/aosp/scripts"],
139*e01b6f76SAndroid Build Coastguard Worker}
140