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