Merge "Using InteractionJankMonitor only in S+" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
29a7cd05d0
@@ -17,6 +17,7 @@
|
|||||||
package com.android.systemui.shared.system;
|
package com.android.systemui.shared.system;
|
||||||
|
|
||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
|
import android.os.Build;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.android.internal.jank.InteractionJankMonitor;
|
import com.android.internal.jank.InteractionJankMonitor;
|
||||||
@@ -58,23 +59,48 @@ public final class InteractionJankMonitorWrapper {
|
|||||||
public @interface CujType {
|
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 =
|
Configuration.Builder builder =
|
||||||
new Configuration.Builder(cujType)
|
new Configuration.Builder(cujType)
|
||||||
.setView(v)
|
.setView(v)
|
||||||
.setTimeout(timeout);
|
.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user