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

Commit 0f50d93d authored by Pascal Muetschard's avatar Pascal Muetschard Committed by Pascal Mütschard
Browse files

Expose the flush jank data transaction via JNI.

Bug: 235178314
Bug: 221393601
Bug: 225105422
Test: atest SurfaceFlinger_test
Change-Id: I119a5264dfb7b831dc3d0bf051ddcf1a0ffe7e60
parent 8b047403
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -173,6 +173,7 @@ public final class SurfaceControl implements Parcelable {
            boolean isTrustedOverlay);
    private static native void nativeSetDropInputMode(
            long transactionObj, long nativeObject, int flags);
    private static native void nativeSurfaceFlushJankData(long nativeSurfaceObject);
    private static native boolean nativeClearContentFrameStats(long nativeObject);
    private static native boolean nativeGetContentFrameStats(long nativeObject, WindowContentFrameStats outStats);
    private static native boolean nativeClearAnimationFrameStats();
@@ -3884,6 +3885,15 @@ public final class SurfaceControl implements Parcelable {
            return this;
        }

        /**
         * Sends a flush jank data transaction for the given surface.
         * @hide
         */
        public static void sendSurfaceFlushJankData(SurfaceControl sc) {
            sc.checkNotReleased();
            nativeSurfaceFlushJankData(sc.mNativeObject);
        }

        /**
         * @hide
         */
+7 −0
Original line number Diff line number Diff line
@@ -951,6 +951,11 @@ static void nativeSetDropInputMode(JNIEnv* env, jclass clazz, jlong transactionO
    transaction->setDropInputMode(ctrl, static_cast<gui::DropInputMode>(mode));
}

static void nativeSurfaceFlushJankData(JNIEnv* env, jclass clazz, jlong nativeObject) {
    SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObject);
    SurfaceComposerClient::Transaction::sendSurfaceFlushJankDataTransaction(ctrl);
}

static void nativeSanitize(JNIEnv* env, jclass clazz, jlong transactionObj) {
    auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
    transaction->sanitize();
@@ -2246,6 +2251,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*)nativeGetLayerId },
    {"nativeSetDropInputMode", "(JJI)V",
             (void*)nativeSetDropInputMode },
    {"nativeSurfaceFlushJankData", "(J)V",
            (void*)nativeSurfaceFlushJankData },
    {"nativeAddTransactionCommittedListener", "(JLandroid/view/SurfaceControl$TransactionCommittedListener;)V",
            (void*) nativeAddTransactionCommittedListener },
    {"nativeSetTrustedPresentationCallback", "(JJJLandroid/view/SurfaceControl$TrustedPresentationThresholds;)V",