From 3915bb845b032dc184dba5e60970b803390ca3ed Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Fri, 5 Nov 2010 15:02:16 -0700 Subject: Tell system server whether the app handled input events. Refactored ViewRoot, NativeActivity and related classes to tell the dispatcher whether an input event was actually handled by the application. This will be used to move more of the global default key processing into the system server instead of the application. Change-Id: If06b98b6f45c543e5ac5b1eae2b3baf9371fba28 --- include/ui/InputDispatcher.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include/ui/InputDispatcher.h') diff --git a/include/ui/InputDispatcher.h b/include/ui/InputDispatcher.h index a5591ba921e3..d09ff412dea3 100644 --- a/include/ui/InputDispatcher.h +++ b/include/ui/InputDispatcher.h @@ -304,6 +304,10 @@ public: virtual bool interceptKeyBeforeDispatching(const sp& inputChannel, const KeyEvent* keyEvent, uint32_t policyFlags) = 0; + /* Allows the policy a chance to perform default processing for an unhandled key. */ + virtual bool dispatchUnhandledKey(const sp& inputChannel, + const KeyEvent* keyEvent, uint32_t policyFlags) = 0; + /* Notifies the policy about switch events. */ virtual void notifySwitch(nsecs_t when, @@ -609,6 +613,7 @@ private: sp inputChannel; sp inputApplicationHandle; int32_t userActivityEventType; + bool handled; }; // Generic queue implementation. @@ -1030,7 +1035,8 @@ private: EventEntry* eventEntry, const InputTarget* inputTarget, bool resumeWithAppendedMotionSample); void startDispatchCycleLocked(nsecs_t currentTime, const sp& connection); - void finishDispatchCycleLocked(nsecs_t currentTime, const sp& connection); + void finishDispatchCycleLocked(nsecs_t currentTime, const sp& connection, + bool handled); void startNextDispatchCycleLocked(nsecs_t currentTime, const sp& connection); void abortBrokenDispatchCycleLocked(nsecs_t currentTime, const sp& connection); void drainOutboundQueueLocked(Connection* connection); @@ -1061,7 +1067,7 @@ private: void onDispatchCycleStartedLocked( nsecs_t currentTime, const sp& connection); void onDispatchCycleFinishedLocked( - nsecs_t currentTime, const sp& connection); + nsecs_t currentTime, const sp& connection, bool handled); void onDispatchCycleBrokenLocked( nsecs_t currentTime, const sp& connection); void onANRLocked( @@ -1073,7 +1079,9 @@ private: void doNotifyInputChannelBrokenLockedInterruptible(CommandEntry* commandEntry); void doNotifyANRLockedInterruptible(CommandEntry* commandEntry); void doInterceptKeyBeforeDispatchingLockedInterruptible(CommandEntry* commandEntry); + void doDispatchCycleFinishedLockedInterruptible(CommandEntry* commandEntry); void doPokeUserActivityLockedInterruptible(CommandEntry* commandEntry); + void initializeKeyEvent(KeyEvent* event, const KeyEntry* entry); // Statistics gathering. void updateDispatchStatisticsLocked(nsecs_t currentTime, const EventEntry* entry, -- cgit v1.2.3-59-g8ed1b