summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jooyung Han <jooyung@google.com> 2021-11-04 02:38:13 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2021-11-04 02:38:13 +0000
commitecaefda9b2f495eb4380531c729190cbaa73ee71 (patch)
tree32c31e267f531d9038f6dcf0c0c91a25704d8b89
parentfde5f61f7c505e9fa1645bbee3666a432a51e2ba (diff)
parentc64a0ba93625dea7ecf65f52d033318e2aaa0da2 (diff)
Merge changes from topic "nested-interface" am: 254d9b3f65 am: 5f85eb1d78 am: c64a0ba936
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1878150 Change-Id: I801cddf1dfd6f5f21205d43a9e546b219900db24
-rw-r--r--libs/binder/ndk/ibinder.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/libs/binder/ndk/ibinder.cpp b/libs/binder/ndk/ibinder.cpp
index 8ffa735700..6949c2c9e5 100644
--- a/libs/binder/ndk/ibinder.cpp
+++ b/libs/binder/ndk/ibinder.cpp
@@ -104,6 +104,17 @@ std::optional<bool> AIBinder::associateClassInternal(const AIBinder_Class* clazz
return {};
}
+// b/175635923 libcxx causes "implicit-conversion" with a string with invalid char
+static std::string SanitizeString(const String16& str) {
+ std::string sanitized{String8(str)};
+ for (auto& c : sanitized) {
+ if (!isprint(c)) {
+ c = '?';
+ }
+ }
+ return sanitized;
+}
+
bool AIBinder::associateClass(const AIBinder_Class* clazz) {
if (clazz == nullptr) return false;
@@ -118,7 +129,7 @@ bool AIBinder::associateClass(const AIBinder_Class* clazz) {
if (descriptor != newDescriptor) {
if (getBinder()->isBinderAlive()) {
LOG(ERROR) << __func__ << ": Expecting binder to have class '" << newDescriptor
- << "' but descriptor is actually '" << descriptor << "'.";
+ << "' but descriptor is actually '" << SanitizeString(descriptor) << "'.";
} else {
// b/155793159
LOG(ERROR) << __func__ << ": Cannot associate class '" << newDescriptor