From 54c798b38084625fa05398d971a2fc1bcf6e8c1f Mon Sep 17 00:00:00 2001 From: Dakkshesh Date: Thu, 7 Aug 2025 11:40:00 +0530 Subject: [PATCH] cpp: stub: Format using clang-format Somehow this was missed out during initial formatting. Signed-off-by: Dakkshesh --- app/src/main/cpp/stub/stub_binder.cpp | 302 +++++++++++++++++++------- app/src/main/cpp/stub/stub_utils.cpp | 100 ++++----- 2 files changed, 275 insertions(+), 127 deletions(-) diff --git a/app/src/main/cpp/stub/stub_binder.cpp b/app/src/main/cpp/stub/stub_binder.cpp index 72cd147..f782bfb 100644 --- a/app/src/main/cpp/stub/stub_binder.cpp +++ b/app/src/main/cpp/stub/stub_binder.cpp @@ -11,11 +11,19 @@ namespace android { IBinder::IBinder() {} IBinder::~IBinder() {} -sp IBinder::queryLocalInterface(const String16&) { return nullptr; } -BBinder* IBinder::localBinder() { return nullptr; } -BpBinder* IBinder::remoteBinder() { return nullptr; } -bool IBinder::checkSubclass(const void*) const { return false; } -void IBinder::withLock(const std::function&) {} +sp IBinder::queryLocalInterface(const String16 &) { + return nullptr; +} +BBinder *IBinder::localBinder() { + return nullptr; +} +BpBinder *IBinder::remoteBinder() { + return nullptr; +} +bool IBinder::checkSubclass(const void *) const { + return false; +} +void IBinder::withLock(const std::function &) {} #ifdef __LP64__ static_assert(sizeof(IBinder) == 24); @@ -28,25 +36,59 @@ static_assert(sizeof(BBinder) == 20); BBinder::BBinder() {} BBinder::~BBinder() {} -const String16& BBinder::getInterfaceDescriptor() const { __builtin_unreachable(); } -bool BBinder::isBinderAlive() const { return false; } -status_t BBinder::pingBinder() { return 0; } -status_t BBinder::dump(int, const Vector&) { return 0; } -status_t BBinder::transact(uint32_t, const Parcel&, Parcel*, uint32_t) { return 0; } -status_t BBinder::linkToDeath(const sp&, void*, uint32_t) { return 0; } -status_t BBinder::unlinkToDeath(const wp&, void*, uint32_t, wp*) { return 0; } -void* BBinder::attachObject(const void*, void*, void*, object_cleanup_func) { return nullptr; } -void* BBinder::findObject(const void*) const { return nullptr; } -void* BBinder::detachObject(const void*) { return nullptr; } -void BBinder::withLock(const std::function&) {} -BBinder* BBinder::localBinder() { return nullptr; } -status_t BBinder::onTransact(uint32_t, const Parcel&, Parcel*, uint32_t) { return 0; } +const String16 &BBinder::getInterfaceDescriptor() const { + __builtin_unreachable(); +} +bool BBinder::isBinderAlive() const { + return false; +} +status_t BBinder::pingBinder() { + return 0; +} +status_t BBinder::dump(int, const Vector &) { + return 0; +} +status_t BBinder::transact(uint32_t, const Parcel &, Parcel *, uint32_t) { + return 0; +} +status_t BBinder::linkToDeath(const sp &, void *, uint32_t) { + return 0; +} +status_t BBinder::unlinkToDeath(const wp &, void *, uint32_t, wp *) { + return 0; +} +void *BBinder::attachObject(const void *, void *, void *, object_cleanup_func) { + return nullptr; +} +void *BBinder::findObject(const void *) const { + return nullptr; +} +void *BBinder::detachObject(const void *) { + return nullptr; +} +void BBinder::withLock(const std::function &) {} +BBinder *BBinder::localBinder() { + return nullptr; +} +status_t BBinder::onTransact(uint32_t, const Parcel &, Parcel *, uint32_t) { + return 0; +} -IPCThreadState* IPCThreadState::self() { return nullptr; } -IPCThreadState* IPCThreadState::selfOrNull() { return nullptr; } -pid_t IPCThreadState::getCallingPid() const { return 0; } -const char* IPCThreadState::getCallingSid() const { return nullptr; } -uid_t IPCThreadState::getCallingUid() const { return 0; } +IPCThreadState *IPCThreadState::self() { + return nullptr; +} +IPCThreadState *IPCThreadState::selfOrNull() { + return nullptr; +} +pid_t IPCThreadState::getCallingPid() const { + return 0; +} +const char *IPCThreadState::getCallingSid() const { + return nullptr; +} +uid_t IPCThreadState::getCallingUid() const { + return 0; +} #ifdef __LP64__ static_assert(sizeof(Parcel) == 120); @@ -56,65 +98,171 @@ static_assert(sizeof(Parcel) == 60); Parcel::Parcel() {} Parcel::~Parcel() {} -const uint8_t* Parcel::data() const { return nullptr; } -size_t Parcel::dataSize() const { return 0; } -size_t Parcel::dataAvail() const { return 0; } -size_t Parcel::dataPosition() const { return 0; } -size_t Parcel::dataCapacity() const { return 0; } -size_t Parcel::dataBufferSize() const { return 0; } -status_t Parcel::setDataSize(size_t) { return 0; } +const uint8_t *Parcel::data() const { + return nullptr; +} +size_t Parcel::dataSize() const { + return 0; +} +size_t Parcel::dataAvail() const { + return 0; +} +size_t Parcel::dataPosition() const { + return 0; +} +size_t Parcel::dataCapacity() const { + return 0; +} +size_t Parcel::dataBufferSize() const { + return 0; +} +status_t Parcel::setDataSize(size_t) { + return 0; +} void Parcel::setDataPosition(size_t) const {} -status_t Parcel::setDataCapacity(size_t) { return 0; } -status_t Parcel::setData(const uint8_t*, size_t) { return 0; } -status_t Parcel::appendFrom(const Parcel*, size_t, size_t) { return 0; } -binder::Status Parcel::enforceNoDataAvail() const { return {}; } +status_t Parcel::setDataCapacity(size_t) { + return 0; +} +status_t Parcel::setData(const uint8_t *, size_t) { + return 0; +} +status_t Parcel::appendFrom(const Parcel *, size_t, size_t) { + return 0; +} +binder::Status Parcel::enforceNoDataAvail() const { + return {}; +} void Parcel::setEnforceNoDataAvail(bool) {} void Parcel::freeData() {} -status_t Parcel::write(const void*, size_t) { return 0; } -void* Parcel::writeInplace(size_t) { return nullptr; } -status_t Parcel::writeInt32(int32_t) { return 0; } -status_t Parcel::writeUint32(uint32_t) { return 0; } -status_t Parcel::writeInt64(int64_t) { return 0; } -status_t Parcel::writeUint64(uint64_t) { return 0; } -status_t Parcel::writeFloat(float) { return 0; } -status_t Parcel::writeDouble(double) { return 0; } -status_t Parcel::writeCString(const char*) { return 0; } -status_t Parcel::writeString8(const char*, size_t) { return 0; } -status_t Parcel::writeStrongBinder(const sp&) { return 0; } -status_t Parcel::writeBool(bool) { return 0; } -status_t Parcel::writeChar(char16_t) { return 0; } -status_t Parcel::writeByte(int8_t) { return 0; } -status_t Parcel::writeNoException() { return 0; } -status_t Parcel::read(void*, size_t) const { return 0; } -const void* Parcel::readInplace(size_t) const { return nullptr; } -int32_t Parcel::readInt32() const { return 0; } -status_t Parcel::readInt32(int32_t*) const { return 0; } -uint32_t Parcel::readUint32() const { return 0; } -status_t Parcel::readUint32(uint32_t*) const { return 0; } -int64_t Parcel::readInt64() const { return 0; } -status_t Parcel::readInt64(int64_t*) const { return 0; } -uint64_t Parcel::readUint64() const { return 0; } -status_t Parcel::readUint64(uint64_t*) const { return 0; } -float Parcel::readFloat() const { return 0; } -status_t Parcel::readFloat(float*) const { return 0; } -double Parcel::readDouble() const { return 0; } -status_t Parcel::readDouble(double*) const { return 0; } -bool Parcel::readBool() const { return 0; } -status_t Parcel::readBool(bool*) const { return 0; } -char16_t Parcel::readChar() const { return 0; } -status_t Parcel::readChar(char16_t*) const { return 0; } -int8_t Parcel::readByte() const { return 0; } -status_t Parcel::readByte(int8_t*) const { return 0; } -sp Parcel::readStrongBinder() const { return nullptr; } -status_t Parcel::readStrongBinder(sp*) const { return 0; } -status_t Parcel::readNullableStrongBinder(sp*) const { return 0; } -int32_t Parcel::readExceptionCode() const { return 0; } -int Parcel::readFileDescriptor() const { return 0; } +status_t Parcel::write(const void *, size_t) { + return 0; +} +void *Parcel::writeInplace(size_t) { + return nullptr; +} +status_t Parcel::writeInt32(int32_t) { + return 0; +} +status_t Parcel::writeUint32(uint32_t) { + return 0; +} +status_t Parcel::writeInt64(int64_t) { + return 0; +} +status_t Parcel::writeUint64(uint64_t) { + return 0; +} +status_t Parcel::writeFloat(float) { + return 0; +} +status_t Parcel::writeDouble(double) { + return 0; +} +status_t Parcel::writeCString(const char *) { + return 0; +} +status_t Parcel::writeString8(const char *, size_t) { + return 0; +} +status_t Parcel::writeStrongBinder(const sp &) { + return 0; +} +status_t Parcel::writeBool(bool) { + return 0; +} +status_t Parcel::writeChar(char16_t) { + return 0; +} +status_t Parcel::writeByte(int8_t) { + return 0; +} +status_t Parcel::writeNoException() { + return 0; +} +status_t Parcel::read(void *, size_t) const { + return 0; +} +const void *Parcel::readInplace(size_t) const { + return nullptr; +} +int32_t Parcel::readInt32() const { + return 0; +} +status_t Parcel::readInt32(int32_t *) const { + return 0; +} +uint32_t Parcel::readUint32() const { + return 0; +} +status_t Parcel::readUint32(uint32_t *) const { + return 0; +} +int64_t Parcel::readInt64() const { + return 0; +} +status_t Parcel::readInt64(int64_t *) const { + return 0; +} +uint64_t Parcel::readUint64() const { + return 0; +} +status_t Parcel::readUint64(uint64_t *) const { + return 0; +} +float Parcel::readFloat() const { + return 0; +} +status_t Parcel::readFloat(float *) const { + return 0; +} +double Parcel::readDouble() const { + return 0; +} +status_t Parcel::readDouble(double *) const { + return 0; +} +bool Parcel::readBool() const { + return 0; +} +status_t Parcel::readBool(bool *) const { + return 0; +} +char16_t Parcel::readChar() const { + return 0; +} +status_t Parcel::readChar(char16_t *) const { + return 0; +} +int8_t Parcel::readByte() const { + return 0; +} +status_t Parcel::readByte(int8_t *) const { + return 0; +} +sp Parcel::readStrongBinder() const { + return nullptr; +} +status_t Parcel::readStrongBinder(sp *) const { + return 0; +} +status_t Parcel::readNullableStrongBinder(sp *) const { + return 0; +} +int32_t Parcel::readExceptionCode() const { + return 0; +} +int Parcel::readFileDescriptor() const { + return 0; +} IServiceManager::IServiceManager() {} IServiceManager::~IServiceManager() {} -const String16& IServiceManager::getInterfaceDescriptor() const { __builtin_unreachable(); } -sp defaultServiceManager() { return nullptr; } -void setDefaultServiceManager(const sp&) {} +const String16 &IServiceManager::getInterfaceDescriptor() const { + __builtin_unreachable(); +} +sp defaultServiceManager() { + return nullptr; +} +void setDefaultServiceManager(const sp &) {} } // namespace android diff --git a/app/src/main/cpp/stub/stub_utils.cpp b/app/src/main/cpp/stub/stub_utils.cpp index 06aebb6..cb97b71 100644 --- a/app/src/main/cpp/stub/stub_utils.cpp +++ b/app/src/main/cpp/stub/stub_utils.cpp @@ -1,62 +1,62 @@ // Copyright 2025 Dakkshesh // SPDX-License-Identifier: GPL-3.0-or-later -#include "utils/StrongPointer.h" #include "utils/RefBase.h" #include "utils/String16.h" +#include "utils/StrongPointer.h" namespace android { - void RefBase::incStrong(const void *id) const { +void RefBase::incStrong(const void *id) const {} - } +void RefBase::incStrongRequireStrong(const void *id) const {} - void RefBase::incStrongRequireStrong(const void *id) const { +void RefBase::decStrong(const void *id) const {} - } +void RefBase::forceIncStrong(const void *id) const {} - void RefBase::decStrong(const void *id) const { - - } - - void RefBase::forceIncStrong(const void *id) const { - - } - - RefBase::weakref_type* RefBase::createWeak(const void* id) const { - return nullptr; - } - - RefBase::weakref_type* RefBase::getWeakRefs() const { - return nullptr; - } - - RefBase::RefBase(): mRefs(nullptr) {} - RefBase::~RefBase() {} - - void RefBase::onFirstRef() {} - void RefBase::onLastStrongRef(const void* id) {} - bool RefBase::onIncStrongAttempted(uint32_t flags, const void* id) { return false; } - void RefBase::onLastWeakRef(const void* id) {} - - RefBase* RefBase::weakref_type::refBase() const { return nullptr; } - - void RefBase::weakref_type::incWeak(const void* id) {} - void RefBase::weakref_type::incWeakRequireWeak(const void* id) {} - void RefBase::weakref_type::decWeak(const void* id) {} - - bool RefBase::weakref_type::attemptIncStrong(const void* id) { return false; } - - bool RefBase::weakref_type::attemptIncWeak(const void* id) { return false; } - - void sp_report_race() {} - - String16::String16() {} - - String16::String16(const String16 &o) {} - - String16::String16(String16 &&o) noexcept {} - - String16::String16(const char *o) {} - - String16::~String16() {} +RefBase::weakref_type *RefBase::createWeak(const void *id) const { + return nullptr; } + +RefBase::weakref_type *RefBase::getWeakRefs() const { + return nullptr; +} + +RefBase::RefBase() : mRefs(nullptr) {} +RefBase::~RefBase() {} + +void RefBase::onFirstRef() {} +void RefBase::onLastStrongRef(const void *id) {} +bool RefBase::onIncStrongAttempted(uint32_t flags, const void *id) { + return false; +} +void RefBase::onLastWeakRef(const void *id) {} + +RefBase *RefBase::weakref_type::refBase() const { + return nullptr; +} + +void RefBase::weakref_type::incWeak(const void *id) {} +void RefBase::weakref_type::incWeakRequireWeak(const void *id) {} +void RefBase::weakref_type::decWeak(const void *id) {} + +bool RefBase::weakref_type::attemptIncStrong(const void *id) { + return false; +} + +bool RefBase::weakref_type::attemptIncWeak(const void *id) { + return false; +} + +void sp_report_race() {} + +String16::String16() {} + +String16::String16(const String16 &o) {} + +String16::String16(String16 &&o) noexcept {} + +String16::String16(const char *o) {} + +String16::~String16() {} +} // namespace android