diff options
| author | Jeff Brown <jeffbrown@google.com> | 2011-12-01 14:01:49 -0800 |
|---|---|---|
| committer | Jeff Brown <jeffbrown@google.com> | 2011-12-01 21:04:47 -0800 |
| commit | 32cbc3855c2a971aa5a801fd339fb6a37db91a1a (patch) | |
| tree | 40d3fcf12181eb6d50fac3a3734ecf3c9f4953ec /core/java/android/view | |
| parent | db918cf171afd3d4b3c22aab6dd3403d1dec94de (diff) | |
| download | frameworks_base-32cbc3855c2a971aa5a801fd339fb6a37db91a1a.zip frameworks_base-32cbc3855c2a971aa5a801fd339fb6a37db91a1a.tar.gz frameworks_base-32cbc3855c2a971aa5a801fd339fb6a37db91a1a.tar.bz2 | |
Refactor InputQueue as InputEventReceiver.
This change simplifies the code associated with receiving input
events from input channels and makes it more robust. It also
does a better job of ensuring that input events are properly
recycled (sometimes we dropped them on the floor).
This change also adds a sequence number to all events, which is
handy for determining whether we are looking at the same event or a
new one, particularly when events are recycled.
Change-Id: I4ebd88f73b5f77f3e150778cd550e7f91956aac2
Diffstat (limited to 'core/java/android/view')
| -rwxr-xr-x | core/java/android/view/InputEvent.java | 57 | ||||
| -rw-r--r-- | core/java/android/view/InputEventConsistencyVerifier.java | 11 | ||||
| -rw-r--r-- | core/java/android/view/InputEventReceiver.java | 151 | ||||
| -rw-r--r-- | core/java/android/view/InputHandler.java | 35 | ||||
| -rw-r--r-- | core/java/android/view/InputQueue.java | 124 | ||||
| -rwxr-xr-x | core/java/android/view/KeyEvent.java | 8 | ||||
| -rw-r--r-- | core/java/android/view/MotionEvent.java | 20 | ||||
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 54 | ||||
| -rw-r--r-- | core/java/android/view/WindowManagerPolicy.java | 3 |
9 files changed, 246 insertions, 217 deletions
diff --git a/core/java/android/view/InputEvent.java b/core/java/android/view/InputEvent.java index 01ddcc9..c42bbdc 100755 --- a/core/java/android/view/InputEvent.java +++ b/core/java/android/view/InputEvent.java @@ -19,6 +19,8 @@ package android.view; import android.os.Parcel; import android.os.Parcelable; +import java.util.concurrent.atomic.AtomicInteger; + /** * Common base class for input events. */ @@ -27,8 +29,21 @@ public abstract class InputEvent implements Parcelable { protected static final int PARCEL_TOKEN_MOTION_EVENT = 1; /** @hide */ protected static final int PARCEL_TOKEN_KEY_EVENT = 2; - + + // Next sequence number. + private static final AtomicInteger mNextSeq = new AtomicInteger(); + + /** @hide */ + protected int mSeq; + + /** @hide */ + protected boolean mRecycled; + + private static final boolean TRACK_RECYCLED_LOCATION = false; + private RuntimeException mRecycledLocation; + /*package*/ InputEvent() { + mSeq = mNextSeq.getAndIncrement(); } /** @@ -82,7 +97,29 @@ public abstract class InputEvent implements Parcelable { * objects are fine. See {@link KeyEvent#recycle()} for details. * @hide */ - public abstract void recycle(); + public void recycle() { + if (TRACK_RECYCLED_LOCATION) { + if (mRecycledLocation != null) { + throw new RuntimeException(toString() + " recycled twice!", mRecycledLocation); + } + mRecycledLocation = new RuntimeException("Last recycled here"); + } else { + if (mRecycled) { + throw new RuntimeException(toString() + " recycled twice!"); + } + mRecycled = true; + } + } + + /** + * Reinitializes the event on reuse (after recycling). + * @hide + */ + protected void prepareForReuse() { + mRecycled = false; + mRecycledLocation = null; + mSeq = mNextSeq.getAndIncrement(); + } /** * Gets a private flag that indicates when the system has detected that this input event @@ -113,6 +150,22 @@ public abstract class InputEvent implements Parcelable { */ public abstract long getEventTimeNano(); + /** + * Gets the unique sequence number of this event. + * Every input event that is created or received by a process has a + * unique sequence number. Moreover, a new sequence number is obtained + * each time an event object is recycled. + * + * Sequence numbers are only guaranteed to be locally unique within a process. + * Sequence numbers are not preserved when events are parceled. + * + * @return The unique sequence number of this event. + * @hide + */ + public int getSequenceNumber() { + return mSeq; + } + public int describeContents() { return 0; } diff --git a/core/java/android/view/InputEventConsistencyVerifier.java b/core/java/android/view/InputEventConsistencyVerifier.java index 9b081b2..fafe416 100644 --- a/core/java/android/view/InputEventConsistencyVerifier.java +++ b/core/java/android/view/InputEventConsistencyVerifier.java @@ -58,7 +58,7 @@ public final class InputEventConsistencyVerifier { // so that the verifier can detect when it has been asked to verify the same event twice. // It does not make sense to examine the contents of the last event since it may have // been recycled. - private InputEvent mLastEvent; + private int mLastEventSeq; private String mLastEventType; private int mLastNestingLevel; @@ -140,7 +140,7 @@ public final class InputEventConsistencyVerifier { * Resets the state of the input event consistency verifier. */ public void reset() { - mLastEvent = null; + mLastEventSeq = -1; mLastNestingLevel = 0; mTrackballDown = false; mTrackballUnhandled = false; @@ -573,17 +573,18 @@ public final class InputEventConsistencyVerifier { private boolean startEvent(InputEvent event, int nestingLevel, String eventType) { // Ignore the event if we already checked it at a higher nesting level. - if (event == mLastEvent && nestingLevel < mLastNestingLevel + final int seq = event.getSequenceNumber(); + if (seq == mLastEventSeq && nestingLevel < mLastNestingLevel && eventType == mLastEventType) { return false; } if (nestingLevel > 0) { - mLastEvent = event; + mLastEventSeq = seq; mLastEventType = eventType; mLastNestingLevel = nestingLevel; } else { - mLastEvent = null; + mLastEventSeq = -1; mLastEventType = null; mLastNestingLevel = 0; } diff --git a/core/java/android/view/InputEventReceiver.java b/core/java/android/view/InputEventReceiver.java new file mode 100644 index 0000000..abb5281 --- /dev/null +++ b/core/java/android/view/InputEventReceiver.java @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.view; + +import dalvik.system.CloseGuard; + +import android.os.Looper; +import android.os.MessageQueue; +import android.util.Log; + +/** + * Provides a low-level mechanism for an application to receive input events. + * @hide + */ +public abstract class InputEventReceiver { + private static final String TAG = "InputEventReceiver"; + + private final CloseGuard mCloseGuard = CloseGuard.get(); + + private int mReceiverPtr; + + // We keep references to the input channel and message queue objects here so that + // they are not GC'd while the native peer of the receiver is using them. + private InputChannel mInputChannel; + private MessageQueue mMessageQueue; + + // The sequence number of the event that is in progress. + private int mEventSequenceNumberInProgress = -1; + + private static native int nativeInit(InputEventReceiver receiver, + InputChannel inputChannel, MessageQueue messageQueue); + private static native void nativeDispose(int receiverPtr); + private static native void nativeFinishInputEvent(int receiverPtr, boolean handled); + + /** + * Creates an input event receiver bound to the specified input channel. + * + * @param inputChannel The input channel. + * @param looper The looper to use when invoking callbacks. + */ + public InputEventReceiver(InputChannel inputChannel, Looper looper) { + if (inputChannel == null) { + throw new IllegalArgumentException("inputChannel must not be null"); + } + if (looper == null) { + throw new IllegalArgumentException("looper must not be null"); + } + + mInputChannel = inputChannel; + mMessageQueue = looper.getQueue(); + mReceiverPtr = nativeInit(this, inputChannel, mMessageQueue); + + mCloseGuard.open("dispose"); + } + + @Override + protected void finalize() throws Throwable { + try { + dispose(); + } finally { + super.finalize(); + } + } + + /** + * Disposes the receiver. + */ + public void dispose() { + if (mCloseGuard != null) { + mCloseGuard.close(); + } + if (mReceiverPtr != 0) { + nativeDispose(mReceiverPtr); + mReceiverPtr = 0; + } + mInputChannel = null; + mMessageQueue = null; + } + + /** + * Called when an input event is received. + * The recipient should process the input event and then call {@link #finishInputEvent} + * to indicate whether the event was handled. No new input events will be received + * until {@link #finishInputEvent} is called. + * + * @param event The input event that was received. + */ + public void onInputEvent(InputEvent event) { + finishInputEvent(event, false); + } + + /** + * Finishes an input event and indicates whether it was handled. + * + * @param event The input event that was finished. + * @param handled True if the event was handled. + */ + public void finishInputEvent(InputEvent event, boolean handled) { + if (event == null) { + throw new IllegalArgumentException("event must not be null"); + } + if (mReceiverPtr == 0) { + Log.w(TAG, "Attempted to finish an input event but the input event " + + "receiver has already been disposed."); + } else { + if (event.getSequenceNumber() != mEventSequenceNumberInProgress) { + Log.w(TAG, "Attempted to finish an input event that is not in progress."); + } else { + mEventSequenceNumberInProgress = -1; + nativeFinishInputEvent(mReceiverPtr, handled); + } + } + recycleInputEvent(event); + } + + // Called from native code. + @SuppressWarnings("unused") + private void dispatchInputEvent(InputEvent event) { + mEventSequenceNumberInProgress = event.getSequenceNumber(); + onInputEvent(event); + } + + private static void recycleInputEvent(InputEvent event) { + if (event instanceof MotionEvent) { + // Event though key events are also recyclable, we only recycle motion events. + // Historically, key events were not recyclable and applications expect + // them to be immutable. We only ever recycle key events behind the + // scenes where an application never sees them (so, not here). + event.recycle(); + } + } + + public static interface Factory { + public InputEventReceiver createInputEventReceiver( + InputChannel inputChannel, Looper looper); + } +} diff --git a/core/java/android/view/InputHandler.java b/core/java/android/view/InputHandler.java deleted file mode 100644 index 192a427..0000000 --- a/core/java/android/view/InputHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.view; - -/** - * Handles input messages that arrive on an input channel. - * @hide - */ -public class InputHandler { - /** - * Handle an input event. - * It is the responsibility of the callee to ensure that the finished callback is - * eventually invoked when the event processing is finished and the input system - * can send the next event. - * @param event The input event. - * @param finishedCallback The callback to invoke when event processing is finished. - */ - public void handleInputEvent(InputEvent event, InputQueue.FinishedCallback finishedCallback) { - finishedCallback.finished(false); - } -} diff --git a/core/java/android/view/InputQueue.java b/core/java/android/view/InputQueue.java index 1206518..909a3b2 100644 --- a/core/java/android/view/InputQueue.java +++ b/core/java/android/view/InputQueue.java @@ -16,18 +16,11 @@ package android.view; -import android.os.MessageQueue; -import android.util.Slog; - /** * An input queue provides a mechanism for an application to receive incoming * input events. Currently only usable from native code. */ public final class InputQueue { - private static final String TAG = "InputQueue"; - - private static final boolean DEBUG = false; - /** * Interface to receive notification of when an InputQueue is associated * and dissociated with a thread. @@ -48,13 +41,6 @@ public final class InputQueue { final InputChannel mChannel; - private static final Object sLock = new Object(); - - private static native void nativeRegisterInputChannel(InputChannel inputChannel, - InputHandler inputHandler, MessageQueue messageQueue); - private static native void nativeUnregisterInputChannel(InputChannel inputChannel); - private static native void nativeFinished(long finishedToken, boolean handled); - /** @hide */ public InputQueue(InputChannel channel) { mChannel = channel; @@ -64,114 +50,4 @@ public final class InputQueue { public InputChannel getInputChannel() { return mChannel; } - - /** - * Registers an input channel and handler. - * @param inputChannel The input channel to register. - * @param inputHandler The input handler to input events send to the target. - * @param messageQueue The message queue on whose thread the handler should be invoked. - * @hide - */ - public static void registerInputChannel(InputChannel inputChannel, InputHandler inputHandler, - MessageQueue messageQueue) { - if (inputChannel == null) { - throw new IllegalArgumentException("inputChannel must not be null"); - } - if (inputHandler == null) { - throw new IllegalArgumentException("inputHandler must not be null"); - } - if (messageQueue == null) { - throw new IllegalArgumentException("messageQueue must not be null"); - } - - synchronized (sLock) { - if (DEBUG) { - Slog.d(TAG, "Registering input channel '" + inputChannel + "'"); - } - - nativeRegisterInputChannel(inputChannel, inputHandler, messageQueue); - } - } - - /** - * Unregisters an input channel. - * Does nothing if the channel is not currently registered. - * @param inputChannel The input channel to unregister. - * @hide - */ - public static void unregisterInputChannel(InputChannel inputChannel) { - if (inputChannel == null) { - throw new IllegalArgumentException("inputChannel must not be null"); - } - - synchronized (sLock) { - if (DEBUG) { - Slog.d(TAG, "Unregistering input channel '" + inputChannel + "'"); - } - - nativeUnregisterInputChannel(inputChannel); - } - } - - @SuppressWarnings("unused") - private static void dispatchInputEvent(InputHandler inputHandler, - InputEvent event, long finishedToken) { - FinishedCallback finishedCallback = FinishedCallback.obtain(finishedToken); - inputHandler.handleInputEvent(event, finishedCallback); - } - - /** - * A callback that must be invoked to when finished processing an event. - * @hide - */ - public static final class FinishedCallback { - private static final boolean DEBUG_RECYCLING = false; - - private static final int RECYCLE_MAX_COUNT = 4; - - private static FinishedCallback sRecycleHead; - private static int sRecycleCount; - - private FinishedCallback mRecycleNext; - private long mFinishedToken; - - private FinishedCallback() { - } - - public static FinishedCallback obtain(long finishedToken) { - synchronized (sLock) { - FinishedCallback callback = sRecycleHead; - if (callback != null) { - sRecycleHead = callback.mRecycleNext; - sRecycleCount -= 1; - callback.mRecycleNext = null; - } else { - callback = new FinishedCallback(); - } - callback.mFinishedToken = finishedToken; - return callback; - } - } - - public void finished(boolean handled) { - synchronized (sLock) { - if (mFinishedToken == -1) { - throw new IllegalStateException("Event finished callback already invoked."); - } - - nativeFinished(mFinishedToken, handled); - mFinishedToken = -1; - - if (sRecycleCount < RECYCLE_MAX_COUNT) { - mRecycleNext = sRecycleHead; - sRecycleHead = this; - sRecycleCount += 1; - - if (DEBUG_RECYCLING) { - Slog.d(TAG, "Recycled finished callbacks: " + sRecycleCount); - } - } - } - } - } } diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java index f53e42c..9a46aab 100755 --- a/core/java/android/view/KeyEvent.java +++ b/core/java/android/view/KeyEvent.java @@ -1225,7 +1225,6 @@ public class KeyEvent extends InputEvent implements Parcelable { private static KeyEvent gRecyclerTop; private KeyEvent mNext; - private boolean mRecycled; private int mDeviceId; private int mSource; @@ -1535,8 +1534,8 @@ public class KeyEvent extends InputEvent implements Parcelable { gRecyclerTop = ev.mNext; gRecyclerUsed -= 1; } - ev.mRecycled = false; ev.mNext = null; + ev.prepareForReuse(); return ev; } @@ -1598,10 +1597,7 @@ public class KeyEvent extends InputEvent implements Parcelable { * @hide */ public final void recycle() { - if (mRecycled) { - throw new RuntimeException(toString() + " recycled twice!"); - } - mRecycled = true; + super.recycle(); mCharacters = null; synchronized (gRecyclerLock) { diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java index 8e0ab1a..e49193e 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -167,7 +167,6 @@ import android.util.SparseArray; */ public final class MotionEvent extends InputEvent implements Parcelable { private static final long NS_PER_MS = 1000000; - private static final boolean TRACK_RECYCLED_LOCATION = false; /** * An invalid pointer id. @@ -1315,8 +1314,6 @@ public final class MotionEvent extends InputEvent implements Parcelable { private int mNativePtr; private MotionEvent mNext; - private RuntimeException mRecycledLocation; - private boolean mRecycled; private static native int nativeInitialize(int nativePtr, int deviceId, int source, int action, int flags, int edgeFlags, @@ -1397,9 +1394,8 @@ public final class MotionEvent extends InputEvent implements Parcelable { gRecyclerTop = ev.mNext; gRecyclerUsed -= 1; } - ev.mRecycledLocation = null; - ev.mRecycled = false; ev.mNext = null; + ev.prepareForReuse(); return ev; } @@ -1647,19 +1643,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * this function you must not ever touch the event again. */ public final void recycle() { - // Ensure recycle is only called once! - if (TRACK_RECYCLED_LOCATION) { - if (mRecycledLocation != null) { - throw new RuntimeException(toString() + " recycled twice!", mRecycledLocation); - } - mRecycledLocation = new RuntimeException("Last recycled here"); - //Log.w("MotionEvent", "Recycling event " + this, mRecycledLocation); - } else { - if (mRecycled) { - throw new RuntimeException(toString() + " recycled twice!"); - } - mRecycled = true; - } + super.recycle(); synchronized (gRecyclerLock) { if (gRecyclerUsed < MAX_RECYCLED) { diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 0e65334..f23c312 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -221,7 +221,6 @@ public final class ViewRootImpl extends Handler implements ViewParent, private static final int MAX_QUEUED_INPUT_EVENT_POOL_SIZE = 10; private QueuedInputEvent mQueuedInputEventPool; private int mQueuedInputEventPoolSize; - private int mQueuedInputEventNextSeq; // Input event queue. QueuedInputEvent mFirstPendingInputEvent; @@ -559,8 +558,8 @@ public final class ViewRootImpl extends Handler implements ViewParent, mInputQueue = new InputQueue(mInputChannel); mInputQueueCallback.onInputQueueCreated(mInputQueue); } else { - InputQueue.registerInputChannel(mInputChannel, mInputHandler, - Looper.myQueue()); + mInputEventReceiver = new WindowInputEventReceiver(mInputChannel, + Looper.myLooper()); } } @@ -2283,8 +2282,9 @@ public final class ViewRootImpl extends Handler implements ViewParent, mInputQueueCallback.onInputQueueDestroyed(mInputQueue); mInputQueueCallback = null; mInputQueue = null; - } else if (mInputChannel != null) { - InputQueue.unregisterInputChannel(mInputChannel); + } else if (mInputEventReceiver != null) { + mInputEventReceiver.dispose(); + mInputEventReceiver = null; } try { sWindowSession.remove(mWindow); @@ -3199,9 +3199,10 @@ public final class ViewRootImpl extends Handler implements ViewParent, if (mLastWasImTarget) { InputMethodManager imm = InputMethodManager.peekInstance(); if (imm != null) { + final int seq = event.getSequenceNumber(); if (DEBUG_IMF) Log.v(TAG, "Sending key event to IME: seq=" - + q.mSeq + " event=" + event); - imm.dispatchKeyEvent(mView.getContext(), q.mSeq, event, mInputMethodCallback); + + seq + " event=" + event); + imm.dispatchKeyEvent(mView.getContext(), seq, event, mInputMethodCallback); return; } } @@ -3213,7 +3214,7 @@ public final class ViewRootImpl extends Handler implements ViewParent, void handleImeFinishedEvent(int seq, boolean handled) { final QueuedInputEvent q = mCurrentInputEvent; - if (q != null && q.mSeq == seq) { + if (q != null && q.mEvent.getSequenceNumber() == seq) { final KeyEvent event = (KeyEvent)q.mEvent; if (DEBUG_IMF) { Log.v(TAG, "IME finished event: seq=" + seq @@ -3715,9 +3716,8 @@ public final class ViewRootImpl extends Handler implements ViewParent, public QueuedInputEvent mNext; public InputEvent mEvent; - public InputQueue.FinishedCallback mFinishedCallback; + public InputEventReceiver mReceiver; public int mFlags; - public int mSeq; // Used for latency calculations. public long mReceiveTimeNanos; @@ -3726,7 +3726,7 @@ public final class ViewRootImpl extends Handler implements ViewParent, } private QueuedInputEvent obtainQueuedInputEvent(InputEvent event, - InputQueue.FinishedCallback finishedCallback, int flags) { + InputEventReceiver receiver, int flags) { QueuedInputEvent q = mQueuedInputEventPool; if (q != null) { mQueuedInputEventPoolSize -= 1; @@ -3737,15 +3737,14 @@ public final class ViewRootImpl extends Handler implements ViewParent, } q.mEvent = event; - q.mFinishedCallback = finishedCallback; + q.mReceiver = receiver; q.mFlags = flags; - q.mSeq = mQueuedInputEventNextSeq++; return q; } private void recycleQueuedInputEvent(QueuedInputEvent q) { q.mEvent = null; - q.mFinishedCallback = null; + q.mReceiver = null; if (mQueuedInputEventPoolSize < MAX_QUEUED_INPUT_EVENT_POOL_SIZE) { mQueuedInputEventPoolSize += 1; @@ -3755,8 +3754,8 @@ public final class ViewRootImpl extends Handler implements ViewParent, } void enqueueInputEvent(InputEvent event, - InputQueue.FinishedCallback finishedCallback, int flags) { - QueuedInputEvent q = obtainQueuedInputEvent(event, finishedCallback, flags); + InputEventReceiver receiver, int flags) { + QueuedInputEvent q = obtainQueuedInputEvent(event, receiver, flags); if (ViewDebug.DEBUG_LATENCY) { q.mReceiveTimeNanos = System.nanoTime(); @@ -3847,11 +3846,9 @@ public final class ViewRootImpl extends Handler implements ViewParent, Log.d(ViewDebug.DEBUG_LATENCY_TAG, msg.toString()); } - if (q.mFinishedCallback != null) { - q.mFinishedCallback.finished(handled); - } - - if (q.mEvent instanceof MotionEvent) { + if (q.mReceiver != null) { + q.mReceiver.finishInputEvent(q.mEvent, handled); + } else if (q.mEvent instanceof MotionEvent) { // Event though key events are also recyclable, we only recycle motion events. // Historically, key events were not recyclable and applications expect // them to be immutable. We only ever recycle key events behind the @@ -3867,12 +3864,17 @@ public final class ViewRootImpl extends Handler implements ViewParent, } } - private final InputHandler mInputHandler = new InputHandler() { - public void handleInputEvent(InputEvent event, - InputQueue.FinishedCallback finishedCallback) { - enqueueInputEvent(event, finishedCallback, 0); + final class WindowInputEventReceiver extends InputEventReceiver { + public WindowInputEventReceiver(InputChannel inputChannel, Looper looper) { + super(inputChannel, looper); } - }; + + @Override + public void onInputEvent(InputEvent event) { + enqueueInputEvent(event, this, 0); + } + } + WindowInputEventReceiver mInputEventReceiver; public void dispatchKey(KeyEvent event) { enqueueInputEvent(event, null, 0); diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index 2e19bf6..7d729c6 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -340,7 +340,8 @@ public interface WindowManagerPolicy { * Add a fake window to the window manager. This window sits * at the top of the other windows and consumes events. */ - public FakeWindow addFakeWindow(Looper looper, InputHandler inputHandler, + public FakeWindow addFakeWindow(Looper looper, + InputEventReceiver.Factory inputEventReceiverFactory, String name, int windowType, int layoutParamsFlags, boolean canReceiveKeys, boolean hasFocus, boolean touchFullscreen); } |
