1// Copyright 2006 The Android Open Source Project
2
3package {
4    default_team: "trendy_team_android_kernel",
5    default_applicable_licenses: ["hardware_libhardware_legacy_license"],
6}
7
8// Added automatically by a large-scale-change
9// See: http://go/android-license-faq
10license {
11    name: "hardware_libhardware_legacy_license",
12    visibility: [":__subpackages__"],
13    license_kinds: [
14        "SPDX-license-identifier-Apache-2.0",
15    ],
16    license_text: [
17        "NOTICE",
18    ],
19}
20
21cc_library_headers {
22    name: "libhardware_legacy_headers",
23    vendor_available: true,
24    export_include_dirs: ["include"],
25
26    header_libs: ["libcutils_headers"],
27    export_header_lib_headers: ["libcutils_headers"],
28}
29
30cc_defaults {
31    name: "libpower_defaults",
32    defaults: ["system_suspend_defaults"],
33    // system_suspend_defaults adds libbinder, but libbpower doesn't need it
34    // because libpower now uses libbinder_ndk.
35    exclude_shared_libs: ["libbinder"],
36    cflags: [
37        "-Wexit-time-destructors",
38        "-fno-c++-static-destructors",
39    ],
40}
41
42soong_config_module_type {
43    name: "cc_library_libpower",
44    module_type: "cc_library",
45    config_namespace: "ANDROID",
46    bool_variables: [
47        "release_libpower_no_lock_binder_txn",
48    ],
49    properties: [
50        "cflags",
51    ],
52}
53
54cc_library_libpower {
55    name: "libpower",
56    defaults: ["libpower_defaults"],
57    srcs: ["power.cpp"],
58    export_include_dirs: ["include"],
59    shared_libs: ["android.system.suspend-V1-ndk"],
60    vendor_available: true,
61    apex_available: [
62        "//apex_available:platform",
63        "com.android.uwb",
64    ],
65    min_sdk_version: "Tiramisu",
66    soong_config_variables: {
67        release_libpower_no_lock_binder_txn: {
68            cflags: ["-DENABLE_NO_LOCK_BINDER_TXN"],
69        },
70    },
71}
72
73cc_test {
74    name: "libpower_test",
75    defaults: ["libpower_defaults"],
76    srcs: ["power_test.cpp"],
77    static_libs: [
78        "libpower",
79        "android.system.suspend.control.internal-ndk",
80        "android.system.suspend-V1-ndk",
81    ],
82    test_suites: ["device-tests"],
83    require_root: true,
84}
85
86cc_library_shared {
87    name: "libhardware_legacy",
88    defaults: ["libpower_defaults"],
89    vendor_available: true,
90
91    shared_libs: [
92        "android.system.suspend-V1-ndk",
93        "libdl",
94    ],
95
96    header_libs: [
97        "libhardware_legacy_headers",
98    ],
99    export_header_lib_headers: ["libhardware_legacy_headers"],
100
101    export_include_dirs: ["include"],
102
103    cflags: [
104        "-DQEMU_HARDWARE",
105        "-Wall",
106        "-Werror",
107    ],
108
109    srcs: [
110        "power.cpp",
111        "uevent.c",
112    ],
113}
114
115cc_test {
116    name: "block_suspend",
117    defaults: ["libpower_defaults"],
118    srcs: ["block_suspend.cpp"],
119    static_libs: ["libpower"],
120    shared_libs: [
121        "android.system.suspend-V1-ndk",
122    ],
123    gtest: false,
124}
125