From 44e13ef1a1aee36b4ce667670345de8ce4e6bb7b Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Wed, 27 Mar 2013 12:34:30 -0700 Subject: [PATCH] Disable some noisy error logs. Disabled some error logs that occur when an input channel is closed remotely by its peer. These can happen during normal course of operations because the act of removing windows or finishing IME sessions is asynchronous so both peers may react to the change independently at different times. The coordination with the input dispatcher is designed to avoid logging these errors. However it's not possible to achieve the same coordination with the IME so we might as well silence the errors since they don't tell us anything useful. If something truly bad happens then one of two things will occur: 1. The system will realize that the process crashed because of a DeadObjectException or other error, so it will take measures to clean up. 2. If the error was spurious and non-fatal (how?) then at worst an ANR may occur because the consumer stopped reading from the input channel. However this has never been observed and I doubt it's even possible. Change-Id: I11a05d6d75e63e91be003971a544069b3a0d77f4 --- core/jni/android_view_InputEventReceiver.cpp | 7 ++++++- core/jni/android_view_InputEventSender.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/jni/android_view_InputEventReceiver.cpp b/core/jni/android_view_InputEventReceiver.cpp index 9501cf225293a..198814a6417ee 100644 --- a/core/jni/android_view_InputEventReceiver.cpp +++ b/core/jni/android_view_InputEventReceiver.cpp @@ -118,8 +118,13 @@ status_t NativeInputEventReceiver::finishInputEvent(uint32_t seq, bool handled) int NativeInputEventReceiver::handleEvent(int receiveFd, int events, void* data) { if (events & (ALOOPER_EVENT_ERROR | ALOOPER_EVENT_HANGUP)) { - ALOGE("channel '%s' ~ Publisher closed input channel or an error occurred. " +#if DEBUG_DISPATCH_CYCLE + // This error typically occurs when the publisher has closed the input channel + // as part of removing a window or finishing an IME session, in which case + // the consumer will soon be disposed as well. + ALOGD("channel '%s' ~ Publisher closed input channel or an error occurred. " "events=0x%x", getInputChannelName(), events); +#endif return 0; // remove the callback } diff --git a/core/jni/android_view_InputEventSender.cpp b/core/jni/android_view_InputEventSender.cpp index bd1d1039906aa..2306cf238e3c5 100644 --- a/core/jni/android_view_InputEventSender.cpp +++ b/core/jni/android_view_InputEventSender.cpp @@ -151,8 +151,13 @@ status_t NativeInputEventSender::sendMotionEvent(uint32_t seq, const MotionEvent int NativeInputEventSender::handleEvent(int receiveFd, int events, void* data) { if (events & (ALOOPER_EVENT_ERROR | ALOOPER_EVENT_HANGUP)) { - ALOGE("channel '%s' ~ Consumer closed input channel or an error occurred. " +#if DEBUG_DISPATCH_CYCLE + // This error typically occurs when the consumer has closed the input channel + // as part of finishing an IME session, in which case the publisher will + // soon be disposed as well. + ALOGD("channel '%s' ~ Consumer closed input channel or an error occurred. " "events=0x%x", getInputChannelName(), events); +#endif return 0; // remove the callback }