summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-06-23 14:10:57 -0700
committerDianne Hackborn <hackbod@google.com>2010-06-23 14:37:30 -0700
commit1e4b9f3936d6f357e89360293e05a0e16d5fa440 (patch)
tree4fc65451804b3d2741969ecb7bfd3d415f54ec51 /core/java/android
parent69a4817e3e1e368e758ff8c238deb5ee26963c04 (diff)
downloadframeworks_base-1e4b9f3936d6f357e89360293e05a0e16d5fa440.zip
frameworks_base-1e4b9f3936d6f357e89360293e05a0e16d5fa440.tar.gz
frameworks_base-1e4b9f3936d6f357e89360293e05a0e16d5fa440.tar.bz2
Remove InputConsumer, replacing with InputQueue.
Change-Id: Ib06907278457aaee842b123adc072840ca3602d8
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/NativeActivity.java14
-rw-r--r--core/java/android/view/InputConsumer.java39
-rw-r--r--core/java/android/view/InputQueue.java24
-rw-r--r--core/java/android/view/ViewRoot.java20
-rw-r--r--core/java/android/view/Window.java6
5 files changed, 41 insertions, 62 deletions
diff --git a/core/java/android/app/NativeActivity.java b/core/java/android/app/NativeActivity.java
index 973ad60..429d164 100644
--- a/core/java/android/app/NativeActivity.java
+++ b/core/java/android/app/NativeActivity.java
@@ -7,7 +7,7 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.InputChannel;
-import android.view.InputConsumer;
+import android.view.InputQueue;
import android.view.SurfaceHolder;
import java.io.File;
@@ -17,7 +17,7 @@ import java.io.File;
* purely in native code. That is, a game (or game-like thing).
*/
public class NativeActivity extends Activity implements SurfaceHolder.Callback,
- InputConsumer.Callback {
+ InputQueue.Callback {
public static final String META_DATA_LIB_NAME = "android.app.lib_name";
private int mNativeHandle;
@@ -45,7 +45,7 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback,
ActivityInfo ai;
getWindow().takeSurface(this);
- getWindow().takeInputChannel(this);
+ getWindow().takeInputQueue(this);
try {
ai = getPackageManager().getActivityInfo(
@@ -145,11 +145,11 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback,
onSurfaceDestroyedNative(mNativeHandle, holder);
}
- public void onInputConsumerCreated(InputConsumer consumer) {
- onInputChannelCreatedNative(mNativeHandle, consumer.getInputChannel());
+ public void onInputQueueCreated(InputQueue queue) {
+ onInputChannelCreatedNative(mNativeHandle, queue.getInputChannel());
}
- public void onInputConsumerDestroyed(InputConsumer consumer) {
- onInputChannelDestroyedNative(mNativeHandle, consumer.getInputChannel());
+ public void onInputQueueDestroyed(InputQueue queue) {
+ onInputChannelDestroyedNative(mNativeHandle, queue.getInputChannel());
}
}
diff --git a/core/java/android/view/InputConsumer.java b/core/java/android/view/InputConsumer.java
deleted file mode 100644
index 63b26c6..0000000
--- a/core/java/android/view/InputConsumer.java
+++ /dev/null
@@ -1,39 +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;
-
-/**
- * Handle for consuming raw input events.
- */
-public class InputConsumer {
- public static interface Callback {
- void onInputConsumerCreated(InputConsumer consumer);
- void onInputConsumerDestroyed(InputConsumer consumer);
- }
-
- final InputChannel mChannel;
-
- /** @hide */
- public InputConsumer(InputChannel channel) {
- mChannel = channel;
- }
-
- /** @hide */
- public InputChannel getInputChannel() {
- return mChannel;
- }
-}
diff --git a/core/java/android/view/InputQueue.java b/core/java/android/view/InputQueue.java
index b38f7d5..7feee38 100644
--- a/core/java/android/view/InputQueue.java
+++ b/core/java/android/view/InputQueue.java
@@ -21,16 +21,25 @@ import android.util.Slog;
/**
* An input queue provides a mechanism for an application to receive incoming
- * input events sent over an input channel. Signalling is implemented by MessageQueue.
- * @hide
+ * input events. Currently only usable from native code.
*/
public final class InputQueue {
private static final String TAG = "InputQueue";
+ public static interface Callback {
+ void onInputQueueCreated(InputQueue queue);
+ void onInputQueueDestroyed(InputQueue queue);
+ }
+
+ final InputChannel mChannel;
+
// Describes the interpretation of an event.
// XXX This concept is tentative. See comments in android/input.h.
+ /** @hide */
public static final int INPUT_EVENT_NATURE_KEY = 1;
+ /** @hide */
public static final int INPUT_EVENT_NATURE_TOUCH = 2;
+ /** @hide */
public static final int INPUT_EVENT_NATURE_TRACKBALL = 3;
private static Object sLock = new Object();
@@ -40,7 +49,14 @@ public final class InputQueue {
private static native void nativeUnregisterInputChannel(InputChannel inputChannel);
private static native void nativeFinished(long finishedToken);
- private InputQueue() {
+ /** @hide */
+ public InputQueue(InputChannel channel) {
+ mChannel = channel;
+ }
+
+ /** @hide */
+ public InputChannel getInputChannel() {
+ return mChannel;
}
/**
@@ -48,6 +64,7 @@ public final class InputQueue {
* @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) {
@@ -71,6 +88,7 @@ public final class InputQueue {
* 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) {
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index 8984b74..4854190 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -154,8 +154,8 @@ public final class ViewRoot extends Handler implements ViewParent,
final View.AttachInfo mAttachInfo;
InputChannel mInputChannel;
- InputConsumer.Callback mInputConsumerCallback;
- InputConsumer mInputConsumer;
+ InputQueue.Callback mInputQueueCallback;
+ InputQueue mInputQueue;
final Rect mTempRect; // used in the transaction to not thrash the heap.
final Rect mVisRect; // used to retrieve visible rect of focused view.
@@ -558,12 +558,12 @@ public final class ViewRoot extends Handler implements ViewParent,
if (WindowManagerPolicy.ENABLE_NATIVE_INPUT_DISPATCH) {
if (view instanceof RootViewSurfaceTaker) {
- mInputConsumerCallback =
- ((RootViewSurfaceTaker)view).willYouTakeTheInputConsumer();
+ mInputQueueCallback =
+ ((RootViewSurfaceTaker)view).willYouTakeTheInputQueue();
}
- if (mInputConsumerCallback != null) {
- mInputConsumer = new InputConsumer(mInputChannel);
- mInputConsumerCallback.onInputConsumerCreated(mInputConsumer);
+ if (mInputQueueCallback != null) {
+ mInputQueue = new InputQueue(mInputChannel);
+ mInputQueueCallback.onInputQueueCreated(mInputQueue);
} else {
InputQueue.registerInputChannel(mInputChannel, mInputHandler,
Looper.myQueue());
@@ -1747,9 +1747,9 @@ public final class ViewRoot extends Handler implements ViewParent,
if (WindowManagerPolicy.ENABLE_NATIVE_INPUT_DISPATCH) {
if (mInputChannel != null) {
- if (mInputConsumerCallback != null) {
- mInputConsumerCallback.onInputConsumerDestroyed(mInputConsumer);
- mInputConsumerCallback = null;
+ if (mInputQueueCallback != null) {
+ mInputQueueCallback.onInputQueueDestroyed(mInputQueue);
+ mInputQueueCallback = null;
} else {
InputQueue.unregisterInputChannel(mInputChannel);
}
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index b00d33d..f40734b 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -481,11 +481,11 @@ public abstract class Window {
public abstract void takeSurface(SurfaceHolder.Callback callback);
/**
- * Take ownership of this window's InputChannel. The window will no
- * longer read and dispatch input events from the channel; it is your
+ * Take ownership of this window's InputQueue. The window will no
+ * longer read and dispatch input events from the queue; it is your
* responsibility to do so.
*/
- public abstract void takeInputChannel(InputConsumer.Callback callback);
+ public abstract void takeInputQueue(InputQueue.Callback callback);
/**
* Return whether this window is being displayed with a floating style