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

Commit d02726e5 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Vishnu Nair
Browse files

Add alpha to InputWindowHandle

WindowInfo already contains alpha, but it's not exposed to Java. Add
alpha to the InputWindowHandle so it can be used for TPL.

Test: builds
Bug: 290795410
Change-Id: Id87cb486ed2a6c2775991a3c62b0d050a7f59c56
parent d3504987
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -160,6 +160,11 @@ public final class InputWindowHandle {
     */
    public Matrix transform;

    /**
     * The alpha value returned from SurfaceFlinger. This will be ignored if passed as input data.
     */
    public float alpha;

    /**
     * The input token for the window to which focus should be transferred when this input window
     * can be successfully focused. If null, this input window will not transfer its focus to
@@ -204,6 +209,7 @@ public final class InputWindowHandle {
        }
        focusTransferTarget = other.focusTransferTarget;
        contentSize = new Size(other.contentSize.getWidth(), other.contentSize.getHeight());
        alpha = other.alpha;
    }

    @Override
@@ -217,6 +223,7 @@ public final class InputWindowHandle {
                .append(", displayId=").append(displayId)
                .append(", isClone=").append((inputConfig & InputConfig.CLONE) != 0)
                .append(", contentSize=").append(contentSize)
                .append(", alpha=").append(alpha)
                .toString();

    }
+5 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ static struct {
    jfieldID transform;
    jfieldID windowToken;
    jfieldID focusTransferTarget;
    jfieldID alpha;
} gInputWindowHandleClassInfo;

static struct {
@@ -325,6 +326,8 @@ jobject android_view_InputWindowHandle_fromWindowInfo(JNIEnv* env, gui::WindowIn
    env->SetObjectField(inputWindowHandle, gInputWindowHandleClassInfo.windowToken,
                        javaObjectForIBinder(env, windowInfo.windowToken));

    env->SetFloatField(inputWindowHandle, gInputWindowHandleClassInfo.alpha, windowInfo.alpha);

    return inputWindowHandle;
}

@@ -446,6 +449,8 @@ int register_android_view_InputWindowHandle(JNIEnv* env) {
    GET_FIELD_ID(gInputWindowHandleClassInfo.touchableRegionSurfaceControl.ctrl, clazz,
            "touchableRegionSurfaceControl", "Ljava/lang/ref/WeakReference;");

    GET_FIELD_ID(gInputWindowHandleClassInfo.alpha, clazz, "alpha", "F");

    jclass surfaceControlClazz;
    FIND_CLASS(surfaceControlClazz, "android/view/SurfaceControl");
    GET_FIELD_ID(gInputWindowHandleClassInfo.touchableRegionSurfaceControl.mNativeObject,