Merge "Instrument jank of CUJ take screen shot" into tm-dev am: 009099e89d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17729988 Change-Id: I18dc9808cccc8c0a3127c781845d4d4966988178 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -71,6 +71,7 @@ import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_IN
|
|||||||
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SUW_LOADING_TO_NEXT_FLOW;
|
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SUW_LOADING_TO_NEXT_FLOW;
|
||||||
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SUW_LOADING_TO_SHOW_INFO_WITH_ACTIONS;
|
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SUW_LOADING_TO_SHOW_INFO_WITH_ACTIONS;
|
||||||
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SUW_SHOW_FUNCTION_SCREEN_WITH_ACTIONS;
|
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SUW_SHOW_FUNCTION_SCREEN_WITH_ACTIONS;
|
||||||
|
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__TAKE_SCREENSHOT;
|
||||||
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__UNFOLD_ANIM;
|
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__UNFOLD_ANIM;
|
||||||
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__USER_SWITCH;
|
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__USER_SWITCH;
|
||||||
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__WALLPAPER_TRANSITION;
|
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__WALLPAPER_TRANSITION;
|
||||||
@@ -194,6 +195,7 @@ public class InteractionJankMonitor {
|
|||||||
public static final int CUJ_LOCKSCREEN_LAUNCH_CAMERA = 51; // reserved.
|
public static final int CUJ_LOCKSCREEN_LAUNCH_CAMERA = 51; // reserved.
|
||||||
public static final int CUJ_SPLIT_SCREEN_RESIZE = 52;
|
public static final int CUJ_SPLIT_SCREEN_RESIZE = 52;
|
||||||
public static final int CUJ_SETTINGS_SLIDER = 53;
|
public static final int CUJ_SETTINGS_SLIDER = 53;
|
||||||
|
public static final int CUJ_TAKE_SCREENSHOT = 54;
|
||||||
|
|
||||||
private static final int NO_STATSD_LOGGING = -1;
|
private static final int NO_STATSD_LOGGING = -1;
|
||||||
|
|
||||||
@@ -256,6 +258,7 @@ public class InteractionJankMonitor {
|
|||||||
UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LOCKSCREEN_LAUNCH_CAMERA,
|
UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LOCKSCREEN_LAUNCH_CAMERA,
|
||||||
UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SPLIT_SCREEN_RESIZE,
|
UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SPLIT_SCREEN_RESIZE,
|
||||||
UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SETTINGS_SLIDER,
|
UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SETTINGS_SLIDER,
|
||||||
|
UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__TAKE_SCREENSHOT,
|
||||||
};
|
};
|
||||||
|
|
||||||
private static volatile InteractionJankMonitor sInstance;
|
private static volatile InteractionJankMonitor sInstance;
|
||||||
@@ -330,6 +333,7 @@ public class InteractionJankMonitor {
|
|||||||
CUJ_LOCKSCREEN_LAUNCH_CAMERA,
|
CUJ_LOCKSCREEN_LAUNCH_CAMERA,
|
||||||
CUJ_SPLIT_SCREEN_RESIZE,
|
CUJ_SPLIT_SCREEN_RESIZE,
|
||||||
CUJ_SETTINGS_SLIDER,
|
CUJ_SETTINGS_SLIDER,
|
||||||
|
CUJ_TAKE_SCREENSHOT,
|
||||||
})
|
})
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface CujType {
|
public @interface CujType {
|
||||||
@@ -756,6 +760,8 @@ public class InteractionJankMonitor {
|
|||||||
return "CUJ_SPLIT_SCREEN_RESIZE";
|
return "CUJ_SPLIT_SCREEN_RESIZE";
|
||||||
case CUJ_SETTINGS_SLIDER:
|
case CUJ_SETTINGS_SLIDER:
|
||||||
return "SETTINGS_SLIDER";
|
return "SETTINGS_SLIDER";
|
||||||
|
case CUJ_TAKE_SCREENSHOT:
|
||||||
|
return "TAKE_SCREENSHOT";
|
||||||
}
|
}
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -484,6 +484,7 @@ public class ScreenshotController {
|
|||||||
setWindowFocusable(false);
|
setWindowFocusable(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
mScreenshotView.setDefaultTimeoutMillis(mScreenshotHandler.getDefaultTimeoutMillis());
|
||||||
|
|
||||||
mScreenshotView.setOnKeyListener((v, keyCode, event) -> {
|
mScreenshotView.setOnKeyListener((v, keyCode, event) -> {
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.android.systemui.screenshot;
|
|||||||
|
|
||||||
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
|
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
|
||||||
|
|
||||||
|
import static com.android.internal.jank.InteractionJankMonitor.CUJ_TAKE_SCREENSHOT;
|
||||||
import static com.android.systemui.screenshot.LogConfig.DEBUG_ANIM;
|
import static com.android.systemui.screenshot.LogConfig.DEBUG_ANIM;
|
||||||
import static com.android.systemui.screenshot.LogConfig.DEBUG_DISMISS;
|
import static com.android.systemui.screenshot.LogConfig.DEBUG_DISMISS;
|
||||||
import static com.android.systemui.screenshot.LogConfig.DEBUG_INPUT;
|
import static com.android.systemui.screenshot.LogConfig.DEBUG_INPUT;
|
||||||
@@ -83,6 +84,7 @@ import android.widget.LinearLayout;
|
|||||||
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
|
||||||
|
import com.android.internal.jank.InteractionJankMonitor;
|
||||||
import com.android.internal.logging.UiEventLogger;
|
import com.android.internal.logging.UiEventLogger;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.screenshot.ScreenshotController.SavedImageData.ActionTransition;
|
import com.android.systemui.screenshot.ScreenshotController.SavedImageData.ActionTransition;
|
||||||
@@ -166,6 +168,9 @@ public class ScreenshotView extends FrameLayout implements
|
|||||||
private final ArrayList<OverlayActionChip> mSmartChips = new ArrayList<>();
|
private final ArrayList<OverlayActionChip> mSmartChips = new ArrayList<>();
|
||||||
private PendingInteraction mPendingInteraction;
|
private PendingInteraction mPendingInteraction;
|
||||||
|
|
||||||
|
private final InteractionJankMonitor mInteractionJankMonitor;
|
||||||
|
private long mDefaultTimeoutOfTimeoutHandler;
|
||||||
|
|
||||||
private enum PendingInteraction {
|
private enum PendingInteraction {
|
||||||
PREVIEW,
|
PREVIEW,
|
||||||
EDIT,
|
EDIT,
|
||||||
@@ -189,6 +194,7 @@ public class ScreenshotView extends FrameLayout implements
|
|||||||
Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
mResources = mContext.getResources();
|
mResources = mContext.getResources();
|
||||||
|
mInteractionJankMonitor = getInteractionJankMonitorInstance();
|
||||||
|
|
||||||
mFixedSize = mResources.getDimensionPixelSize(R.dimen.overlay_x_scale);
|
mFixedSize = mResources.getDimensionPixelSize(R.dimen.overlay_x_scale);
|
||||||
|
|
||||||
@@ -229,6 +235,14 @@ public class ScreenshotView extends FrameLayout implements
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private InteractionJankMonitor getInteractionJankMonitorInstance() {
|
||||||
|
return InteractionJankMonitor.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDefaultTimeoutMillis(long timeout) {
|
||||||
|
mDefaultTimeoutOfTimeoutHandler = timeout;
|
||||||
|
}
|
||||||
|
|
||||||
public void hideScrollChip() {
|
public void hideScrollChip() {
|
||||||
mScrollChip.setVisibility(View.GONE);
|
mScrollChip.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
@@ -395,6 +409,9 @@ public class ScreenshotView extends FrameLayout implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDismissComplete() {
|
public void onDismissComplete() {
|
||||||
|
if (mInteractionJankMonitor.isInstrumenting(CUJ_TAKE_SCREENSHOT)) {
|
||||||
|
mInteractionJankMonitor.end(CUJ_TAKE_SCREENSHOT);
|
||||||
|
}
|
||||||
mCallbacks.onDismiss();
|
mCallbacks.onDismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -594,6 +611,20 @@ public class ScreenshotView extends FrameLayout implements
|
|||||||
dropInAnimation.play(borderFadeIn).after(toCorner);
|
dropInAnimation.play(borderFadeIn).after(toCorner);
|
||||||
|
|
||||||
dropInAnimation.addListener(new AnimatorListenerAdapter() {
|
dropInAnimation.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationCancel(Animator animation) {
|
||||||
|
mInteractionJankMonitor.cancel(CUJ_TAKE_SCREENSHOT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animator animation) {
|
||||||
|
InteractionJankMonitor.Configuration.Builder builder =
|
||||||
|
InteractionJankMonitor.Configuration.Builder.withView(
|
||||||
|
CUJ_TAKE_SCREENSHOT, mScreenshotPreview)
|
||||||
|
.setTag("DropIn");
|
||||||
|
mInteractionJankMonitor.begin(builder);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
if (DEBUG_ANIM) {
|
if (DEBUG_ANIM) {
|
||||||
@@ -620,7 +651,7 @@ public class ScreenshotView extends FrameLayout implements
|
|||||||
mScreenshotPreview.setX(finalPos.x - mScreenshotPreview.getWidth() / 2f);
|
mScreenshotPreview.setX(finalPos.x - mScreenshotPreview.getWidth() / 2f);
|
||||||
mScreenshotPreview.setY(finalPos.y - mScreenshotPreview.getHeight() / 2f);
|
mScreenshotPreview.setY(finalPos.y - mScreenshotPreview.getHeight() / 2f);
|
||||||
requestLayout();
|
requestLayout();
|
||||||
|
mInteractionJankMonitor.end(CUJ_TAKE_SCREENSHOT);
|
||||||
createScreenshotActionsShadeAnimation().start();
|
createScreenshotActionsShadeAnimation().start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -691,6 +722,28 @@ public class ScreenshotView extends FrameLayout implements
|
|||||||
mActionsContainer.setVisibility(View.VISIBLE);
|
mActionsContainer.setVisibility(View.VISIBLE);
|
||||||
mActionsContainerBackground.setVisibility(View.VISIBLE);
|
mActionsContainerBackground.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
animator.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationCancel(Animator animation) {
|
||||||
|
mInteractionJankMonitor.cancel(CUJ_TAKE_SCREENSHOT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
mInteractionJankMonitor.end(CUJ_TAKE_SCREENSHOT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animator animation) {
|
||||||
|
InteractionJankMonitor.Configuration.Builder builder =
|
||||||
|
InteractionJankMonitor.Configuration.Builder.withView(
|
||||||
|
CUJ_TAKE_SCREENSHOT, mScreenshotStatic)
|
||||||
|
.setTag("Actions")
|
||||||
|
.setTimeout(mDefaultTimeoutOfTimeoutHandler);
|
||||||
|
mInteractionJankMonitor.begin(builder);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
animator.addUpdateListener(animation -> {
|
animator.addUpdateListener(animation -> {
|
||||||
float t = animation.getAnimatedFraction();
|
float t = animation.getAnimatedFraction();
|
||||||
float containerAlpha = t < alphaFraction ? t / alphaFraction : 1;
|
float containerAlpha = t < alphaFraction ? t / alphaFraction : 1;
|
||||||
|
|||||||
@@ -72,6 +72,10 @@ public class TimeoutHandler extends Handler {
|
|||||||
mDefaultTimeout = timeout;
|
mDefaultTimeout = timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getDefaultTimeoutMillis() {
|
||||||
|
return mDefaultTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel the current timeout, if any. To reset the delayed runnable use resetTimeout instead.
|
* Cancel the current timeout, if any. To reset the delayed runnable use resetTimeout instead.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user