UEventObserver: Fix logging for uevent messages

Every uevent message in buffer contains '\0' characters
and only part of the message is displayed right now.
So, all '\0' characters should be replaced for correct
logging.

Test: checked uvent message in logcat

Change-Id: I5bcdf117208feae542f0d4619cb03eddbcfce32c
Signed-off-by: Anton Utkin <avutkin@sberdevices.ru>
This commit is contained in:
Anton Utkin
2023-05-19 15:50:03 +03:00
parent 7e5966f01e
commit 50cf7b3722

View File

@@ -71,7 +71,11 @@ static jstring nativeWaitForNextEvent(JNIEnv *env, jclass clazz) {
}
buffer[length] = '\0';
ALOGV("Received uevent message: %s", buffer);
IF_ALOGV() {
std::string message(buffer, length);
std::replace(message.begin(), message.end(), '\0', ' ');
ALOGV("Received uevent message: %s", message.c_str());
}
if (isMatch(buffer, length)) {
// Assume the message is ASCII.