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    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20cc_library {
21    name: "pixelatoms-cpp",
22    vendor: true,
23    proto: {
24        type: "lite",
25        export_proto_headers: true,
26        include_dirs: [
27            "external/protobuf/src",
28            "frameworks/proto_logging/stats",
29        ],
30    },
31    srcs: [
32        "pixelatoms.proto",
33        ":libstats_shared_enum_protos",
34        ":libstats_atom_options_protos",
35        ":libprotobuf-internal-descriptor-proto",
36    ],
37}
38
39java_library {
40    name: "pixelatoms-java",
41    vendor: true,
42    proto: {
43        type: "lite",
44        include_dirs: [
45            "external/protobuf/src",
46            "frameworks/proto_logging/stats",
47        ],
48    },
49    srcs: [
50        "pixelatoms.proto",
51        ":libstats_shared_enum_protos",
52        ":libstats_atom_options_protos",
53        ":libprotobuf-internal-descriptor-proto",
54    ],
55    sdk_version: "current",
56}
57
58java_library_host {
59    name: "pixelatoms-java_host",
60    proto: {
61        type: "full",
62        include_dirs: [
63            "external/protobuf/src",
64            "frameworks/proto_logging/stats",
65        ],
66    },
67    srcs: [
68        "pixelatoms.proto",
69        ":libstats_shared_enum_protos",
70        ":libstats_atom_options_protos",
71    ],
72}
73
74genrule {
75    name: "pixelatoms_defs.h",
76    tools: ["stats-log-api-gen"],
77    cmd: "$(location stats-log-api-gen) --header $(genDir)/pixelatoms_defs.h --namespace hardware,google,pixel,PixelAtoms --vendor-proto $(location pixelatoms.proto)",
78    srcs: [
79        "pixelatoms.proto",
80        ":libstats_shared_enum_protos",
81        ":libstats_atom_options_protos",
82        ":libprotobuf-internal-protos",
83    ],
84    out: [
85        "pixelatoms_defs.h",
86    ],
87}
88
89cc_library {
90    name: "libpixelatoms_defs",
91    vendor: true,
92    generated_headers: ["pixelatoms_defs.h"],
93    export_generated_headers: ["pixelatoms_defs.h"],
94}
95
96genrule {
97    name: "pixelstatsatoms.h",
98    tools: ["stats-log-api-gen"],
99    cmd: "$(location stats-log-api-gen) --header $(out)" +
100        " --module pixelstats" +
101        " --namespace android,hardware,google,pixel,PixelAtoms" +
102        " --vendor-proto $(location pixelatoms.proto)",
103    out: [
104        "pixelstatsatoms.h",
105    ],
106    srcs: [
107        "pixelatoms.proto",
108        ":libstats_shared_enum_protos",
109        ":libstats_atom_options_protos",
110        ":libprotobuf-internal-protos",
111    ],
112}
113
114genrule {
115    name: "pixelstatsatoms.cpp",
116    tools: ["stats-log-api-gen"],
117    cmd: "$(location stats-log-api-gen) --cpp $(out)" +
118        " --module pixelstats" +
119        " --importHeader pixelstatsatoms.h" +
120        " --namespace android,hardware,google,pixel,PixelAtoms" +
121        " --vendor-proto $(location pixelatoms.proto)",
122    out: [
123        "pixelstatsatoms.cpp",
124    ],
125    srcs: [
126        "pixelatoms.proto",
127        ":libstats_shared_enum_protos",
128        ":libstats_atom_options_protos",
129        ":libprotobuf-internal-protos",
130    ],
131}
132
133cc_library_static {
134    name: "libpixelstatsatoms",
135    vendor: true,
136    generated_sources: ["pixelstatsatoms.cpp"],
137    generated_headers: ["pixelstatsatoms.h"],
138    export_generated_headers: ["pixelstatsatoms.h"],
139    shared_libs: [
140        "android.frameworks.stats-V2-ndk",
141    ],
142}
143
144cc_library {
145    name: "libpixelstats",
146    vendor: true,
147    export_include_dirs: ["include"],
148
149    tidy_disabled_srcs: [
150        "MmMetricsReporter.cpp", // b/215238264
151    ],
152    srcs: [
153        "BatteryCapacityReporter.cpp",
154        "BatteryEEPROMReporter.cpp",
155        "BatteryHealthReporter.cpp",
156        "BatteryFGReporter.cpp",
157        "BatteryTTFReporter.cpp",
158        "BrownoutDetectedReporter.cpp",
159        "ChargeStatsReporter.cpp",
160        "DisplayStatsReporter.cpp",
161        "DropDetect.cpp",
162        "MmMetricsReporter.cpp",
163        "MitigationStatsReporter.cpp",
164        "MitigationDurationReporter.cpp",
165        "PcaChargeStats.cpp",
166        "StatsHelper.cpp",
167        "SysfsCollector.cpp",
168        "ThermalStatsReporter.cpp",
169        "TempResidencyReporter.cpp",
170        "UeventListener.cpp",
171        "WirelessChargeStats.cpp",
172    ],
173    cflags: [
174        "-Wall",
175        "-Werror",
176    ],
177    shared_libs: [
178        "android.frameworks.stats-V2-ndk",
179        "libbase",
180        "libbinder_ndk",
181        "libcutils",
182        "libhidlbase",
183        "liblog",
184        "libprotobuf-cpp-lite",
185        "libutils",
186        "libsensorndkbridge",
187        "pixelatoms-cpp",
188    ],
189    export_shared_lib_headers: [
190        "android.frameworks.stats-V2-ndk",
191        "pixelatoms-cpp",
192    ],
193    static_libs: [
194        "chre_client",
195        "libpixelstatsatoms",
196    ],
197    header_libs: ["chre_api"],
198}
199
200filegroup {
201    name: "pixelatoms_proto",
202    srcs: [
203        "pixelatoms.proto",
204    ],
205}
206