1 /*
2  * This file is auto-generated.  DO NOT MODIFY.
3  * Using: out/host/linux-x86/bin/aidl --lang=ndk --structured --version 1 --hash 514f08f7a595501066b94e5de878d240b4d49456 -t --stability vintf --min_sdk_version current -pout/soong/.intermediates/hardware/interfaces/sensors/aidl/android.hardware.sensors_interface/3/preprocessed.aidl -pout/soong/.intermediates/hardware/interfaces/common/aidl/android.hardware.common_interface/2/preprocessed.aidl --ninja -d out/soong/.intermediates/frameworks/hardware/interfaces/sensorservice/aidl/android.frameworks.sensorservice-V1-ndk-source/gen/staging/android/frameworks/sensorservice/IDirectReportChannel.cpp.d -h out/soong/.intermediates/frameworks/hardware/interfaces/sensorservice/aidl/android.frameworks.sensorservice-V1-ndk-source/gen/include/staging -o out/soong/.intermediates/frameworks/hardware/interfaces/sensorservice/aidl/android.frameworks.sensorservice-V1-ndk-source/gen/staging -Nframeworks/hardware/interfaces/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1 frameworks/hardware/interfaces/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/IDirectReportChannel.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/frameworks/sensorservice/IDirectReportChannel.h"
10 
11 #include <android/binder_parcel_utils.h>
12 #include <aidl/android/frameworks/sensorservice/BnDirectReportChannel.h>
13 #include <aidl/android/frameworks/sensorservice/BpDirectReportChannel.h>
14 #include <aidl/android/hardware/sensors/BnSensors.h>
15 #include <aidl/android/hardware/sensors/BnSensorsCallback.h>
16 #include <aidl/android/hardware/sensors/BpSensors.h>
17 #include <aidl/android/hardware/sensors/BpSensorsCallback.h>
18 #include <aidl/android/hardware/sensors/ISensors.h>
19 #include <aidl/android/hardware/sensors/ISensorsCallback.h>
20 
21 namespace aidl {
22 namespace android {
23 namespace frameworks {
24 namespace sensorservice {
_aidl_android_frameworks_sensorservice_IDirectReportChannel_onTransact(AIBinder * _aidl_binder,transaction_code_t _aidl_code,const AParcel * _aidl_in,AParcel * _aidl_out)25 static binder_status_t _aidl_android_frameworks_sensorservice_IDirectReportChannel_onTransact(AIBinder* _aidl_binder, transaction_code_t _aidl_code, const AParcel* _aidl_in, AParcel* _aidl_out) {
26   (void)_aidl_in;
27   (void)_aidl_out;
28   binder_status_t _aidl_ret_status = STATUS_UNKNOWN_TRANSACTION;
29   std::shared_ptr<BnDirectReportChannel> _aidl_impl = std::static_pointer_cast<BnDirectReportChannel>(::ndk::ICInterface::asInterface(_aidl_binder));
30   switch (_aidl_code) {
31     case (FIRST_CALL_TRANSACTION + 0 /*configure*/): {
32       int32_t in_sensorHandle;
33       ::aidl::android::hardware::sensors::ISensors::RateLevel in_rate;
34       int32_t _aidl_return;
35 
36       _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_sensorHandle);
37       if (_aidl_ret_status != STATUS_OK) break;
38 
39       _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_rate);
40       if (_aidl_ret_status != STATUS_OK) break;
41 
42       ::ndk::ScopedAStatus _aidl_status = _aidl_impl->configure(in_sensorHandle, in_rate, &_aidl_return);
43       _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
44       if (_aidl_ret_status != STATUS_OK) break;
45 
46       if (!AStatus_isOk(_aidl_status.get())) break;
47 
48       _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
49       if (_aidl_ret_status != STATUS_OK) break;
50 
51       break;
52     }
53     case (FIRST_CALL_TRANSACTION + 16777214 /*getInterfaceVersion*/): {
54       int32_t _aidl_return;
55 
56       ::ndk::ScopedAStatus _aidl_status = _aidl_impl->getInterfaceVersion(&_aidl_return);
57       _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
58       if (_aidl_ret_status != STATUS_OK) break;
59 
60       if (!AStatus_isOk(_aidl_status.get())) break;
61 
62       _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
63       if (_aidl_ret_status != STATUS_OK) break;
64 
65       break;
66     }
67     case (FIRST_CALL_TRANSACTION + 16777213 /*getInterfaceHash*/): {
68       std::string _aidl_return;
69 
70       ::ndk::ScopedAStatus _aidl_status = _aidl_impl->getInterfaceHash(&_aidl_return);
71       _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
72       if (_aidl_ret_status != STATUS_OK) break;
73 
74       if (!AStatus_isOk(_aidl_status.get())) break;
75 
76       _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
77       if (_aidl_ret_status != STATUS_OK) break;
78 
79       break;
80     }
81   }
82   return _aidl_ret_status;
83 }
84 
85 static const char* _g_aidl_android_frameworks_sensorservice_IDirectReportChannel_clazz_code_to_function[] = { "configure",};
86 static AIBinder_Class* _g_aidl_android_frameworks_sensorservice_IDirectReportChannel_clazz = ::ndk::ICInterface::defineClass(IDirectReportChannel::descriptor, _aidl_android_frameworks_sensorservice_IDirectReportChannel_onTransact, _g_aidl_android_frameworks_sensorservice_IDirectReportChannel_clazz_code_to_function, 1);
87 
BpDirectReportChannel(const::ndk::SpAIBinder & binder)88 BpDirectReportChannel::BpDirectReportChannel(const ::ndk::SpAIBinder& binder) : BpCInterface(binder) {}
~BpDirectReportChannel()89 BpDirectReportChannel::~BpDirectReportChannel() {}
90 
configure(int32_t in_sensorHandle,::aidl::android::hardware::sensors::ISensors::RateLevel in_rate,int32_t * _aidl_return)91 ::ndk::ScopedAStatus BpDirectReportChannel::configure(int32_t in_sensorHandle, ::aidl::android::hardware::sensors::ISensors::RateLevel in_rate, int32_t* _aidl_return) {
92   binder_status_t _aidl_ret_status = STATUS_OK;
93   ::ndk::ScopedAStatus _aidl_status;
94   ::ndk::ScopedAParcel _aidl_in;
95   ::ndk::ScopedAParcel _aidl_out;
96 
97   _aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
98   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
99 
100   _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_sensorHandle);
101   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
102 
103   _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_rate);
104   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
105 
106   _aidl_ret_status = AIBinder_transact(
107     asBinderReference().get(),
108     (FIRST_CALL_TRANSACTION + 0 /*configure*/),
109     _aidl_in.getR(),
110     _aidl_out.getR(),
111     0
112     #ifdef BINDER_STABILITY_SUPPORT
113     | static_cast<int>(FLAG_PRIVATE_LOCAL)
114     #endif  // BINDER_STABILITY_SUPPORT
115     );
116   if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IDirectReportChannel::getDefaultImpl()) {
117     _aidl_status = IDirectReportChannel::getDefaultImpl()->configure(in_sensorHandle, in_rate, _aidl_return);
118     goto _aidl_status_return;
119   }
120   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
121 
122   _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
123   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
124 
125   if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
126   _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
127   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
128 
129   _aidl_error:
130   _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
131   _aidl_status_return:
132   return _aidl_status;
133 }
getInterfaceVersion(int32_t * _aidl_return)134 ::ndk::ScopedAStatus BpDirectReportChannel::getInterfaceVersion(int32_t* _aidl_return) {
135   binder_status_t _aidl_ret_status = STATUS_OK;
136   ::ndk::ScopedAStatus _aidl_status;
137   if (_aidl_cached_version != -1) {
138     *_aidl_return = _aidl_cached_version;
139     _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
140     return _aidl_status;
141   }
142   ::ndk::ScopedAParcel _aidl_in;
143   ::ndk::ScopedAParcel _aidl_out;
144 
145   _aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
146   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
147 
148   _aidl_ret_status = AIBinder_transact(
149     asBinderReference().get(),
150     (FIRST_CALL_TRANSACTION + 16777214 /*getInterfaceVersion*/),
151     _aidl_in.getR(),
152     _aidl_out.getR(),
153     0
154     #ifdef BINDER_STABILITY_SUPPORT
155     | static_cast<int>(FLAG_PRIVATE_LOCAL)
156     #endif  // BINDER_STABILITY_SUPPORT
157     );
158   if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IDirectReportChannel::getDefaultImpl()) {
159     _aidl_status = IDirectReportChannel::getDefaultImpl()->getInterfaceVersion(_aidl_return);
160     goto _aidl_status_return;
161   }
162   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
163 
164   _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
165   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
166 
167   if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
168   _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
169   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
170 
171   _aidl_cached_version = *_aidl_return;
172   _aidl_error:
173   _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
174   _aidl_status_return:
175   return _aidl_status;
176 }
getInterfaceHash(std::string * _aidl_return)177 ::ndk::ScopedAStatus BpDirectReportChannel::getInterfaceHash(std::string* _aidl_return) {
178   binder_status_t _aidl_ret_status = STATUS_OK;
179   ::ndk::ScopedAStatus _aidl_status;
180   const std::lock_guard<std::mutex> lock(_aidl_cached_hash_mutex);
181   if (_aidl_cached_hash != "-1") {
182     *_aidl_return = _aidl_cached_hash;
183     _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
184     return _aidl_status;
185   }
186   ::ndk::ScopedAParcel _aidl_in;
187   ::ndk::ScopedAParcel _aidl_out;
188 
189   _aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
190   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
191 
192   _aidl_ret_status = AIBinder_transact(
193     asBinderReference().get(),
194     (FIRST_CALL_TRANSACTION + 16777213 /*getInterfaceHash*/),
195     _aidl_in.getR(),
196     _aidl_out.getR(),
197     0
198     #ifdef BINDER_STABILITY_SUPPORT
199     | static_cast<int>(FLAG_PRIVATE_LOCAL)
200     #endif  // BINDER_STABILITY_SUPPORT
201     );
202   if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IDirectReportChannel::getDefaultImpl()) {
203     _aidl_status = IDirectReportChannel::getDefaultImpl()->getInterfaceHash(_aidl_return);
204     goto _aidl_status_return;
205   }
206   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
207 
208   _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
209   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
210 
211   if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
212   _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
213   if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
214 
215   _aidl_cached_hash = *_aidl_return;
216   _aidl_error:
217   _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
218   _aidl_status_return:
219   return _aidl_status;
220 }
221 // Source for BnDirectReportChannel
BnDirectReportChannel()222 BnDirectReportChannel::BnDirectReportChannel() {}
~BnDirectReportChannel()223 BnDirectReportChannel::~BnDirectReportChannel() {}
createBinder()224 ::ndk::SpAIBinder BnDirectReportChannel::createBinder() {
225   AIBinder* binder = AIBinder_new(_g_aidl_android_frameworks_sensorservice_IDirectReportChannel_clazz, static_cast<void*>(this));
226   #ifdef BINDER_STABILITY_SUPPORT
227   AIBinder_markVintfStability(binder);
228   #endif  // BINDER_STABILITY_SUPPORT
229   return ::ndk::SpAIBinder(binder);
230 }
getInterfaceVersion(int32_t * _aidl_return)231 ::ndk::ScopedAStatus BnDirectReportChannel::getInterfaceVersion(int32_t* _aidl_return) {
232   *_aidl_return = IDirectReportChannel::version;
233   return ::ndk::ScopedAStatus(AStatus_newOk());
234 }
getInterfaceHash(std::string * _aidl_return)235 ::ndk::ScopedAStatus BnDirectReportChannel::getInterfaceHash(std::string* _aidl_return) {
236   *_aidl_return = IDirectReportChannel::hash;
237   return ::ndk::ScopedAStatus(AStatus_newOk());
238 }
239 // Source for IDirectReportChannel
240 const char* IDirectReportChannel::descriptor = "android.frameworks.sensorservice.IDirectReportChannel";
IDirectReportChannel()241 IDirectReportChannel::IDirectReportChannel() {}
~IDirectReportChannel()242 IDirectReportChannel::~IDirectReportChannel() {}
243 
244 
fromBinder(const::ndk::SpAIBinder & binder)245 std::shared_ptr<IDirectReportChannel> IDirectReportChannel::fromBinder(const ::ndk::SpAIBinder& binder) {
246   if (!AIBinder_associateClass(binder.get(), _g_aidl_android_frameworks_sensorservice_IDirectReportChannel_clazz)) {
247     #if __ANDROID_API__ >= 31
248     const AIBinder_Class* originalClass = AIBinder_getClass(binder.get());
249     if (originalClass == nullptr) return nullptr;
250     if (0 == strcmp(AIBinder_Class_getDescriptor(originalClass), descriptor)) {
251       return ::ndk::SharedRefBase::make<BpDirectReportChannel>(binder);
252     }
253     #endif
254     return nullptr;
255   }
256   std::shared_ptr<::ndk::ICInterface> interface = ::ndk::ICInterface::asInterface(binder.get());
257   if (interface) {
258     return std::static_pointer_cast<IDirectReportChannel>(interface);
259   }
260   return ::ndk::SharedRefBase::make<BpDirectReportChannel>(binder);
261 }
262 
writeToParcel(AParcel * parcel,const std::shared_ptr<IDirectReportChannel> & instance)263 binder_status_t IDirectReportChannel::writeToParcel(AParcel* parcel, const std::shared_ptr<IDirectReportChannel>& instance) {
264   return AParcel_writeStrongBinder(parcel, instance ? instance->asBinder().get() : nullptr);
265 }
readFromParcel(const AParcel * parcel,std::shared_ptr<IDirectReportChannel> * instance)266 binder_status_t IDirectReportChannel::readFromParcel(const AParcel* parcel, std::shared_ptr<IDirectReportChannel>* instance) {
267   ::ndk::SpAIBinder binder;
268   binder_status_t status = AParcel_readStrongBinder(parcel, binder.getR());
269   if (status != STATUS_OK) return status;
270   *instance = IDirectReportChannel::fromBinder(binder);
271   return STATUS_OK;
272 }
setDefaultImpl(const std::shared_ptr<IDirectReportChannel> & impl)273 bool IDirectReportChannel::setDefaultImpl(const std::shared_ptr<IDirectReportChannel>& impl) {
274   // Only one user of this interface can use this function
275   // at a time. This is a heuristic to detect if two different
276   // users in the same process use this function.
277   assert(!IDirectReportChannel::default_impl);
278   if (impl) {
279     IDirectReportChannel::default_impl = impl;
280     return true;
281   }
282   return false;
283 }
getDefaultImpl()284 const std::shared_ptr<IDirectReportChannel>& IDirectReportChannel::getDefaultImpl() {
285   return IDirectReportChannel::default_impl;
286 }
287 std::shared_ptr<IDirectReportChannel> IDirectReportChannel::default_impl = nullptr;
configure(int32_t,::aidl::android::hardware::sensors::ISensors::RateLevel,int32_t *)288 ::ndk::ScopedAStatus IDirectReportChannelDefault::configure(int32_t /*in_sensorHandle*/, ::aidl::android::hardware::sensors::ISensors::RateLevel /*in_rate*/, int32_t* /*_aidl_return*/) {
289   ::ndk::ScopedAStatus _aidl_status;
290   _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
291   return _aidl_status;
292 }
getInterfaceVersion(int32_t * _aidl_return)293 ::ndk::ScopedAStatus IDirectReportChannelDefault::getInterfaceVersion(int32_t* _aidl_return) {
294   *_aidl_return = 0;
295   return ::ndk::ScopedAStatus(AStatus_newOk());
296 }
getInterfaceHash(std::string * _aidl_return)297 ::ndk::ScopedAStatus IDirectReportChannelDefault::getInterfaceHash(std::string* _aidl_return) {
298   *_aidl_return = "";
299   return ::ndk::ScopedAStatus(AStatus_newOk());
300 }
asBinder()301 ::ndk::SpAIBinder IDirectReportChannelDefault::asBinder() {
302   return ::ndk::SpAIBinder();
303 }
isRemote()304 bool IDirectReportChannelDefault::isRemote() {
305   return false;
306 }
307 }  // namespace sensorservice
308 }  // namespace frameworks
309 }  // namespace android
310 }  // namespace aidl
311