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/IEventQueueCallback.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/IEventQueueCallback.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/IEventQueueCallback.h"
10
11 #include <android/binder_parcel_utils.h>
12 #include <aidl/android/frameworks/sensorservice/BnEventQueueCallback.h>
13 #include <aidl/android/frameworks/sensorservice/BpEventQueueCallback.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_IEventQueueCallback_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_IEventQueueCallback_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<BnEventQueueCallback> _aidl_impl = std::static_pointer_cast<BnEventQueueCallback>(::ndk::ICInterface::asInterface(_aidl_binder));
30 switch (_aidl_code) {
31 case (FIRST_CALL_TRANSACTION + 0 /*onEvent*/): {
32 ::aidl::android::hardware::sensors::Event in_event;
33
34 _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_event);
35 if (_aidl_ret_status != STATUS_OK) break;
36
37 ::ndk::ScopedAStatus _aidl_status = _aidl_impl->onEvent(in_event);
38 _aidl_ret_status = STATUS_OK;
39 break;
40 }
41 case (FIRST_CALL_TRANSACTION + 16777214 /*getInterfaceVersion*/): {
42 int32_t _aidl_return;
43
44 ::ndk::ScopedAStatus _aidl_status = _aidl_impl->getInterfaceVersion(&_aidl_return);
45 _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
46 if (_aidl_ret_status != STATUS_OK) break;
47
48 if (!AStatus_isOk(_aidl_status.get())) break;
49
50 _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
51 if (_aidl_ret_status != STATUS_OK) break;
52
53 break;
54 }
55 case (FIRST_CALL_TRANSACTION + 16777213 /*getInterfaceHash*/): {
56 std::string _aidl_return;
57
58 ::ndk::ScopedAStatus _aidl_status = _aidl_impl->getInterfaceHash(&_aidl_return);
59 _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
60 if (_aidl_ret_status != STATUS_OK) break;
61
62 if (!AStatus_isOk(_aidl_status.get())) break;
63
64 _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
65 if (_aidl_ret_status != STATUS_OK) break;
66
67 break;
68 }
69 }
70 return _aidl_ret_status;
71 }
72
73 static const char* _g_aidl_android_frameworks_sensorservice_IEventQueueCallback_clazz_code_to_function[] = { "onEvent",};
74 static AIBinder_Class* _g_aidl_android_frameworks_sensorservice_IEventQueueCallback_clazz = ::ndk::ICInterface::defineClass(IEventQueueCallback::descriptor, _aidl_android_frameworks_sensorservice_IEventQueueCallback_onTransact, _g_aidl_android_frameworks_sensorservice_IEventQueueCallback_clazz_code_to_function, 1);
75
BpEventQueueCallback(const::ndk::SpAIBinder & binder)76 BpEventQueueCallback::BpEventQueueCallback(const ::ndk::SpAIBinder& binder) : BpCInterface(binder) {}
~BpEventQueueCallback()77 BpEventQueueCallback::~BpEventQueueCallback() {}
78
onEvent(const::aidl::android::hardware::sensors::Event & in_event)79 ::ndk::ScopedAStatus BpEventQueueCallback::onEvent(const ::aidl::android::hardware::sensors::Event& in_event) {
80 binder_status_t _aidl_ret_status = STATUS_OK;
81 ::ndk::ScopedAStatus _aidl_status;
82 ::ndk::ScopedAParcel _aidl_in;
83 ::ndk::ScopedAParcel _aidl_out;
84
85 _aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
86 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
87
88 _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_event);
89 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
90
91 _aidl_ret_status = AIBinder_transact(
92 asBinderReference().get(),
93 (FIRST_CALL_TRANSACTION + 0 /*onEvent*/),
94 _aidl_in.getR(),
95 _aidl_out.getR(),
96 FLAG_ONEWAY
97 #ifdef BINDER_STABILITY_SUPPORT
98 | static_cast<int>(FLAG_PRIVATE_LOCAL)
99 #endif // BINDER_STABILITY_SUPPORT
100 );
101 if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IEventQueueCallback::getDefaultImpl()) {
102 _aidl_status = IEventQueueCallback::getDefaultImpl()->onEvent(in_event);
103 goto _aidl_status_return;
104 }
105 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
106
107 _aidl_error:
108 _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
109 _aidl_status_return:
110 return _aidl_status;
111 }
getInterfaceVersion(int32_t * _aidl_return)112 ::ndk::ScopedAStatus BpEventQueueCallback::getInterfaceVersion(int32_t* _aidl_return) {
113 binder_status_t _aidl_ret_status = STATUS_OK;
114 ::ndk::ScopedAStatus _aidl_status;
115 if (_aidl_cached_version != -1) {
116 *_aidl_return = _aidl_cached_version;
117 _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
118 return _aidl_status;
119 }
120 ::ndk::ScopedAParcel _aidl_in;
121 ::ndk::ScopedAParcel _aidl_out;
122
123 _aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
124 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
125
126 _aidl_ret_status = AIBinder_transact(
127 asBinderReference().get(),
128 (FIRST_CALL_TRANSACTION + 16777214 /*getInterfaceVersion*/),
129 _aidl_in.getR(),
130 _aidl_out.getR(),
131 0
132 #ifdef BINDER_STABILITY_SUPPORT
133 | static_cast<int>(FLAG_PRIVATE_LOCAL)
134 #endif // BINDER_STABILITY_SUPPORT
135 );
136 if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IEventQueueCallback::getDefaultImpl()) {
137 _aidl_status = IEventQueueCallback::getDefaultImpl()->getInterfaceVersion(_aidl_return);
138 goto _aidl_status_return;
139 }
140 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
141
142 _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
143 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
144
145 if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
146 _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
147 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
148
149 _aidl_cached_version = *_aidl_return;
150 _aidl_error:
151 _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
152 _aidl_status_return:
153 return _aidl_status;
154 }
getInterfaceHash(std::string * _aidl_return)155 ::ndk::ScopedAStatus BpEventQueueCallback::getInterfaceHash(std::string* _aidl_return) {
156 binder_status_t _aidl_ret_status = STATUS_OK;
157 ::ndk::ScopedAStatus _aidl_status;
158 const std::lock_guard<std::mutex> lock(_aidl_cached_hash_mutex);
159 if (_aidl_cached_hash != "-1") {
160 *_aidl_return = _aidl_cached_hash;
161 _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
162 return _aidl_status;
163 }
164 ::ndk::ScopedAParcel _aidl_in;
165 ::ndk::ScopedAParcel _aidl_out;
166
167 _aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
168 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
169
170 _aidl_ret_status = AIBinder_transact(
171 asBinderReference().get(),
172 (FIRST_CALL_TRANSACTION + 16777213 /*getInterfaceHash*/),
173 _aidl_in.getR(),
174 _aidl_out.getR(),
175 0
176 #ifdef BINDER_STABILITY_SUPPORT
177 | static_cast<int>(FLAG_PRIVATE_LOCAL)
178 #endif // BINDER_STABILITY_SUPPORT
179 );
180 if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IEventQueueCallback::getDefaultImpl()) {
181 _aidl_status = IEventQueueCallback::getDefaultImpl()->getInterfaceHash(_aidl_return);
182 goto _aidl_status_return;
183 }
184 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
185
186 _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
187 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
188
189 if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
190 _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
191 if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
192
193 _aidl_cached_hash = *_aidl_return;
194 _aidl_error:
195 _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
196 _aidl_status_return:
197 return _aidl_status;
198 }
199 // Source for BnEventQueueCallback
BnEventQueueCallback()200 BnEventQueueCallback::BnEventQueueCallback() {}
~BnEventQueueCallback()201 BnEventQueueCallback::~BnEventQueueCallback() {}
createBinder()202 ::ndk::SpAIBinder BnEventQueueCallback::createBinder() {
203 AIBinder* binder = AIBinder_new(_g_aidl_android_frameworks_sensorservice_IEventQueueCallback_clazz, static_cast<void*>(this));
204 #ifdef BINDER_STABILITY_SUPPORT
205 AIBinder_markVintfStability(binder);
206 #endif // BINDER_STABILITY_SUPPORT
207 return ::ndk::SpAIBinder(binder);
208 }
getInterfaceVersion(int32_t * _aidl_return)209 ::ndk::ScopedAStatus BnEventQueueCallback::getInterfaceVersion(int32_t* _aidl_return) {
210 *_aidl_return = IEventQueueCallback::version;
211 return ::ndk::ScopedAStatus(AStatus_newOk());
212 }
getInterfaceHash(std::string * _aidl_return)213 ::ndk::ScopedAStatus BnEventQueueCallback::getInterfaceHash(std::string* _aidl_return) {
214 *_aidl_return = IEventQueueCallback::hash;
215 return ::ndk::ScopedAStatus(AStatus_newOk());
216 }
217 // Source for IEventQueueCallback
218 const char* IEventQueueCallback::descriptor = "android.frameworks.sensorservice.IEventQueueCallback";
IEventQueueCallback()219 IEventQueueCallback::IEventQueueCallback() {}
~IEventQueueCallback()220 IEventQueueCallback::~IEventQueueCallback() {}
221
222
fromBinder(const::ndk::SpAIBinder & binder)223 std::shared_ptr<IEventQueueCallback> IEventQueueCallback::fromBinder(const ::ndk::SpAIBinder& binder) {
224 if (!AIBinder_associateClass(binder.get(), _g_aidl_android_frameworks_sensorservice_IEventQueueCallback_clazz)) {
225 #if __ANDROID_API__ >= 31
226 const AIBinder_Class* originalClass = AIBinder_getClass(binder.get());
227 if (originalClass == nullptr) return nullptr;
228 if (0 == strcmp(AIBinder_Class_getDescriptor(originalClass), descriptor)) {
229 return ::ndk::SharedRefBase::make<BpEventQueueCallback>(binder);
230 }
231 #endif
232 return nullptr;
233 }
234 std::shared_ptr<::ndk::ICInterface> interface = ::ndk::ICInterface::asInterface(binder.get());
235 if (interface) {
236 return std::static_pointer_cast<IEventQueueCallback>(interface);
237 }
238 return ::ndk::SharedRefBase::make<BpEventQueueCallback>(binder);
239 }
240
writeToParcel(AParcel * parcel,const std::shared_ptr<IEventQueueCallback> & instance)241 binder_status_t IEventQueueCallback::writeToParcel(AParcel* parcel, const std::shared_ptr<IEventQueueCallback>& instance) {
242 return AParcel_writeStrongBinder(parcel, instance ? instance->asBinder().get() : nullptr);
243 }
readFromParcel(const AParcel * parcel,std::shared_ptr<IEventQueueCallback> * instance)244 binder_status_t IEventQueueCallback::readFromParcel(const AParcel* parcel, std::shared_ptr<IEventQueueCallback>* instance) {
245 ::ndk::SpAIBinder binder;
246 binder_status_t status = AParcel_readStrongBinder(parcel, binder.getR());
247 if (status != STATUS_OK) return status;
248 *instance = IEventQueueCallback::fromBinder(binder);
249 return STATUS_OK;
250 }
setDefaultImpl(const std::shared_ptr<IEventQueueCallback> & impl)251 bool IEventQueueCallback::setDefaultImpl(const std::shared_ptr<IEventQueueCallback>& impl) {
252 // Only one user of this interface can use this function
253 // at a time. This is a heuristic to detect if two different
254 // users in the same process use this function.
255 assert(!IEventQueueCallback::default_impl);
256 if (impl) {
257 IEventQueueCallback::default_impl = impl;
258 return true;
259 }
260 return false;
261 }
getDefaultImpl()262 const std::shared_ptr<IEventQueueCallback>& IEventQueueCallback::getDefaultImpl() {
263 return IEventQueueCallback::default_impl;
264 }
265 std::shared_ptr<IEventQueueCallback> IEventQueueCallback::default_impl = nullptr;
onEvent(const::aidl::android::hardware::sensors::Event &)266 ::ndk::ScopedAStatus IEventQueueCallbackDefault::onEvent(const ::aidl::android::hardware::sensors::Event& /*in_event*/) {
267 ::ndk::ScopedAStatus _aidl_status;
268 _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
269 return _aidl_status;
270 }
getInterfaceVersion(int32_t * _aidl_return)271 ::ndk::ScopedAStatus IEventQueueCallbackDefault::getInterfaceVersion(int32_t* _aidl_return) {
272 *_aidl_return = 0;
273 return ::ndk::ScopedAStatus(AStatus_newOk());
274 }
getInterfaceHash(std::string * _aidl_return)275 ::ndk::ScopedAStatus IEventQueueCallbackDefault::getInterfaceHash(std::string* _aidl_return) {
276 *_aidl_return = "";
277 return ::ndk::ScopedAStatus(AStatus_newOk());
278 }
asBinder()279 ::ndk::SpAIBinder IEventQueueCallbackDefault::asBinder() {
280 return ::ndk::SpAIBinder();
281 }
isRemote()282 bool IEventQueueCallbackDefault::isRemote() {
283 return false;
284 }
285 } // namespace sensorservice
286 } // namespace frameworks
287 } // namespace android
288 } // namespace aidl
289