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

Commit 94aa4944 authored by Pablo Gamito's avatar Pablo Gamito Committed by Android (Google) Code Review
Browse files

Merge "Add WM API to start and stop transcation trace"

parents 3011a698 a8ed28ba
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -748,6 +748,11 @@ interface IWindowManager
     */
    void setLayerTracingFlags(int flags);

    /**
     * Toggle active SurfaceFlinger transaction tracing.
     */
    void setActiveTransactionTracing(boolean active);

    /**
     * Forwards a scroll capture request to the appropriate window, if available.
     *
+35 −0
Original line number Diff line number Diff line
@@ -8783,6 +8783,41 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    /**
     * Toggle active transaction tracing.
     * Setting to true increases the buffer size for active debugging.
     * Setting to false resets the buffer size and dumps the trace to file.
     */
    public void setActiveTransactionTracing(boolean active) {
        if (!checkCallingPermission(
                android.Manifest.permission.DUMP, "setActiveTransactionTracing()")) {
            throw new SecurityException("Requires DUMP permission");
        }

        final long token = Binder.clearCallingIdentity();
        try {
            Parcel data = null;
            try {
                IBinder sf = ServiceManager.getService("SurfaceFlinger");
                if (sf != null) {
                    data = Parcel.obtain();
                    data.writeInterfaceToken("android.ui.ISurfaceComposer");
                    data.writeInt(active ? 1 : 0);
                    sf.transact(/* TRANSACTION_TRACE_CONTROL_CODE */ 1041, data,
                            null, 0 /* flags */);
                }
            } catch (RemoteException e) {
                Slog.e(TAG, "Failed to set transaction tracing");
            } finally {
                if (data != null) {
                    data.recycle();
                }
            }
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    @Override
    public boolean mirrorDisplay(int displayId, SurfaceControl outSurfaceControl) {
        if (!checkCallingPermission(READ_FRAME_BUFFER, "mirrorDisplay()")) {