| #include <android/aidl/versioned/tests/IFooInterface.h> |
| #include <android/aidl/versioned/tests/BpFooInterface.h> |
| namespace android { |
| namespace aidl { |
| namespace versioned { |
| namespace tests { |
| DO_NOT_DIRECTLY_USE_ME_IMPLEMENT_META_INTERFACE(FooInterface, "android.aidl.versioned.tests.IFooInterface") |
| } // namespace tests |
| } // namespace versioned |
| } // namespace aidl |
| } // namespace android |
| #include <android/aidl/versioned/tests/BpFooInterface.h> |
| #include <android/aidl/versioned/tests/BnFooInterface.h> |
| #include <binder/Parcel.h> |
| #include <android-base/macros.h> |
| |
| namespace android { |
| namespace aidl { |
| namespace versioned { |
| namespace tests { |
| |
| BpFooInterface::BpFooInterface(const ::android::sp<::android::IBinder>& _aidl_impl) |
| : BpInterface<IFooInterface>(_aidl_impl){ |
| } |
| |
| ::android::binder::Status BpFooInterface::originalApi() { |
| ::android::Parcel _aidl_data; |
| _aidl_data.markForBinder(remoteStrong()); |
| ::android::Parcel _aidl_reply; |
| ::android::status_t _aidl_ret_status = ::android::OK; |
| ::android::binder::Status _aidl_status; |
| _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = remote()->transact(BnFooInterface::TRANSACTION_originalApi, _aidl_data, &_aidl_reply, 0); |
| if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl())) { |
| return IFooInterface::getDefaultImpl()->originalApi(); |
| } |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| if (!_aidl_status.isOk()) { |
| return _aidl_status; |
| } |
| _aidl_error: |
| _aidl_status.setFromStatusT(_aidl_ret_status); |
| return _aidl_status; |
| } |
| |
| ::android::binder::Status BpFooInterface::acceptUnionAndReturnString(const ::android::aidl::versioned::tests::BazUnion& u, ::std::string* _aidl_return) { |
| ::android::Parcel _aidl_data; |
| _aidl_data.markForBinder(remoteStrong()); |
| ::android::Parcel _aidl_reply; |
| ::android::status_t _aidl_ret_status = ::android::OK; |
| ::android::binder::Status _aidl_status; |
| _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_data.writeParcelable(u); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = remote()->transact(BnFooInterface::TRANSACTION_acceptUnionAndReturnString, _aidl_data, &_aidl_reply, 0); |
| if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl())) { |
| return IFooInterface::getDefaultImpl()->acceptUnionAndReturnString(u, _aidl_return); |
| } |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| if (!_aidl_status.isOk()) { |
| return _aidl_status; |
| } |
| _aidl_ret_status = _aidl_reply.readUtf8FromUtf16(_aidl_return); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_error: |
| _aidl_status.setFromStatusT(_aidl_ret_status); |
| return _aidl_status; |
| } |
| |
| ::android::binder::Status BpFooInterface::ignoreParcelablesAndRepeatInt(const ::android::aidl::versioned::tests::Foo& inFoo, ::android::aidl::versioned::tests::Foo* inoutFoo, ::android::aidl::versioned::tests::Foo* outFoo, int32_t value, int32_t* _aidl_return) { |
| ::android::Parcel _aidl_data; |
| _aidl_data.markForBinder(remoteStrong()); |
| ::android::Parcel _aidl_reply; |
| ::android::status_t _aidl_ret_status = ::android::OK; |
| ::android::binder::Status _aidl_status; |
| _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_data.writeParcelable(inFoo); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_data.writeParcelable(*inoutFoo); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_data.writeInt32(value); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = remote()->transact(BnFooInterface::TRANSACTION_ignoreParcelablesAndRepeatInt, _aidl_data, &_aidl_reply, 0); |
| if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl())) { |
| return IFooInterface::getDefaultImpl()->ignoreParcelablesAndRepeatInt(inFoo, inoutFoo, outFoo, value, _aidl_return); |
| } |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| if (!_aidl_status.isOk()) { |
| return _aidl_status; |
| } |
| _aidl_ret_status = _aidl_reply.readInt32(_aidl_return); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_reply.readParcelable(inoutFoo); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_reply.readParcelable(outFoo); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_error: |
| _aidl_status.setFromStatusT(_aidl_ret_status); |
| return _aidl_status; |
| } |
| |
| ::android::binder::Status BpFooInterface::returnsLengthOfFooArray(const ::std::vector<::android::aidl::versioned::tests::Foo>& foos, int32_t* _aidl_return) { |
| ::android::Parcel _aidl_data; |
| _aidl_data.markForBinder(remoteStrong()); |
| ::android::Parcel _aidl_reply; |
| ::android::status_t _aidl_ret_status = ::android::OK; |
| ::android::binder::Status _aidl_status; |
| _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor()); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_data.writeParcelableVector(foos); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = remote()->transact(BnFooInterface::TRANSACTION_returnsLengthOfFooArray, _aidl_data, &_aidl_reply, 0); |
| if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl())) { |
| return IFooInterface::getDefaultImpl()->returnsLengthOfFooArray(foos, _aidl_return); |
| } |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| if (!_aidl_status.isOk()) { |
| return _aidl_status; |
| } |
| _aidl_ret_status = _aidl_reply.readInt32(_aidl_return); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| goto _aidl_error; |
| } |
| _aidl_error: |
| _aidl_status.setFromStatusT(_aidl_ret_status); |
| return _aidl_status; |
| } |
| |
| int32_t BpFooInterface::getInterfaceVersion() { |
| if (cached_version_ == -1) { |
| ::android::Parcel data; |
| ::android::Parcel reply; |
| data.writeInterfaceToken(getInterfaceDescriptor()); |
| ::android::status_t err = remote()->transact(BnFooInterface::TRANSACTION_getInterfaceVersion, data, &reply); |
| if (err == ::android::OK) { |
| ::android::binder::Status _aidl_status; |
| err = _aidl_status.readFromParcel(reply); |
| if (err == ::android::OK && _aidl_status.isOk()) { |
| cached_version_ = reply.readInt32(); |
| } |
| } |
| } |
| return cached_version_; |
| } |
| |
| |
| std::string BpFooInterface::getInterfaceHash() { |
| std::lock_guard<std::mutex> lockGuard(cached_hash_mutex_); |
| if (cached_hash_ == "-1") { |
| ::android::Parcel data; |
| ::android::Parcel reply; |
| data.writeInterfaceToken(getInterfaceDescriptor()); |
| ::android::status_t err = remote()->transact(BnFooInterface::TRANSACTION_getInterfaceHash, data, &reply); |
| if (err == ::android::OK) { |
| ::android::binder::Status _aidl_status; |
| err = _aidl_status.readFromParcel(reply); |
| if (err == ::android::OK && _aidl_status.isOk()) { |
| reply.readUtf8FromUtf16(&cached_hash_); |
| } |
| } |
| } |
| return cached_hash_; |
| } |
| |
| } // namespace tests |
| } // namespace versioned |
| } // namespace aidl |
| } // namespace android |
| #include <android/aidl/versioned/tests/BnFooInterface.h> |
| #include <binder/Parcel.h> |
| #include <binder/Stability.h> |
| |
| namespace android { |
| namespace aidl { |
| namespace versioned { |
| namespace tests { |
| |
| BnFooInterface::BnFooInterface() |
| { |
| ::android::internal::Stability::markCompilationUnit(this); |
| } |
| |
| ::android::status_t BnFooInterface::onTransact(uint32_t _aidl_code, const ::android::Parcel& _aidl_data, ::android::Parcel* _aidl_reply, uint32_t _aidl_flags) { |
| ::android::status_t _aidl_ret_status = ::android::OK; |
| switch (_aidl_code) { |
| case BnFooInterface::TRANSACTION_originalApi: |
| { |
| if (!(_aidl_data.checkInterface(this))) { |
| _aidl_ret_status = ::android::BAD_TYPE; |
| break; |
| } |
| ::android::binder::Status _aidl_status(originalApi()); |
| _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| if (!_aidl_status.isOk()) { |
| break; |
| } |
| } |
| break; |
| case BnFooInterface::TRANSACTION_acceptUnionAndReturnString: |
| { |
| ::android::aidl::versioned::tests::BazUnion in_u; |
| ::std::string _aidl_return; |
| if (!(_aidl_data.checkInterface(this))) { |
| _aidl_ret_status = ::android::BAD_TYPE; |
| break; |
| } |
| _aidl_ret_status = _aidl_data.readParcelable(&in_u); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| if (auto st = _aidl_data.enforceNoDataAvail(); !st.isOk()) { |
| _aidl_ret_status = st.writeToParcel(_aidl_reply); |
| break; |
| } |
| ::android::binder::Status _aidl_status(acceptUnionAndReturnString(in_u, &_aidl_return)); |
| _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| if (!_aidl_status.isOk()) { |
| break; |
| } |
| _aidl_ret_status = _aidl_reply->writeUtf8AsUtf16(_aidl_return); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| } |
| break; |
| case BnFooInterface::TRANSACTION_ignoreParcelablesAndRepeatInt: |
| { |
| ::android::aidl::versioned::tests::Foo in_inFoo; |
| ::android::aidl::versioned::tests::Foo in_inoutFoo; |
| ::android::aidl::versioned::tests::Foo out_outFoo; |
| int32_t in_value; |
| int32_t _aidl_return; |
| if (!(_aidl_data.checkInterface(this))) { |
| _aidl_ret_status = ::android::BAD_TYPE; |
| break; |
| } |
| _aidl_ret_status = _aidl_data.readParcelable(&in_inFoo); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| _aidl_ret_status = _aidl_data.readParcelable(&in_inoutFoo); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| _aidl_ret_status = _aidl_data.readInt32(&in_value); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| if (auto st = _aidl_data.enforceNoDataAvail(); !st.isOk()) { |
| _aidl_ret_status = st.writeToParcel(_aidl_reply); |
| break; |
| } |
| ::android::binder::Status _aidl_status(ignoreParcelablesAndRepeatInt(in_inFoo, &in_inoutFoo, &out_outFoo, in_value, &_aidl_return)); |
| _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| if (!_aidl_status.isOk()) { |
| break; |
| } |
| _aidl_ret_status = _aidl_reply->writeInt32(_aidl_return); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| _aidl_ret_status = _aidl_reply->writeParcelable(in_inoutFoo); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| _aidl_ret_status = _aidl_reply->writeParcelable(out_outFoo); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| } |
| break; |
| case BnFooInterface::TRANSACTION_returnsLengthOfFooArray: |
| { |
| ::std::vector<::android::aidl::versioned::tests::Foo> in_foos; |
| int32_t _aidl_return; |
| if (!(_aidl_data.checkInterface(this))) { |
| _aidl_ret_status = ::android::BAD_TYPE; |
| break; |
| } |
| _aidl_ret_status = _aidl_data.readParcelableVector(&in_foos); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| if (auto st = _aidl_data.enforceNoDataAvail(); !st.isOk()) { |
| _aidl_ret_status = st.writeToParcel(_aidl_reply); |
| break; |
| } |
| ::android::binder::Status _aidl_status(returnsLengthOfFooArray(in_foos, &_aidl_return)); |
| _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| if (!_aidl_status.isOk()) { |
| break; |
| } |
| _aidl_ret_status = _aidl_reply->writeInt32(_aidl_return); |
| if (((_aidl_ret_status) != (::android::OK))) { |
| break; |
| } |
| } |
| break; |
| case BnFooInterface::TRANSACTION_getInterfaceVersion: |
| { |
| _aidl_data.checkInterface(this); |
| _aidl_reply->writeNoException(); |
| _aidl_reply->writeInt32(IFooInterface::VERSION); |
| } |
| break; |
| case BnFooInterface::TRANSACTION_getInterfaceHash: |
| { |
| _aidl_data.checkInterface(this); |
| _aidl_reply->writeNoException(); |
| _aidl_reply->writeUtf8AsUtf16(IFooInterface::HASH); |
| } |
| break; |
| default: |
| { |
| _aidl_ret_status = ::android::BBinder::onTransact(_aidl_code, _aidl_data, _aidl_reply, _aidl_flags); |
| } |
| break; |
| } |
| if (_aidl_ret_status == ::android::UNEXPECTED_NULL) { |
| _aidl_ret_status = ::android::binder::Status::fromExceptionCode(::android::binder::Status::EX_NULL_POINTER).writeOverParcel(_aidl_reply); |
| } |
| return _aidl_ret_status; |
| } |
| |
| int32_t BnFooInterface::getInterfaceVersion() { |
| return IFooInterface::VERSION; |
| } |
| std::string BnFooInterface::getInterfaceHash() { |
| return IFooInterface::HASH; |
| } |
| } // namespace tests |
| } // namespace versioned |
| } // namespace aidl |
| } // namespace android |