Add LAUNCHER_ALL_APPS_SEARCH_BACK jank instrumentation

Bug: 330405993
Test: prefetto trace TBD
Flag: aconfig com.android.launcher3.enable_predictive_back_gesture TEAMFOOD
Change-Id: I1fb2876fb29bc360cbb8dc8c1605215f28383c3c
This commit is contained in:
Fengjiang Li
2024-03-28 16:24:39 -07:00
parent 6c585ca7d7
commit 01cc273537
4 changed files with 46 additions and 9 deletions
@@ -44,6 +44,7 @@ import android.view.View;
import android.view.animation.Interpolator;
import androidx.annotation.FloatRange;
import androidx.annotation.Nullable;
import com.android.app.animation.Interpolators;
import com.android.launcher3.DeviceProfile;
@@ -167,6 +168,8 @@ public class AllAppsTransitionController
private final AnimatedFloat mAllAppScale = new AnimatedFloat(this::onScaleProgressChanged);
private final int mNavScrimFlag;
@Nullable private Animator.AnimatorListener mAllAppsSearchBackAnimationListener;
private boolean mIsVerticalLayout;
// Animation in this class is controlled by a single variable {@link mProgress}.
@@ -312,11 +315,25 @@ public class AllAppsTransitionController
}
}
/** Animate all apps view to 1f scale. */
/** Set {@link Animator.AnimatorListener} for scaling all apps scale to 1 animation. */
public void setAllAppsSearchBackAnimationListener(Animator.AnimatorListener listener) {
mAllAppsSearchBackAnimationListener = listener;
}
/**
* Animate all apps view to 1f scale. This is called when backing (exiting) from all apps
* search view to all apps view.
*/
public void animateAllAppsToNoScale() {
mAllAppScale.animateToValue(1f)
.setDuration(REVERT_SWIPE_ALL_APPS_TO_HOME_ANIMATION_DURATION_MS)
.start();
if (mAllAppScale.isAnimating()) {
return;
}
Animator animator = mAllAppScale.animateToValue(1f)
.setDuration(REVERT_SWIPE_ALL_APPS_TO_HOME_ANIMATION_DURATION_MS);
if (mAllAppsSearchBackAnimationListener != null) {
animator.addListener(mAllAppsSearchBackAnimationListener);
}
animator.start();
}
/**