From 51ac79c9495d391b61157f27a5b1cbca0c4645a5 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Thu, 21 Jan 2021 22:46:38 +0000 Subject: [PATCH 1/2] Revert "Clip view before shelf and leave the rest unclipped" Revert submission 13271843-fade-whole-notifications Reason for revert: b/178142654 Reverted Changes: Ic49edf84b:Clip view before shelf and leave the rest unclippe... Iab095bdbd:Fade in notifications one by one Change-Id: I54c1b5393d57bfa9e8ea777167a70172b0834cf3 --- .../systemui/statusbar/NotificationShelf.java | 31 ++----------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index 4a8057201c2f7..20efa32d63c6f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -204,30 +204,6 @@ public class NotificationShelf extends ActivatableNotificationView implements } } - /** - * @return whether to clip bottom of given view - */ - private boolean shouldClipBottom(ExpandableView view) { - final boolean showShelf = ((ShelfState) getViewState()).hasItemsInStableShelf; - if (showShelf) { - if (mAmbientState.isShadeOpening()) { - final float viewEnd = view.getTranslationY() - + view.getActualHeight() - + mPaddingBetweenElements; - final float finalShelfStart = mMaxLayoutHeight - getIntrinsicHeight(); - // While the shade is opening, only clip view if it overlaps with shelf; - // otherwise leave view unclipped. - if (viewEnd < finalShelfStart) { - return false; - } - } - // Clip for scrolling. - return true; - } - // Don't clip since we have enough space to show all views. - return false; - } - /** * Update the shelf appearance based on the other notifications around it. This transforms * the icons from the notification area into the shelf. @@ -369,9 +345,7 @@ public class NotificationShelf extends ActivatableNotificationView implements clipTransientViews(); setClipTopAmount(clipTopAmount); - boolean isHidden = getViewState().hidden - || clipTopAmount >= getIntrinsicHeight() - || mAmbientState.isShadeOpening(); + boolean isHidden = getViewState().hidden || clipTopAmount >= getIntrinsicHeight(); if (mShowNotificationShelf) { setVisibility(isHidden ? View.INVISIBLE : View.VISIBLE); } @@ -494,8 +468,7 @@ public class NotificationShelf extends ActivatableNotificationView implements } else { shouldClipOwnTop = view.showingPulsing(); } - if (shouldClipBottom(view) - && viewEnd > notificationClipEnd && !shouldClipOwnTop + if (viewEnd > notificationClipEnd && !shouldClipOwnTop && (mAmbientState.isShadeExpanded() || !isPinned)) { int clipBottomAmount = (int) (viewEnd - notificationClipEnd); if (isPinned) { From ab7b29369e3c773cdfa68a4b00274a9b6ddfa941 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Thu, 21 Jan 2021 22:46:38 +0000 Subject: [PATCH 2/2] Revert "Fade in notifications one by one" Revert submission 13271843-fade-whole-notifications Reason for revert: b/178142654 Reverted Changes: Ic49edf84b:Clip view before shelf and leave the rest unclippe... Iab095bdbd:Fade in notifications one by one Change-Id: I6527a32d53a734e7b7310790a478275a75261e18 --- .../notification/row/ExpandableView.java | 6 --- .../stack/ExpandableViewState.java | 10 ---- .../stack/NotificationStackScrollLayout.java | 1 - .../stack/StackScrollAlgorithm.java | 13 ++--- .../stack/StackStateAnimator.java | 1 - .../notification/stack/ViewState.java | 54 +++++++------------ 6 files changed, 25 insertions(+), 60 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java index 92b381e58698a..ba03d01b20b06 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java @@ -614,12 +614,6 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable { } } - public void setShouldFadeForShadeOpen(boolean shouldFade) { - if (!mViewState.gone) { - mViewState.setShouldFadeForShadeOpen(shouldFade); - } - } - /** * @return whether the current view doesn't add height to the overall content. This means that * if it is added to a list of items, its content will still have the same height. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ExpandableViewState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ExpandableViewState.java index 21b6863adf0ec..628c4e258e50e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ExpandableViewState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ExpandableViewState.java @@ -88,12 +88,6 @@ public class ExpandableViewState extends ViewState { public boolean hideSensitive; public boolean belowSpeedBump; public boolean inShelf; - public boolean shouldFadeForShadeOpen; - - @Override - boolean shouldAnimateAlpha() { - return shouldFadeForShadeOpen; - } /** * A state indicating whether a headsup is currently fully visible, even when not scrolled. @@ -177,10 +171,6 @@ public class ExpandableViewState extends ViewState { } } - public void setShouldFadeForShadeOpen(boolean shouldFade) { - shouldFadeForShadeOpen = shouldFade; - } - @Override public void animateTo(View child, AnimationProperties properties) { super.animateTo(child, properties); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index a2ce9e1ad6cca..f07d8740c3e90 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -3947,7 +3947,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable int numChildren = getChildCount(); for (int i = 0; i < numChildren; i++) { ExpandableView child = (ExpandableView) getChildAt(i); - child.setShouldFadeForShadeOpen(mAmbientState.isShadeOpening()); child.applyViewState(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java index 4bf7be3ba330c..e6efba7ca28bb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java @@ -568,14 +568,11 @@ public class StackScrollAlgorithm { // Add padding before sections for overscroll effect. childViewState.yTranslation += ambientState.getSectionPadding(); } - boolean show = childViewState.yTranslation < shelfStart - && !ambientState.isAppearing(); - childViewState.hidden = !show - && !child.isExpandAnimationRunning() - && !child.hasExpandingChild(); - childViewState.inShelf = !show; - childViewState.headsUpIsVisible = show; - childViewState.alpha = show ? 1f : 0f; + if (childViewState.yTranslation >= shelfStart) { + childViewState.hidden = !child.isExpandAnimationRunning() && !child.hasExpandingChild(); + childViewState.inShelf = true; + childViewState.headsUpIsVisible = false; + } } protected int getMaxAllowedChildHeight(View child) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java index 43f1f431e138d..66a48f16b6240 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java @@ -45,7 +45,6 @@ public class StackStateAnimator { public static final int ANIMATION_DURATION_CORNER_RADIUS = 200; public static final int ANIMATION_DURATION_WAKEUP = 500; public static final int ANIMATION_DURATION_GO_TO_FULL_SHADE = 448; - public static final int ANIMATION_DURATION_FADE_IN = 700; public static final int ANIMATION_DURATION_APPEAR_DISAPPEAR = 464; public static final int ANIMATION_DURATION_SWIPE = 260; public static final int ANIMATION_DURATION_DIMMED_ACTIVATED = 220; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ViewState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ViewState.java index abe5c698034e8..3da4e321c54d2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ViewState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ViewState.java @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.notification.stack; -import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_FADE_IN; - import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; @@ -58,16 +56,6 @@ public class ViewState implements Dumpable { return mAnimationFilter; } }; - - protected static final AnimationProperties ANIMATE_ALPHA = new AnimationProperties() { - AnimationFilter mAnimationFilter = new AnimationFilter(); - @Override - public AnimationFilter getAnimationFilter() { - mAnimationFilter.animateAlpha(); - return mAnimationFilter; - } - }.setDuration(ANIMATION_DURATION_FADE_IN); - private static final int TAG_ANIMATOR_TRANSLATION_X = R.id.translation_x_animator_tag; private static final int TAG_ANIMATOR_TRANSLATION_Y = R.id.translation_y_animator_tag; private static final int TAG_ANIMATOR_TRANSLATION_Z = R.id.translation_z_animator_tag; @@ -160,10 +148,6 @@ public class ViewState implements Dumpable { scaleY = view.getScaleY(); } - boolean shouldAnimateAlpha() { - return false; - } - /** * Applies a {@link ViewState} to a normal view. */ @@ -216,26 +200,24 @@ public class ViewState implements Dumpable { int oldVisibility = view.getVisibility(); boolean becomesInvisible = this.alpha == 0.0f || (this.hidden && (!isAnimating(view) || oldVisibility != View.VISIBLE)); - if (isAnimating(view, TAG_ANIMATOR_ALPHA)) { - startAlphaAnimation(view, NO_NEW_ANIMATIONS); + boolean animatingAlpha = isAnimating(view, TAG_ANIMATOR_ALPHA); + if (animatingAlpha) { + updateAlphaAnimation(view); } else if (view.getAlpha() != this.alpha) { - if (shouldAnimateAlpha()) { - startAlphaAnimation(view, ANIMATE_ALPHA); - } else { - // apply layer type - boolean becomesFullyVisible = this.alpha == 1.0f; - boolean newLayerTypeIsHardware = !becomesInvisible && !becomesFullyVisible - && view.hasOverlappingRendering(); - int layerType = view.getLayerType(); - int newLayerType = newLayerTypeIsHardware - ? View.LAYER_TYPE_HARDWARE - : View.LAYER_TYPE_NONE; - if (layerType != newLayerType) { - view.setLayerType(newLayerType, null); - } - // apply alpha - view.setAlpha(this.alpha); + // apply layer type + boolean becomesFullyVisible = this.alpha == 1.0f; + boolean newLayerTypeIsHardware = !becomesInvisible && !becomesFullyVisible + && view.hasOverlappingRendering(); + int layerType = view.getLayerType(); + int newLayerType = newLayerTypeIsHardware + ? View.LAYER_TYPE_HARDWARE + : View.LAYER_TYPE_NONE; + if (layerType != newLayerType) { + view.setLayerType(newLayerType, null); } + + // apply alpha + view.setAlpha(this.alpha); } // apply visibility @@ -340,6 +322,10 @@ public class ViewState implements Dumpable { } } + private void updateAlphaAnimation(View view) { + startAlphaAnimation(view, NO_NEW_ANIMATIONS); + } + private void startAlphaAnimation(final View child, AnimationProperties properties) { Float previousStartValue = getChildTag(child,TAG_START_ALPHA); Float previousEndValue = getChildTag(child,TAG_END_ALPHA);