1*38e8c45fSAndroid Build Coastguard Worker /*
2*38e8c45fSAndroid Build Coastguard Worker * Copyright (C) 2021 The Android Open Source Project
3*38e8c45fSAndroid Build Coastguard Worker *
4*38e8c45fSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*38e8c45fSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*38e8c45fSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*38e8c45fSAndroid Build Coastguard Worker *
8*38e8c45fSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
9*38e8c45fSAndroid Build Coastguard Worker *
10*38e8c45fSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*38e8c45fSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*38e8c45fSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*38e8c45fSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*38e8c45fSAndroid Build Coastguard Worker * limitations under the License.
15*38e8c45fSAndroid Build Coastguard Worker */
16*38e8c45fSAndroid Build Coastguard Worker
17*38e8c45fSAndroid Build Coastguard Worker #define DEBUG false // STOPSHIP if true
18*38e8c45fSAndroid Build Coastguard Worker #define LOG_TAG "StatsAidl"
19*38e8c45fSAndroid Build Coastguard Worker
20*38e8c45fSAndroid Build Coastguard Worker #define VLOG(...) \
21*38e8c45fSAndroid Build Coastguard Worker if (DEBUG) ALOGD(__VA_ARGS__);
22*38e8c45fSAndroid Build Coastguard Worker
23*38e8c45fSAndroid Build Coastguard Worker #include "StatsAidl.h"
24*38e8c45fSAndroid Build Coastguard Worker
25*38e8c45fSAndroid Build Coastguard Worker #include <Counter.h>
26*38e8c45fSAndroid Build Coastguard Worker #include <log/log.h>
27*38e8c45fSAndroid Build Coastguard Worker #include <stats_annotations.h>
28*38e8c45fSAndroid Build Coastguard Worker #include <stats_event.h>
29*38e8c45fSAndroid Build Coastguard Worker #include <statslog.h>
30*38e8c45fSAndroid Build Coastguard Worker
31*38e8c45fSAndroid Build Coastguard Worker #include <unordered_map>
32*38e8c45fSAndroid Build Coastguard Worker
33*38e8c45fSAndroid Build Coastguard Worker namespace {
34*38e8c45fSAndroid Build Coastguard Worker static const char* g_AtomErrorMetricName =
35*38e8c45fSAndroid Build Coastguard Worker "statsd_errors.value_report_vendor_atom_errors_count";
36*38e8c45fSAndroid Build Coastguard Worker }
37*38e8c45fSAndroid Build Coastguard Worker
38*38e8c45fSAndroid Build Coastguard Worker namespace aidl {
39*38e8c45fSAndroid Build Coastguard Worker namespace android {
40*38e8c45fSAndroid Build Coastguard Worker namespace frameworks {
41*38e8c45fSAndroid Build Coastguard Worker namespace stats {
42*38e8c45fSAndroid Build Coastguard Worker
43*38e8c45fSAndroid Build Coastguard Worker using ::android::expresslog::Counter;
44*38e8c45fSAndroid Build Coastguard Worker
45*38e8c45fSAndroid Build Coastguard Worker template <typename E>
to_underlying(E e)46*38e8c45fSAndroid Build Coastguard Worker constexpr typename std::underlying_type<E>::type to_underlying(E e) noexcept {
47*38e8c45fSAndroid Build Coastguard Worker return static_cast<typename std::underlying_type<E>::type>(e);
48*38e8c45fSAndroid Build Coastguard Worker }
49*38e8c45fSAndroid Build Coastguard Worker
StatsHal()50*38e8c45fSAndroid Build Coastguard Worker StatsHal::StatsHal() {
51*38e8c45fSAndroid Build Coastguard Worker }
52*38e8c45fSAndroid Build Coastguard Worker
write_annotation(AStatsEvent * event,const Annotation & annotation)53*38e8c45fSAndroid Build Coastguard Worker bool write_annotation(AStatsEvent* event, const Annotation& annotation) {
54*38e8c45fSAndroid Build Coastguard Worker switch (annotation.value.getTag()) {
55*38e8c45fSAndroid Build Coastguard Worker case AnnotationValue::boolValue: {
56*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_addBoolAnnotation(event, to_underlying(annotation.annotationId),
57*38e8c45fSAndroid Build Coastguard Worker annotation.value.get<AnnotationValue::boolValue>());
58*38e8c45fSAndroid Build Coastguard Worker break;
59*38e8c45fSAndroid Build Coastguard Worker }
60*38e8c45fSAndroid Build Coastguard Worker case AnnotationValue::intValue: {
61*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_addInt32Annotation(event, to_underlying(annotation.annotationId),
62*38e8c45fSAndroid Build Coastguard Worker annotation.value.get<AnnotationValue::intValue>());
63*38e8c45fSAndroid Build Coastguard Worker break;
64*38e8c45fSAndroid Build Coastguard Worker }
65*38e8c45fSAndroid Build Coastguard Worker default: {
66*38e8c45fSAndroid Build Coastguard Worker return false;
67*38e8c45fSAndroid Build Coastguard Worker }
68*38e8c45fSAndroid Build Coastguard Worker }
69*38e8c45fSAndroid Build Coastguard Worker return true;
70*38e8c45fSAndroid Build Coastguard Worker }
71*38e8c45fSAndroid Build Coastguard Worker
write_atom_annotations(AStatsEvent * event,const std::vector<std::optional<Annotation>> & annotations)72*38e8c45fSAndroid Build Coastguard Worker bool write_atom_annotations(AStatsEvent* event,
73*38e8c45fSAndroid Build Coastguard Worker const std::vector<std::optional<Annotation>>& annotations) {
74*38e8c45fSAndroid Build Coastguard Worker for (const auto& atomAnnotation : annotations) {
75*38e8c45fSAndroid Build Coastguard Worker if (!atomAnnotation) {
76*38e8c45fSAndroid Build Coastguard Worker return false;
77*38e8c45fSAndroid Build Coastguard Worker }
78*38e8c45fSAndroid Build Coastguard Worker if (!write_annotation(event, *atomAnnotation)) {
79*38e8c45fSAndroid Build Coastguard Worker return false;
80*38e8c45fSAndroid Build Coastguard Worker }
81*38e8c45fSAndroid Build Coastguard Worker }
82*38e8c45fSAndroid Build Coastguard Worker return true;
83*38e8c45fSAndroid Build Coastguard Worker }
84*38e8c45fSAndroid Build Coastguard Worker
write_field_annotations(AStatsEvent * event,const std::vector<Annotation> & annotations)85*38e8c45fSAndroid Build Coastguard Worker bool write_field_annotations(AStatsEvent* event, const std::vector<Annotation>& annotations) {
86*38e8c45fSAndroid Build Coastguard Worker for (const auto& fieldAnnotation : annotations) {
87*38e8c45fSAndroid Build Coastguard Worker if (!write_annotation(event, fieldAnnotation)) {
88*38e8c45fSAndroid Build Coastguard Worker return false;
89*38e8c45fSAndroid Build Coastguard Worker }
90*38e8c45fSAndroid Build Coastguard Worker }
91*38e8c45fSAndroid Build Coastguard Worker return true;
92*38e8c45fSAndroid Build Coastguard Worker }
93*38e8c45fSAndroid Build Coastguard Worker
reportVendorAtom(const VendorAtom & vendorAtom)94*38e8c45fSAndroid Build Coastguard Worker ndk::ScopedAStatus StatsHal::reportVendorAtom(const VendorAtom& vendorAtom) {
95*38e8c45fSAndroid Build Coastguard Worker if (vendorAtom.atomId < 100000 || vendorAtom.atomId >= 200000) {
96*38e8c45fSAndroid Build Coastguard Worker ALOGE("Atom ID %ld is not a valid vendor atom ID", (long)vendorAtom.atomId);
97*38e8c45fSAndroid Build Coastguard Worker Counter::logIncrement(g_AtomErrorMetricName);
98*38e8c45fSAndroid Build Coastguard Worker return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(
99*38e8c45fSAndroid Build Coastguard Worker -1, "Not a valid vendor atom ID");
100*38e8c45fSAndroid Build Coastguard Worker }
101*38e8c45fSAndroid Build Coastguard Worker if (vendorAtom.reverseDomainName.length() > 50) {
102*38e8c45fSAndroid Build Coastguard Worker ALOGE("Vendor atom reverse domain name %s is too long.",
103*38e8c45fSAndroid Build Coastguard Worker vendorAtom.reverseDomainName.c_str());
104*38e8c45fSAndroid Build Coastguard Worker Counter::logIncrement(g_AtomErrorMetricName);
105*38e8c45fSAndroid Build Coastguard Worker return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(
106*38e8c45fSAndroid Build Coastguard Worker -1, "Vendor atom reverse domain name is too long");
107*38e8c45fSAndroid Build Coastguard Worker }
108*38e8c45fSAndroid Build Coastguard Worker AStatsEvent* event = AStatsEvent_obtain();
109*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_setAtomId(event, vendorAtom.atomId);
110*38e8c45fSAndroid Build Coastguard Worker
111*38e8c45fSAndroid Build Coastguard Worker if (vendorAtom.atomAnnotations) {
112*38e8c45fSAndroid Build Coastguard Worker if (!write_atom_annotations(event, *vendorAtom.atomAnnotations)) {
113*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_release(event);
114*38e8c45fSAndroid Build Coastguard Worker ALOGE("Atom ID %ld has incompatible atom level annotation", (long)vendorAtom.atomId);
115*38e8c45fSAndroid Build Coastguard Worker Counter::logIncrement(g_AtomErrorMetricName);
116*38e8c45fSAndroid Build Coastguard Worker return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(
117*38e8c45fSAndroid Build Coastguard Worker -1, "invalid atom annotation");
118*38e8c45fSAndroid Build Coastguard Worker }
119*38e8c45fSAndroid Build Coastguard Worker }
120*38e8c45fSAndroid Build Coastguard Worker
121*38e8c45fSAndroid Build Coastguard Worker // populate map for quickier access for VendorAtomValue associated annotations by value index
122*38e8c45fSAndroid Build Coastguard Worker std::unordered_map<int, int> fieldIndexToAnnotationSetMap;
123*38e8c45fSAndroid Build Coastguard Worker if (vendorAtom.valuesAnnotations) {
124*38e8c45fSAndroid Build Coastguard Worker const std::vector<std::optional<AnnotationSet>>& valuesAnnotations =
125*38e8c45fSAndroid Build Coastguard Worker *vendorAtom.valuesAnnotations;
126*38e8c45fSAndroid Build Coastguard Worker for (int i = 0; i < valuesAnnotations.size(); i++) {
127*38e8c45fSAndroid Build Coastguard Worker if (valuesAnnotations[i]) {
128*38e8c45fSAndroid Build Coastguard Worker fieldIndexToAnnotationSetMap[valuesAnnotations[i]->valueIndex] = i;
129*38e8c45fSAndroid Build Coastguard Worker }
130*38e8c45fSAndroid Build Coastguard Worker }
131*38e8c45fSAndroid Build Coastguard Worker }
132*38e8c45fSAndroid Build Coastguard Worker
133*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeString(event, vendorAtom.reverseDomainName.c_str());
134*38e8c45fSAndroid Build Coastguard Worker size_t atomValueIdx = 0;
135*38e8c45fSAndroid Build Coastguard Worker for (const auto& atomValue : vendorAtom.values) {
136*38e8c45fSAndroid Build Coastguard Worker switch (atomValue.getTag()) {
137*38e8c45fSAndroid Build Coastguard Worker case VendorAtomValue::intValue:
138*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeInt32(event, atomValue.get<VendorAtomValue::intValue>());
139*38e8c45fSAndroid Build Coastguard Worker break;
140*38e8c45fSAndroid Build Coastguard Worker case VendorAtomValue::longValue:
141*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeInt64(event, atomValue.get<VendorAtomValue::longValue>());
142*38e8c45fSAndroid Build Coastguard Worker break;
143*38e8c45fSAndroid Build Coastguard Worker case VendorAtomValue::floatValue:
144*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeFloat(event, atomValue.get<VendorAtomValue::floatValue>());
145*38e8c45fSAndroid Build Coastguard Worker break;
146*38e8c45fSAndroid Build Coastguard Worker case VendorAtomValue::stringValue:
147*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeString(event,
148*38e8c45fSAndroid Build Coastguard Worker atomValue.get<VendorAtomValue::stringValue>().c_str());
149*38e8c45fSAndroid Build Coastguard Worker break;
150*38e8c45fSAndroid Build Coastguard Worker case VendorAtomValue::boolValue:
151*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeBool(event, atomValue.get<VendorAtomValue::boolValue>());
152*38e8c45fSAndroid Build Coastguard Worker break;
153*38e8c45fSAndroid Build Coastguard Worker case VendorAtomValue::repeatedIntValue: {
154*38e8c45fSAndroid Build Coastguard Worker const std::optional<std::vector<int>>& repeatedIntValue =
155*38e8c45fSAndroid Build Coastguard Worker atomValue.get<VendorAtomValue::repeatedIntValue>();
156*38e8c45fSAndroid Build Coastguard Worker if (!repeatedIntValue) {
157*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeInt32Array(event, {}, 0);
158*38e8c45fSAndroid Build Coastguard Worker break;
159*38e8c45fSAndroid Build Coastguard Worker }
160*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeInt32Array(event, repeatedIntValue->data(),
161*38e8c45fSAndroid Build Coastguard Worker repeatedIntValue->size());
162*38e8c45fSAndroid Build Coastguard Worker break;
163*38e8c45fSAndroid Build Coastguard Worker }
164*38e8c45fSAndroid Build Coastguard Worker case VendorAtomValue::repeatedLongValue: {
165*38e8c45fSAndroid Build Coastguard Worker const std::optional<std::vector<int64_t>>& repeatedLongValue =
166*38e8c45fSAndroid Build Coastguard Worker atomValue.get<VendorAtomValue::repeatedLongValue>();
167*38e8c45fSAndroid Build Coastguard Worker if (!repeatedLongValue) {
168*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeInt64Array(event, {}, 0);
169*38e8c45fSAndroid Build Coastguard Worker break;
170*38e8c45fSAndroid Build Coastguard Worker }
171*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeInt64Array(event, repeatedLongValue->data(),
172*38e8c45fSAndroid Build Coastguard Worker repeatedLongValue->size());
173*38e8c45fSAndroid Build Coastguard Worker break;
174*38e8c45fSAndroid Build Coastguard Worker }
175*38e8c45fSAndroid Build Coastguard Worker case VendorAtomValue::repeatedFloatValue: {
176*38e8c45fSAndroid Build Coastguard Worker const std::optional<std::vector<float>>& repeatedFloatValue =
177*38e8c45fSAndroid Build Coastguard Worker atomValue.get<VendorAtomValue::repeatedFloatValue>();
178*38e8c45fSAndroid Build Coastguard Worker if (!repeatedFloatValue) {
179*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeFloatArray(event, {}, 0);
180*38e8c45fSAndroid Build Coastguard Worker break;
181*38e8c45fSAndroid Build Coastguard Worker }
182*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeFloatArray(event, repeatedFloatValue->data(),
183*38e8c45fSAndroid Build Coastguard Worker repeatedFloatValue->size());
184*38e8c45fSAndroid Build Coastguard Worker break;
185*38e8c45fSAndroid Build Coastguard Worker }
186*38e8c45fSAndroid Build Coastguard Worker case VendorAtomValue::repeatedStringValue: {
187*38e8c45fSAndroid Build Coastguard Worker const std::optional<std::vector<std::optional<std::string>>>& repeatedStringValue =
188*38e8c45fSAndroid Build Coastguard Worker atomValue.get<VendorAtomValue::repeatedStringValue>();
189*38e8c45fSAndroid Build Coastguard Worker if (!repeatedStringValue) {
190*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeStringArray(event, {}, 0);
191*38e8c45fSAndroid Build Coastguard Worker break;
192*38e8c45fSAndroid Build Coastguard Worker }
193*38e8c45fSAndroid Build Coastguard Worker const std::vector<std::optional<std::string>>& repeatedStringVector =
194*38e8c45fSAndroid Build Coastguard Worker *repeatedStringValue;
195*38e8c45fSAndroid Build Coastguard Worker const char* cStringArray[repeatedStringVector.size()];
196*38e8c45fSAndroid Build Coastguard Worker
197*38e8c45fSAndroid Build Coastguard Worker for (int i = 0; i < repeatedStringVector.size(); ++i) {
198*38e8c45fSAndroid Build Coastguard Worker cStringArray[i] = repeatedStringVector[i].has_value()
199*38e8c45fSAndroid Build Coastguard Worker ? repeatedStringVector[i]->c_str()
200*38e8c45fSAndroid Build Coastguard Worker : "";
201*38e8c45fSAndroid Build Coastguard Worker }
202*38e8c45fSAndroid Build Coastguard Worker
203*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeStringArray(event, cStringArray, repeatedStringVector.size());
204*38e8c45fSAndroid Build Coastguard Worker break;
205*38e8c45fSAndroid Build Coastguard Worker }
206*38e8c45fSAndroid Build Coastguard Worker case VendorAtomValue::repeatedBoolValue: {
207*38e8c45fSAndroid Build Coastguard Worker const std::optional<std::vector<bool>>& repeatedBoolValue =
208*38e8c45fSAndroid Build Coastguard Worker atomValue.get<VendorAtomValue::repeatedBoolValue>();
209*38e8c45fSAndroid Build Coastguard Worker if (!repeatedBoolValue) {
210*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeBoolArray(event, {}, 0);
211*38e8c45fSAndroid Build Coastguard Worker break;
212*38e8c45fSAndroid Build Coastguard Worker }
213*38e8c45fSAndroid Build Coastguard Worker const std::vector<bool>& repeatedBoolVector = *repeatedBoolValue;
214*38e8c45fSAndroid Build Coastguard Worker bool boolArray[repeatedBoolValue->size()];
215*38e8c45fSAndroid Build Coastguard Worker
216*38e8c45fSAndroid Build Coastguard Worker for (int i = 0; i < repeatedBoolVector.size(); ++i) {
217*38e8c45fSAndroid Build Coastguard Worker boolArray[i] = repeatedBoolVector[i];
218*38e8c45fSAndroid Build Coastguard Worker }
219*38e8c45fSAndroid Build Coastguard Worker
220*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeBoolArray(event, boolArray, repeatedBoolVector.size());
221*38e8c45fSAndroid Build Coastguard Worker break;
222*38e8c45fSAndroid Build Coastguard Worker }
223*38e8c45fSAndroid Build Coastguard Worker case VendorAtomValue::byteArrayValue: {
224*38e8c45fSAndroid Build Coastguard Worker const std::optional<std::vector<uint8_t>>& byteArrayValue =
225*38e8c45fSAndroid Build Coastguard Worker atomValue.get<VendorAtomValue::byteArrayValue>();
226*38e8c45fSAndroid Build Coastguard Worker if (!byteArrayValue) {
227*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeByteArray(event, {}, 0);
228*38e8c45fSAndroid Build Coastguard Worker break;
229*38e8c45fSAndroid Build Coastguard Worker }
230*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_writeByteArray(event, byteArrayValue->data(), byteArrayValue->size());
231*38e8c45fSAndroid Build Coastguard Worker break;
232*38e8c45fSAndroid Build Coastguard Worker }
233*38e8c45fSAndroid Build Coastguard Worker default: {
234*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_release(event);
235*38e8c45fSAndroid Build Coastguard Worker ALOGE("Atom ID %ld has invalid atomValue.getTag", (long)vendorAtom.atomId);
236*38e8c45fSAndroid Build Coastguard Worker Counter::logIncrement(g_AtomErrorMetricName);
237*38e8c45fSAndroid Build Coastguard Worker return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(
238*38e8c45fSAndroid Build Coastguard Worker -1, "invalid atomValue.getTag");
239*38e8c45fSAndroid Build Coastguard Worker break;
240*38e8c45fSAndroid Build Coastguard Worker }
241*38e8c45fSAndroid Build Coastguard Worker }
242*38e8c45fSAndroid Build Coastguard Worker
243*38e8c45fSAndroid Build Coastguard Worker const auto& valueAnnotationIndex = fieldIndexToAnnotationSetMap.find(atomValueIdx);
244*38e8c45fSAndroid Build Coastguard Worker if (valueAnnotationIndex != fieldIndexToAnnotationSetMap.end()) {
245*38e8c45fSAndroid Build Coastguard Worker const std::vector<Annotation>& fieldAnnotations =
246*38e8c45fSAndroid Build Coastguard Worker (*vendorAtom.valuesAnnotations)[valueAnnotationIndex->second]->annotations;
247*38e8c45fSAndroid Build Coastguard Worker VLOG("Atom ID %ld has %ld annotations for field #%ld", (long)vendorAtom.atomId,
248*38e8c45fSAndroid Build Coastguard Worker (long)fieldAnnotations.size(), (long)atomValueIdx + 2);
249*38e8c45fSAndroid Build Coastguard Worker if (!write_field_annotations(event, fieldAnnotations)) {
250*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_release(event);
251*38e8c45fSAndroid Build Coastguard Worker ALOGE("Atom ID %ld has incompatible field level annotation for field #%ld",
252*38e8c45fSAndroid Build Coastguard Worker (long)vendorAtom.atomId, (long)atomValueIdx + 2);
253*38e8c45fSAndroid Build Coastguard Worker Counter::logIncrement(g_AtomErrorMetricName);
254*38e8c45fSAndroid Build Coastguard Worker return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(
255*38e8c45fSAndroid Build Coastguard Worker -1, "invalid atom field annotation");
256*38e8c45fSAndroid Build Coastguard Worker }
257*38e8c45fSAndroid Build Coastguard Worker }
258*38e8c45fSAndroid Build Coastguard Worker atomValueIdx++;
259*38e8c45fSAndroid Build Coastguard Worker }
260*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_build(event);
261*38e8c45fSAndroid Build Coastguard Worker const int ret = AStatsEvent_write(event);
262*38e8c45fSAndroid Build Coastguard Worker AStatsEvent_release(event);
263*38e8c45fSAndroid Build Coastguard Worker if (ret <= 0) {
264*38e8c45fSAndroid Build Coastguard Worker ALOGE("Error writing Atom ID %ld. Result: %d", (long)vendorAtom.atomId, ret);
265*38e8c45fSAndroid Build Coastguard Worker Counter::logIncrement(g_AtomErrorMetricName);
266*38e8c45fSAndroid Build Coastguard Worker }
267*38e8c45fSAndroid Build Coastguard Worker return ret <= 0 ? ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(ret,
268*38e8c45fSAndroid Build Coastguard Worker "report atom failed")
269*38e8c45fSAndroid Build Coastguard Worker : ndk::ScopedAStatus::ok();
270*38e8c45fSAndroid Build Coastguard Worker }
271*38e8c45fSAndroid Build Coastguard Worker
272*38e8c45fSAndroid Build Coastguard Worker } // namespace stats
273*38e8c45fSAndroid Build Coastguard Worker } // namespace frameworks
274*38e8c45fSAndroid Build Coastguard Worker } // namespace android
275*38e8c45fSAndroid Build Coastguard Worker } // namespace aidl
276