blob: 6fd97286cdc145682d386c2df3c6e1d0fedfae9d [file] [log] [blame]
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -08001//
2// Copyright (C) 2018 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//
16
17// =========================================================================
18// Native library to write stats log to statsd socket on Android R and later
19// =========================================================================
Tej Singh29512fb2020-01-29 15:56:52 -080020cc_defaults {
21 name: "libstatssocket_defaults",
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080022 srcs: [
Muhammad Qureshi962cc232019-11-06 15:15:23 -080023 "stats_buffer_writer.c",
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080024 "stats_event.c",
Muhammad Qureshi962cc232019-11-06 15:15:23 -080025 // TODO(b/145573568): Remove stats_event_list once stats_event
26 // migration is complete.
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080027 "stats_event_list.c",
28 "statsd_writer.c",
29 ],
Tej Singh29512fb2020-01-29 15:56:52 -080030 export_include_dirs: ["include"],
31 static_libs: [
32 "libcutils", // does not expose a stable C API
33 ],
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080034 cflags: [
35 "-Wall",
36 "-Werror",
37 "-DLIBLOG_LOG_TAG=1006",
38 "-DWRITE_TO_STATSD=1",
39 "-DWRITE_TO_LOGD=0",
40 ],
Tej Singh29512fb2020-01-29 15:56:52 -080041}
42
43
44cc_library {
45 name: "libstatssocket",
46 defaults: [
47 "libstatssocket_defaults",
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080048 ],
Tej Singh29512fb2020-01-29 15:56:52 -080049 host_supported: true,
50 target: {
51 // On android, libstatssocket should only be linked as a shared lib
52 android: {
53 static: {
54 enabled: false,
55 },
56 },
57 host: {
58 shared: {
59 enabled: false,
60 },
61 },
62 },
Ruchir Rastogi5dbcae52019-12-19 15:44:58 -080063
64 // enumerate stable entry points for APEX use
65 stubs: {
66 symbol_file: "libstatssocket.map.txt",
67 versions: [
68 "1",
69 ],
Tej Singh29512fb2020-01-29 15:56:52 -080070 },
71 apex_available: [
72 "com.android.os.statsd",
73 "test_com.android.os.statsd",
74 ],
75}
76
77//TODO (b/149842105): Figure out if there is a better solution for this.
78cc_test_library {
79 name: "libstatssocket_private",
80 defaults: [
81 "libstatssocket_defaults",
82 ],
83 visibility: [
84 "//frameworks/base/apex/statsd/tests/libstatspull",
85 "//frameworks/base/cmds/statsd",
86 ],
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080087}
Ruchir Rastogi926fa882019-12-10 18:46:23 -080088
89cc_library_headers {
90 name: "libstatssocket_headers",
91 export_include_dirs: ["include"],
92 host_supported: true,
Jiyong Park937b4bf2020-04-08 23:40:03 +090093 apex_available: ["com.android.resolv"],
Jooyung Hancc3588a2020-04-16 18:48:33 +090094 min_sdk_version: "29",
Ruchir Rastogi926fa882019-12-10 18:46:23 -080095}
Ruchir Rastogi79dd3ea2019-12-12 17:16:59 -080096
97cc_benchmark {
98 name: "libstatssocket_benchmark",
99 srcs: [
100 "benchmark/main.cpp",
101 "benchmark/stats_event_benchmark.cpp",
102 ],
103 cflags: [
104 "-Wall",
105 "-Werror",
106 ],
107 static_libs: [
Tej Singh29512fb2020-01-29 15:56:52 -0800108 "libstatssocket_private",
Ruchir Rastogi79dd3ea2019-12-12 17:16:59 -0800109 ],
110 shared_libs: [
111 "libcutils",
112 "liblog",
113 "libgtest_prod",
114 ],
115}
Ruchir Rastogic6e6c442020-01-07 09:36:04 -0800116
117cc_test {
118 name: "libstatssocket_test",
119 srcs: ["tests/stats_event_test.cpp"],
120 cflags: [
121 "-Wall",
122 "-Werror",
123 ],
124 static_libs: [
125 "libgmock",
Tej Singh29512fb2020-01-29 15:56:52 -0800126 "libstatssocket_private",
Ruchir Rastogic6e6c442020-01-07 09:36:04 -0800127 ],
128 shared_libs: [
129 "libcutils",
130 "liblog",
131 "libutils",
132 ],
133 test_suites: ["device_tests"],
134}