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

Commit 99fa3031 authored by Melody Hsu's avatar Melody Hsu
Browse files

Support SurfaceControlRegistry logs in native

Log state changes in native when a transaction is
merged or applied.

Bug: b/366484871
Test: adb logcat to check for logs
Flag: EXEMPT logging
Change-Id: Ie61c2655609f4513291d55a7a82570e392086fb8
parent 66ee0072
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -311,6 +311,7 @@ public final class SurfaceControl implements Parcelable {
    private static native void nativeNotifyShutdown();
    private static native void nativeSetLuts(long transactionObj, long nativeObject,
            float[] buffers, int[] slots, int[] dimensions, int[] sizes, int[] samplingKeys);
    private static native void nativeEnableDebugLogCallPoints(long transactionObj);

    /**
     * Transforms that can be applied to buffers as they are displayed to a window.
@@ -4552,7 +4553,6 @@ public final class SurfaceControl implements Parcelable {
        }

        /**
         * TODO(b/366484871): To be removed once we have some logging in native
         * This is called when BlastBufferQueue.mergeWithNextTransaction() is called from java, and
         * for the purposes of logging that path.
         */
@@ -4563,6 +4563,7 @@ public final class SurfaceControl implements Parcelable {
                if (mCalls != null) {
                    mCalls.clear();
                }
                nativeEnableDebugLogCallPoints(mNativeObject);
            }
        }

+6 −0
Original line number Diff line number Diff line
@@ -2380,6 +2380,11 @@ SurfaceComposerClient::Transaction* android_view_SurfaceTransaction_getNativeSur
    }
}

static void nativeEnableDebugLogCallPoints(JNIEnv* env, jclass clazz, jlong transactionObj) {
    auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
    transaction->enableDebugLogCallPoints();
}

static const JNINativeMethod sSurfaceControlMethods[] = {
        // clang-format off
    {"nativeCreate", "(Landroid/view/SurfaceSession;Ljava/lang/String;IIIIJLandroid/os/Parcel;)J",
@@ -2626,6 +2631,7 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
    {"nativeNotifyShutdown", "()V",
            (void*)nativeNotifyShutdown },
    {"nativeSetLuts", "(JJ[F[I[I[I[I)V", (void*)nativeSetLuts },
    {"nativeEnableDebugLogCallPoints", "(J)V", (void*)nativeEnableDebugLogCallPoints },
        // clang-format on
};