libbinder_ndk: dead binder when associating dead binder
It may be surprising that this is null. Add diagnostic message to assist
development. If/when we change this behavior, it will probably require a
new libbinder_ndk to avoid changing behavior.
Bug: 155793159
Test: repro error and check message:
07-08 00:56:55.250 3414 3418 E binderNdkDroppedTest: associateClass:
Cannot associate class 'IBinderNdkDroppedTest' to dead binder.
Change-Id: If9d897df1676dce4be1bd79327087dad918a2a73
diff --git a/libs/binder/ndk/ibinder.cpp b/libs/binder/ndk/ibinder.cpp
index 649faa1..743ef89 100644
--- a/libs/binder/ndk/ibinder.cpp
+++ b/libs/binder/ndk/ibinder.cpp
@@ -99,8 +99,14 @@
String8 descriptor(getBinder()->getInterfaceDescriptor());
if (descriptor != newDescriptor) {
- LOG(ERROR) << __func__ << ": Expecting binder to have class '" << newDescriptor.c_str()
- << "' but descriptor is actually '" << descriptor.c_str() << "'.";
+ if (getBinder()->isBinderAlive()) {
+ LOG(ERROR) << __func__ << ": Expecting binder to have class '" << newDescriptor.c_str()
+ << "' but descriptor is actually '" << descriptor.c_str() << "'.";
+ } else {
+ // b/155793159
+ LOG(ERROR) << __func__ << ": Cannot associate class '" << newDescriptor.c_str()
+ << "' to dead binder.";
+ }
return false;
}