diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java index 41df196c62b0b..225f7fcc9de91 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java @@ -73,6 +73,7 @@ public class KeyguardStatusView extends GridLayout implements private ArraySet mVisibleInDoze; private boolean mPulsing; + private boolean mWasPulsing; private float mDarkAmount = 0; private int mTextColor; private float mWidgetPadding; @@ -224,7 +225,8 @@ public class KeyguardStatusView extends GridLayout implements boolean hasHeader = mKeyguardSlice.hasHeader(); boolean smallClock = hasHeader || mPulsing; long duration = KeyguardSliceView.DEFAULT_ANIM_DURATION; - long delay = smallClock ? 0 : duration / 4; + long delay = smallClock || mWasPulsing ? 0 : duration / 4; + mWasPulsing = false; boolean shouldAnimate = mKeyguardSlice.getLayoutTransition() != null && mKeyguardSlice.getLayoutTransition().isRunning(); @@ -448,6 +450,12 @@ public class KeyguardStatusView extends GridLayout implements } public void setPulsing(boolean pulsing, boolean animate) { + if (mPulsing == pulsing) { + return; + } + if (mPulsing) { + mWasPulsing = true; + } mPulsing = pulsing; mKeyguardSlice.setPulsing(pulsing, animate); updateDozeVisibleViews(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 2f18aad9612de..95ae2c4ad9062 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -2736,13 +2736,14 @@ public class NotificationPanelView extends PanelView implements public void setPulsing(boolean pulsing) { mPulsing = pulsing; - final boolean canAnimatePulse = - !DozeParameters.getInstance(mContext).getDisplayNeedsBlanking(); - if (canAnimatePulse) { + DozeParameters dozeParameters = DozeParameters.getInstance(mContext); + final boolean animatePulse = !dozeParameters.getDisplayNeedsBlanking() + && dozeParameters.getAlwaysOn(); + if (animatePulse) { mAnimateNextPositionUpdate = true; } - mNotificationStackScroller.setPulsing(pulsing, canAnimatePulse); - mKeyguardStatusView.setPulsing(pulsing, canAnimatePulse); + mNotificationStackScroller.setPulsing(pulsing, animatePulse); + mKeyguardStatusView.setPulsing(pulsing, animatePulse); } public void setAmbientIndicationBottomPadding(int ambientIndicationBottomPadding) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AnimationFilter.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AnimationFilter.java index c26568ea00b3e..e80f48309bbb8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AnimationFilter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AnimationFilter.java @@ -137,6 +137,10 @@ public class AnimationFilter { // to look nice customDelay = StackStateAnimator.ANIMATION_DELAY_HEADS_UP_CLICKED + StackStateAnimator.ANIMATION_DELAY_HEADS_UP; + } else if (ev.animationType == NotificationStackScrollLayout.AnimationEvent + .ANIMATION_TYPE_PULSE_APPEAR || ev.animationType == + NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_PULSE_DISAPPEAR) { + customDelay = StackStateAnimator.ANIMATION_DURATION_PULSE_APPEAR / 2; } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 126e6fb687a99..e630208e972e5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -5051,11 +5051,13 @@ public class NotificationStackScrollLayout extends ViewGroup // ANIMATION_TYPE_PULSE_APPEAR new AnimationFilter() .animateAlpha() + .hasDelays() .animateY(), // ANIMATION_TYPE_PULSE_DISAPPEAR new AnimationFilter() .animateAlpha() + .hasDelays() .animateY(), }; @@ -5119,10 +5121,10 @@ public class NotificationStackScrollLayout extends ViewGroup StackStateAnimator.ANIMATION_DURATION_STANDARD, // ANIMATION_TYPE_PULSE_APPEAR - KeyguardSliceView.DEFAULT_ANIM_DURATION, + StackStateAnimator.ANIMATION_DURATION_PULSE_APPEAR, // ANIMATION_TYPE_PULSE_DISAPPEAR - KeyguardSliceView.DEFAULT_ANIM_DURATION / 2, + StackStateAnimator.ANIMATION_DURATION_PULSE_APPEAR / 2, }; static final int ANIMATION_TYPE_ADD = 0; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java index a75d40f920112..b83a09dd02ade 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java @@ -24,6 +24,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.animation.Interpolator; +import com.android.keyguard.KeyguardSliceView; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.statusbar.ExpandableNotificationRow; @@ -51,6 +52,8 @@ public class StackStateAnimator { = (int) (ANIMATION_DURATION_HEADS_UP_APPEAR * HeadsUpAppearInterpolator.getFractionUntilOvershoot()); public static final int ANIMATION_DURATION_HEADS_UP_DISAPPEAR = 300; + public static final int ANIMATION_DURATION_PULSE_APPEAR = + KeyguardSliceView.DEFAULT_ANIM_DURATION; public static final int ANIMATION_DURATION_BLOCKING_HELPER_FADE = 240; public static final int ANIMATION_DELAY_PER_ELEMENT_INTERRUPTING = 80; public static final int ANIMATION_DELAY_PER_ELEMENT_MANUAL = 32; @@ -430,15 +433,26 @@ public class StackStateAnimator { } else if (event.animationType == NotificationStackScrollLayout .AnimationEvent.ANIMATION_TYPE_PULSE_APPEAR) { ExpandableViewState viewState = finalState.getViewStateForView(changingView); - mTmpState.copyFrom(viewState); - mTmpState.yTranslation += mPulsingAppearingTranslation; - mTmpState.alpha = 0; - mTmpState.applyToView(changingView); + if (viewState != null) { + mTmpState.copyFrom(viewState); + mTmpState.yTranslation += mPulsingAppearingTranslation; + mTmpState.alpha = 0; + mTmpState.applyToView(changingView); + } } else if (event.animationType == NotificationStackScrollLayout .AnimationEvent.ANIMATION_TYPE_PULSE_DISAPPEAR) { ExpandableViewState viewState = finalState.getViewStateForView(changingView); - viewState.yTranslation += mPulsingAppearingTranslation; - viewState.alpha = 0; + if (viewState != null) { + viewState.alpha = 0; + // We want to animate the alpha away before the view starts translating, + // otherwise everything will overlap and look xtra ugly. + float originalYTranslation = viewState.yTranslation; + viewState.yTranslation = changingView.getTranslationY(); + mAnimationFilter.animateAlpha = true; + mAnimationProperties.duration = ANIMATION_DURATION_PULSE_APPEAR / 2; + viewState.animateTo(changingView, mAnimationProperties); + viewState.yTranslation = originalYTranslation; + } } else if (event.animationType == NotificationStackScrollLayout .AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR) { // This item is added, initialize it's properties.