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

Commit d57f82ec authored by Wenhui Yang's avatar Wenhui Yang Committed by Android (Google) Code Review
Browse files

Merge "Capture transaction traces before system reboot" into main

parents 924d4f1b c40c077e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -302,6 +302,7 @@ public final class SurfaceControl implements Parcelable {
                                                                long desiredPresentTimeNanos);
    private static native void nativeSetFrameTimeline(long transactionObj,
                                                           long vsyncId);
    private static native void nativeNotifyShutdown();

    /**
     * Transforms that can be applied to buffers as they are displayed to a window.
@@ -4765,4 +4766,11 @@ public final class SurfaceControl implements Parcelable {
        return nativeGetStalledTransactionInfo(pid);
    }

    /**
     * Notify the SurfaceFlinger to capture transaction traces when shutdown.
     * @hide
     */
    public static void notifyShutdown() {
        nativeNotifyShutdown();
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -2201,6 +2201,10 @@ static jobject nativeGetStalledTransactionInfo(JNIEnv* env, jclass clazz, jint p
    return jStalledTransactionInfo;
}

static void nativeNotifyShutdown() {
    SurfaceComposerClient::notifyShutdown();
}

// ----------------------------------------------------------------------------

SurfaceControl* android_view_SurfaceControl_getNativeSurfaceControl(JNIEnv* env,
@@ -2476,6 +2480,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*) nativeGetStalledTransactionInfo },
    {"nativeSetDesiredPresentTimeNanos", "(JJ)V",
            (void*) nativeSetDesiredPresentTimeNanos },
    {"nativeNotifyShutdown", "()V",
            (void*)nativeNotifyShutdown },
        // clang-format on
};

+5 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import android.util.ArrayMap;
import android.util.Log;
import android.util.Slog;
import android.util.TimingsTraceLog;
import android.view.SurfaceControl;
import android.view.WindowManager;

import com.android.internal.annotations.VisibleForTesting;
@@ -459,6 +460,10 @@ public final class ShutdownThread extends Thread {
        metricShutdownStart();
        metricStarted(METRIC_SYSTEM_SERVER);

        // Notify SurfaceFlinger that the device is shutting down.
        // Transaction traces should be captured at this stage.
        SurfaceControl.notifyShutdown();

        // Start dumping check points for this shutdown in a separate thread.
        Thread dumpCheckPointsThread = ShutdownCheckPoints.newDumpThread(
                new File(CHECK_POINTS_FILE_BASENAME));