Loading libs/binder/ndk/ibinder.cpp +8 −9 Original line number Diff line number Diff line Loading @@ -74,12 +74,12 @@ AIBinder::AIBinder(const AIBinder_Class* clazz) : mClazz(clazz) {} AIBinder::~AIBinder() {} std::optional<bool> AIBinder::associateClassInternal(const AIBinder_Class* clazz, const String8& newDescriptor, bool set) { const String16& newDescriptor, bool set) { std::lock_guard<std::mutex> lock(mClazzMutex); if (mClazz == clazz) return true; if (mClazz != nullptr) { String8 currentDescriptor(mClazz->getInterfaceDescriptor()); const String16& currentDescriptor = mClazz->getInterfaceDescriptor(); if (newDescriptor == currentDescriptor) { LOG(ERROR) << __func__ << ": Class descriptors '" << currentDescriptor << "' match during associateClass, but they are different class objects. " Loading @@ -88,8 +88,7 @@ std::optional<bool> AIBinder::associateClassInternal(const AIBinder_Class* clazz LOG(ERROR) << __func__ << ": Class cannot be associated on object which already has a class. " "Trying to associate to '" << newDescriptor.c_str() << "' but already set to '" << currentDescriptor.c_str() << "'."; << newDescriptor << "' but already set to '" << currentDescriptor << "'."; } // always a failure because we know mClazz != clazz Loading @@ -108,21 +107,21 @@ std::optional<bool> AIBinder::associateClassInternal(const AIBinder_Class* clazz bool AIBinder::associateClass(const AIBinder_Class* clazz) { if (clazz == nullptr) return false; String8 newDescriptor(clazz->getInterfaceDescriptor()); const String16& newDescriptor = clazz->getInterfaceDescriptor(); auto result = associateClassInternal(clazz, newDescriptor, false); if (result.has_value()) return *result; CHECK(asABpBinder() != nullptr); // ABBinder always has a descriptor String8 descriptor(getBinder()->getInterfaceDescriptor()); const String16& descriptor = getBinder()->getInterfaceDescriptor(); if (descriptor != newDescriptor) { if (getBinder()->isBinderAlive()) { LOG(ERROR) << __func__ << ": Expecting binder to have class '" << newDescriptor.c_str() << "' but descriptor is actually '" << descriptor.c_str() << "'."; LOG(ERROR) << __func__ << ": Expecting binder to have class '" << newDescriptor << "' but descriptor is actually '" << descriptor << "'."; } else { // b/155793159 LOG(ERROR) << __func__ << ": Cannot associate class '" << newDescriptor.c_str() LOG(ERROR) << __func__ << ": Cannot associate class '" << newDescriptor << "' to dead binder."; } return false; Loading libs/binder/ndk/ibinder_internal.h +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ struct AIBinder : public virtual ::android::RefBase { private: std::optional<bool> associateClassInternal(const AIBinder_Class* clazz, const ::android::String8& newDescriptor, bool set); const ::android::String16& newDescriptor, bool set); // AIBinder instance is instance of this class for a local object. In order to transact on a // remote object, this also must be set for simplicity (although right now, only the Loading Loading
libs/binder/ndk/ibinder.cpp +8 −9 Original line number Diff line number Diff line Loading @@ -74,12 +74,12 @@ AIBinder::AIBinder(const AIBinder_Class* clazz) : mClazz(clazz) {} AIBinder::~AIBinder() {} std::optional<bool> AIBinder::associateClassInternal(const AIBinder_Class* clazz, const String8& newDescriptor, bool set) { const String16& newDescriptor, bool set) { std::lock_guard<std::mutex> lock(mClazzMutex); if (mClazz == clazz) return true; if (mClazz != nullptr) { String8 currentDescriptor(mClazz->getInterfaceDescriptor()); const String16& currentDescriptor = mClazz->getInterfaceDescriptor(); if (newDescriptor == currentDescriptor) { LOG(ERROR) << __func__ << ": Class descriptors '" << currentDescriptor << "' match during associateClass, but they are different class objects. " Loading @@ -88,8 +88,7 @@ std::optional<bool> AIBinder::associateClassInternal(const AIBinder_Class* clazz LOG(ERROR) << __func__ << ": Class cannot be associated on object which already has a class. " "Trying to associate to '" << newDescriptor.c_str() << "' but already set to '" << currentDescriptor.c_str() << "'."; << newDescriptor << "' but already set to '" << currentDescriptor << "'."; } // always a failure because we know mClazz != clazz Loading @@ -108,21 +107,21 @@ std::optional<bool> AIBinder::associateClassInternal(const AIBinder_Class* clazz bool AIBinder::associateClass(const AIBinder_Class* clazz) { if (clazz == nullptr) return false; String8 newDescriptor(clazz->getInterfaceDescriptor()); const String16& newDescriptor = clazz->getInterfaceDescriptor(); auto result = associateClassInternal(clazz, newDescriptor, false); if (result.has_value()) return *result; CHECK(asABpBinder() != nullptr); // ABBinder always has a descriptor String8 descriptor(getBinder()->getInterfaceDescriptor()); const String16& descriptor = getBinder()->getInterfaceDescriptor(); if (descriptor != newDescriptor) { if (getBinder()->isBinderAlive()) { LOG(ERROR) << __func__ << ": Expecting binder to have class '" << newDescriptor.c_str() << "' but descriptor is actually '" << descriptor.c_str() << "'."; LOG(ERROR) << __func__ << ": Expecting binder to have class '" << newDescriptor << "' but descriptor is actually '" << descriptor << "'."; } else { // b/155793159 LOG(ERROR) << __func__ << ": Cannot associate class '" << newDescriptor.c_str() LOG(ERROR) << __func__ << ": Cannot associate class '" << newDescriptor << "' to dead binder."; } return false; Loading
libs/binder/ndk/ibinder_internal.h +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ struct AIBinder : public virtual ::android::RefBase { private: std::optional<bool> associateClassInternal(const AIBinder_Class* clazz, const ::android::String8& newDescriptor, bool set); const ::android::String16& newDescriptor, bool set); // AIBinder instance is instance of this class for a local object. In order to transact on a // remote object, this also must be set for simplicity (although right now, only the Loading