diff options
| author | 2024-03-06 20:20:59 +0000 | |
|---|---|---|
| committer | 2024-03-06 20:20:59 +0000 | |
| commit | acca83b6c504242a551063a729885613c5a2bc14 (patch) | |
| tree | 8b9fc5659e8ac3d387b687d0249991422dc2980b | |
| parent | b1e76c2db008d9aae635438e7c814febf9b83d1b (diff) | |
| parent | 33493216f62eb52acac0eb3de8fe0aa696c8b751 (diff) | |
Merge "Remove config_drawNotificationBackground and resulting dead code" into main
14 files changed, 4 insertions, 571 deletions
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index e181d079fc6d..35f6a08795bc 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -345,9 +345,6 @@ the notification is not swiped enough to dismiss it. --> <bool name="config_showNotificationGear">true</bool> - <!-- Whether or not a background should be drawn behind a notification. --> - <bool name="config_drawNotificationBackground">false</bool> - <!-- Whether or the notifications can be shown and dismissed with a drag. --> <bool name="config_enableNotificationShadeDrag">true</bool> diff --git a/packages/SystemUI/src/com/android/systemui/scrim/ScrimView.java b/packages/SystemUI/src/com/android/systemui/scrim/ScrimView.java index d0585d3782c2..20bd7c65c0ec 100644 --- a/packages/SystemUI/src/com/android/systemui/scrim/ScrimView.java +++ b/packages/SystemUI/src/com/android/systemui/scrim/ScrimView.java @@ -64,8 +64,6 @@ public class ScrimView extends View { private String mScrimName; private int mTintColor; private boolean mBlendWithMainColor = true; - private Runnable mChangeRunnable; - private Executor mChangeRunnableExecutor; private Executor mExecutor; private Looper mExecutorLooper; @Nullable @@ -270,9 +268,6 @@ public class ScrimView extends View { mDrawable.invalidateSelf(); } - if (mChangeRunnable != null) { - mChangeRunnableExecutor.execute(mChangeRunnable); - } } public int getTint() { @@ -300,9 +295,6 @@ public class ScrimView extends View { mViewAlpha = alpha; mDrawable.setAlpha((int) (255 * alpha)); - if (mChangeRunnable != null) { - mChangeRunnableExecutor.execute(mChangeRunnable); - } } }); } @@ -311,14 +303,6 @@ public class ScrimView extends View { return mViewAlpha; } - /** - * Sets a callback that is invoked whenever the alpha, color, or tint change. - */ - public void setChangeRunnable(Runnable changeRunnable, Executor changeRunnableExecutor) { - mChangeRunnable = changeRunnable; - mChangeRunnableExecutor = changeRunnableExecutor; - } - @Override protected boolean canReceivePointerEvents() { return false; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt index 4ee83497b368..81f644f8acbb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt @@ -352,10 +352,6 @@ constructor( /** Called by the touch helper when the drag down was aborted and should be reset. */ internal fun onDragDownReset() { logger.logDragDownAborted() - nsslController.setDimmed( - /* dimmed= */ true, - /* animate= */ true, - ) nsslController.resetScrollPosition() nsslController.resetCheckSnoozeLeavebehind() setDragDownAmountAnimated(0f) @@ -366,12 +362,7 @@ constructor( * * @param above whether they dragged above it */ - internal fun onCrossedThreshold(above: Boolean) { - nsslController.setDimmed( - /* dimmed= */ !above, - /* animate= */ true, - ) - } + internal fun onCrossedThreshold(above: Boolean) {} /** Called by the touch helper when the drag down was started */ internal fun onDragDownStarted(startingChild: ExpandableView?) { 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 ea9df9af8cff..05e8717d0005 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 @@ -275,15 +275,6 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable, Ro return getHeight(); } - /** - * Sets the notification as dimmed. The default implementation does nothing. - * - * @param dimmed Whether the notification should be dimmed. - * @param fade Whether an animation should be played to change the state. - */ - public void setDimmed(boolean dimmed, boolean fade) { - } - public boolean isRemoved() { return false; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java index c90aceef6934..ab2f664fee88 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java @@ -61,7 +61,6 @@ public class AmbientState implements Dumpable { */ private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private int mScrollY; - private boolean mDimmed; private float mOverScrollTopAmount; private float mOverScrollBottomAmount; private boolean mDozing; @@ -344,14 +343,6 @@ public class AmbientState implements Dumpable { this.mScrollY = Math.max(scrollY, 0); } - /** - * @param dimmed Whether we are in a dimmed state (on the lockscreen), where the backgrounds are - * translucent and everything is scaled back a bit. - */ - public void setDimmed(boolean dimmed) { - mDimmed = dimmed; - } - /** While dozing, we draw as little as possible, assuming a black background */ public void setDozing(boolean dozing) { mDozing = dozing; @@ -375,12 +366,6 @@ public class AmbientState implements Dumpable { mHideSensitive = hideSensitive; } - public boolean isDimmed() { - // While we are expanding from pulse, we want the notifications not to be dimmed, otherwise - // you'd see the difference to the pulsing notification - return mDimmed && !(isPulseExpanding() && mDozeAmount == 1.0f); - } - public boolean isDozing() { return mDozing; } @@ -768,7 +753,6 @@ public class AmbientState implements Dumpable { pw.println("mHideSensitive=" + mHideSensitive); pw.println("mShadeExpanded=" + mShadeExpanded); pw.println("mClearAllInProgress=" + mClearAllInProgress); - pw.println("mDimmed=" + mDimmed); pw.println("mStatusBarState=" + mStatusBarState); pw.println("mExpansionChanging=" + mExpansionChanging); pw.println("mPanelFullWidth=" + mIsSmallScreen); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java index 5343cbf4f9fa..03a108287087 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java @@ -35,7 +35,6 @@ public class AnimationFilter { boolean animateZ; boolean animateHeight; boolean animateTopInset; - boolean animateDimmed; boolean animateHideSensitive; boolean hasDelays; boolean hasGoToFullShadeEvent; @@ -83,11 +82,6 @@ public class AnimationFilter { return this; } - public AnimationFilter animateDimmed() { - animateDimmed = true; - return this; - } - public AnimationFilter animateHideSensitive() { animateHideSensitive = true; return this; @@ -128,7 +122,6 @@ public class AnimationFilter { animateZ |= filter.animateZ; animateHeight |= filter.animateHeight; animateTopInset |= filter.animateTopInset; - animateDimmed |= filter.animateDimmed; animateHideSensitive |= filter.animateHideSensitive; hasDelays |= filter.hasDelays; mAnimatedProperties.addAll(filter.mAnimatedProperties); @@ -142,7 +135,6 @@ public class AnimationFilter { animateZ = false; animateHeight = false; animateTopInset = false; - animateDimmed = false; animateHideSensitive = false; hasDelays = false; hasGoToFullShadeEvent = false; 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 d0c5c82b50ee..d1e5ab04a630 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,7 +88,6 @@ public class ExpandableViewState extends ViewState { | ExpandableViewState.LOCATION_MAIN_AREA; public int height; - public boolean dimmed; public boolean hideSensitive; public boolean belowSpeedBump; public boolean inShelf; @@ -128,7 +127,6 @@ public class ExpandableViewState extends ViewState { if (viewState instanceof ExpandableViewState) { ExpandableViewState svs = (ExpandableViewState) viewState; height = svs.height; - dimmed = svs.dimmed; hideSensitive = svs.hideSensitive; belowSpeedBump = svs.belowSpeedBump; clipTopAmount = svs.clipTopAmount; @@ -155,9 +153,6 @@ public class ExpandableViewState extends ViewState { expandableView.setActualHeight(newHeight, false /* notifyListeners */); } - // apply dimming - expandableView.setDimmed(this.dimmed, false /* animate */); - // apply hiding sensitive expandableView.setHideSensitive( this.hideSensitive, false /* animated */, 0 /* delay */, 0 /* duration */); @@ -216,9 +211,6 @@ public class ExpandableViewState extends ViewState { abortAnimation(child, TAG_ANIMATOR_BOTTOM_INSET); } - // start dimmed animation - expandableView.setDimmed(this.dimmed, animationFilter.animateDimmed); - // apply below the speed bump if (!NotificationIconContainerRefactor.isEnabled()) { expandableView.setBelowSpeedBump(this.belowSpeedBump); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java index fa973001cec7..28f874da0c74 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java @@ -795,7 +795,6 @@ public class NotificationChildrenContainer extends ViewGroup } else { childState.setZTranslation(0); } - childState.dimmed = parentState.dimmed; childState.hideSensitive = parentState.hideSensitive; childState.belowSpeedBump = parentState.belowSpeedBump; childState.clipTopAmount = 0; 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 27db84f6715e..bfda6d5ca2c9 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 @@ -29,10 +29,6 @@ import static com.android.systemui.util.DumpUtilsKt.visibilityString; import static java.lang.annotation.RetentionPolicy.SOURCE; -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.TimeAnimator; -import android.animation.ValueAnimator; import android.annotation.ColorInt; import android.annotation.DrawableRes; import android.annotation.FloatRange; @@ -79,7 +75,6 @@ import android.widget.ScrollView; import com.android.app.animation.Interpolators; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.graphics.ColorUtils; import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.policy.SystemBarUtils; import com.android.keyguard.BouncerPanelExpansionCalculator; @@ -163,18 +158,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable * Sentinel value for no current active pointer. Used by {@link #mActivePointerId}. */ private static final int INVALID_POINTER = -1; - /** - * The distance in pixels between sections when the sections are directly adjacent (no visible - * gap is drawn between them). In this case we don't want to round their corners. - */ - private static final int DISTANCE_BETWEEN_ADJACENT_SECTIONS_PX = 1; private boolean mKeyguardBypassEnabled; private final ExpandHelper mExpandHelper; private NotificationSwipeHelper mSwipeHelper; private int mCurrentStackHeight = Integer.MAX_VALUE; - private final Paint mBackgroundPaint = new Paint(); - private final boolean mShouldDrawNotificationBackground; private boolean mHighPriorityBeforeSpeedBump; private float mExpandedHeight; @@ -263,7 +251,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private OnEmptySpaceClickListener mOnEmptySpaceClickListener; private boolean mNeedsAnimation; private boolean mTopPaddingNeedsAnimation; - private boolean mDimmedNeedsAnimation; private boolean mHideSensitiveNeedsAnimation; private boolean mActivateNeedsAnimation; private boolean mGoToFullShadeNeedsAnimation; @@ -350,40 +337,15 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } }; private final NotificationSection[] mSections; - private boolean mAnimateNextBackgroundTop; - private boolean mAnimateNextBackgroundBottom; - private boolean mAnimateNextSectionBoundsChange; - private @ColorInt int mBgColor; - private float mDimAmount; - private ValueAnimator mDimAnimator; private final ArrayList<ExpandableView> mTmpSortedChildren = new ArrayList<>(); - private final Animator.AnimatorListener mDimEndListener = new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - mDimAnimator = null; - } - }; - private final ValueAnimator.AnimatorUpdateListener mDimUpdateListener - = new ValueAnimator.AnimatorUpdateListener() { - - @Override - public void onAnimationUpdate(ValueAnimator animation) { - setDimAmount((Float) animation.getAnimatedValue()); - } - }; protected ViewGroup mQsHeader; // Rect of QsHeader. Kept as a field just to avoid creating a new one each time. private final Rect mQsHeaderBound = new Rect(); private boolean mContinuousShadowUpdate; - private boolean mContinuousBackgroundUpdate; private final ViewTreeObserver.OnPreDrawListener mShadowUpdater = () -> { updateViewShadows(); return true; }; - private final ViewTreeObserver.OnPreDrawListener mBackgroundUpdater = () -> { - updateBackground(); - return true; - }; private final Comparator<ExpandableView> mViewPositionComparator = (view, otherView) -> { float endY = view.getTranslationY() + view.getActualHeight(); float otherEndY = otherView.getTranslationY() + otherView.getActualHeight(); @@ -481,7 +443,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private boolean mHeadsUpAnimatingAway; private int mStatusBarState; private int mUpcomingStatusBarState; - private int mCachedBackgroundColor; private boolean mHeadsUpGoingAwayAnimationsAllowed = true; private final Runnable mReflingAndAnimateScroll = this::animateScroll; private int mCornerRadius; @@ -581,7 +542,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable */ private boolean mDismissUsingRowTranslationX = true; private ExpandableNotificationRow mTopHeadsUpRow; - private long mNumHeadsUp; private NotificationStackScrollLayoutController.TouchHandler mTouchHandler; private final ScreenOffAnimationController mScreenOffAnimationController; private boolean mShouldUseSplitNotificationShade; @@ -595,7 +555,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mSplitShadeStateController = splitShadeStateController; updateSplitNotificationShade(); } - private FeatureFlags mFeatureFlags; + private final FeatureFlags mFeatureFlags; private final ExpandableView.OnHeightChangedListener mOnChildHeightChangedListener = new ExpandableView.OnHeightChangedListener() { @@ -667,8 +627,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mSections = mSectionsManager.createSectionsForBuckets(); mAmbientState = Dependency.get(AmbientState.class); - mBgColor = Utils.getColorAttr(mContext, - com.android.internal.R.attr.materialColorSurfaceContainerHigh).getDefaultColor(); int minHeight = res.getDimensionPixelSize(R.dimen.notification_min_height); int maxHeight = res.getDimensionPixelSize(R.dimen.notification_max_height); mSplitShadeMinContentHeight = res.getDimensionPixelSize( @@ -680,16 +638,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mStackScrollAlgorithm = createStackScrollAlgorithm(context); mStateAnimator = new StackStateAnimator(context, this); - mShouldDrawNotificationBackground = - res.getBoolean(R.bool.config_drawNotificationBackground); setOutlineProvider(mOutlineProvider); // We could set this whenever we 'requestChildUpdate' much like the viewTreeObserver, but // that adds a bunch of complexity, and drawing nothing isn't *that* expensive. - boolean willDraw = SceneContainerFlag.isEnabled() - || mShouldDrawNotificationBackground || mDebugLines; + boolean willDraw = SceneContainerFlag.isEnabled() || mDebugLines; setWillNotDraw(!willDraw); - mBackgroundPaint.setAntiAlias(true); if (mDebugLines) { mDebugPaint = new Paint(); mDebugPaint.setColor(0xffff0000); @@ -812,9 +766,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } void updateBgColor() { - mBgColor = Utils.getColorAttr(mContext, - com.android.internal.R.attr.materialColorSurfaceContainerHigh).getDefaultColor(); - updateBackgroundDimming(); for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); if (child instanceof ActivatableNotificationView activatableView) { @@ -835,14 +786,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable protected void onDraw(Canvas canvas) { onJustBeforeDraw(); - if (mShouldDrawNotificationBackground - && (mSections[0].getCurrentBounds().top - < mSections[mSections.length - 1].getCurrentBounds().bottom - || mAmbientState.isDozing())) { - drawBackground(canvas); - } else if (mInHeadsUpPinnedMode || mHeadsUpAnimatingAway) { - drawHeadsUpBackground(canvas); - } if (mDebugLines) { onDrawDebug(canvas); @@ -930,150 +873,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable return textY; } - private void drawBackground(Canvas canvas) { - int lockScreenLeft = mSidePaddings; - int lockScreenRight = getWidth() - mSidePaddings; - int lockScreenTop = mSections[0].getCurrentBounds().top; - int lockScreenBottom = mSections[mSections.length - 1].getCurrentBounds().bottom; - int hiddenLeft = getWidth() / 2; - int hiddenTop = mTopPadding; - - float yProgress = 1 - mInterpolatedHideAmount; - float xProgress = mHideXInterpolator.getInterpolation( - (1 - mLinearHideAmount) * mBackgroundXFactor); - - int left = (int) MathUtils.lerp(hiddenLeft, lockScreenLeft, xProgress); - int right = (int) MathUtils.lerp(hiddenLeft, lockScreenRight, xProgress); - int top = (int) MathUtils.lerp(hiddenTop, lockScreenTop, yProgress); - int bottom = (int) MathUtils.lerp(hiddenTop, lockScreenBottom, yProgress); - mBackgroundAnimationRect.set( - left, - top, - right, - bottom); - - int backgroundTopAnimationOffset = top - lockScreenTop; - // TODO(kprevas): this may not be necessary any more since we don't display the shelf in AOD - boolean anySectionHasVisibleChild = false; - for (NotificationSection section : mSections) { - if (section.needsBackground()) { - anySectionHasVisibleChild = true; - break; - } - } - boolean shouldDrawBackground; - if (mKeyguardBypassEnabled && onKeyguard()) { - shouldDrawBackground = isPulseExpanding(); - } else { - shouldDrawBackground = !mAmbientState.isDozing() || anySectionHasVisibleChild; - } - if (shouldDrawBackground) { - drawBackgroundRects(canvas, left, right, top, backgroundTopAnimationOffset); - } - - updateClipping(); - } - - /** - * Draws round rects for each background section. - * <p> - * We want to draw a round rect for each background section as defined by {@link #mSections}. - * However, if two sections are directly adjacent with no gap between them (e.g. on the - * lockscreen where the shelf can appear directly below the high priority section, or while - * scrolling the shade so that the top of the shelf is right at the bottom of the high priority - * section), we don't want to round the adjacent corners. - * <p> - * Since {@link Canvas} doesn't provide a way to draw a half-rounded rect, this means that we - * need to coalesce the backgrounds for adjacent sections and draw them as a single round rect. - * This method tracks the top of each rect we need to draw, then iterates through the visible - * sections. If a section is not adjacent to the previous section, we draw the previous rect - * behind the sections we've accumulated up to that point, then start a new rect at the top of - * the current section. When we're done iterating we will always have one rect left to draw. - */ - private void drawBackgroundRects(Canvas canvas, int left, int right, int top, - int animationYOffset) { - int backgroundRectTop = top; - int lastSectionBottom = - mSections[0].getCurrentBounds().bottom + animationYOffset; - int currentLeft = left; - int currentRight = right; - boolean first = true; - for (NotificationSection section : mSections) { - if (!section.needsBackground()) { - continue; - } - int sectionTop = section.getCurrentBounds().top + animationYOffset; - int ownLeft = Math.min(Math.max(left, section.getCurrentBounds().left), right); - int ownRight = Math.max(Math.min(right, section.getCurrentBounds().right), ownLeft); - // If sections are directly adjacent to each other, we don't want to draw them - // as separate roundrects, as the rounded corners right next to each other look - // bad. - if (sectionTop - lastSectionBottom > DISTANCE_BETWEEN_ADJACENT_SECTIONS_PX - || ((currentLeft != ownLeft || currentRight != ownRight) && !first)) { - canvas.drawRoundRect(currentLeft, - backgroundRectTop, - currentRight, - lastSectionBottom, - mCornerRadius, mCornerRadius, mBackgroundPaint); - backgroundRectTop = sectionTop; - } - currentLeft = ownLeft; - currentRight = ownRight; - lastSectionBottom = - section.getCurrentBounds().bottom + animationYOffset; - first = false; - } - canvas.drawRoundRect(currentLeft, - backgroundRectTop, - currentRight, - lastSectionBottom, - mCornerRadius, mCornerRadius, mBackgroundPaint); - } - - private void drawHeadsUpBackground(Canvas canvas) { - int left = mSidePaddings; - int right = getWidth() - mSidePaddings; - - float top = getHeight(); - float bottom = 0; - int childCount = getChildCount(); - for (int i = 0; i < childCount; i++) { - View child = getChildAt(i); - if (child.getVisibility() != View.GONE - && child instanceof ExpandableNotificationRow row) { - if ((row.isPinned() || row.isHeadsUpAnimatingAway()) && row.getTranslation() < 0 - && row.getProvider().shouldShowGutsOnSnapOpen()) { - top = Math.min(top, row.getTranslationY()); - bottom = Math.max(bottom, row.getTranslationY() + row.getActualHeight()); - } - } - } - - if (top < bottom) { - canvas.drawRoundRect( - left, top, right, bottom, - mCornerRadius, mCornerRadius, mBackgroundPaint); - } - } - - void updateBackgroundDimming() { - // No need to update the background color if it's not being drawn. - if (!mShouldDrawNotificationBackground) { - return; - } - // Interpolate between semi-transparent notification panel background color - // and white AOD separator. - float colorInterpolation = MathUtils.smoothStep(0.4f /* start */, 1f /* end */, - mLinearHideAmount); - int color = ColorUtils.blendARGB(mBgColor, Color.WHITE, colorInterpolation); - - if (mCachedBackgroundColor != color) { - mCachedBackgroundColor = color; - mBackgroundPaint.setColor(color); - invalidate(); - } - } - private void reinitView() { initView(getContext(), mSwipeHelper, mNotificationStackSizeCalculator); } @@ -1359,9 +1158,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private void onPreDrawDuringAnimation() { mShelf.updateAppearance(); - if (!mNeedsAnimation && !mChildrenUpdateRequested) { - updateBackground(); - } } private void updateScrollStateForAddedChildren() { @@ -2565,125 +2361,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } } - private void updateBackground() { - // No need to update the background color if it's not being drawn. - if (!mShouldDrawNotificationBackground) { - return; - } - - updateBackgroundBounds(); - if (didSectionBoundsChange()) { - boolean animate = mAnimateNextSectionBoundsChange || mAnimateNextBackgroundTop - || mAnimateNextBackgroundBottom || areSectionBoundsAnimating(); - if (!isExpanded()) { - abortBackgroundAnimators(); - animate = false; - } - if (animate) { - startBackgroundAnimation(); - } else { - for (NotificationSection section : mSections) { - section.resetCurrentBounds(); - } - invalidate(); - } - } else { - abortBackgroundAnimators(); - } - mAnimateNextBackgroundTop = false; - mAnimateNextBackgroundBottom = false; - mAnimateNextSectionBoundsChange = false; - } - - private void abortBackgroundAnimators() { - for (NotificationSection section : mSections) { - section.cancelAnimators(); - } - } - - private boolean didSectionBoundsChange() { - for (NotificationSection section : mSections) { - if (section.didBoundsChange()) { - return true; - } - } - return false; - } - - private boolean areSectionBoundsAnimating() { - for (NotificationSection section : mSections) { - if (section.areBoundsAnimating()) { - return true; - } - } - return false; - } - - private void startBackgroundAnimation() { - // TODO(kprevas): do we still need separate fields for top/bottom? - // or can each section manage its own animation state? - NotificationSection firstVisibleSection = getFirstVisibleSection(); - NotificationSection lastVisibleSection = getLastVisibleSection(); - for (NotificationSection section : mSections) { - section.startBackgroundAnimation( - section == firstVisibleSection - ? mAnimateNextBackgroundTop - : mAnimateNextSectionBoundsChange, - section == lastVisibleSection - ? mAnimateNextBackgroundBottom - : mAnimateNextSectionBoundsChange); - } - } - - /** - * Update the background bounds to the new desired bounds - */ - private void updateBackgroundBounds() { - int left = mSidePaddings; - int right = getWidth() - mSidePaddings; - for (NotificationSection section : mSections) { - section.getBounds().left = left; - section.getBounds().right = right; - } - - if (!mIsExpanded) { - for (NotificationSection section : mSections) { - section.getBounds().top = 0; - section.getBounds().bottom = 0; - } - return; - } - int minTopPosition; - NotificationSection lastSection = getLastVisibleSection(); - boolean onKeyguard = mStatusBarState == StatusBarState.KEYGUARD; - if (!onKeyguard) { - minTopPosition = (int) (mTopPadding + mStackTranslation); - } else if (lastSection == null) { - minTopPosition = mTopPadding; - } else { - // The first sections could be empty while there could still be elements in later - // sections. The position of these first few sections is determined by the position of - // the first visible section. - NotificationSection firstVisibleSection = getFirstVisibleSection(); - firstVisibleSection.updateBounds(0 /* minTopPosition*/, 0 /* minBottomPosition */, - false /* shiftPulsingWithFirst */); - minTopPosition = firstVisibleSection.getBounds().top; - } - boolean shiftPulsingWithFirst = mNumHeadsUp <= 1 - && (mAmbientState.isDozing() || (mKeyguardBypassEnabled && onKeyguard)); - for (NotificationSection section : mSections) { - int minBottomPosition = minTopPosition; - if (section == lastSection) { - // We need to make sure the section goes all the way to the shelf - minBottomPosition = (int) (ViewState.getFinalTranslationY(mShelf) - + mShelf.getIntrinsicHeight()); - } - minTopPosition = section.updateBounds(minTopPosition, minBottomPosition, - shiftPulsingWithFirst); - shiftPulsingWithFirst = false; - } - } - private NotificationSection getFirstVisibleSection() { for (NotificationSection section : mSections) { if (section.getFirstVisibleChild() != null) { @@ -3184,13 +2861,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mSections, getChildrenWithBackground()); if (mAnimationsEnabled && mIsExpanded) { - mAnimateNextBackgroundTop = firstChild != previousFirstChild; - mAnimateNextBackgroundBottom = lastChild != previousLastChild || mAnimateBottomOnLayout; - mAnimateNextSectionBoundsChange = sectionViewsChanged; } else { - mAnimateNextBackgroundTop = false; - mAnimateNextBackgroundBottom = false; - mAnimateNextSectionBoundsChange = false; } mAmbientState.setLastVisibleBackgroundChild(lastChild); mAnimateBottomOnLayout = false; @@ -3344,7 +3015,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable setAnimationRunning(true); mStateAnimator.startAnimationForEvents(mAnimationEvents, mGoToFullShadeDelay); mAnimationEvents.clear(); - updateBackground(); updateViewShadows(); } else { applyCurrentState(); @@ -3359,7 +3029,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable generatePositionChangeEvents(); generateTopPaddingEvent(); generateActivateEvent(); - generateDimmedEvent(); generateHideSensitiveEvent(); generateGoToFullShadeEvent(); generateViewResizeEvent(); @@ -3577,14 +3246,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mEverythingNeedsAnimation = false; } - private void generateDimmedEvent() { - if (mDimmedNeedsAnimation) { - mAnimationEvents.add( - new AnimationEvent(null, AnimationEvent.ANIMATION_TYPE_DIMMED)); - } - mDimmedNeedsAnimation = false; - } - private void generateHideSensitiveEvent() { if (mHideSensitiveNeedsAnimation) { mAnimationEvents.add( @@ -4486,48 +4147,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mAnimationFinishedRunnables.clear(); } - /** - * See {@link AmbientState#setDimmed}. - */ - void setDimmed(boolean dimmed, boolean animate) { - dimmed &= onKeyguard(); - mAmbientState.setDimmed(dimmed); - if (animate && mAnimationsEnabled) { - mDimmedNeedsAnimation = true; - mNeedsAnimation = true; - animateDimmed(dimmed); - } else { - setDimAmount(dimmed ? 1.0f : 0.0f); - } - requestChildrenUpdate(); - } - - @VisibleForTesting - boolean isDimmed() { - return mAmbientState.isDimmed(); - } - - private void setDimAmount(float dimAmount) { - mDimAmount = dimAmount; - updateBackgroundDimming(); - } - - private void animateDimmed(boolean dimmed) { - if (mDimAnimator != null) { - mDimAnimator.cancel(); - } - float target = dimmed ? 1.0f : 0.0f; - if (target == mDimAmount) { - return; - } - mDimAnimator = TimeAnimator.ofFloat(mDimAmount, target); - mDimAnimator.setDuration(StackStateAnimator.ANIMATION_DURATION_DIMMED_ACTIVATED); - mDimAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN); - mDimAnimator.addListener(mDimEndListener); - mDimAnimator.addUpdateListener(mDimUpdateListener); - mDimAnimator.start(); - } - void updateSensitiveness(boolean animate, boolean hideSensitive) { if (hideSensitive != mAmbientState.isHideSensitive()) { int childCount = getChildCount(); @@ -4564,7 +4183,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable runAnimationFinishedRunnables(); setAnimationRunning(false); - updateBackground(); updateViewShadows(); } @@ -4714,7 +4332,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable invalidateOutline(); } updateAlgorithmHeightAndPadding(); - updateBackgroundDimming(); requestChildrenUpdate(); updateOwnTranslationZ(); } @@ -4747,21 +4364,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } } - private int getNotGoneIndex(View child) { - int count = getChildCount(); - int notGoneIndex = 0; - for (int i = 0; i < count; i++) { - View v = getChildAt(i); - if (child == v) { - return notGoneIndex; - } - if (v.getVisibility() != View.GONE) { - notGoneIndex++; - } - } - return -1; - } - /** * Returns whether or not a History button is shown in the footer. If there is no footer, then * this will return false. @@ -5266,13 +4868,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable void onStatePostChange(boolean fromShadeLocked) { boolean onKeyguard = onKeyguard(); - mAmbientState.setDimmed(onKeyguard); - if (mHeadsUpAppearanceController != null) { mHeadsUpAppearanceController.onStateChanged(); } - setDimmed(onKeyguard, fromShadeLocked); setExpandingEnabled(!onKeyguard); if (!FooterViewRefactor.isEnabled()) { updateFooter(); @@ -5676,7 +5275,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable */ public void setDozeAmount(float dozeAmount) { mAmbientState.setDozeAmount(dozeAmount); - updateContinuousBackgroundDrawing(); updateStackPosition(); requestChildrenUpdate(); } @@ -5711,7 +5309,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable view.setTranslationY(wakeUplocation); } } - mDimmedNeedsAnimation = true; } void setAnimateBottomOnLayout(boolean animateBottomOnLayout) { @@ -5763,7 +5360,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable updateFirstAndLastBackgroundViews(); requestDisallowInterceptTouchEvent(true); updateContinuousShadowDrawing(); - updateContinuousBackgroundDrawing(); requestChildrenUpdate(); } @@ -5786,7 +5382,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable * @param numHeadsUp the number of active alerting notifications. */ public void setNumHeadsUp(long numHeadsUp) { - mNumHeadsUp = numHeadsUp; mAmbientState.setHasHeadsUpEntries(numHeadsUp > 0); } @@ -6160,19 +5755,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mSpeedBumpIndexDirty = true; } - void updateContinuousBackgroundDrawing() { - boolean continuousBackground = !mAmbientState.isFullyAwake() - && mSwipeHelper.isSwiping(); - if (continuousBackground != mContinuousBackgroundUpdate) { - mContinuousBackgroundUpdate = continuousBackground; - if (continuousBackground) { - getViewTreeObserver().addOnPreDrawListener(mBackgroundUpdater); - } else { - getViewTreeObserver().removeOnPreDrawListener(mBackgroundUpdater); - } - } - } - private void resetAllSwipeState() { Trace.beginSection("NSSL.resetAllSwipeState()"); mSwipeHelper.resetTouchState(); @@ -6259,7 +5841,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable .animateHeight() .animateTopInset() .animateY() - .animateDimmed() .animateZ(), // ANIMATION_TYPE_ACTIVATED_CHILD @@ -6267,8 +5848,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable .animateZ(), // ANIMATION_TYPE_DIMMED - new AnimationFilter() - .animateDimmed(), + new AnimationFilter(), // ANIMATION_TYPE_CHANGE_POSITION new AnimationFilter() @@ -6283,7 +5863,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable .animateHeight() .animateTopInset() .animateY() - .animateDimmed() .animateZ() .hasDelays(), @@ -6339,7 +5918,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable // ANIMATION_TYPE_EVERYTHING new AnimationFilter() .animateAlpha() - .animateDimmed() .animateHideSensitive() .animateHeight() .animateTopInset() diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index 7c138776d5a5..3bdd0e9920c0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -875,8 +875,6 @@ public class NotificationStackScrollLayoutController implements Dumpable { mHeadsUpManager.setAnimationStateHandler(mView::setHeadsUpGoingAwayAnimationsAllowed); mDynamicPrivacyController.addListener(mDynamicPrivacyControllerListener); - mScrimController.setScrimBehindChangeRunnable(mView::updateBackgroundDimming); - mLockscreenShadeTransitionController.setStackScroller(this); mLockscreenUserManager.addUserChangedListener(mLockscreenUserChangeListener); @@ -1743,13 +1741,6 @@ public class NotificationStackScrollLayoutController implements Dumpable { } /** - * Set the dimmed state for all of the notification views. - */ - public void setDimmed(boolean dimmed, boolean animate) { - mView.setDimmed(dimmed, animate); - } - - /** * @return the inset during the full shade transition, that needs to be added to the position * of the quick settings edge. This is relevant for media, that is transitioning * from the keyguard host to the quick settings one. 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 1ef9a8f3d7ec..9b1952ba63fd 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 @@ -369,13 +369,11 @@ public class StackScrollAlgorithm { /** Updates the dimmed and hiding sensitive states of the children. */ private void updateDimmedAndHideSensitive(AmbientState ambientState, StackScrollAlgorithmState algorithmState) { - boolean dimmed = ambientState.isDimmed(); boolean hideSensitive = ambientState.isHideSensitive(); int childCount = algorithmState.visibleChildren.size(); for (int i = 0; i < childCount; i++) { ExpandableView child = algorithmState.visibleChildren.get(i); ExpandableViewState childViewState = child.getViewState(); - childViewState.dimmed = dimmed; childViewState.hideSensitive = hideSensitive; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index d2e36b88fd9d..088f8949525b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -207,8 +207,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump private ScrimView mNotificationsScrim; private ScrimView mScrimBehind; - private Runnable mScrimBehindChangeRunnable; - private final KeyguardStateController mKeyguardStateController; private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; private final DozeParameters mDozeParameters; @@ -415,11 +413,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump behindScrim.enableBottomEdgeConcave(mClipsQsScrim); mNotificationsScrim.enableRoundedCorners(true); - if (mScrimBehindChangeRunnable != null) { - mScrimBehind.setChangeRunnable(mScrimBehindChangeRunnable, mMainExecutor); - mScrimBehindChangeRunnable = null; - } - final ScrimState[] states = ScrimState.values(); for (int i = 0; i < states.length; i++) { states[i].init(mScrimInFront, mScrimBehind, mDozeParameters, mDockManager); @@ -1542,16 +1535,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump mScrimBehind.postOnAnimationDelayed(callback, 32 /* delayMillis */); } - public void setScrimBehindChangeRunnable(Runnable changeRunnable) { - // TODO: remove this. This is necessary because of an order-of-operations limitation. - // The fix is to move more of these class into @SysUISingleton. - if (mScrimBehind == null) { - mScrimBehindChangeRunnable = changeRunnable; - } else { - mScrimBehind.setChangeRunnable(changeRunnable, mMainExecutor); - } - } - private void updateThemeColors() { if (mScrimBehind == null) return; int background = Utils.getColorAttr(mScrimBehind.getContext(), diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt index 3d752880f423..4715b33aa40a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/AmbientStateTest.kt @@ -57,39 +57,6 @@ class AmbientStateTest : SysuiTestCase() { ) } - // region isDimmed - @Test - fun isDimmed_whenTrue_shouldReturnTrue() { - sut.arrangeDimmed(true) - - assertThat(sut.isDimmed).isTrue() - } - - @Test - fun isDimmed_whenFalse_shouldReturnFalse() { - sut.arrangeDimmed(false) - - assertThat(sut.isDimmed).isFalse() - } - - @Test - fun isDimmed_whenDozeAmountIsEmpty_shouldReturnTrue() { - sut.arrangeDimmed(true) - sut.dozeAmount = 0f - - assertThat(sut.isDimmed).isTrue() - } - - @Test - fun isDimmed_whenPulseExpandingIsFalse_shouldReturnTrue() { - sut.arrangeDimmed(true) - sut.arrangePulseExpanding(false) - sut.dozeAmount = 1f // arrangePulseExpanding changes dozeAmount - - assertThat(sut.isDimmed).isTrue() - } - // endregion - // region pulseHeight @Test fun pulseHeight_whenValueChanged_shouldCallListener() { @@ -383,12 +350,6 @@ class AmbientStateTest : SysuiTestCase() { } // region Arrange helper methods. -private fun AmbientState.arrangeDimmed(value: Boolean) { - isDimmed = value - dozeAmount = if (value) 0f else 1f - arrangePulseExpanding(!value) -} - private fun AmbientState.arrangePulseExpanding(value: Boolean) { if (value) { dozeAmount = 1f diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java index f326ceaf1950..28dfbbb64777 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java @@ -307,14 +307,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { } @Test - public void testNotDimmedOnKeyguard() { - when(mBarState.getState()).thenReturn(StatusBarState.SHADE); - mStackScroller.setDimmed(true /* dimmed */, false /* animate */); - mStackScroller.setDimmed(true /* dimmed */, true /* animate */); - assertFalse(mStackScroller.isDimmed()); - } - - @Test public void updateEmptyView_dndSuppressing() { when(mEmptyShadeView.willBeGone()).thenReturn(true); |