Merge "Fix broken cuj instrumentation of CUJ_LOCKSCREEN_PIN_DISAPPEAR" into tm-dev
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settingslib.animation;
|
package com.android.settingslib.animation;
|
||||||
|
|
||||||
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,7 +24,17 @@ import android.view.animation.Interpolator;
|
|||||||
* {@link AppearAnimationUtils}
|
* {@link AppearAnimationUtils}
|
||||||
*/
|
*/
|
||||||
public interface AppearAnimationCreator<T> {
|
public interface AppearAnimationCreator<T> {
|
||||||
|
/**
|
||||||
|
* Create the appear / disappear animation.
|
||||||
|
*/
|
||||||
void createAnimation(T animatedObject, long delay, long duration,
|
void createAnimation(T animatedObject, long delay, long duration,
|
||||||
float translationY, boolean appearing, Interpolator interpolator,
|
float translationY, boolean appearing, Interpolator interpolator,
|
||||||
Runnable finishListener);
|
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
|
@Override
|
||||||
public void createAnimation(final View view, long delay, long duration, float translationY,
|
public void createAnimation(final View view, long delay, long duration, float translationY,
|
||||||
boolean appearing, Interpolator interpolator, final Runnable endRunnable) {
|
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) {
|
if (view != null) {
|
||||||
float targetAlpha = appearing ? 1f : 0f;
|
float targetAlpha = appearing ? 1f : 0f;
|
||||||
float targetTranslationY = appearing ? 0 : translationY;
|
float targetTranslationY = appearing ? 0 : translationY;
|
||||||
@@ -224,7 +232,7 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> {
|
|||||||
});
|
});
|
||||||
alphaAnim.start();
|
alphaAnim.start();
|
||||||
startTranslationYAnimation(view, delay, duration, appearing ? 0 : translationY,
|
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
|
* A static method to start translation y animation
|
||||||
*/
|
*/
|
||||||
public static void startTranslationYAnimation(View view, long delay, long duration,
|
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;
|
Animator translationAnim;
|
||||||
if (view.isHardwareAccelerated()) {
|
if (view.isHardwareAccelerated()) {
|
||||||
RenderNodeAnimator translationAnimRt = new RenderNodeAnimator(
|
RenderNodeAnimator translationAnimRt = new RenderNodeAnimator(
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.keyguard;
|
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_HALF_OPENED;
|
||||||
import static com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_UNKNOWN;
|
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.ConstraintLayout;
|
||||||
import androidx.constraintlayout.widget.ConstraintSet;
|
import androidx.constraintlayout.widget.ConstraintSet;
|
||||||
|
|
||||||
import com.android.internal.jank.InteractionJankMonitor;
|
|
||||||
import com.android.settingslib.animation.AppearAnimationUtils;
|
import com.android.settingslib.animation.AppearAnimationUtils;
|
||||||
import com.android.settingslib.animation.DisappearAnimationUtils;
|
import com.android.settingslib.animation.DisappearAnimationUtils;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
@@ -173,7 +174,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView {
|
|||||||
setTranslationY(mAppearAnimationUtils.getStartTranslation());
|
setTranslationY(mAppearAnimationUtils.getStartTranslation());
|
||||||
AppearAnimationUtils.startTranslationYAnimation(this, 0 /* delay */, 500 /* duration */,
|
AppearAnimationUtils.startTranslationYAnimation(this, 0 /* delay */, 500 /* duration */,
|
||||||
0, mAppearAnimationUtils.getInterpolator(),
|
0, mAppearAnimationUtils.getInterpolator(),
|
||||||
getAnimationListener(InteractionJankMonitor.CUJ_LOCKSCREEN_PIN_APPEAR));
|
getAnimationListener(CUJ_LOCKSCREEN_PIN_APPEAR));
|
||||||
mAppearAnimationUtils.startAnimation2d(mViews,
|
mAppearAnimationUtils.startAnimation2d(mViews,
|
||||||
new Runnable() {
|
new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -194,12 +195,12 @@ public class KeyguardPINView extends KeyguardPinBasedInputView {
|
|||||||
disappearAnimationUtils.createAnimation(
|
disappearAnimationUtils.createAnimation(
|
||||||
this, 0, 200, mDisappearYTranslation, false,
|
this, 0, 200, mDisappearYTranslation, false,
|
||||||
mDisappearAnimationUtils.getInterpolator(), () -> {
|
mDisappearAnimationUtils.getInterpolator(), () -> {
|
||||||
getAnimationListener(InteractionJankMonitor.CUJ_LOCKSCREEN_PIN_DISAPPEAR);
|
|
||||||
enableClipping(true);
|
enableClipping(true);
|
||||||
if (finishRunnable != null) {
|
if (finishRunnable != null) {
|
||||||
finishRunnable.run();
|
finishRunnable.run();
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
getAnimationListener(CUJ_LOCKSCREEN_PIN_DISAPPEAR));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user