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

Commit 6266d8c9 authored by Pablo Ceballos's avatar Pablo Ceballos Committed by Android (Google) Code Review
Browse files

Merge "Java bindings for SurfaceControl::setFinalCrop" into nyc-dev

parents a62a0f72 27982e65
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ public class SurfaceControl {
    private static native void nativeSetMatrix(long nativeObject, float dsdx, float dtdx, float dsdy, float dtdy);
    private static native void nativeSetFlags(long nativeObject, int flags, int mask);
    private static native void nativeSetWindowCrop(long nativeObject, int l, int t, int r, int b);
    private static native void nativeSetFinalCrop(long nativeObject, int l, int t, int r, int b);
    private static native void nativeSetLayerStack(long nativeObject, int layerStack);

    private static native boolean nativeClearContentFrameStats(long nativeObject);
@@ -456,6 +457,16 @@ public class SurfaceControl {
        }
    }

    public void setFinalCrop(Rect crop) {
        checkNotReleased();
        if (crop != null) {
            nativeSetFinalCrop(mNativeObject,
                crop.left, crop.top, crop.right, crop.bottom);
        } else {
            nativeSetFinalCrop(mNativeObject, 0, 0, 0, 0);
        }
    }

    public void setLayerStack(int layerStack) {
        checkNotReleased();
        nativeSetLayerStack(mNativeObject, layerStack);
+12 −0
Original line number Diff line number Diff line
@@ -309,6 +309,16 @@ static void nativeSetWindowCrop(JNIEnv* env, jclass clazz, jlong nativeObject,
    }
}

static void nativeSetFinalCrop(JNIEnv* env, jclass clazz, jlong nativeObject,
        jint l, jint t, jint r, jint b) {
    SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
    Rect crop(l, t, r, b);
    status_t err = ctrl->setFinalCrop(crop);
    if (err < 0 && err != NO_INIT) {
        doThrowIAE(env);
    }
}

static void nativeSetLayerStack(JNIEnv* env, jclass clazz, jlong nativeObject, jint layerStack) {
    SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
    status_t err = ctrl->setLayerStack(layerStack);
@@ -630,6 +640,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*)nativeSetFlags },
    {"nativeSetWindowCrop", "(JIIII)V",
            (void*)nativeSetWindowCrop },
    {"nativeSetFinalCrop", "(JIIII)V",
            (void*)nativeSetFinalCrop },
    {"nativeSetLayerStack", "(JI)V",
            (void*)nativeSetLayerStack },
    {"nativeGetBuiltInDisplay", "(I)Landroid/os/IBinder;",