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

Commit eadae82b authored by Robert Carr's avatar Robert Carr
Browse files

Replace InputWindowInfo#inputChannel with an IBinder token.

The IBinder token is now being used as the UUID for InputWindows.
We can pass it around without the channel to avoid unnecessary FD
parcelling, duping, and other juggling.

Test: Existing tests pass.
Bug: 80101428
Bug: 113136004
Bug: 111440400
Change-Id: I8eba3fa05f249b7dfcb5c3d9817241cbfe9ab76c
parent ebdf858c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.view;

import android.graphics.Region;
import android.os.IBinder;
import android.view.IWindow;
import android.view.InputChannel;

@@ -37,8 +38,8 @@ public final class InputWindowHandle {
    // The client window.
    public final IWindow clientWindow;

    // The input channel associated with the window.
    public InputChannel inputChannel;
    // The token assosciated with the window.
    public IBinder token;

    // The window name.
    public String name;
+8 −10
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@
#include <android_runtime/AndroidRuntime.h>
#include <utils/threads.h>

#include <android_view_InputChannel.h>
#include <android/graphics/Region.h>
#include <ui/Region.h>

@@ -33,7 +32,7 @@ namespace android {
static struct {
    jfieldID ptr;
    jfieldID inputApplicationHandle;
    jfieldID inputChannel;
    jfieldID token;
    jfieldID name;
    jfieldID layoutParamsFlags;
    jfieldID layoutParamsType;
@@ -86,13 +85,12 @@ bool NativeInputWindowHandle::updateInfo() {

    mInfo.touchableRegion.clear();

    jobject inputChannelObj = env->GetObjectField(obj,
            gInputWindowHandleClassInfo.inputChannel);
    if (inputChannelObj) {
        mInfo.inputChannel = android_view_InputChannel_getInputChannel(env, inputChannelObj);
        env->DeleteLocalRef(inputChannelObj);
    jobject tokenObj = env->GetObjectField(obj,
            gInputWindowHandleClassInfo.token);
    if (tokenObj) {
        mInfo.token = ibinderForJavaObject(env, tokenObj);
    } else {
        mInfo.inputChannel.clear();
        mInfo.token.clear();
    }

    jstring nameObj = jstring(env->GetObjectField(obj,
@@ -236,8 +234,8 @@ int register_android_server_InputWindowHandle(JNIEnv* env) {
            clazz,
            "inputApplicationHandle", "Landroid/view/InputApplicationHandle;");

    GET_FIELD_ID(gInputWindowHandleClassInfo.inputChannel, clazz,
            "inputChannel", "Landroid/view/InputChannel;");
    GET_FIELD_ID(gInputWindowHandleClassInfo.token, clazz,
            "token", "Landroid/os/IBinder;");

    GET_FIELD_ID(gInputWindowHandleClassInfo.name, clazz,
            "name", "Ljava/lang/String;");
+1 −1
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ class DragState {
            mDragWindowHandle = new InputWindowHandle(mDragApplicationHandle, null,
                    display.getDisplayId());
            mDragWindowHandle.name = "drag";
            mDragWindowHandle.inputChannel = mServerChannel;
            mDragWindowHandle.token = mServerChannel.getToken();
            mDragWindowHandle.layer = getDragLayerLocked();
            mDragWindowHandle.layoutParamsFlags = 0;
            mDragWindowHandle.layoutParamsType = WindowManager.LayoutParams.TYPE_DRAG;
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ class InputConsumerImpl implements IBinder.DeathRecipient {

        mWindowHandle = new InputWindowHandle(mApplicationHandle, null, displayId);
        mWindowHandle.name = name;
        mWindowHandle.inputChannel = mServerChannel;
        mWindowHandle.token = mServerChannel.getToken();
        mWindowHandle.layoutParamsType = WindowManager.LayoutParams.TYPE_INPUT_CONSUMER;
        mWindowHandle.layer = getLayerLw(mWindowHandle.layoutParamsType);
        mWindowHandle.layoutParamsFlags = 0;
+1 −1
Original line number Diff line number Diff line
@@ -269,7 +269,7 @@ class TaskPositioner {
        mDragWindowHandle = new InputWindowHandle(mDragApplicationHandle, null,
                display.getDisplayId());
        mDragWindowHandle.name = TAG;
        mDragWindowHandle.inputChannel = mServerChannel;
        mDragWindowHandle.token = mServerChannel.getToken();
        mDragWindowHandle.layer = mService.getDragLayerLocked();
        mDragWindowHandle.layoutParamsFlags = 0;
        mDragWindowHandle.layoutParamsType = WindowManager.LayoutParams.TYPE_DRAG;
Loading