${CMAKE_CURRENT_SOURCE_DIR}/hardware/neuralnetworks/1.0/ExecutionCallbackAll.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hardware/neuralnetworks/1.0/types.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hardware/neuralnetworks/1.0/PreparedModelAll.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/hardware/neuralnetworks/1.1/DeviceAll.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/hardware/neuralnetworks/1.1/types.cpp
)
SET(HAL_HIDL_SRCS
--- /dev/null
+#define LOG_TAG "android.hardware.neuralnetworks@1.1::Device"
+
+#include <android/log.h>
+#include <cutils/trace.h>
+#include <hidl/HidlTransportSupport.h>
+
+#include <android/hidl/manager/1.0/IServiceManager.h>
+#include <android/hardware/neuralnetworks/1.1/BpHwDevice.h>
+#include <android/hardware/neuralnetworks/1.1/BnHwDevice.h>
+#include <android/hardware/neuralnetworks/1.1/BsDevice.h>
+#include <android/hardware/neuralnetworks/1.0/BpHwDevice.h>
+#include <android/hidl/base/1.0/BpHwBase.h>
+#include <hidl/ServiceManagement.h>
+
+namespace android {
+namespace hardware {
+namespace neuralnetworks {
+namespace V1_1 {
+
+std::string toString(const ::android::sp<IDevice>& o) {
+ std::string os = "[class or subclass of ";
+ os += IDevice::descriptor;
+ os += "]";
+ os += o->isRemote() ? "@remote" : "@local";
+ return os;
+}
+
+const char* IDevice::descriptor("android.hardware.neuralnetworks@1.1::IDevice");
+
+__attribute__((constructor))static void static_constructor() {
+ ::android::hardware::details::gBnConstructorMap.set(IDevice::descriptor,
+ [](void *iIntf) -> ::android::sp<::android::hardware::IBinder> {
+ return new BnHwDevice(static_cast<IDevice *>(iIntf));
+ });
+ ::android::hardware::details::gBsConstructorMap.set(IDevice::descriptor,
+ [](void *iIntf) -> ::android::sp<::android::hidl::base::V1_0::IBase> {
+ return new BsDevice(static_cast<IDevice *>(iIntf));
+ });
+};
+
+__attribute__((destructor))static void static_destructor() {
+ ::android::hardware::details::gBnConstructorMap.erase(IDevice::descriptor);
+ ::android::hardware::details::gBsConstructorMap.erase(IDevice::descriptor);
+};
+
+// Methods from ::android::hardware::neuralnetworks::V1_0::IDevice follow.
+// no default implementation for: ::android::hardware::Return<void> IDevice::getCapabilities(getCapabilities_cb _hidl_cb)
+// no default implementation for: ::android::hardware::Return<void> IDevice::getSupportedOperations(const ::android::hardware::neuralnetworks::V1_0::Model& model, getSupportedOperations_cb _hidl_cb)
+// no default implementation for: ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> IDevice::prepareModel(const ::android::hardware::neuralnetworks::V1_0::Model& model, const ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>& callback)
+// no default implementation for: ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::DeviceStatus> IDevice::getStatus()
+
+// Methods from IDevice follow.
+// no default implementation for: ::android::hardware::Return<void> IDevice::getCapabilities_1_1(getCapabilities_1_1_cb _hidl_cb)
+// no default implementation for: ::android::hardware::Return<void> IDevice::getSupportedOperations_1_1(const Model& model, getSupportedOperations_1_1_cb _hidl_cb)
+// no default implementation for: ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> IDevice::prepareModel_1_1(const Model& model, const ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>& callback)
+
+// Methods from ::android::hidl::base::V1_0::IBase follow.
+::android::hardware::Return<void> IDevice::interfaceChain(interfaceChain_cb _hidl_cb){
+ _hidl_cb({
+ IDevice::descriptor,
+ ::android::hardware::neuralnetworks::V1_0::IDevice::descriptor,
+ ::android::hidl::base::V1_0::IBase::descriptor,
+ });
+ return ::android::hardware::Void();}
+
+::android::hardware::Return<void> IDevice::debug(const ::android::hardware::hidl_handle& fd, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& options){
+ (void)fd;
+ (void)options;
+ return ::android::hardware::Void();}
+
+::android::hardware::Return<void> IDevice::interfaceDescriptor(interfaceDescriptor_cb _hidl_cb){
+ _hidl_cb(IDevice::descriptor);
+ return ::android::hardware::Void();}
+
+::android::hardware::Return<void> IDevice::getHashChain(getHashChain_cb _hidl_cb){
+ _hidl_cb({
+ std::move((uint8_t[32]){21,41,64,158,215,106,232,127,172,171,21,43,119,4,149,233,230,37,68,252,197,33,93,170,191,20,108,40,213,136,186,185}) /* 1529409ed76ae87facab152b770495e9e62544fcc5215daabf146c28d588bab9 */,
+ std::move((uint8_t[32]){147,235,55,87,206,175,33,89,15,164,205,29,74,125,254,59,55,148,175,83,150,16,10,109,37,99,8,121,53,42,188,233}) /* 93eb3757ceaf21590fa4cd1d4a7dfe3b3794af5396100a6d25630879352abce9 */,
+ std::move((uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217}) /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
+ return ::android::hardware::Void();
+}
+
+::android::hardware::Return<void> IDevice::setHALInstrumentation(){
+ return ::android::hardware::Void();
+}
+
+::android::hardware::Return<bool> IDevice::linkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient, uint64_t cookie){
+ (void)cookie;
+ return (recipient != nullptr);
+}
+
+::android::hardware::Return<void> IDevice::ping(){
+ return ::android::hardware::Void();
+}
+
+::android::hardware::Return<void> IDevice::getDebugInfo(getDebugInfo_cb _hidl_cb){
+ _hidl_cb({ -1 /* pid */, 0 /* ptr */,
+ #if defined(__LP64__)
+ ::android::hidl::base::V1_0::DebugInfo::Architecture::IS_64BIT
+ #else
+ ::android::hidl::base::V1_0::DebugInfo::Architecture::IS_32BIT
+ #endif
+ });
+ return ::android::hardware::Void();}
+
+::android::hardware::Return<void> IDevice::notifySyspropsChanged(){
+ ::android::report_sysprop_change();
+ return ::android::hardware::Void();}
+
+::android::hardware::Return<bool> IDevice::unlinkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient){
+ return (recipient != nullptr);
+}
+
+
+// static
+::android::hardware::Return<::android::sp<IDevice>> IDevice::castFrom(const ::android::sp<IDevice>& parent, bool /* emitError */) {
+ return parent;
+}
+
+// static
+::android::hardware::Return<::android::sp<IDevice>> IDevice::castFrom(const ::android::sp<::android::hardware::neuralnetworks::V1_0::IDevice>& parent, bool emitError) {
+ return ::android::hardware::details::castInterface<IDevice, ::android::hardware::neuralnetworks::V1_0::IDevice, BpHwDevice>(
+ parent, "android.hardware.neuralnetworks@1.1::IDevice", emitError);
+}
+
+// static
+::android::hardware::Return<::android::sp<IDevice>> IDevice::castFrom(const ::android::sp<::android::hidl::base::V1_0::IBase>& parent, bool emitError) {
+ return ::android::hardware::details::castInterface<IDevice, ::android::hidl::base::V1_0::IBase, BpHwDevice>(
+ parent, "android.hardware.neuralnetworks@1.1::IDevice", emitError);
+}
+
+BpHwDevice::BpHwDevice(const ::android::sp<::android::hardware::IBinder> &_hidl_impl)
+ : BpInterface<IDevice>(_hidl_impl),
+ ::android::hardware::details::HidlInstrumentor("android.hardware.neuralnetworks@1.1", "IDevice") {
+}
+
+// Methods from IDevice follow.
+::android::hardware::Return<void> BpHwDevice::_hidl_getCapabilities_1_1(::android::hardware::IInterface *_hidl_this, ::android::hardware::details::HidlInstrumentor *_hidl_this_instrumentor, getCapabilities_1_1_cb _hidl_cb) {
+ #ifdef __ANDROID_DEBUGGABLE__
+ bool mEnableInstrumentation = _hidl_this_instrumentor->isInstrumentationEnabled();
+ const auto &mInstrumentationCallbacks = _hidl_this_instrumentor->getInstrumentationCallbacks();
+ #else
+ (void) _hidl_this_instrumentor;
+ #endif // __ANDROID_DEBUGGABLE__
+ if (_hidl_cb == nullptr) {
+ return ::android::hardware::Status::fromExceptionCode(
+ ::android::hardware::Status::EX_ILLEGAL_ARGUMENT,
+ "Null synchronous callback passed.");
+ }
+
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::getCapabilities_1_1::client");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::CLIENT_API_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "getCapabilities_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ ::android::hardware::Parcel _hidl_data;
+ ::android::hardware::Parcel _hidl_reply;
+ ::android::status_t _hidl_err;
+ ::android::hardware::Status _hidl_status;
+
+ ::android::hardware::neuralnetworks::V1_0::ErrorStatus _hidl_out_status;
+ const Capabilities* _hidl_out_capabilities;
+
+ _hidl_err = _hidl_data.writeInterfaceToken(BpHwDevice::descriptor);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ _hidl_err = ::android::hardware::IInterface::asBinder(_hidl_this)->transact(5 /* getCapabilities_1_1 */, _hidl_data, &_hidl_reply);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ _hidl_err = ::android::hardware::readFromParcel(&_hidl_status, _hidl_reply);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ if (!_hidl_status.isOk()) { return _hidl_status; }
+
+ _hidl_err = _hidl_reply.readInt32((int32_t *)&_hidl_out_status);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ size_t _hidl__hidl_out_capabilities_parent;
+
+ _hidl_err = _hidl_reply.readBuffer(sizeof(*_hidl_out_capabilities), &_hidl__hidl_out_capabilities_parent, reinterpret_cast<const void **>(&_hidl_out_capabilities));
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ _hidl_cb(_hidl_out_status, *_hidl_out_capabilities);
+
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_status);
+ _hidl_args.push_back((void *)_hidl_out_capabilities);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::CLIENT_API_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "getCapabilities_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_status.setFromStatusT(_hidl_err);
+ return ::android::hardware::Return<void>();
+
+_hidl_error:
+ _hidl_status.setFromStatusT(_hidl_err);
+ return ::android::hardware::Return<void>(_hidl_status);
+}
+
+::android::hardware::Return<void> BpHwDevice::_hidl_getSupportedOperations_1_1(::android::hardware::IInterface *_hidl_this, ::android::hardware::details::HidlInstrumentor *_hidl_this_instrumentor, const Model& model, getSupportedOperations_1_1_cb _hidl_cb) {
+ #ifdef __ANDROID_DEBUGGABLE__
+ bool mEnableInstrumentation = _hidl_this_instrumentor->isInstrumentationEnabled();
+ const auto &mInstrumentationCallbacks = _hidl_this_instrumentor->getInstrumentationCallbacks();
+ #else
+ (void) _hidl_this_instrumentor;
+ #endif // __ANDROID_DEBUGGABLE__
+ if (_hidl_cb == nullptr) {
+ return ::android::hardware::Status::fromExceptionCode(
+ ::android::hardware::Status::EX_ILLEGAL_ARGUMENT,
+ "Null synchronous callback passed.");
+ }
+
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::getSupportedOperations_1_1::client");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&model);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::CLIENT_API_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "getSupportedOperations_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ ::android::hardware::Parcel _hidl_data;
+ ::android::hardware::Parcel _hidl_reply;
+ ::android::status_t _hidl_err;
+ ::android::hardware::Status _hidl_status;
+
+ ::android::hardware::neuralnetworks::V1_0::ErrorStatus _hidl_out_status;
+ const ::android::hardware::hidl_vec<bool>* _hidl_out_supportedOperations;
+
+ _hidl_err = _hidl_data.writeInterfaceToken(BpHwDevice::descriptor);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ size_t _hidl_model_parent;
+
+ _hidl_err = _hidl_data.writeBuffer(&model, sizeof(model), &_hidl_model_parent);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ _hidl_err = writeEmbeddedToParcel(
+ model,
+ &_hidl_data,
+ _hidl_model_parent,
+ 0 /* parentOffset */);
+
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ _hidl_err = ::android::hardware::IInterface::asBinder(_hidl_this)->transact(6 /* getSupportedOperations_1_1 */, _hidl_data, &_hidl_reply);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ _hidl_err = ::android::hardware::readFromParcel(&_hidl_status, _hidl_reply);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ if (!_hidl_status.isOk()) { return _hidl_status; }
+
+ _hidl_err = _hidl_reply.readInt32((int32_t *)&_hidl_out_status);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ size_t _hidl__hidl_out_supportedOperations_parent;
+
+ _hidl_err = _hidl_reply.readBuffer(sizeof(*_hidl_out_supportedOperations), &_hidl__hidl_out_supportedOperations_parent, reinterpret_cast<const void **>(&_hidl_out_supportedOperations));
+
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ size_t _hidl__hidl_out_supportedOperations_child;
+
+ _hidl_err = ::android::hardware::readEmbeddedFromParcel(
+ const_cast<::android::hardware::hidl_vec<bool> &>(*_hidl_out_supportedOperations),
+ _hidl_reply,
+ _hidl__hidl_out_supportedOperations_parent,
+ 0 /* parentOffset */, &_hidl__hidl_out_supportedOperations_child);
+
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ _hidl_cb(_hidl_out_status, *_hidl_out_supportedOperations);
+
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_status);
+ _hidl_args.push_back((void *)_hidl_out_supportedOperations);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::CLIENT_API_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "getSupportedOperations_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_status.setFromStatusT(_hidl_err);
+ return ::android::hardware::Return<void>();
+
+_hidl_error:
+ _hidl_status.setFromStatusT(_hidl_err);
+ return ::android::hardware::Return<void>(_hidl_status);
+}
+
+::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> BpHwDevice::_hidl_prepareModel_1_1(::android::hardware::IInterface *_hidl_this, ::android::hardware::details::HidlInstrumentor *_hidl_this_instrumentor, const Model& model, const ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>& callback) {
+ #ifdef __ANDROID_DEBUGGABLE__
+ bool mEnableInstrumentation = _hidl_this_instrumentor->isInstrumentationEnabled();
+ const auto &mInstrumentationCallbacks = _hidl_this_instrumentor->getInstrumentationCallbacks();
+ #else
+ (void) _hidl_this_instrumentor;
+ #endif // __ANDROID_DEBUGGABLE__
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::prepareModel_1_1::client");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&model);
+ _hidl_args.push_back((void *)&callback);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::CLIENT_API_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "prepareModel_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ ::android::hardware::Parcel _hidl_data;
+ ::android::hardware::Parcel _hidl_reply;
+ ::android::status_t _hidl_err;
+ ::android::hardware::Status _hidl_status;
+
+ ::android::hardware::neuralnetworks::V1_0::ErrorStatus _hidl_out_status;
+
+ _hidl_err = _hidl_data.writeInterfaceToken(BpHwDevice::descriptor);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ size_t _hidl_model_parent;
+
+ _hidl_err = _hidl_data.writeBuffer(&model, sizeof(model), &_hidl_model_parent);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ _hidl_err = writeEmbeddedToParcel(
+ model,
+ &_hidl_data,
+ _hidl_model_parent,
+ 0 /* parentOffset */);
+
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ if (callback == nullptr) {
+ _hidl_err = _hidl_data.writeStrongBinder(nullptr);
+ } else {
+ ::android::sp<::android::hardware::IBinder> _hidl_binder = ::android::hardware::toBinder<
+ ::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>(callback);
+ if (_hidl_binder.get() != nullptr) {
+ _hidl_err = _hidl_data.writeStrongBinder(_hidl_binder);
+ } else {
+ _hidl_err = ::android::UNKNOWN_ERROR;
+ }
+ }
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ ::android::hardware::ProcessState::self()->startThreadPool();
+ _hidl_err = ::android::hardware::IInterface::asBinder(_hidl_this)->transact(7 /* prepareModel_1_1 */, _hidl_data, &_hidl_reply);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ _hidl_err = ::android::hardware::readFromParcel(&_hidl_status, _hidl_reply);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ if (!_hidl_status.isOk()) { return _hidl_status; }
+
+ _hidl_err = _hidl_reply.readInt32((int32_t *)&_hidl_out_status);
+ if (_hidl_err != ::android::OK) { goto _hidl_error; }
+
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_status);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::CLIENT_API_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "prepareModel_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_status.setFromStatusT(_hidl_err);
+ return ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus>(_hidl_out_status);
+
+_hidl_error:
+ _hidl_status.setFromStatusT(_hidl_err);
+ return ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus>(_hidl_status);
+}
+
+
+// Methods from ::android::hardware::neuralnetworks::V1_0::IDevice follow.
+::android::hardware::Return<void> BpHwDevice::getCapabilities(getCapabilities_cb _hidl_cb){
+ ::android::hardware::Return<void> _hidl_out = ::android::hardware::neuralnetworks::V1_0::BpHwDevice::_hidl_getCapabilities(this, this, _hidl_cb);
+
+ return _hidl_out;
+}
+
+::android::hardware::Return<void> BpHwDevice::getSupportedOperations(const ::android::hardware::neuralnetworks::V1_0::Model& model, getSupportedOperations_cb _hidl_cb){
+ ::android::hardware::Return<void> _hidl_out = ::android::hardware::neuralnetworks::V1_0::BpHwDevice::_hidl_getSupportedOperations(this, this, model, _hidl_cb);
+
+ return _hidl_out;
+}
+
+::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> BpHwDevice::prepareModel(const ::android::hardware::neuralnetworks::V1_0::Model& model, const ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>& callback){
+ ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> _hidl_out = ::android::hardware::neuralnetworks::V1_0::BpHwDevice::_hidl_prepareModel(this, this, model, callback);
+
+ return _hidl_out;
+}
+
+::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::DeviceStatus> BpHwDevice::getStatus(){
+ ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::DeviceStatus> _hidl_out = ::android::hardware::neuralnetworks::V1_0::BpHwDevice::_hidl_getStatus(this, this);
+
+ return _hidl_out;
+}
+
+
+// Methods from IDevice follow.
+::android::hardware::Return<void> BpHwDevice::getCapabilities_1_1(getCapabilities_1_1_cb _hidl_cb){
+ ::android::hardware::Return<void> _hidl_out = ::android::hardware::neuralnetworks::V1_1::BpHwDevice::_hidl_getCapabilities_1_1(this, this, _hidl_cb);
+
+ return _hidl_out;
+}
+
+::android::hardware::Return<void> BpHwDevice::getSupportedOperations_1_1(const Model& model, getSupportedOperations_1_1_cb _hidl_cb){
+ ::android::hardware::Return<void> _hidl_out = ::android::hardware::neuralnetworks::V1_1::BpHwDevice::_hidl_getSupportedOperations_1_1(this, this, model, _hidl_cb);
+
+ return _hidl_out;
+}
+
+::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> BpHwDevice::prepareModel_1_1(const Model& model, const ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>& callback){
+ ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> _hidl_out = ::android::hardware::neuralnetworks::V1_1::BpHwDevice::_hidl_prepareModel_1_1(this, this, model, callback);
+
+ return _hidl_out;
+}
+
+
+// Methods from ::android::hidl::base::V1_0::IBase follow.
+::android::hardware::Return<void> BpHwDevice::interfaceChain(interfaceChain_cb _hidl_cb){
+ ::android::hardware::Return<void> _hidl_out = ::android::hidl::base::V1_0::BpHwBase::_hidl_interfaceChain(this, this, _hidl_cb);
+
+ return _hidl_out;
+}
+
+::android::hardware::Return<void> BpHwDevice::debug(const ::android::hardware::hidl_handle& fd, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& options){
+ ::android::hardware::Return<void> _hidl_out = ::android::hidl::base::V1_0::BpHwBase::_hidl_debug(this, this, fd, options);
+
+ return _hidl_out;
+}
+
+::android::hardware::Return<void> BpHwDevice::interfaceDescriptor(interfaceDescriptor_cb _hidl_cb){
+ ::android::hardware::Return<void> _hidl_out = ::android::hidl::base::V1_0::BpHwBase::_hidl_interfaceDescriptor(this, this, _hidl_cb);
+
+ return _hidl_out;
+}
+
+::android::hardware::Return<void> BpHwDevice::getHashChain(getHashChain_cb _hidl_cb){
+ ::android::hardware::Return<void> _hidl_out = ::android::hidl::base::V1_0::BpHwBase::_hidl_getHashChain(this, this, _hidl_cb);
+
+ return _hidl_out;
+}
+
+::android::hardware::Return<void> BpHwDevice::setHALInstrumentation(){
+ ::android::hardware::Return<void> _hidl_out = ::android::hidl::base::V1_0::BpHwBase::_hidl_setHALInstrumentation(this, this);
+
+ return _hidl_out;
+}
+
+::android::hardware::Return<bool> BpHwDevice::linkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient, uint64_t cookie){
+ ::android::hardware::ProcessState::self()->startThreadPool();
+ ::android::hardware::hidl_binder_death_recipient *binder_recipient = new ::android::hardware::hidl_binder_death_recipient(recipient, cookie, this);
+ std::unique_lock<std::mutex> lock(_hidl_mMutex);
+ _hidl_mDeathRecipients.push_back(binder_recipient);
+ return (remote()->linkToDeath(binder_recipient) == ::android::OK);
+}
+
+::android::hardware::Return<void> BpHwDevice::ping(){
+ ::android::hardware::Return<void> _hidl_out = ::android::hidl::base::V1_0::BpHwBase::_hidl_ping(this, this);
+
+ return _hidl_out;
+}
+
+::android::hardware::Return<void> BpHwDevice::getDebugInfo(getDebugInfo_cb _hidl_cb){
+ ::android::hardware::Return<void> _hidl_out = ::android::hidl::base::V1_0::BpHwBase::_hidl_getDebugInfo(this, this, _hidl_cb);
+
+ return _hidl_out;
+}
+
+::android::hardware::Return<void> BpHwDevice::notifySyspropsChanged(){
+ ::android::hardware::Return<void> _hidl_out = ::android::hidl::base::V1_0::BpHwBase::_hidl_notifySyspropsChanged(this, this);
+
+ return _hidl_out;
+}
+
+::android::hardware::Return<bool> BpHwDevice::unlinkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient){
+ std::unique_lock<std::mutex> lock(_hidl_mMutex);
+ for (auto it = _hidl_mDeathRecipients.begin();it != _hidl_mDeathRecipients.end();++it) {
+ if ((*it)->getRecipient() == recipient) {
+ ::android::status_t status = remote()->unlinkToDeath(*it);
+ _hidl_mDeathRecipients.erase(it);
+ return status == ::android::OK;
+ }}
+ return false;
+}
+
+
+BnHwDevice::BnHwDevice(const ::android::sp<IDevice> &_hidl_impl)
+ : ::android::hidl::base::V1_0::BnHwBase(_hidl_impl, "android.hardware.neuralnetworks@1.1", "IDevice") {
+ _hidl_mImpl = _hidl_impl;
+ auto prio = ::android::hardware::details::gServicePrioMap.get(_hidl_impl, {SCHED_NORMAL, 0});
+ mSchedPolicy = prio.sched_policy;
+ mSchedPriority = prio.prio;
+}
+
+BnHwDevice::~BnHwDevice() {
+ ::android::hardware::details::gBnMap.eraseIfEqual(_hidl_mImpl.get(), this);
+}
+
+// Methods from IDevice follow.
+::android::status_t BnHwDevice::_hidl_getCapabilities_1_1(
+ ::android::hidl::base::V1_0::BnHwBase* _hidl_this,
+ const ::android::hardware::Parcel &_hidl_data,
+ ::android::hardware::Parcel *_hidl_reply,
+ TransactCallback _hidl_cb) {
+ #ifdef __ANDROID_DEBUGGABLE__
+ bool mEnableInstrumentation = _hidl_this->isInstrumentationEnabled();
+ const auto &mInstrumentationCallbacks = _hidl_this->getInstrumentationCallbacks();
+ #endif // __ANDROID_DEBUGGABLE__
+
+ ::android::status_t _hidl_err = ::android::OK;
+ if (!_hidl_data.enforceInterface(BnHwDevice::Pure::descriptor)) {
+ _hidl_err = ::android::BAD_TYPE;
+ return _hidl_err;
+ }
+
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::getCapabilities_1_1::server");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::SERVER_API_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "getCapabilities_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ bool _hidl_callbackCalled = false;
+
+ static_cast<BnHwDevice*>(_hidl_this)->_hidl_mImpl->getCapabilities_1_1([&](const auto &_hidl_out_status, const auto &_hidl_out_capabilities) {
+ if (_hidl_callbackCalled) {
+ LOG_ALWAYS_FATAL("getCapabilities_1_1: _hidl_cb called a second time, but must be called once.");
+ }
+ _hidl_callbackCalled = true;
+
+ ::android::hardware::writeToParcel(::android::hardware::Status::ok(), _hidl_reply);
+
+ _hidl_err = _hidl_reply->writeInt32((int32_t)_hidl_out_status);
+ /* _hidl_err ignored! */
+
+ size_t _hidl__hidl_out_capabilities_parent;
+
+ _hidl_err = _hidl_reply->writeBuffer(&_hidl_out_capabilities, sizeof(_hidl_out_capabilities), &_hidl__hidl_out_capabilities_parent);
+ /* _hidl_err ignored! */
+
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_status);
+ _hidl_args.push_back((void *)&_hidl_out_capabilities);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::SERVER_API_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "getCapabilities_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_cb(*_hidl_reply);
+ });
+
+ if (!_hidl_callbackCalled) {
+ LOG_ALWAYS_FATAL("getCapabilities_1_1: _hidl_cb not called, but must be called once.");
+ }
+
+ return _hidl_err;
+}
+
+::android::status_t BnHwDevice::_hidl_getSupportedOperations_1_1(
+ ::android::hidl::base::V1_0::BnHwBase* _hidl_this,
+ const ::android::hardware::Parcel &_hidl_data,
+ ::android::hardware::Parcel *_hidl_reply,
+ TransactCallback _hidl_cb) {
+ #ifdef __ANDROID_DEBUGGABLE__
+ bool mEnableInstrumentation = _hidl_this->isInstrumentationEnabled();
+ const auto &mInstrumentationCallbacks = _hidl_this->getInstrumentationCallbacks();
+ #endif // __ANDROID_DEBUGGABLE__
+
+ ::android::status_t _hidl_err = ::android::OK;
+ if (!_hidl_data.enforceInterface(BnHwDevice::Pure::descriptor)) {
+ _hidl_err = ::android::BAD_TYPE;
+ return _hidl_err;
+ }
+
+ const Model* model;
+
+ size_t _hidl_model_parent;
+
+ _hidl_err = _hidl_data.readBuffer(sizeof(*model), &_hidl_model_parent, reinterpret_cast<const void **>(&model));
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ _hidl_err = readEmbeddedFromParcel(
+ const_cast<Model &>(*model),
+ _hidl_data,
+ _hidl_model_parent,
+ 0 /* parentOffset */);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::getSupportedOperations_1_1::server");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)model);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::SERVER_API_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "getSupportedOperations_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ bool _hidl_callbackCalled = false;
+
+ static_cast<BnHwDevice*>(_hidl_this)->_hidl_mImpl->getSupportedOperations_1_1(*model, [&](const auto &_hidl_out_status, const auto &_hidl_out_supportedOperations) {
+ if (_hidl_callbackCalled) {
+ LOG_ALWAYS_FATAL("getSupportedOperations_1_1: _hidl_cb called a second time, but must be called once.");
+ }
+ _hidl_callbackCalled = true;
+
+ ::android::hardware::writeToParcel(::android::hardware::Status::ok(), _hidl_reply);
+
+ _hidl_err = _hidl_reply->writeInt32((int32_t)_hidl_out_status);
+ /* _hidl_err ignored! */
+
+ size_t _hidl__hidl_out_supportedOperations_parent;
+
+ _hidl_err = _hidl_reply->writeBuffer(&_hidl_out_supportedOperations, sizeof(_hidl_out_supportedOperations), &_hidl__hidl_out_supportedOperations_parent);
+ /* _hidl_err ignored! */
+
+ size_t _hidl__hidl_out_supportedOperations_child;
+
+ _hidl_err = ::android::hardware::writeEmbeddedToParcel(
+ _hidl_out_supportedOperations,
+ _hidl_reply,
+ _hidl__hidl_out_supportedOperations_parent,
+ 0 /* parentOffset */, &_hidl__hidl_out_supportedOperations_child);
+
+ /* _hidl_err ignored! */
+
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_status);
+ _hidl_args.push_back((void *)&_hidl_out_supportedOperations);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::SERVER_API_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "getSupportedOperations_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_cb(*_hidl_reply);
+ });
+
+ if (!_hidl_callbackCalled) {
+ LOG_ALWAYS_FATAL("getSupportedOperations_1_1: _hidl_cb not called, but must be called once.");
+ }
+
+ return _hidl_err;
+}
+
+::android::status_t BnHwDevice::_hidl_prepareModel_1_1(
+ ::android::hidl::base::V1_0::BnHwBase* _hidl_this,
+ const ::android::hardware::Parcel &_hidl_data,
+ ::android::hardware::Parcel *_hidl_reply,
+ TransactCallback _hidl_cb) {
+ #ifdef __ANDROID_DEBUGGABLE__
+ bool mEnableInstrumentation = _hidl_this->isInstrumentationEnabled();
+ const auto &mInstrumentationCallbacks = _hidl_this->getInstrumentationCallbacks();
+ #endif // __ANDROID_DEBUGGABLE__
+
+ ::android::status_t _hidl_err = ::android::OK;
+ if (!_hidl_data.enforceInterface(BnHwDevice::Pure::descriptor)) {
+ _hidl_err = ::android::BAD_TYPE;
+ return _hidl_err;
+ }
+
+ const Model* model;
+ ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback> callback;
+
+ size_t _hidl_model_parent;
+
+ _hidl_err = _hidl_data.readBuffer(sizeof(*model), &_hidl_model_parent, reinterpret_cast<const void **>(&model));
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ _hidl_err = readEmbeddedFromParcel(
+ const_cast<Model &>(*model),
+ _hidl_data,
+ _hidl_model_parent,
+ 0 /* parentOffset */);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ {
+ ::android::sp<::android::hardware::IBinder> _hidl_callback_binder;
+ _hidl_err = _hidl_data.readNullableStrongBinder(&_hidl_callback_binder);
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ callback = ::android::hardware::fromBinder<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback,::android::hardware::neuralnetworks::V1_0::BpHwPreparedModelCallback,::android::hardware::neuralnetworks::V1_0::BnHwPreparedModelCallback>(_hidl_callback_binder);
+ }
+
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::prepareModel_1_1::server");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)model);
+ _hidl_args.push_back((void *)&callback);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::SERVER_API_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "prepareModel_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ ::android::hardware::neuralnetworks::V1_0::ErrorStatus _hidl_out_status = static_cast<BnHwDevice*>(_hidl_this)->_hidl_mImpl->prepareModel_1_1(*model, callback);
+
+ ::android::hardware::writeToParcel(::android::hardware::Status::ok(), _hidl_reply);
+
+ _hidl_err = _hidl_reply->writeInt32((int32_t)_hidl_out_status);
+ /* _hidl_err ignored! */
+
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_status);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::SERVER_API_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "prepareModel_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_cb(*_hidl_reply);
+ return _hidl_err;
+}
+
+
+// Methods from ::android::hardware::neuralnetworks::V1_0::IDevice follow.
+
+// Methods from IDevice follow.
+
+// Methods from ::android::hidl::base::V1_0::IBase follow.
+::android::hardware::Return<void> BnHwDevice::ping() {
+ return ::android::hardware::Void();
+}
+::android::hardware::Return<void> BnHwDevice::getDebugInfo(getDebugInfo_cb _hidl_cb) {
+ _hidl_cb({
+ ::android::hardware::details::debuggable()? getpid() : -1 /* pid */,
+ ::android::hardware::details::debuggable()? reinterpret_cast<uint64_t>(this) : 0 /* ptr */,
+ #if defined(__LP64__)
+ ::android::hidl::base::V1_0::DebugInfo::Architecture::IS_64BIT
+ #else
+ ::android::hidl::base::V1_0::DebugInfo::Architecture::IS_32BIT
+ #endif
+
+ });
+ return ::android::hardware::Void();}
+
+::android::status_t BnHwDevice::onTransact(
+ uint32_t _hidl_code,
+ const ::android::hardware::Parcel &_hidl_data,
+ ::android::hardware::Parcel *_hidl_reply,
+ uint32_t _hidl_flags,
+ TransactCallback _hidl_cb) {
+ ::android::status_t _hidl_err = ::android::OK;
+
+ switch (_hidl_code) {
+ case 1 /* getCapabilities */:
+ {
+ _hidl_err = ::android::hardware::neuralnetworks::V1_0::BnHwDevice::_hidl_getCapabilities(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 2 /* getSupportedOperations */:
+ {
+ _hidl_err = ::android::hardware::neuralnetworks::V1_0::BnHwDevice::_hidl_getSupportedOperations(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 3 /* prepareModel */:
+ {
+ _hidl_err = ::android::hardware::neuralnetworks::V1_0::BnHwDevice::_hidl_prepareModel(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 4 /* getStatus */:
+ {
+ _hidl_err = ::android::hardware::neuralnetworks::V1_0::BnHwDevice::_hidl_getStatus(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 5 /* getCapabilities_1_1 */:
+ {
+ _hidl_err = ::android::hardware::neuralnetworks::V1_1::BnHwDevice::_hidl_getCapabilities_1_1(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 6 /* getSupportedOperations_1_1 */:
+ {
+ _hidl_err = ::android::hardware::neuralnetworks::V1_1::BnHwDevice::_hidl_getSupportedOperations_1_1(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 7 /* prepareModel_1_1 */:
+ {
+ _hidl_err = ::android::hardware::neuralnetworks::V1_1::BnHwDevice::_hidl_prepareModel_1_1(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 256067662 /* interfaceChain */:
+ {
+ _hidl_err = ::android::hidl::base::V1_0::BnHwBase::_hidl_interfaceChain(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 256131655 /* debug */:
+ {
+ _hidl_err = ::android::hidl::base::V1_0::BnHwBase::_hidl_debug(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 256136003 /* interfaceDescriptor */:
+ {
+ _hidl_err = ::android::hidl::base::V1_0::BnHwBase::_hidl_interfaceDescriptor(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 256398152 /* getHashChain */:
+ {
+ _hidl_err = ::android::hidl::base::V1_0::BnHwBase::_hidl_getHashChain(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 256462420 /* setHALInstrumentation */:
+ {
+ configureInstrumentation();
+ break;
+ }
+
+ case 256660548 /* linkToDeath */:
+ {
+ break;
+ }
+
+ case 256921159 /* ping */:
+ {
+ _hidl_err = ::android::hidl::base::V1_0::BnHwBase::_hidl_ping(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 257049926 /* getDebugInfo */:
+ {
+ _hidl_err = ::android::hidl::base::V1_0::BnHwBase::_hidl_getDebugInfo(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 257120595 /* notifySyspropsChanged */:
+ {
+ _hidl_err = ::android::hidl::base::V1_0::BnHwBase::_hidl_notifySyspropsChanged(this, _hidl_data, _hidl_reply, _hidl_cb);
+ break;
+ }
+
+ case 257250372 /* unlinkToDeath */:
+ {
+ break;
+ }
+
+ default:
+ {
+ return ::android::hidl::base::V1_0::BnHwBase::onTransact(
+ _hidl_code, _hidl_data, _hidl_reply, _hidl_flags, _hidl_cb);
+ }
+ }
+
+ if (_hidl_err == ::android::UNEXPECTED_NULL) {
+ _hidl_err = ::android::hardware::writeToParcel(
+ ::android::hardware::Status::fromExceptionCode(::android::hardware::Status::EX_NULL_POINTER),
+ _hidl_reply);
+ }return _hidl_err;
+}
+
+BsDevice::BsDevice(const ::android::sp<IDevice> impl) : ::android::hardware::details::HidlInstrumentor("android.hardware.neuralnetworks@1.1", "IDevice"), mImpl(impl) {
+ mOnewayQueue.start(3000 /* similar limit to binderized */);
+}
+
+::android::hardware::Return<void> BsDevice::addOnewayTask(std::function<void(void)> fun) {
+ if (!mOnewayQueue.push(fun)) {
+ return ::android::hardware::Status::fromExceptionCode(
+ ::android::hardware::Status::EX_TRANSACTION_FAILED,
+ "Passthrough oneway function queue exceeds maximum size.");
+ }
+ return ::android::hardware::Status();
+}
+
+// static
+::android::sp<IDevice> IDevice::tryGetService(const std::string &serviceName, const bool getStub) {
+ using ::android::hardware::defaultServiceManager;
+ using ::android::hardware::details::waitForHwService;
+ using ::android::hardware::getPassthroughServiceManager;
+ using ::android::hardware::Return;
+ using ::android::sp;
+ using Transport = ::android::hidl::manager::V1_0::IServiceManager::Transport;
+
+ sp<IDevice> iface = nullptr;
+
+ const sp<::android::hidl::manager::V1_0::IServiceManager> sm = defaultServiceManager();
+ if (sm == nullptr) {
+ ALOGE("getService: defaultServiceManager() is null");
+ return nullptr;
+ }
+
+ Return<Transport> transportRet = sm->getTransport(IDevice::descriptor, serviceName);
+
+ if (!transportRet.isOk()) {
+ ALOGE("getService: defaultServiceManager()->getTransport returns %s", transportRet.description().c_str());
+ return nullptr;
+ }
+ Transport transport = transportRet;
+ const bool vintfHwbinder = (transport == Transport::HWBINDER);
+ const bool vintfPassthru = (transport == Transport::PASSTHROUGH);
+
+ #ifdef __ANDROID_TREBLE__
+
+ #ifdef __ANDROID_DEBUGGABLE__
+ const char* env = std::getenv("TREBLE_TESTING_OVERRIDE");
+ const bool trebleTestingOverride = env && !strcmp(env, "true");
+ const bool vintfLegacy = (transport == Transport::EMPTY) && trebleTestingOverride;
+ #else // __ANDROID_TREBLE__ but not __ANDROID_DEBUGGABLE__
+ const bool trebleTestingOverride = false;
+ const bool vintfLegacy = false;
+ #endif // __ANDROID_DEBUGGABLE__
+
+ #else // not __ANDROID_TREBLE__
+ const char* env = std::getenv("TREBLE_TESTING_OVERRIDE");
+ const bool trebleTestingOverride = env && !strcmp(env, "true");
+ const bool vintfLegacy = (transport == Transport::EMPTY);
+
+ #endif // __ANDROID_TREBLE__
+
+ for (int tries = 0; !getStub && (vintfHwbinder || (vintfLegacy && tries == 0)); tries++) {
+ Return<sp<::android::hidl::base::V1_0::IBase>> ret =
+ sm->get(IDevice::descriptor, serviceName);
+ if (!ret.isOk()) {
+ ALOGE("IDevice: defaultServiceManager()->get returns %s", ret.description().c_str());
+ break;
+ }
+ sp<::android::hidl::base::V1_0::IBase> base = ret;
+ if (base == nullptr) {
+ if (tries > 0) {
+ ALOGW("IDevice: found null hwbinder interface");
+ }break;
+ }
+ Return<sp<IDevice>> castRet = IDevice::castFrom(base, true /* emitError */);
+ if (!castRet.isOk()) {
+ if (castRet.isDeadObject()) {
+ ALOGW("IDevice: found dead hwbinder service");
+ break;
+ } else {
+ ALOGW("IDevice: cannot call into hwbinder service: %s; No permission? Check for selinux denials.", castRet.description().c_str());
+ break;
+ }
+ }
+ iface = castRet;
+ if (iface == nullptr) {
+ ALOGW("IDevice: received incompatible service; bug in hwservicemanager?");
+ break;
+ }
+ return iface;
+ }
+ if (getStub || vintfPassthru || vintfLegacy) {
+ const sp<::android::hidl::manager::V1_0::IServiceManager> pm = getPassthroughServiceManager();
+ if (pm != nullptr) {
+ Return<sp<::android::hidl::base::V1_0::IBase>> ret =
+ pm->get(IDevice::descriptor, serviceName);
+ if (ret.isOk()) {
+ sp<::android::hidl::base::V1_0::IBase> baseInterface = ret;
+ if (baseInterface != nullptr) {
+ iface = IDevice::castFrom(baseInterface);
+ if (!getStub || trebleTestingOverride) {
+ iface = new BsDevice(iface);
+ }
+ }
+ }
+ }
+ }
+ return iface;
+}
+
+// static
+::android::sp<IDevice> IDevice::getService(const std::string &serviceName, const bool getStub) {
+ using ::android::hardware::defaultServiceManager;
+ using ::android::hardware::details::waitForHwService;
+ using ::android::hardware::getPassthroughServiceManager;
+ using ::android::hardware::Return;
+ using ::android::sp;
+ using Transport = ::android::hidl::manager::V1_0::IServiceManager::Transport;
+
+ sp<IDevice> iface = nullptr;
+
+ const sp<::android::hidl::manager::V1_0::IServiceManager> sm = defaultServiceManager();
+ if (sm == nullptr) {
+ ALOGE("getService: defaultServiceManager() is null");
+ return nullptr;
+ }
+
+ Return<Transport> transportRet = sm->getTransport(IDevice::descriptor, serviceName);
+
+ if (!transportRet.isOk()) {
+ ALOGE("getService: defaultServiceManager()->getTransport returns %s", transportRet.description().c_str());
+ return nullptr;
+ }
+ Transport transport = transportRet;
+ const bool vintfHwbinder = (transport == Transport::HWBINDER);
+ const bool vintfPassthru = (transport == Transport::PASSTHROUGH);
+
+ #ifdef __ANDROID_TREBLE__
+
+ #ifdef __ANDROID_DEBUGGABLE__
+ const char* env = std::getenv("TREBLE_TESTING_OVERRIDE");
+ const bool trebleTestingOverride = env && !strcmp(env, "true");
+ const bool vintfLegacy = (transport == Transport::EMPTY) && trebleTestingOverride;
+ #else // __ANDROID_TREBLE__ but not __ANDROID_DEBUGGABLE__
+ const bool trebleTestingOverride = false;
+ const bool vintfLegacy = false;
+ #endif // __ANDROID_DEBUGGABLE__
+
+ #else // not __ANDROID_TREBLE__
+ const char* env = std::getenv("TREBLE_TESTING_OVERRIDE");
+ const bool trebleTestingOverride = env && !strcmp(env, "true");
+ const bool vintfLegacy = (transport == Transport::EMPTY);
+
+ #endif // __ANDROID_TREBLE__
+
+ for (int tries = 0; !getStub && (vintfHwbinder || (vintfLegacy && tries == 0)); tries++) {
+ if (tries > 1) {
+ ALOGI("getService: Will do try %d for %s/%s in 1s...", tries, IDevice::descriptor, serviceName.c_str());
+ sleep(1);
+ }
+ if (vintfHwbinder && tries > 0) {
+ waitForHwService(IDevice::descriptor, serviceName);
+ }
+ Return<sp<::android::hidl::base::V1_0::IBase>> ret =
+ sm->get(IDevice::descriptor, serviceName);
+ if (!ret.isOk()) {
+ ALOGE("IDevice: defaultServiceManager()->get returns %s", ret.description().c_str());
+ break;
+ }
+ sp<::android::hidl::base::V1_0::IBase> base = ret;
+ if (base == nullptr) {
+ if (tries > 0) {
+ ALOGW("IDevice: found null hwbinder interface");
+ }continue;
+ }
+ Return<sp<IDevice>> castRet = IDevice::castFrom(base, true /* emitError */);
+ if (!castRet.isOk()) {
+ if (castRet.isDeadObject()) {
+ ALOGW("IDevice: found dead hwbinder service");
+ continue;
+ } else {
+ ALOGW("IDevice: cannot call into hwbinder service: %s; No permission? Check for selinux denials.", castRet.description().c_str());
+ break;
+ }
+ }
+ iface = castRet;
+ if (iface == nullptr) {
+ ALOGW("IDevice: received incompatible service; bug in hwservicemanager?");
+ break;
+ }
+ return iface;
+ }
+ if (getStub || vintfPassthru || vintfLegacy) {
+ const sp<::android::hidl::manager::V1_0::IServiceManager> pm = getPassthroughServiceManager();
+ if (pm != nullptr) {
+ Return<sp<::android::hidl::base::V1_0::IBase>> ret =
+ pm->get(IDevice::descriptor, serviceName);
+ if (ret.isOk()) {
+ sp<::android::hidl::base::V1_0::IBase> baseInterface = ret;
+ if (baseInterface != nullptr) {
+ iface = IDevice::castFrom(baseInterface);
+ if (!getStub || trebleTestingOverride) {
+ iface = new BsDevice(iface);
+ }
+ }
+ }
+ }
+ }
+ return iface;
+}
+
+::android::status_t IDevice::registerAsService(const std::string &serviceName) {
+ ::android::hardware::details::onRegistration("android.hardware.neuralnetworks@1.1", "IDevice", serviceName);
+
+ const ::android::sp<::android::hidl::manager::V1_0::IServiceManager> sm
+ = ::android::hardware::defaultServiceManager();
+ if (sm == nullptr) {
+ return ::android::INVALID_OPERATION;
+ }
+ ::android::hardware::Return<bool> ret = sm->add(serviceName.c_str(), this);
+ return ret.isOk() && ret ? ::android::OK : ::android::UNKNOWN_ERROR;
+}
+
+bool IDevice::registerForNotifications(
+ const std::string &serviceName,
+ const ::android::sp<::android::hidl::manager::V1_0::IServiceNotification> ¬ification) {
+ const ::android::sp<::android::hidl::manager::V1_0::IServiceManager> sm
+ = ::android::hardware::defaultServiceManager();
+ if (sm == nullptr) {
+ return false;
+ }
+ ::android::hardware::Return<bool> success =
+ sm->registerForNotifications("android.hardware.neuralnetworks@1.1::IDevice",
+ serviceName, notification);
+ return success.isOk() && success;
+}
+
+static_assert(sizeof(::android::hardware::MQDescriptor<char, ::android::hardware::kSynchronizedReadWrite>) == 32, "wrong size");
+static_assert(sizeof(::android::hardware::hidl_handle) == 16, "wrong size");
+static_assert(sizeof(::android::hardware::hidl_memory) == 40, "wrong size");
+static_assert(sizeof(::android::hardware::hidl_string) == 16, "wrong size");
+static_assert(sizeof(::android::hardware::hidl_vec<char>) == 16, "wrong size");
+
+} // namespace V1_1
+} // namespace neuralnetworks
+} // namespace hardware
+} // namespace android
--- /dev/null
+#define LOG_TAG "android.hardware.neuralnetworks@1.1::types"
+
+#include <android/log.h>
+#include <cutils/trace.h>
+#include <hidl/HidlTransportSupport.h>
+
+#include <android/hardware/neuralnetworks/1.1/types.h>
+#include <android/hardware/neuralnetworks/1.1/hwtypes.h>
+
+namespace android {
+namespace hardware {
+namespace neuralnetworks {
+namespace V1_1 {
+
+template<>
+std::string toString<OperationType>(int32_t o) {
+ using ::android::hardware::details::toHexString;
+ std::string os;
+ int32_t flipped = 0;
+ bool first = true;
+ if ((o & OperationType::BATCH_TO_SPACE_ND) == static_cast<int32_t>(OperationType::BATCH_TO_SPACE_ND)) {
+ os += (first ? "" : " | ");
+ os += "BATCH_TO_SPACE_ND";
+ first = false;
+ flipped |= OperationType::BATCH_TO_SPACE_ND;
+ }
+ if ((o & OperationType::DIV) == static_cast<int32_t>(OperationType::DIV)) {
+ os += (first ? "" : " | ");
+ os += "DIV";
+ first = false;
+ flipped |= OperationType::DIV;
+ }
+ if ((o & OperationType::MEAN) == static_cast<int32_t>(OperationType::MEAN)) {
+ os += (first ? "" : " | ");
+ os += "MEAN";
+ first = false;
+ flipped |= OperationType::MEAN;
+ }
+ if ((o & OperationType::PAD) == static_cast<int32_t>(OperationType::PAD)) {
+ os += (first ? "" : " | ");
+ os += "PAD";
+ first = false;
+ flipped |= OperationType::PAD;
+ }
+ if ((o & OperationType::SPACE_TO_BATCH_ND) == static_cast<int32_t>(OperationType::SPACE_TO_BATCH_ND)) {
+ os += (first ? "" : " | ");
+ os += "SPACE_TO_BATCH_ND";
+ first = false;
+ flipped |= OperationType::SPACE_TO_BATCH_ND;
+ }
+ if ((o & OperationType::SQUEEZE) == static_cast<int32_t>(OperationType::SQUEEZE)) {
+ os += (first ? "" : " | ");
+ os += "SQUEEZE";
+ first = false;
+ flipped |= OperationType::SQUEEZE;
+ }
+ if ((o & OperationType::STRIDED_SLICE) == static_cast<int32_t>(OperationType::STRIDED_SLICE)) {
+ os += (first ? "" : " | ");
+ os += "STRIDED_SLICE";
+ first = false;
+ flipped |= OperationType::STRIDED_SLICE;
+ }
+ if ((o & OperationType::SUB) == static_cast<int32_t>(OperationType::SUB)) {
+ os += (first ? "" : " | ");
+ os += "SUB";
+ first = false;
+ flipped |= OperationType::SUB;
+ }
+ if ((o & OperationType::TRANSPOSE) == static_cast<int32_t>(OperationType::TRANSPOSE)) {
+ os += (first ? "" : " | ");
+ os += "TRANSPOSE";
+ first = false;
+ flipped |= OperationType::TRANSPOSE;
+ }
+ if (o != flipped) {
+ os += (first ? "" : " | ");
+ os += toHexString(o & (~flipped));
+ }os += " (";
+ os += toHexString(o);
+ os += ")";
+ return os;
+}
+
+std::string toString(OperationType o) {
+ using ::android::hardware::details::toHexString;
+ if (o == OperationType::BATCH_TO_SPACE_ND) {
+ return "BATCH_TO_SPACE_ND";
+ }
+ if (o == OperationType::DIV) {
+ return "DIV";
+ }
+ if (o == OperationType::MEAN) {
+ return "MEAN";
+ }
+ if (o == OperationType::PAD) {
+ return "PAD";
+ }
+ if (o == OperationType::SPACE_TO_BATCH_ND) {
+ return "SPACE_TO_BATCH_ND";
+ }
+ if (o == OperationType::SQUEEZE) {
+ return "SQUEEZE";
+ }
+ if (o == OperationType::STRIDED_SLICE) {
+ return "STRIDED_SLICE";
+ }
+ if (o == OperationType::SUB) {
+ return "SUB";
+ }
+ if (o == OperationType::TRANSPOSE) {
+ return "TRANSPOSE";
+ }
+ std::string os;
+ os += toHexString(static_cast<int32_t>(o));
+ return os;
+}
+
+std::string toString(const Capabilities& o) {
+ using ::android::hardware::toString;
+ std::string os;
+ os += "{";
+ os += ".float32Performance = ";
+ os += ::android::hardware::neuralnetworks::V1_0::toString(o.float32Performance);
+ os += ", .quantized8Performance = ";
+ os += ::android::hardware::neuralnetworks::V1_0::toString(o.quantized8Performance);
+ os += ", .relaxedFloat32toFloat16Performance = ";
+ os += ::android::hardware::neuralnetworks::V1_0::toString(o.relaxedFloat32toFloat16Performance);
+ os += "}"; return os;
+}
+
+bool operator==(const Capabilities& lhs, const Capabilities& rhs) {
+ if (lhs.float32Performance != rhs.float32Performance) {
+ return false;
+ }
+ if (lhs.quantized8Performance != rhs.quantized8Performance) {
+ return false;
+ }
+ if (lhs.relaxedFloat32toFloat16Performance != rhs.relaxedFloat32toFloat16Performance) {
+ return false;
+ }
+ return true;
+}
+
+bool operator!=(const Capabilities& lhs,const Capabilities& rhs){
+ return !(lhs == rhs);
+}
+
+::android::status_t readEmbeddedFromParcel(
+ const Operation &obj,
+ const ::android::hardware::Parcel &parcel,
+ size_t parentHandle,
+ size_t parentOffset) {
+ ::android::status_t _hidl_err = ::android::OK;
+
+ size_t _hidl_inputs_child;
+
+ _hidl_err = ::android::hardware::readEmbeddedFromParcel(
+ const_cast<::android::hardware::hidl_vec<uint32_t> &>(obj.inputs),
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Operation, inputs), &_hidl_inputs_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ size_t _hidl_outputs_child;
+
+ _hidl_err = ::android::hardware::readEmbeddedFromParcel(
+ const_cast<::android::hardware::hidl_vec<uint32_t> &>(obj.outputs),
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Operation, outputs), &_hidl_outputs_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ return _hidl_err;
+}
+
+::android::status_t writeEmbeddedToParcel(
+ const Operation &obj,
+ ::android::hardware::Parcel *parcel,
+ size_t parentHandle,
+ size_t parentOffset) {
+ ::android::status_t _hidl_err = ::android::OK;
+
+ size_t _hidl_inputs_child;
+
+ _hidl_err = ::android::hardware::writeEmbeddedToParcel(
+ obj.inputs,
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Operation, inputs), &_hidl_inputs_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ size_t _hidl_outputs_child;
+
+ _hidl_err = ::android::hardware::writeEmbeddedToParcel(
+ obj.outputs,
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Operation, outputs), &_hidl_outputs_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ return _hidl_err;
+}
+
+std::string toString(const Operation& o) {
+ using ::android::hardware::toString;
+ std::string os;
+ os += "{";
+ os += ".type = ";
+ os += toString(o.type);
+ os += ", .inputs = ";
+ os += ::android::hardware::toString(o.inputs);
+ os += ", .outputs = ";
+ os += ::android::hardware::toString(o.outputs);
+ os += "}"; return os;
+}
+
+bool operator==(const Operation& lhs, const Operation& rhs) {
+ if (lhs.type != rhs.type) {
+ return false;
+ }
+ if (lhs.inputs != rhs.inputs) {
+ return false;
+ }
+ if (lhs.outputs != rhs.outputs) {
+ return false;
+ }
+ return true;
+}
+
+bool operator!=(const Operation& lhs,const Operation& rhs){
+ return !(lhs == rhs);
+}
+
+::android::status_t readEmbeddedFromParcel(
+ const Model &obj,
+ const ::android::hardware::Parcel &parcel,
+ size_t parentHandle,
+ size_t parentOffset) {
+ ::android::status_t _hidl_err = ::android::OK;
+
+ size_t _hidl_operands_child;
+
+ _hidl_err = ::android::hardware::readEmbeddedFromParcel(
+ const_cast<::android::hardware::hidl_vec<::android::hardware::neuralnetworks::V1_0::Operand> &>(obj.operands),
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Model, operands), &_hidl_operands_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ for (size_t _hidl_index_0 = 0; _hidl_index_0 < obj.operands.size(); ++_hidl_index_0) {
+ _hidl_err = readEmbeddedFromParcel(
+ const_cast<::android::hardware::neuralnetworks::V1_0::Operand &>(obj.operands[_hidl_index_0]),
+ parcel,
+ _hidl_operands_child,
+ _hidl_index_0 * sizeof(::android::hardware::neuralnetworks::V1_0::Operand));
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ }
+
+ size_t _hidl_operations_child;
+
+ _hidl_err = ::android::hardware::readEmbeddedFromParcel(
+ const_cast<::android::hardware::hidl_vec<Operation> &>(obj.operations),
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Model, operations), &_hidl_operations_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ for (size_t _hidl_index_0 = 0; _hidl_index_0 < obj.operations.size(); ++_hidl_index_0) {
+ _hidl_err = readEmbeddedFromParcel(
+ const_cast<Operation &>(obj.operations[_hidl_index_0]),
+ parcel,
+ _hidl_operations_child,
+ _hidl_index_0 * sizeof(Operation));
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ }
+
+ size_t _hidl_inputIndexes_child;
+
+ _hidl_err = ::android::hardware::readEmbeddedFromParcel(
+ const_cast<::android::hardware::hidl_vec<uint32_t> &>(obj.inputIndexes),
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Model, inputIndexes), &_hidl_inputIndexes_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ size_t _hidl_outputIndexes_child;
+
+ _hidl_err = ::android::hardware::readEmbeddedFromParcel(
+ const_cast<::android::hardware::hidl_vec<uint32_t> &>(obj.outputIndexes),
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Model, outputIndexes), &_hidl_outputIndexes_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ size_t _hidl_operandValues_child;
+
+ _hidl_err = ::android::hardware::readEmbeddedFromParcel(
+ const_cast<::android::hardware::hidl_vec<uint8_t> &>(obj.operandValues),
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Model, operandValues), &_hidl_operandValues_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ size_t _hidl_pools_child;
+
+ _hidl_err = ::android::hardware::readEmbeddedFromParcel(
+ const_cast<::android::hardware::hidl_vec<::android::hardware::hidl_memory> &>(obj.pools),
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Model, pools), &_hidl_pools_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ for (size_t _hidl_index_0 = 0; _hidl_index_0 < obj.pools.size(); ++_hidl_index_0) {
+ _hidl_err = ::android::hardware::readEmbeddedFromParcel(
+ const_cast<::android::hardware::hidl_memory &>(obj.pools[_hidl_index_0]),
+ parcel,
+ _hidl_pools_child,
+ _hidl_index_0 * sizeof(::android::hardware::hidl_memory));
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ }
+
+ return _hidl_err;
+}
+
+::android::status_t writeEmbeddedToParcel(
+ const Model &obj,
+ ::android::hardware::Parcel *parcel,
+ size_t parentHandle,
+ size_t parentOffset) {
+ ::android::status_t _hidl_err = ::android::OK;
+
+ size_t _hidl_operands_child;
+
+ _hidl_err = ::android::hardware::writeEmbeddedToParcel(
+ obj.operands,
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Model, operands), &_hidl_operands_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ for (size_t _hidl_index_0 = 0; _hidl_index_0 < obj.operands.size(); ++_hidl_index_0) {
+ _hidl_err = writeEmbeddedToParcel(
+ obj.operands[_hidl_index_0],
+ parcel,
+ _hidl_operands_child,
+ _hidl_index_0 * sizeof(::android::hardware::neuralnetworks::V1_0::Operand));
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ }
+
+ size_t _hidl_operations_child;
+
+ _hidl_err = ::android::hardware::writeEmbeddedToParcel(
+ obj.operations,
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Model, operations), &_hidl_operations_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ for (size_t _hidl_index_0 = 0; _hidl_index_0 < obj.operations.size(); ++_hidl_index_0) {
+ _hidl_err = writeEmbeddedToParcel(
+ obj.operations[_hidl_index_0],
+ parcel,
+ _hidl_operations_child,
+ _hidl_index_0 * sizeof(Operation));
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ }
+
+ size_t _hidl_inputIndexes_child;
+
+ _hidl_err = ::android::hardware::writeEmbeddedToParcel(
+ obj.inputIndexes,
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Model, inputIndexes), &_hidl_inputIndexes_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ size_t _hidl_outputIndexes_child;
+
+ _hidl_err = ::android::hardware::writeEmbeddedToParcel(
+ obj.outputIndexes,
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Model, outputIndexes), &_hidl_outputIndexes_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ size_t _hidl_operandValues_child;
+
+ _hidl_err = ::android::hardware::writeEmbeddedToParcel(
+ obj.operandValues,
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Model, operandValues), &_hidl_operandValues_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ size_t _hidl_pools_child;
+
+ _hidl_err = ::android::hardware::writeEmbeddedToParcel(
+ obj.pools,
+ parcel,
+ parentHandle,
+ parentOffset + offsetof(Model, pools), &_hidl_pools_child);
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ for (size_t _hidl_index_0 = 0; _hidl_index_0 < obj.pools.size(); ++_hidl_index_0) {
+ _hidl_err = ::android::hardware::writeEmbeddedToParcel(
+ obj.pools[_hidl_index_0],
+ parcel,
+ _hidl_pools_child,
+ _hidl_index_0 * sizeof(::android::hardware::hidl_memory));
+
+ if (_hidl_err != ::android::OK) { return _hidl_err; }
+
+ }
+
+ return _hidl_err;
+}
+
+std::string toString(const Model& o) {
+ using ::android::hardware::toString;
+ std::string os;
+ os += "{";
+ os += ".operands = ";
+ os += ::android::hardware::toString(o.operands);
+ os += ", .operations = ";
+ os += ::android::hardware::toString(o.operations);
+ os += ", .inputIndexes = ";
+ os += ::android::hardware::toString(o.inputIndexes);
+ os += ", .outputIndexes = ";
+ os += ::android::hardware::toString(o.outputIndexes);
+ os += ", .operandValues = ";
+ os += ::android::hardware::toString(o.operandValues);
+ os += ", .pools = ";
+ os += ::android::hardware::toString(o.pools);
+ os += ", .relaxComputationFloat32toFloat16 = ";
+ os += ::android::hardware::toString(o.relaxComputationFloat32toFloat16);
+ os += "}"; return os;
+}
+
+// operator== and operator!= are not generated for Model
+static_assert(sizeof(::android::hardware::MQDescriptor<char, ::android::hardware::kSynchronizedReadWrite>) == 32, "wrong size");
+static_assert(sizeof(::android::hardware::hidl_handle) == 16, "wrong size");
+static_assert(sizeof(::android::hardware::hidl_memory) == 40, "wrong size");
+static_assert(sizeof(::android::hardware::hidl_string) == 16, "wrong size");
+static_assert(sizeof(::android::hardware::hidl_vec<char>) == 16, "wrong size");
+
+} // namespace V1_1
+} // namespace neuralnetworks
+} // namespace hardware
+} // namespace android
--- /dev/null
+#ifndef HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_BNHWDEVICE_H
+#define HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_BNHWDEVICE_H
+
+#include <android/hardware/neuralnetworks/1.1/IHwDevice.h>
+
+namespace android {
+namespace hardware {
+namespace neuralnetworks {
+namespace V1_1 {
+
+struct BnHwDevice : public ::android::hidl::base::V1_0::BnHwBase {
+ explicit BnHwDevice(const ::android::sp<IDevice> &_hidl_impl);
+ explicit BnHwDevice(const ::android::sp<IDevice> &_hidl_impl, const std::string& HidlInstrumentor_package, const std::string& HidlInstrumentor_interface);
+
+ virtual ~BnHwDevice();
+
+ ::android::status_t onTransact(
+ uint32_t _hidl_code,
+ const ::android::hardware::Parcel &_hidl_data,
+ ::android::hardware::Parcel *_hidl_reply,
+ uint32_t _hidl_flags = 0,
+ TransactCallback _hidl_cb = nullptr) override;
+
+
+ typedef IDevice Pure;
+
+ ::android::sp<IDevice> getImpl() { return _hidl_mImpl; };
+ // Methods from IDevice follow.
+ static ::android::status_t _hidl_getCapabilities_1_1(
+ ::android::hidl::base::V1_0::BnHwBase* _hidl_this,
+ const ::android::hardware::Parcel &_hidl_data,
+ ::android::hardware::Parcel *_hidl_reply,
+ TransactCallback _hidl_cb);
+
+
+ static ::android::status_t _hidl_getSupportedOperations_1_1(
+ ::android::hidl::base::V1_0::BnHwBase* _hidl_this,
+ const ::android::hardware::Parcel &_hidl_data,
+ ::android::hardware::Parcel *_hidl_reply,
+ TransactCallback _hidl_cb);
+
+
+ static ::android::status_t _hidl_prepareModel_1_1(
+ ::android::hidl::base::V1_0::BnHwBase* _hidl_this,
+ const ::android::hardware::Parcel &_hidl_data,
+ ::android::hardware::Parcel *_hidl_reply,
+ TransactCallback _hidl_cb);
+
+
+
+private:
+ // Methods from ::android::hardware::neuralnetworks::V1_0::IDevice follow.
+
+ // Methods from IDevice follow.
+
+ // Methods from ::android::hidl::base::V1_0::IBase follow.
+ ::android::hardware::Return<void> ping();
+ using getDebugInfo_cb = ::android::hidl::base::V1_0::IBase::getDebugInfo_cb;
+ ::android::hardware::Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb);
+
+ ::android::sp<IDevice> _hidl_mImpl;
+};
+
+} // namespace V1_1
+} // namespace neuralnetworks
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_BNHWDEVICE_H
--- /dev/null
+#ifndef HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_BPHWDEVICE_H
+#define HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_BPHWDEVICE_H
+
+#include <hidl/HidlTransportSupport.h>
+
+#include <android/hardware/neuralnetworks/1.1/IHwDevice.h>
+
+namespace android {
+namespace hardware {
+namespace neuralnetworks {
+namespace V1_1 {
+
+struct BpHwDevice : public ::android::hardware::BpInterface<IDevice>, public ::android::hardware::details::HidlInstrumentor {
+ explicit BpHwDevice(const ::android::sp<::android::hardware::IBinder> &_hidl_impl);
+
+ typedef IDevice Pure;
+
+ virtual bool isRemote() const override { return true; }
+
+ // Methods from IDevice follow.
+ static ::android::hardware::Return<void> _hidl_getCapabilities_1_1(::android::hardware::IInterface* _hidl_this, ::android::hardware::details::HidlInstrumentor *_hidl_this_instrumentor, getCapabilities_1_1_cb _hidl_cb);
+ static ::android::hardware::Return<void> _hidl_getSupportedOperations_1_1(::android::hardware::IInterface* _hidl_this, ::android::hardware::details::HidlInstrumentor *_hidl_this_instrumentor, const Model& model, getSupportedOperations_1_1_cb _hidl_cb);
+ static ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> _hidl_prepareModel_1_1(::android::hardware::IInterface* _hidl_this, ::android::hardware::details::HidlInstrumentor *_hidl_this_instrumentor, const Model& model, const ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>& callback);
+
+ // Methods from ::android::hardware::neuralnetworks::V1_0::IDevice follow.
+ ::android::hardware::Return<void> getCapabilities(getCapabilities_cb _hidl_cb) override;
+ ::android::hardware::Return<void> getSupportedOperations(const ::android::hardware::neuralnetworks::V1_0::Model& model, getSupportedOperations_cb _hidl_cb) override;
+ ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> prepareModel(const ::android::hardware::neuralnetworks::V1_0::Model& model, const ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>& callback) override;
+ ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::DeviceStatus> getStatus() override;
+
+ // Methods from IDevice follow.
+ ::android::hardware::Return<void> getCapabilities_1_1(getCapabilities_1_1_cb _hidl_cb) override;
+ ::android::hardware::Return<void> getSupportedOperations_1_1(const Model& model, getSupportedOperations_1_1_cb _hidl_cb) override;
+ ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> prepareModel_1_1(const Model& model, const ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>& callback) override;
+
+ // Methods from ::android::hidl::base::V1_0::IBase follow.
+ ::android::hardware::Return<void> interfaceChain(interfaceChain_cb _hidl_cb) override;
+ ::android::hardware::Return<void> debug(const ::android::hardware::hidl_handle& fd, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& options) override;
+ ::android::hardware::Return<void> interfaceDescriptor(interfaceDescriptor_cb _hidl_cb) override;
+ ::android::hardware::Return<void> getHashChain(getHashChain_cb _hidl_cb) override;
+ ::android::hardware::Return<void> setHALInstrumentation() override;
+ ::android::hardware::Return<bool> linkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient, uint64_t cookie) override;
+ ::android::hardware::Return<void> ping() override;
+ ::android::hardware::Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb) override;
+ ::android::hardware::Return<void> notifySyspropsChanged() override;
+ ::android::hardware::Return<bool> unlinkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient) override;
+
+private:
+ std::mutex _hidl_mMutex;
+ std::vector<::android::sp<::android::hardware::hidl_binder_death_recipient>> _hidl_mDeathRecipients;
+};
+
+} // namespace V1_1
+} // namespace neuralnetworks
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_BPHWDEVICE_H
--- /dev/null
+#ifndef HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_BSDEVICE_H
+#define HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_BSDEVICE_H
+
+#include <android-base/macros.h>
+#include <cutils/trace.h>
+#include <future>
+#include <android/hardware/neuralnetworks/1.1/IDevice.h>
+
+#include <hidl/HidlPassthroughSupport.h>
+#include <hidl/TaskRunner.h>
+namespace android {
+namespace hardware {
+namespace neuralnetworks {
+namespace V1_1 {
+
+struct BsDevice : IDevice, ::android::hardware::details::HidlInstrumentor {
+ explicit BsDevice(const ::android::sp<IDevice> impl);
+
+ typedef IDevice Pure;
+
+ // Methods from ::android::hardware::neuralnetworks::V1_0::IDevice follow.
+ ::android::hardware::Return<void> getCapabilities(getCapabilities_cb _hidl_cb) {
+ if (_hidl_cb == nullptr) {
+ return ::android::hardware::Status::fromExceptionCode(
+ ::android::hardware::Status::EX_ILLEGAL_ARGUMENT,
+ "Null synchronous callback passed.");
+ }
+
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::getCapabilities::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "getCapabilities", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->getCapabilities([&](const auto &_hidl_out_status, const auto &_hidl_out_capabilities) {
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_status);
+ _hidl_args.push_back((void *)&_hidl_out_capabilities);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "getCapabilities", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_cb(_hidl_out_status, _hidl_out_capabilities);
+ });
+
+ return _hidl_return;
+ }
+ ::android::hardware::Return<void> getSupportedOperations(const ::android::hardware::neuralnetworks::V1_0::Model& model, getSupportedOperations_cb _hidl_cb) {
+ if (_hidl_cb == nullptr) {
+ return ::android::hardware::Status::fromExceptionCode(
+ ::android::hardware::Status::EX_ILLEGAL_ARGUMENT,
+ "Null synchronous callback passed.");
+ }
+
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::getSupportedOperations::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&model);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "getSupportedOperations", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->getSupportedOperations(model, [&](const auto &_hidl_out_status, const auto &_hidl_out_supportedOperations) {
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_status);
+ _hidl_args.push_back((void *)&_hidl_out_supportedOperations);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "getSupportedOperations", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_cb(_hidl_out_status, _hidl_out_supportedOperations);
+ });
+
+ return _hidl_return;
+ }
+ ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> prepareModel(const ::android::hardware::neuralnetworks::V1_0::Model& model, const ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>& callback) {
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::prepareModel::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&model);
+ _hidl_args.push_back((void *)&callback);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "prepareModel", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback> _hidl_wrapped_callback;
+ if (callback != nullptr && !callback->isRemote()) {
+ _hidl_wrapped_callback = ::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback::castFrom(::android::hardware::details::wrapPassthrough<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>(callback));
+ if (_hidl_wrapped_callback == nullptr) {
+ return ::android::hardware::Status::fromExceptionCode(
+ ::android::hardware::Status::EX_TRANSACTION_FAILED,
+ "Cannot wrap passthrough interface.");
+ }
+ } else {
+ _hidl_wrapped_callback = callback;
+ }
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->prepareModel(model, _hidl_wrapped_callback);
+
+ #ifdef __ANDROID_DEBUGGABLE__
+ ::android::hardware::neuralnetworks::V1_0::ErrorStatus _hidl_out_status = _hidl_return;
+ #endif // __ANDROID_DEBUGGABLE__
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_status);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "prepareModel", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ return _hidl_return;
+ }
+ ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::DeviceStatus> getStatus() {
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::getStatus::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "getStatus", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->getStatus();
+
+ #ifdef __ANDROID_DEBUGGABLE__
+ ::android::hardware::neuralnetworks::V1_0::DeviceStatus _hidl_out_status = _hidl_return;
+ #endif // __ANDROID_DEBUGGABLE__
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_status);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "getStatus", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ return _hidl_return;
+ }
+
+ // Methods from IDevice follow.
+ ::android::hardware::Return<void> getCapabilities_1_1(getCapabilities_1_1_cb _hidl_cb) {
+ if (_hidl_cb == nullptr) {
+ return ::android::hardware::Status::fromExceptionCode(
+ ::android::hardware::Status::EX_ILLEGAL_ARGUMENT,
+ "Null synchronous callback passed.");
+ }
+
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::getCapabilities_1_1::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "getCapabilities_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->getCapabilities_1_1([&](const auto &_hidl_out_status, const auto &_hidl_out_capabilities) {
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_status);
+ _hidl_args.push_back((void *)&_hidl_out_capabilities);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "getCapabilities_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_cb(_hidl_out_status, _hidl_out_capabilities);
+ });
+
+ return _hidl_return;
+ }
+ ::android::hardware::Return<void> getSupportedOperations_1_1(const Model& model, getSupportedOperations_1_1_cb _hidl_cb) {
+ if (_hidl_cb == nullptr) {
+ return ::android::hardware::Status::fromExceptionCode(
+ ::android::hardware::Status::EX_ILLEGAL_ARGUMENT,
+ "Null synchronous callback passed.");
+ }
+
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::getSupportedOperations_1_1::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&model);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "getSupportedOperations_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->getSupportedOperations_1_1(model, [&](const auto &_hidl_out_status, const auto &_hidl_out_supportedOperations) {
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_status);
+ _hidl_args.push_back((void *)&_hidl_out_supportedOperations);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "getSupportedOperations_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_cb(_hidl_out_status, _hidl_out_supportedOperations);
+ });
+
+ return _hidl_return;
+ }
+ ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> prepareModel_1_1(const Model& model, const ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>& callback) {
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::prepareModel_1_1::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&model);
+ _hidl_args.push_back((void *)&callback);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "prepareModel_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback> _hidl_wrapped_callback;
+ if (callback != nullptr && !callback->isRemote()) {
+ _hidl_wrapped_callback = ::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback::castFrom(::android::hardware::details::wrapPassthrough<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>(callback));
+ if (_hidl_wrapped_callback == nullptr) {
+ return ::android::hardware::Status::fromExceptionCode(
+ ::android::hardware::Status::EX_TRANSACTION_FAILED,
+ "Cannot wrap passthrough interface.");
+ }
+ } else {
+ _hidl_wrapped_callback = callback;
+ }
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->prepareModel_1_1(model, _hidl_wrapped_callback);
+
+ #ifdef __ANDROID_DEBUGGABLE__
+ ::android::hardware::neuralnetworks::V1_0::ErrorStatus _hidl_out_status = _hidl_return;
+ #endif // __ANDROID_DEBUGGABLE__
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_status);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "prepareModel_1_1", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ return _hidl_return;
+ }
+
+ // Methods from ::android::hidl::base::V1_0::IBase follow.
+ ::android::hardware::Return<void> interfaceChain(interfaceChain_cb _hidl_cb) {
+ if (_hidl_cb == nullptr) {
+ return ::android::hardware::Status::fromExceptionCode(
+ ::android::hardware::Status::EX_ILLEGAL_ARGUMENT,
+ "Null synchronous callback passed.");
+ }
+
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::interfaceChain::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "interfaceChain", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->interfaceChain([&](const auto &_hidl_out_descriptors) {
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_descriptors);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "interfaceChain", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_cb(_hidl_out_descriptors);
+ });
+
+ return _hidl_return;
+ }
+ ::android::hardware::Return<void> debug(const ::android::hardware::hidl_handle& fd, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& options) {
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::debug::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&fd);
+ _hidl_args.push_back((void *)&options);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "debug", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->debug(fd, options);
+
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "debug", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ return _hidl_return;
+ }
+ ::android::hardware::Return<void> interfaceDescriptor(interfaceDescriptor_cb _hidl_cb) {
+ if (_hidl_cb == nullptr) {
+ return ::android::hardware::Status::fromExceptionCode(
+ ::android::hardware::Status::EX_ILLEGAL_ARGUMENT,
+ "Null synchronous callback passed.");
+ }
+
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::interfaceDescriptor::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "interfaceDescriptor", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->interfaceDescriptor([&](const auto &_hidl_out_descriptor) {
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_descriptor);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "interfaceDescriptor", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_cb(_hidl_out_descriptor);
+ });
+
+ return _hidl_return;
+ }
+ ::android::hardware::Return<void> getHashChain(getHashChain_cb _hidl_cb) {
+ if (_hidl_cb == nullptr) {
+ return ::android::hardware::Status::fromExceptionCode(
+ ::android::hardware::Status::EX_ILLEGAL_ARGUMENT,
+ "Null synchronous callback passed.");
+ }
+
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::getHashChain::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "getHashChain", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->getHashChain([&](const auto &_hidl_out_hashchain) {
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_hashchain);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "getHashChain", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_cb(_hidl_out_hashchain);
+ });
+
+ return _hidl_return;
+ }
+ ::android::hardware::Return<void> setHALInstrumentation() {
+ configureInstrumentation();
+ return ::android::hardware::Void();
+ }
+
+ ::android::hardware::Return<bool> linkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient, uint64_t cookie) {
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::linkToDeath::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&recipient);
+ _hidl_args.push_back((void *)&cookie);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "linkToDeath", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->linkToDeath(recipient, cookie);
+
+ #ifdef __ANDROID_DEBUGGABLE__
+ bool _hidl_out_success = _hidl_return;
+ #endif // __ANDROID_DEBUGGABLE__
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_success);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "linkToDeath", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ return _hidl_return;
+ }
+ ::android::hardware::Return<void> ping() {
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::ping::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "ping", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->ping();
+
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "ping", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ return _hidl_return;
+ }
+ ::android::hardware::Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb) {
+ if (_hidl_cb == nullptr) {
+ return ::android::hardware::Status::fromExceptionCode(
+ ::android::hardware::Status::EX_ILLEGAL_ARGUMENT,
+ "Null synchronous callback passed.");
+ }
+
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::getDebugInfo::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "getDebugInfo", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->getDebugInfo([&](const auto &_hidl_out_info) {
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_info);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "getDebugInfo", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ _hidl_cb(_hidl_out_info);
+ });
+
+ return _hidl_return;
+ }
+ ::android::hardware::Return<void> notifySyspropsChanged() {
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::notifySyspropsChanged::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "notifySyspropsChanged", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = addOnewayTask([mImpl = this->mImpl
+ #ifdef __ANDROID_DEBUGGABLE__
+ , mEnableInstrumentation = this->mEnableInstrumentation, mInstrumentationCallbacks = this->mInstrumentationCallbacks
+ #endif // __ANDROID_DEBUGGABLE__
+ ] {
+ mImpl->notifySyspropsChanged();
+
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "notifySyspropsChanged", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ });
+ return _hidl_return;
+ }
+ ::android::hardware::Return<bool> unlinkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient) {
+ atrace_begin(ATRACE_TAG_HAL, "HIDL::IDevice::unlinkToDeath::passthrough");
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&recipient);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_ENTRY, "android.hardware.neuralnetworks", "1.1", "IDevice", "unlinkToDeath", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ auto _hidl_error = ::android::hardware::Void();
+ auto _hidl_return = mImpl->unlinkToDeath(recipient);
+
+ #ifdef __ANDROID_DEBUGGABLE__
+ bool _hidl_out_success = _hidl_return;
+ #endif // __ANDROID_DEBUGGABLE__
+ atrace_end(ATRACE_TAG_HAL);
+ #ifdef __ANDROID_DEBUGGABLE__
+ if (UNLIKELY(mEnableInstrumentation)) {
+ std::vector<void *> _hidl_args;
+ _hidl_args.push_back((void *)&_hidl_out_success);
+ for (const auto &callback: mInstrumentationCallbacks) {
+ callback(InstrumentationEvent::PASSTHROUGH_EXIT, "android.hardware.neuralnetworks", "1.1", "IDevice", "unlinkToDeath", &_hidl_args);
+ }
+ }
+ #endif // __ANDROID_DEBUGGABLE__
+
+ return _hidl_return;
+ }
+
+private:
+ const ::android::sp<IDevice> mImpl;
+ ::android::hardware::details::TaskRunner mOnewayQueue;
+
+ ::android::hardware::Return<void> addOnewayTask(std::function<void(void)>);
+
+};
+
+} // namespace V1_1
+} // namespace neuralnetworks
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_BSDEVICE_H
--- /dev/null
+#ifndef HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_IDEVICE_H
+#define HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_IDEVICE_H
+
+#include <android/hardware/neuralnetworks/1.0/IDevice.h>
+#include <android/hardware/neuralnetworks/1.0/IPreparedModelCallback.h>
+#include <android/hardware/neuralnetworks/1.0/types.h>
+#include <android/hardware/neuralnetworks/1.1/types.h>
+
+#include <android/hidl/manager/1.0/IServiceNotification.h>
+
+#include <hidl/HidlSupport.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+#include <utils/NativeHandle.h>
+#include <utils/misc.h>
+
+namespace android {
+namespace hardware {
+namespace neuralnetworks {
+namespace V1_1 {
+
+struct IDevice : public ::android::hardware::neuralnetworks::V1_0::IDevice {
+ virtual bool isRemote() const override { return false; }
+
+
+ using getCapabilities_cb = std::function<void(::android::hardware::neuralnetworks::V1_0::ErrorStatus status, const ::android::hardware::neuralnetworks::V1_0::Capabilities& capabilities)>;
+ virtual ::android::hardware::Return<void> getCapabilities(getCapabilities_cb _hidl_cb) = 0;
+
+ using getSupportedOperations_cb = std::function<void(::android::hardware::neuralnetworks::V1_0::ErrorStatus status, const ::android::hardware::hidl_vec<bool>& supportedOperations)>;
+ virtual ::android::hardware::Return<void> getSupportedOperations(const ::android::hardware::neuralnetworks::V1_0::Model& model, getSupportedOperations_cb _hidl_cb) = 0;
+
+ virtual ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> prepareModel(const ::android::hardware::neuralnetworks::V1_0::Model& model, const ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>& callback) = 0;
+
+ virtual ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::DeviceStatus> getStatus() = 0;
+
+ using getCapabilities_1_1_cb = std::function<void(::android::hardware::neuralnetworks::V1_0::ErrorStatus status, const Capabilities& capabilities)>;
+ virtual ::android::hardware::Return<void> getCapabilities_1_1(getCapabilities_1_1_cb _hidl_cb) = 0;
+
+ using getSupportedOperations_1_1_cb = std::function<void(::android::hardware::neuralnetworks::V1_0::ErrorStatus status, const ::android::hardware::hidl_vec<bool>& supportedOperations)>;
+ virtual ::android::hardware::Return<void> getSupportedOperations_1_1(const Model& model, getSupportedOperations_1_1_cb _hidl_cb) = 0;
+
+ virtual ::android::hardware::Return<::android::hardware::neuralnetworks::V1_0::ErrorStatus> prepareModel_1_1(const Model& model, const ::android::sp<::android::hardware::neuralnetworks::V1_0::IPreparedModelCallback>& callback) = 0;
+
+ using interfaceChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& descriptors)>;
+ virtual ::android::hardware::Return<void> interfaceChain(interfaceChain_cb _hidl_cb) override;
+
+ virtual ::android::hardware::Return<void> debug(const ::android::hardware::hidl_handle& fd, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& options) override;
+
+ using interfaceDescriptor_cb = std::function<void(const ::android::hardware::hidl_string& descriptor)>;
+ virtual ::android::hardware::Return<void> interfaceDescriptor(interfaceDescriptor_cb _hidl_cb) override;
+
+ using getHashChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_array<uint8_t, 32>>& hashchain)>;
+ virtual ::android::hardware::Return<void> getHashChain(getHashChain_cb _hidl_cb) override;
+
+ virtual ::android::hardware::Return<void> setHALInstrumentation() override;
+
+ virtual ::android::hardware::Return<bool> linkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient, uint64_t cookie) override;
+
+ virtual ::android::hardware::Return<void> ping() override;
+
+ using getDebugInfo_cb = std::function<void(const ::android::hidl::base::V1_0::DebugInfo& info)>;
+ virtual ::android::hardware::Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb) override;
+
+ virtual ::android::hardware::Return<void> notifySyspropsChanged() override;
+
+ virtual ::android::hardware::Return<bool> unlinkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient) override;
+ // cast static functions
+ static ::android::hardware::Return<::android::sp<IDevice>> castFrom(const ::android::sp<IDevice>& parent, bool emitError = false);
+ static ::android::hardware::Return<::android::sp<IDevice>> castFrom(const ::android::sp<::android::hardware::neuralnetworks::V1_0::IDevice>& parent, bool emitError = false);
+ static ::android::hardware::Return<::android::sp<IDevice>> castFrom(const ::android::sp<::android::hidl::base::V1_0::IBase>& parent, bool emitError = false);
+
+ static const char* descriptor;
+
+ static ::android::sp<IDevice> tryGetService(const std::string &serviceName="default", bool getStub=false);
+ static ::android::sp<IDevice> tryGetService(const char serviceName[], bool getStub=false) { std::string str(serviceName ? serviceName : ""); return tryGetService(str, getStub); }
+ static ::android::sp<IDevice> tryGetService(const ::android::hardware::hidl_string& serviceName, bool getStub=false) { std::string str(serviceName.c_str()); return tryGetService(str, getStub); }
+ static ::android::sp<IDevice> tryGetService(bool getStub) { return tryGetService("default", getStub); }
+ static ::android::sp<IDevice> getService(const std::string &serviceName="default", bool getStub=false);
+ static ::android::sp<IDevice> getService(const char serviceName[], bool getStub=false) { std::string str(serviceName ? serviceName : ""); return getService(str, getStub); }
+ static ::android::sp<IDevice> getService(const ::android::hardware::hidl_string& serviceName, bool getStub=false) { std::string str(serviceName.c_str()); return getService(str, getStub); }
+ static ::android::sp<IDevice> getService(bool getStub) { return getService("default", getStub); }
+ __attribute__ ((warn_unused_result))::android::status_t registerAsService(const std::string &serviceName="default");
+ static bool registerForNotifications(
+ const std::string &serviceName,
+ const ::android::sp<::android::hidl::manager::V1_0::IServiceNotification> ¬ification);
+};
+
+std::string toString(const ::android::sp<IDevice>&);
+
+} // namespace V1_1
+} // namespace neuralnetworks
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_IDEVICE_H
--- /dev/null
+#ifndef HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_IHWDEVICE_H
+#define HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_IHWDEVICE_H
+
+#include <android/hardware/neuralnetworks/1.1/IDevice.h>
+
+#include <android/hardware/neuralnetworks/1.0/BnHwDevice.h>
+#include <android/hardware/neuralnetworks/1.0/BpHwDevice.h>
+#include <android/hardware/neuralnetworks/1.0/BnHwPreparedModelCallback.h>
+#include <android/hardware/neuralnetworks/1.0/BpHwPreparedModelCallback.h>
+#include <android/hardware/neuralnetworks/1.0/hwtypes.h>
+#include <android/hardware/neuralnetworks/1.1/hwtypes.h>
+
+#include <hidl/Status.h>
+#include <hwbinder/IBinder.h>
+#include <hwbinder/Parcel.h>
+
+namespace android {
+namespace hardware {
+namespace neuralnetworks {
+namespace V1_1 {
+} // namespace V1_1
+} // namespace neuralnetworks
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_IHWDEVICE_H
--- /dev/null
+#ifndef HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_HWTYPES_H
+#define HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_HWTYPES_H
+
+#include <android/hardware/neuralnetworks/1.1/types.h>
+
+#include <android/hardware/neuralnetworks/1.0/hwtypes.h>
+
+#include <hidl/Status.h>
+#include <hwbinder/IBinder.h>
+#include <hwbinder/Parcel.h>
+
+namespace android {
+namespace hardware {
+namespace neuralnetworks {
+namespace V1_1 {
+::android::status_t readEmbeddedFromParcel(
+ const Operation &obj,
+ const ::android::hardware::Parcel &parcel,
+ size_t parentHandle,
+ size_t parentOffset);
+
+::android::status_t writeEmbeddedToParcel(
+ const Operation &obj,
+ ::android::hardware::Parcel *parcel,
+ size_t parentHandle,
+ size_t parentOffset);
+
+::android::status_t readEmbeddedFromParcel(
+ const Model &obj,
+ const ::android::hardware::Parcel &parcel,
+ size_t parentHandle,
+ size_t parentOffset);
+
+::android::status_t writeEmbeddedToParcel(
+ const Model &obj,
+ ::android::hardware::Parcel *parcel,
+ size_t parentHandle,
+ size_t parentOffset);
+
+} // namespace V1_1
+} // namespace neuralnetworks
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_HWTYPES_H
--- /dev/null
+#ifndef HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_TYPES_H
+#define HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_TYPES_H
+
+#include <android/hardware/neuralnetworks/1.0/types.h>
+
+#include <hidl/HidlSupport.h>
+#include <hidl/MQDescriptor.h>
+#include <utils/NativeHandle.h>
+#include <utils/misc.h>
+
+namespace android {
+namespace hardware {
+namespace neuralnetworks {
+namespace V1_1 {
+
+enum class OperationType : int32_t {
+ ADD = 0,
+ AVERAGE_POOL_2D = 1,
+ CONCATENATION = 2,
+ CONV_2D = 3,
+ DEPTHWISE_CONV_2D = 4,
+ DEPTH_TO_SPACE = 5,
+ DEQUANTIZE = 6,
+ EMBEDDING_LOOKUP = 7,
+ FLOOR = 8,
+ FULLY_CONNECTED = 9,
+ HASHTABLE_LOOKUP = 10,
+ L2_NORMALIZATION = 11,
+ L2_POOL_2D = 12,
+ LOCAL_RESPONSE_NORMALIZATION = 13,
+ LOGISTIC = 14,
+ LSH_PROJECTION = 15,
+ LSTM = 16,
+ MAX_POOL_2D = 17,
+ MUL = 18,
+ RELU = 19,
+ RELU1 = 20,
+ RELU6 = 21,
+ RESHAPE = 22,
+ RESIZE_BILINEAR = 23,
+ RNN = 24,
+ SOFTMAX = 25,
+ SPACE_TO_DEPTH = 26,
+ SVDF = 27,
+ TANH = 28,
+ OEM_OPERATION = 10000,
+ BATCH_TO_SPACE_ND = 29,
+ DIV = 30,
+ MEAN = 31,
+ PAD = 32,
+ SPACE_TO_BATCH_ND = 33,
+ SQUEEZE = 34,
+ STRIDED_SLICE = 35,
+ SUB = 36,
+ TRANSPOSE = 37,
+};
+
+struct Capabilities final {
+ ::android::hardware::neuralnetworks::V1_0::PerformanceInfo float32Performance __attribute__ ((aligned(4)));
+ ::android::hardware::neuralnetworks::V1_0::PerformanceInfo quantized8Performance __attribute__ ((aligned(4)));
+ ::android::hardware::neuralnetworks::V1_0::PerformanceInfo relaxedFloat32toFloat16Performance __attribute__ ((aligned(4)));
+};
+
+static_assert(offsetof(Capabilities, float32Performance) == 0, "wrong offset");
+static_assert(offsetof(Capabilities, quantized8Performance) == 8, "wrong offset");
+static_assert(offsetof(Capabilities, relaxedFloat32toFloat16Performance) == 16, "wrong offset");
+static_assert(sizeof(Capabilities) == 24, "wrong size");
+static_assert(__alignof(Capabilities) == 4, "wrong alignment");
+
+struct Operation final {
+ OperationType type __attribute__ ((aligned(4)));
+ ::android::hardware::hidl_vec<uint32_t> inputs __attribute__ ((aligned(8)));
+ ::android::hardware::hidl_vec<uint32_t> outputs __attribute__ ((aligned(8)));
+};
+
+static_assert(offsetof(Operation, type) == 0, "wrong offset");
+static_assert(offsetof(Operation, inputs) == 8, "wrong offset");
+static_assert(offsetof(Operation, outputs) == 24, "wrong offset");
+static_assert(sizeof(Operation) == 40, "wrong size");
+static_assert(__alignof(Operation) == 8, "wrong alignment");
+
+struct Model final {
+ ::android::hardware::hidl_vec<::android::hardware::neuralnetworks::V1_0::Operand> operands __attribute__ ((aligned(8)));
+ ::android::hardware::hidl_vec<Operation> operations __attribute__ ((aligned(8)));
+ ::android::hardware::hidl_vec<uint32_t> inputIndexes __attribute__ ((aligned(8)));
+ ::android::hardware::hidl_vec<uint32_t> outputIndexes __attribute__ ((aligned(8)));
+ ::android::hardware::hidl_vec<uint8_t> operandValues __attribute__ ((aligned(8)));
+ ::android::hardware::hidl_vec<::android::hardware::hidl_memory> pools __attribute__ ((aligned(8)));
+ bool relaxComputationFloat32toFloat16 __attribute__ ((aligned(1)));
+};
+
+static_assert(offsetof(Model, operands) == 0, "wrong offset");
+static_assert(offsetof(Model, operations) == 16, "wrong offset");
+static_assert(offsetof(Model, inputIndexes) == 32, "wrong offset");
+static_assert(offsetof(Model, outputIndexes) == 48, "wrong offset");
+static_assert(offsetof(Model, operandValues) == 64, "wrong offset");
+static_assert(offsetof(Model, pools) == 80, "wrong offset");
+static_assert(offsetof(Model, relaxComputationFloat32toFloat16) == 96, "wrong offset");
+static_assert(sizeof(Model) == 104, "wrong size");
+static_assert(__alignof(Model) == 8, "wrong alignment");
+
+constexpr int32_t operator|(const OperationType lhs, const OperationType rhs) {
+ return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs));
+}
+
+constexpr int32_t operator|(const int32_t lhs, const OperationType rhs) {
+ return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs));
+}
+
+constexpr int32_t operator|(const OperationType lhs, const int32_t rhs) {
+ return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs);
+}
+
+constexpr int32_t operator&(const OperationType lhs, const OperationType rhs) {
+ return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs));
+}
+
+constexpr int32_t operator&(const int32_t lhs, const OperationType rhs) {
+ return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs));
+}
+
+constexpr int32_t operator&(const OperationType lhs, const int32_t rhs) {
+ return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs);
+}
+
+constexpr int32_t &operator|=(int32_t& v, const OperationType e) {
+ v |= static_cast<int32_t>(e);
+ return v;
+}
+
+constexpr int32_t &operator&=(int32_t& v, const OperationType e) {
+ v &= static_cast<int32_t>(e);
+ return v;
+}
+
+template<typename>
+std::string toString(int32_t o);
+template<>
+std::string toString<OperationType>(int32_t o);
+
+std::string toString(OperationType o);
+
+std::string toString(const Capabilities&);
+
+bool operator==(const Capabilities&, const Capabilities&);
+
+bool operator!=(const Capabilities&, const Capabilities&);
+
+std::string toString(const Operation&);
+
+bool operator==(const Operation&, const Operation&);
+
+bool operator!=(const Operation&, const Operation&);
+
+std::string toString(const Model&);
+
+// operator== and operator!= are not generated for Model
+
+
+} // namespace V1_1
+} // namespace neuralnetworks
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_1_TYPES_H