Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98f7aed6 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 1e4b9f39: Remove InputConsumer, replacing with InputQueue.

Merge commit '1e4b9f39' into gingerbread-plus-aosp

* commit '1e4b9f39':
  Remove InputConsumer, replacing with InputQueue.
parents c82b4e80 1e4b9f39
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -26330,7 +26330,7 @@
 deprecated="not deprecated"
 visibility="public"
>
<implements name="android.view.InputConsumer.Callback">
<implements name="android.view.InputQueue.Callback">
</implements>
<implements name="android.view.SurfaceHolder.Callback">
</implements>
@@ -26342,7 +26342,7 @@
 visibility="public"
>
</constructor>
<method name="onInputConsumerCreated"
<method name="onInputQueueCreated"
 return="void"
 abstract="false"
 native="false"
@@ -26352,10 +26352,10 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="consumer" type="android.view.InputConsumer">
<parameter name="queue" type="android.view.InputQueue">
</parameter>
</method>
<method name="onInputConsumerDestroyed"
<method name="onInputQueueDestroyed"
 return="void"
 abstract="false"
 native="false"
@@ -26365,7 +26365,7 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="consumer" type="android.view.InputConsumer">
<parameter name="queue" type="android.view.InputQueue">
</parameter>
</method>
<method name="surfaceChanged"
@@ -172775,23 +172775,23 @@
</parameter>
</constructor>
</class>
<class name="InputConsumer"
<class name="InputQueue"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="false"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</class>
<interface name="InputConsumer.Callback"
<interface name="InputQueue.Callback"
 abstract="true"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<method name="onInputConsumerCreated"
<method name="onInputQueueCreated"
 return="void"
 abstract="true"
 native="false"
@@ -172801,10 +172801,10 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="consumer" type="android.view.InputConsumer">
<parameter name="queue" type="android.view.InputQueue">
</parameter>
</method>
<method name="onInputConsumerDestroyed"
<method name="onInputQueueDestroyed"
 return="void"
 abstract="true"
 native="false"
@@ -172814,7 +172814,7 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="consumer" type="android.view.InputConsumer">
<parameter name="queue" type="android.view.InputQueue">
</parameter>
</method>
</interface>
@@ -187271,7 +187271,7 @@
<parameter name="event" type="android.view.MotionEvent">
</parameter>
</method>
<method name="takeInputChannel"
<method name="takeInputQueue"
 return="void"
 abstract="true"
 native="false"
@@ -187281,7 +187281,7 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="callback" type="android.view.InputConsumer.Callback">
<parameter name="callback" type="android.view.InputQueue.Callback">
</parameter>
</method>
<method name="takeKeyEvents"
+7 −7
Original line number Diff line number Diff line
@@ -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());
    }
}
+0 −39
Original line number Diff line number Diff line
/*
 * 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;
    }
}
+21 −3
Original line number Diff line number Diff line
@@ -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) {
+10 −10
Original line number Diff line number Diff line
@@ -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);
                }
Loading