From 3a9817228928a8db68c34afe547c9ba18169af5b Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Wed, 10 Jun 2015 15:26:13 +0100 Subject: [PATCH] Only log dropped input when disabled for the first event. Bug: 19851495 Change-Id: I8cb8076723c1ca1732c3bc37f283d8eb48b7bee0 --- services/inputflinger/InputDispatcher.cpp | 8 ++++++-- services/inputflinger/InputDispatcher.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/services/inputflinger/InputDispatcher.cpp b/services/inputflinger/InputDispatcher.cpp index a87cc7704..ffaa7e72f 100644 --- a/services/inputflinger/InputDispatcher.cpp +++ b/services/inputflinger/InputDispatcher.cpp @@ -201,7 +201,8 @@ static void dumpRegion(String8& dump, const Region& region) { InputDispatcher::InputDispatcher(const sp& policy) : mPolicy(policy), - mPendingEvent(NULL), mAppSwitchSawKeyDown(false), mAppSwitchDueTime(LONG_LONG_MAX), + mPendingEvent(NULL), mLastDropReason(DROP_REASON_NOT_DROPPED), + mAppSwitchSawKeyDown(false), mAppSwitchDueTime(LONG_LONG_MAX), mNextUnblockedEvent(NULL), mDispatchEnabled(false), mDispatchFrozen(false), mInputFilterEnabled(false), mInputTargetWaitCause(INPUT_TARGET_WAIT_CAUSE_NONE) { @@ -397,6 +398,7 @@ void InputDispatcher::dispatchOnceInnerLocked(nsecs_t* nextWakeupTime) { if (dropReason != DROP_REASON_NOT_DROPPED) { dropInboundEventLocked(mPendingEvent, dropReason); } + mLastDropReason = dropReason; releasePendingEventLocked(); *nextWakeupTime = LONG_LONG_MIN; // force next poll to wake up immediately @@ -506,7 +508,9 @@ void InputDispatcher::dropInboundEventLocked(EventEntry* entry, DropReason dropR reason = "inbound event was dropped because the policy consumed it"; break; case DROP_REASON_DISABLED: - ALOGI("Dropped event because input dispatch is disabled."); + if (mLastDropReason != DROP_REASON_DISABLED) { + ALOGI("Dropped event because input dispatch is disabled."); + } reason = "inbound event was dropped because input dispatch is disabled"; break; case DROP_REASON_APP_SWITCH: diff --git a/services/inputflinger/InputDispatcher.h b/services/inputflinger/InputDispatcher.h index 9a340c931..80eed56c1 100644 --- a/services/inputflinger/InputDispatcher.h +++ b/services/inputflinger/InputDispatcher.h @@ -857,6 +857,8 @@ private: Queue mRecentQueue; Queue mCommandQueue; + DropReason mLastDropReason; + void dispatchOnceInnerLocked(nsecs_t* nextWakeupTime); // Enqueues an inbound event. Returns true if mLooper->wake() should be called.