blob: 6bb4560eb2494688da8884c971da04213e9c0028 [file] [log] [blame]
#include <android/binder_parcel_utils.h>
#include <aidl/android/hardware/oemlock/BpOemLock.h>
#include <aidl/android/hardware/oemlock/BnOemLock.h>
#include <aidl/android/hardware/oemlock/IOemLock.h>
namespace aidl {
namespace android {
namespace hardware {
namespace oemlock {
static binder_status_t _aidl_onTransact(AIBinder* _aidl_binder, transaction_code_t _aidl_code, const AParcel* _aidl_in, AParcel* _aidl_out) {
(void)_aidl_in;
(void)_aidl_out;
binder_status_t _aidl_ret_status = STATUS_UNKNOWN_TRANSACTION;
std::shared_ptr<BnOemLock> _aidl_impl = std::static_pointer_cast<BnOemLock>(::ndk::ICInterface::asInterface(_aidl_binder));
switch (_aidl_code) {
case (FIRST_CALL_TRANSACTION + 0 /*getName*/): {
std::string _aidl_return;
::ndk::ScopedAStatus _aidl_status = _aidl_impl->getName(&_aidl_return);
_aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
if (_aidl_ret_status != STATUS_OK) break;
if (!AStatus_isOk(_aidl_status.get())) break;
_aidl_ret_status = ::ndk::AParcel_writeString(_aidl_out, _aidl_return);
if (_aidl_ret_status != STATUS_OK) break;
break;
}
case (FIRST_CALL_TRANSACTION + 1 /*isOemUnlockAllowedByCarrier*/): {
bool _aidl_return;
::ndk::ScopedAStatus _aidl_status = _aidl_impl->isOemUnlockAllowedByCarrier(&_aidl_return);
_aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
if (_aidl_ret_status != STATUS_OK) break;
if (!AStatus_isOk(_aidl_status.get())) break;
_aidl_ret_status = AParcel_writeBool(_aidl_out, _aidl_return);
if (_aidl_ret_status != STATUS_OK) break;
break;
}
case (FIRST_CALL_TRANSACTION + 2 /*isOemUnlockAllowedByDevice*/): {
bool _aidl_return;
::ndk::ScopedAStatus _aidl_status = _aidl_impl->isOemUnlockAllowedByDevice(&_aidl_return);
_aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
if (_aidl_ret_status != STATUS_OK) break;
if (!AStatus_isOk(_aidl_status.get())) break;
_aidl_ret_status = AParcel_writeBool(_aidl_out, _aidl_return);
if (_aidl_ret_status != STATUS_OK) break;
break;
}
case (FIRST_CALL_TRANSACTION + 3 /*setOemUnlockAllowedByCarrier*/): {
bool in_allowed;
std::vector<uint8_t> in_signature;
::aidl::android::hardware::oemlock::OemLockSecureStatus _aidl_return;
_aidl_ret_status = AParcel_readBool(_aidl_in, &in_allowed);
if (_aidl_ret_status != STATUS_OK) break;
_aidl_ret_status = ::ndk::AParcel_readVector(_aidl_in, &in_signature);
if (_aidl_ret_status != STATUS_OK) break;
::ndk::ScopedAStatus _aidl_status = _aidl_impl->setOemUnlockAllowedByCarrier(in_allowed, in_signature, &_aidl_return);
_aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
if (_aidl_ret_status != STATUS_OK) break;
if (!AStatus_isOk(_aidl_status.get())) break;
_aidl_ret_status = AParcel_writeInt32(_aidl_out, static_cast<int32_t>(_aidl_return));
if (_aidl_ret_status != STATUS_OK) break;
break;
}
case (FIRST_CALL_TRANSACTION + 4 /*setOemUnlockAllowedByDevice*/): {
bool in_allowed;
_aidl_ret_status = AParcel_readBool(_aidl_in, &in_allowed);
if (_aidl_ret_status != STATUS_OK) break;
::ndk::ScopedAStatus _aidl_status = _aidl_impl->setOemUnlockAllowedByDevice(in_allowed);
_aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
if (_aidl_ret_status != STATUS_OK) break;
if (!AStatus_isOk(_aidl_status.get())) break;
break;
}
case (FIRST_CALL_TRANSACTION + 16777214 /*getInterfaceVersion*/): {
int32_t _aidl_return;
::ndk::ScopedAStatus _aidl_status = _aidl_impl->getInterfaceVersion(&_aidl_return);
_aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
if (_aidl_ret_status != STATUS_OK) break;
if (!AStatus_isOk(_aidl_status.get())) break;
_aidl_ret_status = AParcel_writeInt32(_aidl_out, _aidl_return);
if (_aidl_ret_status != STATUS_OK) break;
break;
}
case (FIRST_CALL_TRANSACTION + 16777213 /*getInterfaceHash*/): {
std::string _aidl_return;
::ndk::ScopedAStatus _aidl_status = _aidl_impl->getInterfaceHash(&_aidl_return);
_aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
if (_aidl_ret_status != STATUS_OK) break;
if (!AStatus_isOk(_aidl_status.get())) break;
_aidl_ret_status = ::ndk::AParcel_writeString(_aidl_out, _aidl_return);
if (_aidl_ret_status != STATUS_OK) break;
break;
}
}
return _aidl_ret_status;
}
static AIBinder_Class* _g_aidl_clazz = ::ndk::ICInterface::defineClass(IOemLock::descriptor, _aidl_onTransact);
BpOemLock::BpOemLock(const ::ndk::SpAIBinder& binder) : BpCInterface(binder) {}
BpOemLock::~BpOemLock() {}
::ndk::ScopedAStatus BpOemLock::getName(std::string* _aidl_return) {
binder_status_t _aidl_ret_status = STATUS_OK;
::ndk::ScopedAStatus _aidl_status;
::ndk::ScopedAParcel _aidl_in;
::ndk::ScopedAParcel _aidl_out;
_aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AIBinder_transact(
asBinder().get(),
(FIRST_CALL_TRANSACTION + 0 /*getName*/),
_aidl_in.getR(),
_aidl_out.getR(),
0
#ifdef BINDER_STABILITY_SUPPORT
| FLAG_PRIVATE_LOCAL
#endif // BINDER_STABILITY_SUPPORT
);
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IOemLock::getDefaultImpl()) {
_aidl_status = IOemLock::getDefaultImpl()->getName(_aidl_return);
goto _aidl_status_return;
}
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
_aidl_ret_status = ::ndk::AParcel_readString(_aidl_out.get(), _aidl_return);
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_error:
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
_aidl_status_return:
return _aidl_status;
}
::ndk::ScopedAStatus BpOemLock::isOemUnlockAllowedByCarrier(bool* _aidl_return) {
binder_status_t _aidl_ret_status = STATUS_OK;
::ndk::ScopedAStatus _aidl_status;
::ndk::ScopedAParcel _aidl_in;
::ndk::ScopedAParcel _aidl_out;
_aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AIBinder_transact(
asBinder().get(),
(FIRST_CALL_TRANSACTION + 1 /*isOemUnlockAllowedByCarrier*/),
_aidl_in.getR(),
_aidl_out.getR(),
0
#ifdef BINDER_STABILITY_SUPPORT
| FLAG_PRIVATE_LOCAL
#endif // BINDER_STABILITY_SUPPORT
);
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IOemLock::getDefaultImpl()) {
_aidl_status = IOemLock::getDefaultImpl()->isOemUnlockAllowedByCarrier(_aidl_return);
goto _aidl_status_return;
}
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
_aidl_ret_status = AParcel_readBool(_aidl_out.get(), _aidl_return);
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_error:
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
_aidl_status_return:
return _aidl_status;
}
::ndk::ScopedAStatus BpOemLock::isOemUnlockAllowedByDevice(bool* _aidl_return) {
binder_status_t _aidl_ret_status = STATUS_OK;
::ndk::ScopedAStatus _aidl_status;
::ndk::ScopedAParcel _aidl_in;
::ndk::ScopedAParcel _aidl_out;
_aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AIBinder_transact(
asBinder().get(),
(FIRST_CALL_TRANSACTION + 2 /*isOemUnlockAllowedByDevice*/),
_aidl_in.getR(),
_aidl_out.getR(),
0
#ifdef BINDER_STABILITY_SUPPORT
| FLAG_PRIVATE_LOCAL
#endif // BINDER_STABILITY_SUPPORT
);
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IOemLock::getDefaultImpl()) {
_aidl_status = IOemLock::getDefaultImpl()->isOemUnlockAllowedByDevice(_aidl_return);
goto _aidl_status_return;
}
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
_aidl_ret_status = AParcel_readBool(_aidl_out.get(), _aidl_return);
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_error:
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
_aidl_status_return:
return _aidl_status;
}
::ndk::ScopedAStatus BpOemLock::setOemUnlockAllowedByCarrier(bool in_allowed, const std::vector<uint8_t>& in_signature, ::aidl::android::hardware::oemlock::OemLockSecureStatus* _aidl_return) {
binder_status_t _aidl_ret_status = STATUS_OK;
::ndk::ScopedAStatus _aidl_status;
::ndk::ScopedAParcel _aidl_in;
::ndk::ScopedAParcel _aidl_out;
_aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AParcel_writeBool(_aidl_in.get(), in_allowed);
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = ::ndk::AParcel_writeVector(_aidl_in.get(), in_signature);
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AIBinder_transact(
asBinder().get(),
(FIRST_CALL_TRANSACTION + 3 /*setOemUnlockAllowedByCarrier*/),
_aidl_in.getR(),
_aidl_out.getR(),
0
#ifdef BINDER_STABILITY_SUPPORT
| FLAG_PRIVATE_LOCAL
#endif // BINDER_STABILITY_SUPPORT
);
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IOemLock::getDefaultImpl()) {
_aidl_status = IOemLock::getDefaultImpl()->setOemUnlockAllowedByCarrier(in_allowed, in_signature, _aidl_return);
goto _aidl_status_return;
}
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
_aidl_ret_status = AParcel_readInt32(_aidl_out.get(), reinterpret_cast<int32_t*>(_aidl_return));
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_error:
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
_aidl_status_return:
return _aidl_status;
}
::ndk::ScopedAStatus BpOemLock::setOemUnlockAllowedByDevice(bool in_allowed) {
binder_status_t _aidl_ret_status = STATUS_OK;
::ndk::ScopedAStatus _aidl_status;
::ndk::ScopedAParcel _aidl_in;
::ndk::ScopedAParcel _aidl_out;
_aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AParcel_writeBool(_aidl_in.get(), in_allowed);
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AIBinder_transact(
asBinder().get(),
(FIRST_CALL_TRANSACTION + 4 /*setOemUnlockAllowedByDevice*/),
_aidl_in.getR(),
_aidl_out.getR(),
0
#ifdef BINDER_STABILITY_SUPPORT
| FLAG_PRIVATE_LOCAL
#endif // BINDER_STABILITY_SUPPORT
);
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IOemLock::getDefaultImpl()) {
_aidl_status = IOemLock::getDefaultImpl()->setOemUnlockAllowedByDevice(in_allowed);
goto _aidl_status_return;
}
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
_aidl_error:
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
_aidl_status_return:
return _aidl_status;
}
::ndk::ScopedAStatus BpOemLock::getInterfaceVersion(int32_t* _aidl_return) {
binder_status_t _aidl_ret_status = STATUS_OK;
::ndk::ScopedAStatus _aidl_status;
if (_aidl_cached_version != -1) {
*_aidl_return = _aidl_cached_version;
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
return _aidl_status;
}
::ndk::ScopedAParcel _aidl_in;
::ndk::ScopedAParcel _aidl_out;
_aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AIBinder_transact(
asBinder().get(),
(FIRST_CALL_TRANSACTION + 16777214 /*getInterfaceVersion*/),
_aidl_in.getR(),
_aidl_out.getR(),
0
#ifdef BINDER_STABILITY_SUPPORT
| FLAG_PRIVATE_LOCAL
#endif // BINDER_STABILITY_SUPPORT
);
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IOemLock::getDefaultImpl()) {
_aidl_status = IOemLock::getDefaultImpl()->getInterfaceVersion(_aidl_return);
goto _aidl_status_return;
}
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
_aidl_ret_status = AParcel_readInt32(_aidl_out.get(), _aidl_return);
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_cached_version = *_aidl_return;
_aidl_error:
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
_aidl_status_return:
return _aidl_status;
}
::ndk::ScopedAStatus BpOemLock::getInterfaceHash(std::string* _aidl_return) {
binder_status_t _aidl_ret_status = STATUS_OK;
::ndk::ScopedAStatus _aidl_status;
const std::lock_guard<std::mutex> lock(_aidl_cached_hash_mutex);
if (_aidl_cached_hash != "-1") {
*_aidl_return = _aidl_cached_hash;
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
return _aidl_status;
}
::ndk::ScopedAParcel _aidl_in;
::ndk::ScopedAParcel _aidl_out;
_aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AIBinder_transact(
asBinder().get(),
(FIRST_CALL_TRANSACTION + 16777213 /*getInterfaceHash*/),
_aidl_in.getR(),
_aidl_out.getR(),
0
#ifdef BINDER_STABILITY_SUPPORT
| FLAG_PRIVATE_LOCAL
#endif // BINDER_STABILITY_SUPPORT
);
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IOemLock::getDefaultImpl()) {
_aidl_status = IOemLock::getDefaultImpl()->getInterfaceHash(_aidl_return);
goto _aidl_status_return;
}
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
_aidl_ret_status = ::ndk::AParcel_readString(_aidl_out.get(), _aidl_return);
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
_aidl_cached_hash = *_aidl_return;
_aidl_error:
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
_aidl_status_return:
return _aidl_status;
}
// Source for BnOemLock
BnOemLock::BnOemLock() {}
BnOemLock::~BnOemLock() {}
::ndk::SpAIBinder BnOemLock::createBinder() {
AIBinder* binder = AIBinder_new(_g_aidl_clazz, static_cast<void*>(this));
#ifdef BINDER_STABILITY_SUPPORT
AIBinder_markVintfStability(binder);
#endif // BINDER_STABILITY_SUPPORT
return ::ndk::SpAIBinder(binder);
}
::ndk::ScopedAStatus BnOemLock::getInterfaceVersion(int32_t* _aidl_return) {
*_aidl_return = IOemLock::version;
return ::ndk::ScopedAStatus(AStatus_newOk());
}
::ndk::ScopedAStatus BnOemLock::getInterfaceHash(std::string* _aidl_return) {
*_aidl_return = IOemLock::hash;
return ::ndk::ScopedAStatus(AStatus_newOk());
}
// Source for IOemLock
const char* IOemLock::descriptor = "android.hardware.oemlock.IOemLock";
IOemLock::IOemLock() {}
IOemLock::~IOemLock() {}
std::shared_ptr<IOemLock> IOemLock::fromBinder(const ::ndk::SpAIBinder& binder) {
if (!AIBinder_associateClass(binder.get(), _g_aidl_clazz)) { return nullptr; }
std::shared_ptr<::ndk::ICInterface> interface = ::ndk::ICInterface::asInterface(binder.get());
if (interface) {
return std::static_pointer_cast<IOemLock>(interface);
}
return ::ndk::SharedRefBase::make<BpOemLock>(binder);
}
binder_status_t IOemLock::writeToParcel(AParcel* parcel, const std::shared_ptr<IOemLock>& instance) {
return AParcel_writeStrongBinder(parcel, instance ? instance->asBinder().get() : nullptr);
}
binder_status_t IOemLock::readFromParcel(const AParcel* parcel, std::shared_ptr<IOemLock>* instance) {
::ndk::SpAIBinder binder;
binder_status_t status = AParcel_readStrongBinder(parcel, binder.getR());
if (status != STATUS_OK) return status;
*instance = IOemLock::fromBinder(binder);
return STATUS_OK;
}
bool IOemLock::setDefaultImpl(const std::shared_ptr<IOemLock>& impl) {
// Only one user of this interface can use this function
// at a time. This is a heuristic to detect if two different
// users in the same process use this function.
assert(!IOemLock::default_impl);
if (impl) {
IOemLock::default_impl = impl;
return true;
}
return false;
}
const std::shared_ptr<IOemLock>& IOemLock::getDefaultImpl() {
return IOemLock::default_impl;
}
std::shared_ptr<IOemLock> IOemLock::default_impl = nullptr;
::ndk::ScopedAStatus IOemLockDefault::getName(std::string* /*_aidl_return*/) {
::ndk::ScopedAStatus _aidl_status;
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
return _aidl_status;
}
::ndk::ScopedAStatus IOemLockDefault::isOemUnlockAllowedByCarrier(bool* /*_aidl_return*/) {
::ndk::ScopedAStatus _aidl_status;
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
return _aidl_status;
}
::ndk::ScopedAStatus IOemLockDefault::isOemUnlockAllowedByDevice(bool* /*_aidl_return*/) {
::ndk::ScopedAStatus _aidl_status;
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
return _aidl_status;
}
::ndk::ScopedAStatus IOemLockDefault::setOemUnlockAllowedByCarrier(bool /*in_allowed*/, const std::vector<uint8_t>& /*in_signature*/, ::aidl::android::hardware::oemlock::OemLockSecureStatus* /*_aidl_return*/) {
::ndk::ScopedAStatus _aidl_status;
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
return _aidl_status;
}
::ndk::ScopedAStatus IOemLockDefault::setOemUnlockAllowedByDevice(bool /*in_allowed*/) {
::ndk::ScopedAStatus _aidl_status;
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
return _aidl_status;
}
::ndk::ScopedAStatus IOemLockDefault::getInterfaceVersion(int32_t* _aidl_return) {
*_aidl_return = 0;
return ::ndk::ScopedAStatus(AStatus_newOk());
}
::ndk::ScopedAStatus IOemLockDefault::getInterfaceHash(std::string* _aidl_return) {
*_aidl_return = "";
return ::ndk::ScopedAStatus(AStatus_newOk());
}
::ndk::SpAIBinder IOemLockDefault::asBinder() {
return ::ndk::SpAIBinder();
}
bool IOemLockDefault::isRemote() {
return false;
}
} // namespace oemlock
} // namespace hardware
} // namespace android
} // namespace aidl