summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2010-11-05 15:02:16 -0700
committerJeff Brown <jeffbrown@google.com>2010-11-08 12:49:43 -0800
commit3915bb845b032dc184dba5e60970b803390ca3ed (patch)
tree198a47c1d4ada990ef04d563b5e0caaec35abc18 /include
parent60029771d26ca3c51288c3d92cab1d3537147acd (diff)
downloadframeworks_base-3915bb845b032dc184dba5e60970b803390ca3ed.zip
frameworks_base-3915bb845b032dc184dba5e60970b803390ca3ed.tar.gz
frameworks_base-3915bb845b032dc184dba5e60970b803390ca3ed.tar.bz2
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
Diffstat (limited to 'include')
-rw-r--r--include/android_runtime/android_app_NativeActivity.h2
-rw-r--r--include/ui/InputDispatcher.h12
-rw-r--r--include/ui/InputTransport.h7
3 files changed, 15 insertions, 6 deletions
diff --git a/include/android_runtime/android_app_NativeActivity.h b/include/android_runtime/android_app_NativeActivity.h
index 5dbec59..990143b 100644
--- a/include/android_runtime/android_app_NativeActivity.h
+++ b/include/android_runtime/android_app_NativeActivity.h
@@ -83,7 +83,7 @@ public:
bool preDispatchEvent(AInputEvent* event);
- void finishEvent(AInputEvent* event, bool handled);
+ void finishEvent(AInputEvent* event, bool handled, bool didDefaultHandling);
// ----------------------------------------------------------
diff --git a/include/ui/InputDispatcher.h b/include/ui/InputDispatcher.h
index a5591ba..d09ff41 100644
--- a/include/ui/InputDispatcher.h
+++ b/include/ui/InputDispatcher.h
@@ -304,6 +304,10 @@ public:
virtual bool interceptKeyBeforeDispatching(const sp<InputChannel>& 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>& 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> inputChannel;
sp<InputApplicationHandle> 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>& connection);
- void finishDispatchCycleLocked(nsecs_t currentTime, const sp<Connection>& connection);
+ void finishDispatchCycleLocked(nsecs_t currentTime, const sp<Connection>& connection,
+ bool handled);
void startNextDispatchCycleLocked(nsecs_t currentTime, const sp<Connection>& connection);
void abortBrokenDispatchCycleLocked(nsecs_t currentTime, const sp<Connection>& connection);
void drainOutboundQueueLocked(Connection* connection);
@@ -1061,7 +1067,7 @@ private:
void onDispatchCycleStartedLocked(
nsecs_t currentTime, const sp<Connection>& connection);
void onDispatchCycleFinishedLocked(
- nsecs_t currentTime, const sp<Connection>& connection);
+ nsecs_t currentTime, const sp<Connection>& connection, bool handled);
void onDispatchCycleBrokenLocked(
nsecs_t currentTime, const sp<Connection>& 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,
diff --git a/include/ui/InputTransport.h b/include/ui/InputTransport.h
index dc9e27a..7efb6cc 100644
--- a/include/ui/InputTransport.h
+++ b/include/ui/InputTransport.h
@@ -250,12 +250,13 @@ public:
status_t sendDispatchSignal();
/* Receives the finished signal from the consumer in reply to the original dispatch signal.
+ * Returns whether the consumer handled the message.
*
* Returns OK on success.
* Returns WOULD_BLOCK if there is no signal present.
* Other errors probably indicate that the channel is broken.
*/
- status_t receiveFinishedSignal();
+ status_t receiveFinishedSignal(bool& outHandled);
private:
sp<InputChannel> mChannel;
@@ -305,12 +306,12 @@ public:
status_t consume(InputEventFactoryInterface* factory, InputEvent** outEvent);
/* Sends a finished signal to the publisher to inform it that the current message is
- * finished processing.
+ * finished processing and specifies whether the message was handled by the consumer.
*
* Returns OK on success.
* Errors probably indicate that the channel is broken.
*/
- status_t sendFinishedSignal();
+ status_t sendFinishedSignal(bool handled);
/* Receives the dispatched signal from the publisher.
*