1 2 /* 3 * Copyright (C) 2022 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 #pragma once 18 19 #include <lib/shared/ibinder/ibinder.h> 20 #include <lk/compiler.h> 21 #include <stddef.h> 22 #include <stdint.h> 23 24 #ifdef __cplusplus 25 #include <android/frameworks/stats/VendorAtom.h> 26 #include <android/trusty/stats/tz/IStats.h> 27 #endif 28 29 __BEGIN_CDECLS 30 31 struct stats_istats; 32 struct stats_vendor_atom; 33 34 void stats_istats_add_ref(struct stats_istats* self); 35 36 void stats_istats_release(struct stats_istats** pself); 37 38 __WARN_UNUSED_RESULT int stats_istats_get_service(const char* port, 39 size_t port_len, 40 struct stats_istats** pself); 41 42 __WARN_UNUSED_RESULT int stats_istats_report_vendor_atom( 43 struct stats_istats* self, 44 struct stats_vendor_atom* vendor_atom); 45 46 void stats_vendor_atom_add_ref(struct stats_vendor_atom* self); 47 48 void stats_vendor_atom_release(struct stats_vendor_atom** pself); 49 50 __WARN_UNUSED_RESULT int stats_vendor_atom_create_parcel( 51 struct stats_vendor_atom** pself); 52 53 __WARN_UNUSED_RESULT int stats_vendor_atom_set_reverse_domain_name( 54 struct stats_vendor_atom* self, 55 const char* name, 56 size_t name_len); 57 58 __WARN_UNUSED_RESULT int stats_vendor_atom_set_atom_id( 59 struct stats_vendor_atom* self, 60 int atom_id); 61 62 __WARN_UNUSED_RESULT int stats_vendor_atom_set_int_value_at( 63 struct stats_vendor_atom* self, 64 size_t atom_value_index, 65 int32_t value); 66 67 __WARN_UNUSED_RESULT int stats_vendor_atom_set_long_value_at( 68 struct stats_vendor_atom* self, 69 size_t atom_value_index, 70 int64_t value); 71 72 __WARN_UNUSED_RESULT int stats_vendor_atom_set_float_value_at( 73 struct stats_vendor_atom* self, 74 size_t atom_value_index, 75 float value); 76 77 __WARN_UNUSED_RESULT int stats_vendor_atom_set_string_value_at( 78 struct stats_vendor_atom* self, 79 size_t atom_value_index, 80 const char* value, 81 size_t value_len); 82 83 __END_CDECLS 84 85 #ifdef __cplusplus 86 android::frameworks::stats::VendorAtom* stats_vendor_atom_to_VendorAtom( 87 struct stats_vendor_atom* self); 88 android::sp<android::trusty::stats::tz::IStats>& stats_istats_to_IStats( 89 struct stats_istats* self); 90 #endif 91