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 // See README.md: "Dumpstate philosophy: exec not link" 87 // Do not add things here - keep dumpstate as simple as possible and exec where possible. 88 shared_libs: [ 89 "android.hardware.dumpstate@1.0", 90 "android.hardware.dumpstate@1.1", 91 "android.hardware.dumpstate-V1-ndk", 92 "libziparchive", 93 "libbase", 94 "libbinder", // BAD: dumpstate should not link code directly, should only exec binaries 95 "libbinder_ndk", // BAD: dumpstate should not link code directly, should only exec binaries 96 "libcrypto", 97 "libcutils", 98 "libdebuggerd_client", 99 "libdumpstateaidl", 100 "libdumpstateutil", 101 "libdumputils", 102 "libhardware_legacy", 103 "libhidlbase", // BAD: dumpstate should not link code directly, should only exec binaries 104 "liblog", 105 "libutils", 106 "libvintf", // BAD: dumpstate should not link code directly, should only exec binaries 107 "libbinderdebug", // BAD: dumpstate should not link code directly, should only exec binaries 108 "packagemanager_aidl-cpp", 109 "server_configurable_flags", 110 "device_policy_aconfig_flags_c_lib", 111 ], 112 srcs: [ 113 "DumpstateService.cpp", 114 ], 115 static_libs: [ 116 "libincidentcompanion", 117 "libdumpsys", 118 "libserviceutils", 119 "android.tracing.flags_c_lib", 120 "perfetto_flags_c_lib", 121 ], 122} 123 124prebuilt_etc { 125 name: "default_screenshot", 126 src: "res/default_screenshot.png", 127 filename_from_src: true, 128} 129 130cc_binary { 131 name: "dumpstate", 132 defaults: ["dumpstate_defaults"], 133 srcs: [ 134 "DumpPool.cpp", 135 "TaskQueue.cpp", 136 "dumpstate.cpp", 137 "main.cpp", 138 ], 139 required: [ 140 "alloctop", 141 "atrace", 142 "bugreport_procdump", 143 "default_screenshot", 144 "dmabuf_dump", 145 "ip", 146 "iptables", 147 "librank", 148 "logcat", 149 "lpdump", 150 "lpdumpd", 151 "procrank", 152 "screencap", 153 "showmap", 154 "ss", 155 "storaged", 156 "toolbox", 157 "toybox", 158 "vdc", 159 ], 160 init_rc: ["dumpstate.rc"], 161} 162 163cc_test { 164 name: "dumpstate_test", 165 defaults: ["dumpstate_defaults"], 166 srcs: [ 167 "DumpPool.cpp", 168 "TaskQueue.cpp", 169 "dumpstate.cpp", 170 "tests/dumpstate_test.cpp", 171 ], 172 static_libs: [ 173 "libgmock", 174 ], 175 test_config: "dumpstate_test.xml", 176 data: [ 177 ":dumpstate_test_fixture", 178 "tests/testdata/**/*", 179 ], 180 test_suites: ["device-tests"], 181} 182 183cc_test { 184 name: "dumpstate_smoke_test", 185 defaults: ["dumpstate_defaults"], 186 srcs: [ 187 "DumpPool.cpp", 188 "TaskQueue.cpp", 189 "dumpstate.cpp", 190 "tests/dumpstate_smoke_test.cpp", 191 ], 192 static_libs: ["libgmock"], 193 test_config: "dumpstate_smoke_test.xml", 194 test_suites: ["device-tests"], 195} 196 197// =======================# 198// dumpstate_test_fixture # 199// =======================# 200cc_test { 201 202 name: "dumpstate_test_fixture", 203 test_suites: ["device-tests"], 204 cflags: [ 205 "-Wall", 206 "-Werror", 207 "-Wno-missing-field-initializers", 208 "-Wno-unused-variable", 209 "-Wunused-parameter", 210 ], 211 srcs: ["tests/dumpstate_test_fixture.cpp"], 212 data: ["tests/testdata/**/*"], 213} 214