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

Commit ddaebe93 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "EdgeExtension: Add SurfaceControl.Transaction API" into main

parents 30ff6173 4e00a7a3
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -164,6 +164,9 @@ public final class SurfaceControl implements Parcelable {
            float width, float height, float vecX, float vecY,
            float maxStretchAmountX, float maxStretchAmountY, float childRelativeLeft,
            float childRelativeTop, float childRelativeRight, float childRelativeBottom);
    private static native void nativeSetEdgeExtensionEffect(long transactionObj, long nativeObj,
                                                            boolean leftEdge, boolean rightEdge,
                                                            boolean topEdge, boolean bottomEdge);
    private static native void nativeSetTrustedOverlay(long transactionObj, long nativeObject,
            int isTrustedOverlay);
    private static native void nativeSetDropInputMode(
@@ -3510,6 +3513,19 @@ public final class SurfaceControl implements Parcelable {
            return this;
        }

        /**
         * @hide
         */
        public Transaction setEdgeExtensionEffect(SurfaceControl sc, int edge) {
            checkPreconditions(sc);

            nativeSetEdgeExtensionEffect(
                    mNativeObject, sc.mNativeObject,
                    (edge & WindowInsets.Side.LEFT) != 0, (edge & WindowInsets.Side.RIGHT) != 0,
                    (edge & WindowInsets.Side.TOP) != 0, (edge & WindowInsets.Side.BOTTOM) != 0);
            return this;
        }

        /**
         * @hide
         */
+17 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <android/graphics/properties.h>
#include <android/graphics/region.h>
#include <android/gui/BnWindowInfosReportedListener.h>
#include <android/gui/EdgeExtensionParameters.h>
#include <android/gui/JankData.h>
#include <android/hardware/display/IDeviceProductInfoConstants.h>
#include <android/os/IInputConstants.h>
@@ -799,6 +800,20 @@ static void nativeSetStretchEffect(JNIEnv* env, jclass clazz, jlong transactionO
    transaction->setStretchEffect(ctrl, stretch);
}

static void nativeSetEdgeExtensionEffect(JNIEnv* env, jclass clazz, jlong transactionObj,
                                         jlong nativeObj, jboolean leftEdge, jboolean rightEdge,
                                         jboolean topEdge, jboolean bottomEdge) {
    auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
    auto* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObj);

    auto effect = gui::EdgeExtensionParameters();
    effect.extendLeft = leftEdge;
    effect.extendRight = rightEdge;
    effect.extendTop = topEdge;
    effect.extendBottom = bottomEdge;
    transaction->setEdgeExtensionEffect(ctrl, effect);
}

static void nativeSetFlags(JNIEnv* env, jclass clazz, jlong transactionObj,
        jlong nativeObject, jint flags, jint mask) {
    auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
@@ -2340,6 +2355,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*)nativeSetBlurRegions },
    {"nativeSetStretchEffect", "(JJFFFFFFFFFF)V",
            (void*) nativeSetStretchEffect },
    {"nativeSetEdgeExtensionEffect", "(JJZZZZ)V",
            (void*) nativeSetEdgeExtensionEffect },
    {"nativeSetShadowRadius", "(JJF)V",
            (void*)nativeSetShadowRadius },
    {"nativeSetFrameRate", "(JJFII)V",