Merge "Annotating open-Launcher transition in trace files" into ub-launcher3-master

This commit is contained in:
TreeHugger Robot
2020-09-08 22:27:58 +00:00
committed by Android (Google) Code Review
2 changed files with 26 additions and 0 deletions
@@ -57,6 +57,7 @@ import android.graphics.drawable.Drawable;
import android.os.CancellationSignal;
import android.os.Handler;
import android.os.Looper;
import android.os.Trace;
import android.util.Pair;
import android.view.View;
@@ -137,6 +138,7 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
// Progress = 0: All apps is fully pulled up, Progress = 1: All apps is fully pulled down.
public static final float ALL_APPS_PROGRESS_OFF_SCREEN = 1.3059858f;
public static final String TRANSITION_OPEN_LAUNCHER = "transition:OpenLauncher";
protected final BaseQuickstepLauncher mLauncher;
@@ -853,6 +855,21 @@ 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);
}
});
}
// Only register the content animation for cancellation when state changes
mLauncher.getStateManager().setCurrentAnimation(anim);
@@ -19,6 +19,7 @@ import static android.widget.Toast.LENGTH_SHORT;
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER;
import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
import static com.android.launcher3.QuickstepAppTransitionManagerImpl.TRANSITION_OPEN_LAUNCHER;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
@@ -53,6 +54,7 @@ import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Build;
import android.os.SystemClock;
import android.os.Trace;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
@@ -1142,6 +1144,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
anim.addAnimatorListener(new AnimationSuccessListener() {
@Override
public void onAnimationStart(Animator animation) {
Trace.beginAsyncSection(TRANSITION_OPEN_LAUNCHER, 0);
if (mActivity != null) {
removeLiveTileOverlay();
}
@@ -1156,6 +1159,12 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
maybeUpdateRecentsAttachedState(false);
mActivityInterface.onSwipeUpToHomeComplete(mDeviceState);
}
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
Trace.endAsyncSection(TRANSITION_OPEN_LAUNCHER, 0);
}
});
if (mRecentsAnimationTargets != null) {
mRecentsAnimationTargets.addReleaseCheck(anim);