Merge "Using InteractionJankMonitor only in S+" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-06-17 20:13:38 +00:00
committed by Android (Google) Code Review

View File

@@ -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);
}
}