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

Commit 0ada73d3 authored by Pablo Gamito's avatar Pablo Gamito
Browse files

Expose transaction id

We will need to dump the transaction id in transition traces to be able to reliably associated the start and end of a transition to the states in the SF trace.

Bug: 230462538
Test: N/A
Change-Id: I2a040503d9e1f4f4636549bae6b7fe12d5632049
parent dc1cde0d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ public final class SurfaceControl implements Parcelable {
    private static native void nativeSetAnimationTransaction(long transactionObj);
    private static native void nativeSetEarlyWakeupStart(long transactionObj);
    private static native void nativeSetEarlyWakeupEnd(long transactionObj);
    private static native long nativeGetTransactionId(long transactionObj);

    private static native void nativeSetLayer(long transactionObj, long nativeObject, int zorder);
    private static native void nativeSetRelativeLayer(long transactionObj, long nativeObject,
@@ -3536,6 +3537,15 @@ public final class SurfaceControl implements Parcelable {
            return this;
        }

        /**
         * @hide
         * @return The transaction's current id.
         *         The id changed every time the transaction is applied.
         */
        public long getId() {
            return nativeGetTransactionId(mNativeObject);
        }

        /**
         * Sets an arbitrary piece of metadata on the surface. This is a helper for int data.
         * @hide
+7 −0
Original line number Diff line number Diff line
@@ -580,6 +580,11 @@ static void nativeSetEarlyWakeupEnd(JNIEnv* env, jclass clazz, jlong transaction
    transaction->setEarlyWakeupEnd();
}

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

static void nativeSetLayer(JNIEnv* env, jclass clazz, jlong transactionObj,
        jlong nativeObject, jint zorder) {
    auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
@@ -2103,6 +2108,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*)nativeSetEarlyWakeupStart },
    {"nativeSetEarlyWakeupEnd", "(J)V",
            (void*)nativeSetEarlyWakeupEnd },
    {"nativeGetTransactionId", "(J)J",
                (void*)nativeGetTransactionId },
    {"nativeSetLayer", "(JJI)V",
            (void*)nativeSetLayer },
    {"nativeSetRelativeLayer", "(JJJI)V",