Adding jank tracing for some CUJs
Test: checking traces Bug: 169220800 Bug: 169220955 Bug: 169221267 Bug: 169220924 Bug: 169220843 Change-Id: Ia32635764c78139f7e9a616c9fe70ae1a507c1b2
This commit is contained in:
1 parent
cc7b860566
commit
b8a30ef68a
3 files changed
+59
-34
No files matched your search
@@ -66,6 +66,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
|
||||
import com.android.launcher3.allapps.AllAppsTransitionController;
|
||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.shortcuts.DeepShortcutView;
|
||||
@@ -81,6 +82,7 @@ import com.android.quickstep.util.StaggeredWorkspaceAnim;
|
||||
import com.android.quickstep.util.SurfaceTransactionApplier;
|
||||
import com.android.systemui.shared.system.ActivityCompat;
|
||||
import com.android.systemui.shared.system.ActivityOptionsCompat;
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
|
||||
import com.android.systemui.shared.system.RemoteAnimationDefinitionCompat;
|
||||
@@ -791,6 +793,36 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
== PackageManager.PERMISSION_GRANTED;
|
||||
}
|
||||
|
||||
private void addCujInstrumentation(Animator anim, int cuj, String transition) {
|
||||
if (Trace.isEnabled()) {
|
||||
anim.addListener(new AnimationSuccessListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
Trace.beginAsyncSection(transition, 0);
|
||||
InteractionJankMonitorWrapper.begin(cuj);
|
||||
super.onAnimationStart(animation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
super.onAnimationCancel(animation);
|
||||
InteractionJankMonitorWrapper.cancel(cuj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationSuccess(Animator animator) {
|
||||
InteractionJankMonitorWrapper.end(cuj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
Trace.endAsyncSection(TRANSITION_OPEN_LAUNCHER, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remote animation runner for animation from the app to Launcher, including recents.
|
||||
*/
|
||||
@@ -855,21 +887,9 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
// is initialized.
|
||||
if (launcherIsATargetWithMode(appTargets, MODE_OPENING)
|
||||
|| mLauncher.isForceInvisible()) {
|
||||
if (Trace.isEnabled()) {
|
||||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
Trace.beginAsyncSection(TRANSITION_OPEN_LAUNCHER, 0);
|
||||
super.onAnimationStart(animation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
Trace.endAsyncSection(TRANSITION_OPEN_LAUNCHER, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
addCujInstrumentation(
|
||||
anim, InteractionJankMonitorWrapper.CUJ_APP_CLOSE_TO_HOME,
|
||||
TRANSITION_OPEN_LAUNCHER);
|
||||
// Only register the content animation for cancellation when state changes
|
||||
mLauncher.getStateManager().setCurrentAnimation(anim);
|
||||
|
||||
@@ -938,25 +958,12 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
launcherClosing);
|
||||
}
|
||||
|
||||
if (Trace.isEnabled()) {
|
||||
final String section =
|
||||
launchingFromRecents
|
||||
? TRANSITION_LAUNCH_FROM_RECENTS : TRANSITION_LAUNCH_FROM_ICON;
|
||||
|
||||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
Trace.beginAsyncSection(section, 0);
|
||||
super.onAnimationStart(animation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
Trace.endAsyncSection(section, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
addCujInstrumentation(anim,
|
||||
launchingFromRecents
|
||||
? InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_RECENTS
|
||||
: InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_ICON,
|
||||
launchingFromRecents
|
||||
? TRANSITION_LAUNCH_FROM_RECENTS : TRANSITION_LAUNCH_FROM_ICON);
|
||||
|
||||
if (launcherClosing) {
|
||||
anim.addListener(mForceInvisibleListener);
|
||||
|
||||
Reference in new issue
Block a user