xref: /aosp_15_r20/frameworks/native/cmds/dumpstate/Android.bp (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1//
2// Copyright (C) 2017 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
16package {
17    // See: http://go/android-license-faq
18    // A large-scale-change added 'default_applicable_licenses' to import
19    // all of the 'license_kinds' from "frameworks_native_license"
20    // to get the below license kinds:
21    //   SPDX-license-identifier-Apache-2.0
22    default_applicable_licenses: ["frameworks_native_license"],
23}
24
25cc_defaults {
26    name: "dumpstate_cflag_defaults",
27    cflags: [
28        "-Wall",
29        "-Werror",
30        "-Wno-missing-field-initializers",
31        "-Wno-unused-variable",
32        "-Wunused-parameter",
33    ],
34}
35
36cc_library_shared {
37    name: "libdumpstateutil",
38    defaults: ["dumpstate_cflag_defaults"],
39    vendor_available: true,
40    srcs: [
41        "DumpstateInternal.cpp",
42        "DumpstateUtil.cpp",
43    ],
44    shared_libs: [
45        "libbase",
46        "liblog",
47    ],
48    export_include_dirs: ["."],
49    export_shared_lib_headers: [
50        "libbase",
51    ],
52}
53
54cc_library_shared {
55    name: "libdumpstateaidl",
56    defaults: ["dumpstate_cflag_defaults"],
57    shared_libs: [
58        "libbinder",
59        "libutils",
60    ],
61    aidl: {
62        local_include_dirs: ["binder"],
63        export_aidl_headers: true,
64    },
65    srcs: [
66        ":dumpstate_aidl",
67    ],
68    export_include_dirs: ["binder"],
69}
70
71filegroup {
72    name: "dumpstate_aidl",
73    srcs: [
74        "binder/android/os/IDumpstateListener.aidl",
75        "binder/android/os/IDumpstate.aidl",
76    ],
77    path: "binder",
78}
79
80cc_defaults {
81    name: "dumpstate_defaults",
82    defaults: [
83        "aconfig_lib_cc_static_link.defaults",
84        "dumpstate_cflag_defaults",
85    ],
86    shared_libs: [
87        "[email protected]",
88        "[email protected]",
89        "android.hardware.dumpstate-V1-ndk",
90        "libziparchive",
91        "libbase",
92        "libbinder",
93        "libbinder_ndk",
94        "libcrypto",
95        "libcutils",
96        "libdebuggerd_client",
97        "libdumpstateaidl",
98        "libdumpstateutil",
99        "libdumputils",
100        "libhardware_legacy",
101        "libhidlbase",
102        "liblog",
103        "libutils",
104        "libvintf",
105        "libbinderdebug",
106        "packagemanager_aidl-cpp",
107        "server_configurable_flags",
108        "device_policy_aconfig_flags_c_lib",
109    ],
110    srcs: [
111        "DumpstateService.cpp",
112    ],
113    static_libs: [
114        "libincidentcompanion",
115        "libdumpsys",
116        "libserviceutils",
117        "android.tracing.flags_c_lib",
118    ],
119}
120
121prebuilt_etc {
122    name: "default_screenshot",
123    src: "res/default_screenshot.png",
124    filename_from_src: true,
125}
126
127cc_binary {
128    name: "dumpstate",
129    defaults: ["dumpstate_defaults"],
130    srcs: [
131        "DumpPool.cpp",
132        "TaskQueue.cpp",
133        "dumpstate.cpp",
134        "main.cpp",
135    ],
136    required: [
137        "atrace",
138        "bugreport_procdump",
139        "default_screenshot",
140        "dmabuf_dump",
141        "ip",
142        "iptables",
143        "librank",
144        "logcat",
145        "lpdump",
146        "lpdumpd",
147        "procrank",
148        "screencap",
149        "showmap",
150        "ss",
151        "storaged",
152        "toolbox",
153        "toybox",
154        "vdc",
155    ],
156    init_rc: ["dumpstate.rc"],
157}
158
159cc_test {
160    name: "dumpstate_test",
161    defaults: ["dumpstate_defaults"],
162    srcs: [
163        "DumpPool.cpp",
164        "TaskQueue.cpp",
165        "dumpstate.cpp",
166        "tests/dumpstate_test.cpp",
167    ],
168    static_libs: [
169        "libgmock",
170    ],
171    test_config: "dumpstate_test.xml",
172    data: [
173        ":dumpstate_test_fixture",
174        "tests/testdata/**/*",
175    ],
176    test_suites: ["device-tests"],
177}
178
179cc_test {
180    name: "dumpstate_smoke_test",
181    defaults: ["dumpstate_defaults"],
182    srcs: [
183        "DumpPool.cpp",
184        "TaskQueue.cpp",
185        "dumpstate.cpp",
186        "tests/dumpstate_smoke_test.cpp",
187    ],
188    static_libs: ["libgmock"],
189    test_config: "dumpstate_smoke_test.xml",
190    test_suites: ["device-tests"],
191}
192
193// =======================#
194// dumpstate_test_fixture #
195// =======================#
196cc_test {
197
198    name: "dumpstate_test_fixture",
199    test_suites: ["device-tests"],
200    cflags: [
201        "-Wall",
202        "-Werror",
203        "-Wno-missing-field-initializers",
204        "-Wno-unused-variable",
205        "-Wunused-parameter",
206    ],
207    srcs: ["tests/dumpstate_test_fixture.cpp"],
208    data: ["tests/testdata/**/*"],
209}
210