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

Commit eedc3d2b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Using InteractionJankMonitor only in S+" into sc-dev am: 29a7cd05

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14986721

Change-Id: I41507fd2c8a9f83422304c27e8e50a83a8468a31
parents 58774b9c 29a7cd05
Loading
Loading
Loading
Loading
+34 −8
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.shared.system;

import android.annotation.IntDef;
import android.os.Build;
import android.view.View;

import com.android.internal.jank.InteractionJankMonitor;
@@ -58,23 +59,48 @@ public final class InteractionJankMonitorWrapper {
    public @interface CujType {
    }

    public static boolean begin(View v, @CujType int cujType) {
        return InteractionJankMonitor.getInstance().begin(v, cujType);
    /**
     * Begin a trace session.
     *
     * @param v       an attached view.
     * @param cujType the specific {@link InteractionJankMonitor.CujType}.
     */
    public static void begin(View v, @CujType int cujType) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) return;
        InteractionJankMonitor.getInstance().begin(v, cujType);
    }

    public static boolean begin(View v, @CujType int cujType, long timeout) {
    /**
     * Begin a trace session.
     *
     * @param v       an attached view.
     * @param cujType the specific {@link InteractionJankMonitor.CujType}.
     * @param timeout duration to cancel the instrumentation in ms
     */
    public static void begin(View v, @CujType int cujType, long timeout) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) return;
        Configuration.Builder builder =
                new Configuration.Builder(cujType)
                        .setView(v)
                        .setTimeout(timeout);
        return InteractionJankMonitor.getInstance().begin(builder);
        InteractionJankMonitor.getInstance().begin(builder);
    }

    public static boolean end(@CujType int cujType) {
        return InteractionJankMonitor.getInstance().end(cujType);
    /**
     * End a trace session.
     *
     * @param cujType the specific {@link InteractionJankMonitor.CujType}.
     */
    public static void end(@CujType int cujType) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) return;
        InteractionJankMonitor.getInstance().end(cujType);
    }

    public static boolean cancel(@CujType int cujType) {
        return InteractionJankMonitor.getInstance().cancel(cujType);
    /**
     * Cancel the trace session.
     */
    public static void cancel(@CujType int cujType) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) return;
        InteractionJankMonitor.getInstance().cancel(cujType);
    }
}