Merge "Fix broken cuj instrumentation of CUJ_LOCKSCREEN_PIN_DISAPPEAR" into tm-dev am: e6ec124ee8 am: 75f954311d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18527309 Change-Id: Ib8ee61aad974bebbb2a1e0b6e2496f5462bd7a5c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settingslib.animation;
|
||||
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
/**
|
||||
@@ -23,7 +24,17 @@ import android.view.animation.Interpolator;
|
||||
* {@link AppearAnimationUtils}
|
||||
*/
|
||||
public interface AppearAnimationCreator<T> {
|
||||
void createAnimation(T animatedObject, long delay, long duration,
|
||||
float translationY, boolean appearing, Interpolator interpolator,
|
||||
Runnable finishListener);
|
||||
/**
|
||||
* Create the appear / disappear animation.
|
||||
*/
|
||||
void createAnimation(T animatedObject, long delay, long duration,
|
||||
float translationY, boolean appearing, Interpolator interpolator,
|
||||
Runnable endRunnable);
|
||||
|
||||
/**
|
||||
* Create the animation with {@link AnimatorListenerAdapter}.
|
||||
*/
|
||||
default void createAnimation(T animatedObject, long delay, long duration,
|
||||
float translationY, boolean appearing, Interpolator interpolator,
|
||||
Runnable endRunnable, AnimatorListenerAdapter animatorListener) {}
|
||||
}
|
||||
|
||||
@@ -180,6 +180,14 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> {
|
||||
@Override
|
||||
public void createAnimation(final View view, long delay, long duration, float translationY,
|
||||
boolean appearing, Interpolator interpolator, final Runnable endRunnable) {
|
||||
createAnimation(
|
||||
view, delay, duration, translationY, appearing, interpolator, endRunnable, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAnimation(final View view, long delay,
|
||||
long duration, float translationY, boolean appearing, Interpolator interpolator,
|
||||
final Runnable endRunnable, final AnimatorListenerAdapter animatorListener) {
|
||||
if (view != null) {
|
||||
float targetAlpha = appearing ? 1f : 0f;
|
||||
float targetTranslationY = appearing ? 0 : translationY;
|
||||
@@ -224,7 +232,7 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> {
|
||||
});
|
||||
alphaAnim.start();
|
||||
startTranslationYAnimation(view, delay, duration, appearing ? 0 : translationY,
|
||||
interpolator);
|
||||
interpolator, animatorListener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +248,7 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> {
|
||||
* A static method to start translation y animation
|
||||
*/
|
||||
public static void startTranslationYAnimation(View view, long delay, long duration,
|
||||
float endTranslationY, Interpolator interpolator, Animator.AnimatorListener listener) {
|
||||
float endTranslationY, Interpolator interpolator, AnimatorListenerAdapter listener) {
|
||||
Animator translationAnim;
|
||||
if (view.isHardwareAccelerated()) {
|
||||
RenderNodeAnimator translationAnimRt = new RenderNodeAnimator(
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.keyguard;
|
||||
|
||||
import static com.android.internal.jank.InteractionJankMonitor.CUJ_LOCKSCREEN_PIN_APPEAR;
|
||||
import static com.android.internal.jank.InteractionJankMonitor.CUJ_LOCKSCREEN_PIN_DISAPPEAR;
|
||||
import static com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_HALF_OPENED;
|
||||
import static com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_UNKNOWN;
|
||||
|
||||
@@ -28,7 +30,6 @@ import android.view.animation.AnimationUtils;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.constraintlayout.widget.ConstraintSet;
|
||||
|
||||
import com.android.internal.jank.InteractionJankMonitor;
|
||||
import com.android.settingslib.animation.AppearAnimationUtils;
|
||||
import com.android.settingslib.animation.DisappearAnimationUtils;
|
||||
import com.android.systemui.R;
|
||||
@@ -173,7 +174,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView {
|
||||
setTranslationY(mAppearAnimationUtils.getStartTranslation());
|
||||
AppearAnimationUtils.startTranslationYAnimation(this, 0 /* delay */, 500 /* duration */,
|
||||
0, mAppearAnimationUtils.getInterpolator(),
|
||||
getAnimationListener(InteractionJankMonitor.CUJ_LOCKSCREEN_PIN_APPEAR));
|
||||
getAnimationListener(CUJ_LOCKSCREEN_PIN_APPEAR));
|
||||
mAppearAnimationUtils.startAnimation2d(mViews,
|
||||
new Runnable() {
|
||||
@Override
|
||||
@@ -194,12 +195,12 @@ public class KeyguardPINView extends KeyguardPinBasedInputView {
|
||||
disappearAnimationUtils.createAnimation(
|
||||
this, 0, 200, mDisappearYTranslation, false,
|
||||
mDisappearAnimationUtils.getInterpolator(), () -> {
|
||||
getAnimationListener(InteractionJankMonitor.CUJ_LOCKSCREEN_PIN_DISAPPEAR);
|
||||
enableClipping(true);
|
||||
if (finishRunnable != null) {
|
||||
finishRunnable.run();
|
||||
}
|
||||
});
|
||||
},
|
||||
getAnimationListener(CUJ_LOCKSCREEN_PIN_DISAPPEAR));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user