1 /*
2  * This file is auto-generated.  DO NOT MODIFY.
3  * Using: out/host/linux-x86/bin/aidl --lang=ndk -Weverything -Wno-missing-permission-annotation -t --min_sdk_version 30 --ninja -d out/soong/.intermediates/packages/modules/StatsD/aidl/statsd-aidl-ndk-source/gen/staging/android/os/IStatsQueryCallback.cpp.d -h out/soong/.intermediates/packages/modules/StatsD/aidl/statsd-aidl-ndk-source/gen/include/staging -o out/soong/.intermediates/packages/modules/StatsD/aidl/statsd-aidl-ndk-source/gen/staging -Npackages/modules/StatsD/aidl packages/modules/StatsD/aidl/android/os/IStatsQueryCallback.aidl
4  *
5  * DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
6  * ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
7  * AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
8  */
9 #include "aidl/android/os/IStatsQueryCallback.h"
10 
11 #include <android/binder_parcel_utils.h>
12 #include <aidl/android/os/BnStatsQueryCallback.h>
13 #include <aidl/android/os/BpStatsQueryCallback.h>
14 
15 namespace aidl {
16 namespace android {
17 namespace os {
_aidl_android_os_IStatsQueryCallback_onTransact(AIBinder * _aidl_binder,transaction_code_t _aidl_code,const AParcel * _aidl_in,AParcel * _aidl_out)18 static binder_status_t _aidl_android_os_IStatsQueryCallback_onTransact(AIBinder* _aidl_binder, transaction_code_t _aidl_code, const AParcel* _aidl_in, AParcel* _aidl_out) {
19   (void)_aidl_in;
20   (void)_aidl_out;
21   binder_status_t _aidl_ret_status = STATUS_UNKNOWN_TRANSACTION;
22   std::shared_ptr<BnStatsQueryCallback> _aidl_impl = std::static_pointer_cast<BnStatsQueryCallback>(::ndk::ICInterface::asInterface(_aidl_binder));
23   switch (_aidl_code) {
24     case (FIRST_CALL_TRANSACTION + 0 /*sendResults*/): {
25       std::vector<std::string> in_queryData;
26       std::vector<std::string> in_columnNames;
27       std::vector<int32_t> in_columnTypes;
28       int32_t in_rowCount;
29 
30       _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_queryData);
31       if (_aidl_ret_status != STATUS_OK) break;
32 
33       _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_columnNames);
34       if (_aidl_ret_status != STATUS_OK) break;
35 
36       _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_columnTypes);
37       if (_aidl_ret_status != STATUS_OK) break;
38 
39       _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_rowCount);
40       if (_aidl_ret_status != STATUS_OK) break;
41 
42       ::ndk::ScopedAStatus _aidl_status = _aidl_impl->sendResults(in_queryData, in_columnNames, in_columnTypes, in_rowCount);
43       _aidl_ret_status = STATUS_OK;
44       break;
45     }
46     case (FIRST_CALL_TRANSACTION + 1 /*sendFailure*/): {
47       std::string in_error;
48 
49       _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_error);
50       if (_aidl_ret_status != STATUS_OK) break;
51 
52       ::ndk::ScopedAStatus _aidl_status = _aidl_impl->sendFailure(in_error);
53       _aidl_ret_status = STATUS_OK;
54       break;
55     }
56   }
57   return _aidl_ret_status;
58 }
59 
60 static const char* _g_aidl_android_os_IStatsQueryCallback_clazz_code_to_function[] = { "sendResults","sendFailure",};
61 static AIBinder_Class* _g_aidl_android_os_IStatsQueryCallback_clazz = ::ndk::ICInterface::defineClass(IStatsQueryCallback::descriptor, _aidl_android_os_IStatsQueryCallback_onTransact, _g_aidl_android_os_IStatsQueryCallback_clazz_code_to_function, 2);
62 
BpStatsQueryCallback(const::ndk::SpAIBinder & binder)63 BpStatsQueryCallback::BpStatsQueryCallback(const ::ndk::SpAIBinder& binder) : BpCInterface(binder) {}
~BpStatsQueryCallback()64 BpStatsQueryCallback::~BpStatsQueryCallback() {}
65 
sendResults(const std::vector<std::string> & in_queryData,const std::vector<std::string> & in_columnNames,const std::vector<int32_t> & in_columnTypes,int32_t in_rowCount)66 ::ndk::ScopedAStatus BpStatsQueryCallback::sendResults(const std::vector<std::string>& in_queryData, const std::vector<std::string>& in_columnNames, const std::vector<int32_t>& in_columnTypes, int32_t in_rowCount) {
67   binder_status_t _aidl_ret_status = STATUS_OK;
68   ::ndk::ScopedAStatus _aidl_status;
69   ::ndk::ScopedAParcel _aidl_in;
70   ::ndk::ScopedAParcel _aidl_out;
71 
72   _aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
73   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
74 
75   _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_queryData);
76   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
77 
78   _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_columnNames);
79   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
80 
81   _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_columnTypes);
82   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
83 
84   _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_rowCount);
85   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
86 
87   _aidl_ret_status = AIBinder_transact(
88     asBinderReference().get(),
89     (FIRST_CALL_TRANSACTION + 0 /*sendResults*/),
90     _aidl_in.getR(),
91     _aidl_out.getR(),
92     FLAG_ONEWAY
93     #ifdef BINDER_STABILITY_SUPPORT
94     | static_cast<int>(FLAG_PRIVATE_LOCAL)
95     #endif  // BINDER_STABILITY_SUPPORT
96     );
97   if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IStatsQueryCallback::getDefaultImpl()) {
98     _aidl_status = IStatsQueryCallback::getDefaultImpl()->sendResults(in_queryData, in_columnNames, in_columnTypes, in_rowCount);
99     goto _aidl_status_return;
100   }
101   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
102 
103   _aidl_error:
104   _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
105   _aidl_status_return:
106   return _aidl_status;
107 }
sendFailure(const std::string & in_error)108 ::ndk::ScopedAStatus BpStatsQueryCallback::sendFailure(const std::string& in_error) {
109   binder_status_t _aidl_ret_status = STATUS_OK;
110   ::ndk::ScopedAStatus _aidl_status;
111   ::ndk::ScopedAParcel _aidl_in;
112   ::ndk::ScopedAParcel _aidl_out;
113 
114   _aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
115   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
116 
117   _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_error);
118   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
119 
120   _aidl_ret_status = AIBinder_transact(
121     asBinderReference().get(),
122     (FIRST_CALL_TRANSACTION + 1 /*sendFailure*/),
123     _aidl_in.getR(),
124     _aidl_out.getR(),
125     FLAG_ONEWAY
126     #ifdef BINDER_STABILITY_SUPPORT
127     | static_cast<int>(FLAG_PRIVATE_LOCAL)
128     #endif  // BINDER_STABILITY_SUPPORT
129     );
130   if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IStatsQueryCallback::getDefaultImpl()) {
131     _aidl_status = IStatsQueryCallback::getDefaultImpl()->sendFailure(in_error);
132     goto _aidl_status_return;
133   }
134   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
135 
136   _aidl_error:
137   _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
138   _aidl_status_return:
139   return _aidl_status;
140 }
141 // Source for BnStatsQueryCallback
BnStatsQueryCallback()142 BnStatsQueryCallback::BnStatsQueryCallback() {}
~BnStatsQueryCallback()143 BnStatsQueryCallback::~BnStatsQueryCallback() {}
createBinder()144 ::ndk::SpAIBinder BnStatsQueryCallback::createBinder() {
145   AIBinder* binder = AIBinder_new(_g_aidl_android_os_IStatsQueryCallback_clazz, static_cast<void*>(this));
146   #ifdef BINDER_STABILITY_SUPPORT
147   AIBinder_markCompilationUnitStability(binder);
148   #endif  // BINDER_STABILITY_SUPPORT
149   return ::ndk::SpAIBinder(binder);
150 }
151 // Source for IStatsQueryCallback
152 const char* IStatsQueryCallback::descriptor = "android.os.IStatsQueryCallback";
IStatsQueryCallback()153 IStatsQueryCallback::IStatsQueryCallback() {}
~IStatsQueryCallback()154 IStatsQueryCallback::~IStatsQueryCallback() {}
155 
156 
fromBinder(const::ndk::SpAIBinder & binder)157 std::shared_ptr<IStatsQueryCallback> IStatsQueryCallback::fromBinder(const ::ndk::SpAIBinder& binder) {
158   if (!AIBinder_associateClass(binder.get(), _g_aidl_android_os_IStatsQueryCallback_clazz)) {
159     #if __ANDROID_API__ >= 31
160     const AIBinder_Class* originalClass = AIBinder_getClass(binder.get());
161     if (originalClass == nullptr) return nullptr;
162     if (0 == strcmp(AIBinder_Class_getDescriptor(originalClass), descriptor)) {
163       return ::ndk::SharedRefBase::make<BpStatsQueryCallback>(binder);
164     }
165     #endif
166     return nullptr;
167   }
168   std::shared_ptr<::ndk::ICInterface> interface = ::ndk::ICInterface::asInterface(binder.get());
169   if (interface) {
170     return std::static_pointer_cast<IStatsQueryCallback>(interface);
171   }
172   return ::ndk::SharedRefBase::make<BpStatsQueryCallback>(binder);
173 }
174 
writeToParcel(AParcel * parcel,const std::shared_ptr<IStatsQueryCallback> & instance)175 binder_status_t IStatsQueryCallback::writeToParcel(AParcel* parcel, const std::shared_ptr<IStatsQueryCallback>& instance) {
176   return AParcel_writeStrongBinder(parcel, instance ? instance->asBinder().get() : nullptr);
177 }
readFromParcel(const AParcel * parcel,std::shared_ptr<IStatsQueryCallback> * instance)178 binder_status_t IStatsQueryCallback::readFromParcel(const AParcel* parcel, std::shared_ptr<IStatsQueryCallback>* instance) {
179   ::ndk::SpAIBinder binder;
180   binder_status_t status = AParcel_readStrongBinder(parcel, binder.getR());
181   if (status != STATUS_OK) return status;
182   *instance = IStatsQueryCallback::fromBinder(binder);
183   return STATUS_OK;
184 }
setDefaultImpl(const std::shared_ptr<IStatsQueryCallback> & impl)185 bool IStatsQueryCallback::setDefaultImpl(const std::shared_ptr<IStatsQueryCallback>& impl) {
186   // Only one user of this interface can use this function
187   // at a time. This is a heuristic to detect if two different
188   // users in the same process use this function.
189   assert(!IStatsQueryCallback::default_impl);
190   if (impl) {
191     IStatsQueryCallback::default_impl = impl;
192     return true;
193   }
194   return false;
195 }
getDefaultImpl()196 const std::shared_ptr<IStatsQueryCallback>& IStatsQueryCallback::getDefaultImpl() {
197   return IStatsQueryCallback::default_impl;
198 }
199 std::shared_ptr<IStatsQueryCallback> IStatsQueryCallback::default_impl = nullptr;
sendResults(const std::vector<std::string> &,const std::vector<std::string> &,const std::vector<int32_t> &,int32_t)200 ::ndk::ScopedAStatus IStatsQueryCallbackDefault::sendResults(const std::vector<std::string>& /*in_queryData*/, const std::vector<std::string>& /*in_columnNames*/, const std::vector<int32_t>& /*in_columnTypes*/, int32_t /*in_rowCount*/) {
201   ::ndk::ScopedAStatus _aidl_status;
202   _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
203   return _aidl_status;
204 }
sendFailure(const std::string &)205 ::ndk::ScopedAStatus IStatsQueryCallbackDefault::sendFailure(const std::string& /*in_error*/) {
206   ::ndk::ScopedAStatus _aidl_status;
207   _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
208   return _aidl_status;
209 }
asBinder()210 ::ndk::SpAIBinder IStatsQueryCallbackDefault::asBinder() {
211   return ::ndk::SpAIBinder();
212 }
isRemote()213 bool IStatsQueryCallbackDefault::isRemote() {
214   return false;
215 }
216 }  // namespace os
217 }  // namespace android
218 }  // namespace aidl
219