1package {
2    default_applicable_licenses: ["Android-Apache-2.0"],
3    default_team: "trendy_team_system_performance",
4}
5
6aconfig_declarations {
7    name: "uprobestats_flags",
8    package: "android.uprobestats.flags",
9    container: "system",
10    srcs: ["flag.aconfig"],
11}
12
13aconfig_declarations {
14    name: "uprobestats_mainline_flags",
15    package: "android.uprobestats.mainline.flags",
16    container: "com.android.uprobestats",
17    srcs: ["mainline-flag.aconfig"],
18}
19
20cc_aconfig_library {
21    name: "uprobestats_flags_c_lib",
22    aconfig_declarations: "uprobestats_flags",
23    apex_available: [
24        "//apex_available:platform",
25        "com.android.uprobestats",
26    ],
27    min_sdk_version: "35",
28}
29
30cc_aconfig_library {
31    name: "uprobestats_mainline_flags_c_lib",
32    aconfig_declarations: "uprobestats_mainline_flags",
33    apex_available: [
34        "//apex_available:platform",
35        "com.android.uprobestats",
36    ],
37    min_sdk_version: "35",
38}
39
40java_aconfig_library {
41    name: "uprobestats_flags_java_lib",
42    aconfig_declarations: "uprobestats_flags",
43    host_supported: true,
44}
45
46java_aconfig_library {
47    name: "art_flags_uprobestats_java_lib",
48    aconfig_declarations: "art-aconfig-flags",
49    host_supported: true,
50}
51
52java_aconfig_library {
53    name: "uprobestats_mainline_flags_java_lib",
54    aconfig_declarations: "uprobestats_mainline_flags",
55    host_supported: true,
56    visibility: [
57        "//cts/hostsidetests/statsdatom:__subpackages__",
58    ],
59}
60
61soong_config_module_type {
62    name: "uprobestats_cc_library",
63    module_type: "cc_library",
64    config_namespace: "ANDROID",
65    bool_variables: [
66        "release_uprobestats_module",
67    ],
68    properties: [
69        "cflags",
70    ],
71}
72
73soong_config_bool_variable {
74    name: "release_uprobestats_module",
75}
76
77uprobestats_cc_library {
78    name: "libuprobestats",
79    soong_config_variables: {
80        release_uprobestats_module: {
81            cflags: [
82                "-DUPROBESTATS_IN_MAINLINE=1",
83            ],
84        },
85    },
86    srcs: [
87        "Art.cpp",
88        "Bpf.cpp",
89        "ConfigResolver.cpp",
90        "DynamicInstrumentationManager.cpp",
91        "FlagSelector.cpp",
92        "Process.cpp",
93        "Guardrail.cpp",
94        "config.proto",
95    ],
96    header_libs: [
97        "uprobestats_bpf_headers",
98    ],
99    shared_libs: [
100        "libandroid",
101        "libbinder_ndk",
102        "libbase",
103        "liblog",
104    ],
105    static_libs: [
106        "libjsoncpp",
107        "uprobestats_flags_c_lib",
108        "uprobestats_mainline_flags_c_lib",
109    ],
110    proto: {
111        export_proto_headers: true,
112        type: "lite",
113    },
114    apex_available: [
115        "//apex_available:platform",
116        "com.android.uprobestats",
117    ],
118    min_sdk_version: "35",
119}
120
121cc_binary {
122    name: "uprobestats",
123    srcs: [
124        "UprobeStats.cpp",
125        "config.proto",
126    ],
127    static_libs: [
128        "libjsoncpp",
129        "libprotoutil",
130        "libuprobestats",
131        "uprobestats_flags_c_lib",
132        "uprobestats_mainline_flags_c_lib",
133    ],
134    shared_libs: [
135        "libandroid",
136        "libbase",
137        "libbinder_ndk",
138        "liblog",
139        "libstatssocket",
140    ],
141    init_rc: [
142        "UprobeStats-platform.rc",
143    ],
144    required: select(release_flag("RELEASE_UPROBESTATS_MODULE"), {
145        true: [],
146        false: [
147            "BitmapAllocation.o",
148            "GenericInstrumentation.o",
149            "ProcessManagement.o",
150        ],
151    }),
152
153    proto: {
154        type: "lite",
155        static: true,
156    },
157    apex_available: [
158        "//apex_available:platform",
159        "com.android.uprobestats",
160    ],
161
162    min_sdk_version: "35",
163}
164
165java_library_host {
166    name: "uprobestats-protos",
167    srcs: [
168        "config.proto",
169    ],
170    proto: {
171        include_dirs: [
172            "external/protobuf/src",
173        ],
174        type: "full",
175    },
176}
177
178java_test_host {
179    name: "uprobestats-test",
180    srcs: [
181        "test/*.java",
182        "config.proto",
183    ],
184    java_resources: ["test/*.textproto"],
185    libs: [
186        "compatibility-host-util",
187        "core_cts_test_resources",
188        "cts-tradefed",
189        "host-libprotobuf-java-full",
190        "tradefed",
191        "truth",
192    ],
193    static_libs: [
194        "android.hardware.usb.flags-aconfig-java-host",
195        "android.os.flags-aconfig-java-host",
196        "cts-statsd-atom-host-test-utils",
197        "flag-junit-host",
198        "perfetto_config-full",
199        "art_flags_uprobestats_java_lib",
200        "uprobestats_flags_java_lib",
201    ],
202    proto: {
203        type: "full",
204    },
205    test_suites: [
206        "general-tests",
207        "mts-uprobestats",
208    ],
209}
210
211python_binary_host {
212    name: "hello_uprobestats",
213    main: "test/hello_uprobestats.py",
214    srcs: [
215        "test/hello_uprobestats.py",
216        "config.proto",
217    ],
218    data: ["test/*.textproto"],
219    libs: ["libprotobuf-python"],
220    proto: {
221        canonical_path_from_root: false,
222    },
223}
224
225cc_test {
226    name: "libuprobestats_test",
227    srcs: [
228        "config.proto",
229        "Guardrail-test.cpp",
230    ],
231    shared_libs: [
232        "libbase",
233    ],
234    static_libs: [
235        "libbase",
236        "libgtest",
237        "liblog",
238        "libprotoutil",
239        "libuprobestats",
240    ],
241    proto: {
242        type: "lite",
243        static: true,
244    },
245}
246