diff options
18 files changed, 91 insertions, 533 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LegacyNotificationShelfControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/LegacyNotificationShelfControllerImpl.java index 505f45d021b8..dcd9dc3e7fa3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/LegacyNotificationShelfControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/LegacyNotificationShelfControllerImpl.java @@ -52,7 +52,6 @@ public class LegacyNotificationShelfControllerImpl implements NotificationShelfC mActivatableNotificationViewController = activatableNotificationViewController; mKeyguardBypassController = keyguardBypassController; mStatusBarStateController = statusBarStateController; - mView.useRoundnessSourceTypes(true); mView.setSensitiveRevealAnimEndabled(featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM)); mOnAttachStateChangeListener = new View.OnAttachStateChangeListener() { @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index 7eb63da38028..92b382849f97 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -128,13 +128,6 @@ public class NotificationShelf extends ActivatableNotificationView implements St setClipToPadding(false); mShelfIcons.setIsStaticLayout(false); requestRoundness(/* top = */ 1f, /* bottom = */ 1f, BASE_VALUE, /* animate = */ false); - - if (!mUseRoundnessSourceTypes) { - // Setting this to first in section to get the clipping to the top roundness correct. - // This value determines the way we are clipping to the top roundness of the overall - // shade - setFirstInSection(true); - } updateResources(); } @@ -569,17 +562,8 @@ public class NotificationShelf extends ActivatableNotificationView implements St * mAmbientState.getExpansionFraction(); final float cornerAnimationTop = shelfStart - cornerAnimationDistance; - final SourceType sourceType; - if (mUseRoundnessSourceTypes) { - sourceType = SHELF_SCROLL; - } else { - sourceType = LegacySourceType.OnScroll; - } - final float topValue; - if (!mUseRoundnessSourceTypes && anv.isFirstInSection()) { - topValue = 1f; - } else if (viewStart >= cornerAnimationTop) { + if (viewStart >= cornerAnimationTop) { // Round top corners within animation bounds topValue = MathUtils.saturate( (viewStart - cornerAnimationTop) / cornerAnimationDistance); @@ -588,12 +572,10 @@ public class NotificationShelf extends ActivatableNotificationView implements St // Reset top and bottom corners outside of animation bounds. topValue = 0f; } - anv.requestTopRoundness(topValue, sourceType, /* animate = */ false); + anv.requestTopRoundness(topValue, SHELF_SCROLL, /* animate = */ false); final float bottomValue; - if (!mUseRoundnessSourceTypes && anv.isLastInSection()) { - bottomValue = 1f; - } else if (viewEnd >= cornerAnimationTop) { + if (viewEnd >= cornerAnimationTop) { // Round bottom corners within animation bounds bottomValue = MathUtils.saturate( (viewEnd - cornerAnimationTop) / cornerAnimationDistance); @@ -602,7 +584,7 @@ public class NotificationShelf extends ActivatableNotificationView implements St // Reset top and bottom corners outside of animation bounds. bottomValue = 0f; } - anv.requestBottomRoundness(bottomValue, sourceType, /* animate = */ false); + anv.requestBottomRoundness(bottomValue, SHELF_SCROLL, /* animate = */ false); } private boolean isViewAffectedBySwipe(ExpandableView expandableView) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java index 766ad88f8a55..66d4c3a97773 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java @@ -110,7 +110,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView protected Point mTargetPoint; private boolean mDismissed; private boolean mRefocusOnDismiss; - protected boolean mUseRoundnessSourceTypes; public ActivatableNotificationView(Context context, AttributeSet attrs) { super(context, attrs); @@ -709,18 +708,10 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mTouchHandler = touchHandler; } - /** - * Enable the support for rounded corner based on the SourceType - * @param enabled true if is supported - */ - public void useRoundnessSourceTypes(boolean enabled) { - mUseRoundnessSourceTypes = enabled; - } - @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - if (mUseRoundnessSourceTypes && !mOnDetachResetRoundness.isEmpty()) { + if (!mOnDetachResetRoundness.isEmpty()) { for (SourceType sourceType : mOnDetachResetRoundness) { requestRoundnessReset(sourceType); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index e468a59d4eb1..597813344d6e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -87,7 +87,6 @@ import com.android.systemui.statusbar.StatusBarIconView; import com.android.systemui.statusbar.notification.AboveShelfChangedListener; import com.android.systemui.statusbar.notification.FeedbackIcon; import com.android.systemui.statusbar.notification.LaunchAnimationParameters; -import com.android.systemui.statusbar.notification.LegacySourceType; import com.android.systemui.statusbar.notification.NotificationFadeAware; import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorController; import com.android.systemui.statusbar.notification.NotificationUtils; @@ -866,9 +865,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } onAttachedChildrenCountChanged(); row.setIsChildInGroup(false, null); - if (!mUseRoundnessSourceTypes) { - row.requestBottomRoundness(0.0f, LegacySourceType.DefaultValue, /* animate = */ false); - } } /** @@ -884,10 +880,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView if (child.keepInParentForDismissAnimation()) { mChildrenContainer.removeNotification(child); child.setIsChildInGroup(false, null); - if (!mUseRoundnessSourceTypes) { - LegacySourceType sourceType = LegacySourceType.DefaultValue; - child.requestBottomRoundness(0f, sourceType, /* animate = */ false); - } child.setKeepInParentForDismissAnimation(false); logKeepInParentChildDetached(child); childCountChanged = true; @@ -942,9 +934,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mNotificationParent.updateBackgroundForGroupState(); } updateBackgroundClipping(); - if (mUseRoundnessSourceTypes) { - updateBaseRoundness(); - } + updateBaseRoundness(); } @Override @@ -1054,15 +1044,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView if (isAboveShelf() != wasAboveShelf) { mAboveShelfChangedListener.onAboveShelfStateChanged(!wasAboveShelf); } - if (mUseRoundnessSourceTypes) { - if (pinned) { - // Should be animated if someone explicitly set it to 0 and the row is shown. - boolean animated = mAnimatePinnedRoundness && isShown(); - requestRoundness(/* top = */ 1f, /* bottom = */ 1f, PINNED, animated); - } else { - requestRoundnessReset(PINNED); - mAnimatePinnedRoundness = true; - } + if (pinned) { + // Should be animated if someone explicitly set it to 0 and the row is shown. + boolean animated = mAnimatePinnedRoundness && isShown(); + requestRoundness(/* top = */ 1f, /* bottom = */ 1f, PINNED, animated); + } else { + requestRoundnessReset(PINNED); + mAnimatePinnedRoundness = true; } } @@ -1879,7 +1867,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mChildrenContainer.setIsLowPriority(mIsLowPriority); mChildrenContainer.setContainingNotification(ExpandableNotificationRow.this); mChildrenContainer.onNotificationUpdated(); - mChildrenContainer.useRoundnessSourceTypes(mUseRoundnessSourceTypes); mTranslateableViews.add(mChildrenContainer); }); @@ -2308,24 +2295,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mBackgroundNormal.setExpandAnimationSize(params.getWidth(), actualHeight); } - @Override - public float getTopRoundness() { - if (!mUseRoundnessSourceTypes && mExpandAnimationRunning) { - return mTopRoundnessDuringLaunchAnimation; - } - - return super.getTopRoundness(); - } - - @Override - public float getBottomRoundness() { - if (!mUseRoundnessSourceTypes && mExpandAnimationRunning) { - return mBottomRoundnessDuringLaunchAnimation; - } - - return super.getBottomRoundness(); - } - public void setExpandAnimationRunning(boolean expandAnimationRunning) { if (expandAnimationRunning) { setAboveShelf(true); @@ -3481,18 +3450,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView private void applyChildrenRoundness() { if (mIsSummaryWithChildren) { - if (mUseRoundnessSourceTypes) { - mChildrenContainer.requestRoundness( - /* top = */ getTopRoundness(), - /* bottom = */ getBottomRoundness(), - /* sourceType = */ FROM_PARENT, - /* animate = */ false); - } else { - mChildrenContainer.requestBottomRoundness( - getBottomRoundness(), - LegacySourceType.DefaultValue, - /* animate = */ false); - } + mChildrenContainer.requestRoundness( + /* top = */ getTopRoundness(), + /* bottom = */ getBottomRoundness(), + /* sourceType = */ FROM_PARENT, + /* animate = */ false); } } @@ -3709,24 +3671,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } } - /** - * Enable the support for rounded corner based on the SourceType - * @param enabled true if is supported - */ - @Override - public void useRoundnessSourceTypes(boolean enabled) { - super.useRoundnessSourceTypes(enabled); - if (mChildrenContainer != null) { - mChildrenContainer.useRoundnessSourceTypes(mUseRoundnessSourceTypes); - } - } - @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - if (mUseRoundnessSourceTypes) { - updateBaseRoundness(); - } + updateBaseRoundness(); } /** Set whether this notification may show a snooze action. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java index 19c612ed21ff..1acc9f90b58f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java @@ -261,7 +261,6 @@ public class ExpandableNotificationRowController implements NotifViewController mStatusBarStateController.removeCallback(mStatusBarStateListener); } }); - mView.useRoundnessSourceTypes(true); } private final StatusBarStateController.StateListener mStatusBarStateListener = diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationHeaderViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationHeaderViewWrapper.java index 9a777ea6230b..2c59c2e8a06f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationHeaderViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationHeaderViewWrapper.java @@ -72,7 +72,6 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper imple private View mFeedbackIcon; private boolean mIsLowPriority; private boolean mTransformLowPriorityTitle; - private boolean mUseRoundnessSourceTypes; private RoundnessChangedListener mRoundnessChangedListener; protected NotificationHeaderViewWrapper(Context ctx, View view, ExpandableNotificationRow row) { @@ -122,7 +121,7 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper imple @Override public void applyRoundnessAndInvalidate() { - if (mUseRoundnessSourceTypes && mRoundnessChangedListener != null) { + if (mRoundnessChangedListener != null) { // We cannot apply the rounded corner to this View, so our parents (in drawChild()) will // clip our canvas. So we should invalidate our parent. mRoundnessChangedListener.applyRoundnessAndInvalidate(); @@ -377,15 +376,6 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper imple } /** - * Enable the support for rounded corner based on the SourceType - * - * @param enabled true if is supported - */ - public void useRoundnessSourceTypes(boolean enabled) { - mUseRoundnessSourceTypes = enabled; - } - - /** * Interface that handle the Roundness changes */ public interface RoundnessChangedListener { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/shelf/ui/viewbinder/NotificationShelfViewBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/shelf/ui/viewbinder/NotificationShelfViewBinder.kt index 81067157ca5b..12956ab9498a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/shelf/ui/viewbinder/NotificationShelfViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/shelf/ui/viewbinder/NotificationShelfViewBinder.kt @@ -81,7 +81,6 @@ object NotificationShelfViewBinder { ActivatableNotificationViewBinder.bind(viewModel, shelf, falsingManager) shelf.apply { setRefactorFlagEnabled(true) - useRoundnessSourceTypes(true) setSensitiveRevealAnimEndabled(featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM)) // TODO(278765923): Replace with eventual NotificationIconContainerViewBinder#bind() notificationIconAreaController.setShelfIcons(shelfIcons) 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 160a2309bfcc..d18757d3453f 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 @@ -45,9 +45,7 @@ import com.android.internal.widget.NotificationExpandButton; import com.android.systemui.R; import com.android.systemui.statusbar.CrossFadeHelper; import com.android.systemui.statusbar.NotificationGroupingUtil; -import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.notification.FeedbackIcon; -import com.android.systemui.statusbar.notification.LegacySourceType; import com.android.systemui.statusbar.notification.NotificationFadeAware; import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.Roundable; @@ -133,7 +131,6 @@ public class NotificationChildrenContainer extends ViewGroup private int mUntruncatedChildCount; private boolean mContainingNotificationIsFaded = false; private RoundableState mRoundableState; - private boolean mUseRoundnessSourceTypes; public NotificationChildrenContainer(Context context) { this(context, null); @@ -328,13 +325,6 @@ public class NotificationChildrenContainer extends ViewGroup row.setContentTransformationAmount(0, false /* isLastChild */); row.setNotificationFaded(mContainingNotificationIsFaded); - if (!mUseRoundnessSourceTypes) { - // This is a workaround, the NotificationShelf should be the owner of `OnScroll` - // roundness. - // Here we should reset the `OnScroll` roundness only on top-level rows. - NotificationShelf.resetLegacyOnScrollRoundness(row); - } - // It doesn't make sense to keep old animations around, lets cancel them! ExpandableViewState viewState = row.getViewState(); if (viewState != null) { @@ -342,9 +332,7 @@ public class NotificationChildrenContainer extends ViewGroup row.cancelAppearDrawing(); } - if (mUseRoundnessSourceTypes) { - applyRoundnessAndInvalidate(); - } + applyRoundnessAndInvalidate(); } private void ensureRemovedFromTransientContainer(View v) { @@ -379,10 +367,8 @@ public class NotificationChildrenContainer extends ViewGroup mGroupingUtil.restoreChildNotification(row); } - if (mUseRoundnessSourceTypes) { - row.requestRoundnessReset(FROM_PARENT, /* animate = */ false); - applyRoundnessAndInvalidate(); - } + row.requestRoundnessReset(FROM_PARENT, /* animate = */ false); + applyRoundnessAndInvalidate(); } /** @@ -409,10 +395,7 @@ public class NotificationChildrenContainer extends ViewGroup getContext(), mNotificationHeader, mContainingNotification); - mNotificationHeaderWrapper.useRoundnessSourceTypes(mUseRoundnessSourceTypes); - if (mUseRoundnessSourceTypes) { - mNotificationHeaderWrapper.setOnRoundnessChangedListener(this::invalidate); - } + mNotificationHeaderWrapper.setOnRoundnessChangedListener(this::invalidate); addView(mNotificationHeader, 0); invalidate(); } else { @@ -450,12 +433,7 @@ public class NotificationChildrenContainer extends ViewGroup getContext(), mNotificationHeaderLowPriority, mContainingNotification); - mNotificationHeaderWrapperLowPriority.useRoundnessSourceTypes( - mUseRoundnessSourceTypes - ); - if (mUseRoundnessSourceTypes) { - mNotificationHeaderWrapper.setOnRoundnessChangedListener(this::invalidate); - } + mNotificationHeaderWrapper.setOnRoundnessChangedListener(this::invalidate); addView(mNotificationHeaderLowPriority, 0); invalidate(); } else { @@ -891,7 +869,7 @@ public class NotificationChildrenContainer extends ViewGroup isCanvasChanged = true; canvas.save(); - if (mUseRoundnessSourceTypes && translation != 0f) { + if (translation != 0f) { clipPath.offset(translation, 0f); canvas.clipPath(clipPath); clipPath.offset(-translation, 0f); @@ -1444,40 +1422,30 @@ public class NotificationChildrenContainer extends ViewGroup @Override public void applyRoundnessAndInvalidate() { boolean last = true; - if (mUseRoundnessSourceTypes) { - if (mNotificationHeaderWrapper != null) { - mNotificationHeaderWrapper.requestTopRoundness( - /* value = */ getTopRoundness(), - /* sourceType = */ FROM_PARENT, - /* animate = */ false - ); - } - if (mNotificationHeaderWrapperLowPriority != null) { - mNotificationHeaderWrapperLowPriority.requestTopRoundness( - /* value = */ getTopRoundness(), - /* sourceType = */ FROM_PARENT, - /* animate = */ false - ); - } + if (mNotificationHeaderWrapper != null) { + mNotificationHeaderWrapper.requestTopRoundness( + /* value = */ getTopRoundness(), + /* sourceType = */ FROM_PARENT, + /* animate = */ false + ); + } + if (mNotificationHeaderWrapperLowPriority != null) { + mNotificationHeaderWrapperLowPriority.requestTopRoundness( + /* value = */ getTopRoundness(), + /* sourceType = */ FROM_PARENT, + /* animate = */ false + ); } for (int i = mAttachedChildren.size() - 1; i >= 0; i--) { ExpandableNotificationRow child = mAttachedChildren.get(i); if (child.getVisibility() == View.GONE) { continue; } - if (mUseRoundnessSourceTypes) { - child.requestRoundness( - /* top = */ 0f, - /* bottom = */ last ? getBottomRoundness() : 0f, - /* sourceType = */ FROM_PARENT, - /* animate = */ false); - } else { - child.requestRoundness( - /* top = */ 0f, - /* bottom = */ last ? getBottomRoundness() : 0f, - LegacySourceType.DefaultValue, - /* animate = */ isShown()); - } + child.requestRoundness( + /* top = */ 0f, + /* bottom = */ last ? getBottomRoundness() : 0f, + /* sourceType = */ FROM_PARENT, + /* animate = */ false); last = false; } Roundable.super.applyRoundnessAndInvalidate(); @@ -1537,15 +1505,6 @@ public class NotificationChildrenContainer extends ViewGroup return mNotificationHeaderWrapper; } - /** - * Enable the support for rounded corner based on the SourceType - * - * @param enabled true if is supported - */ - public void useRoundnessSourceTypes(boolean enabled) { - mUseRoundnessSourceTypes = enabled; - } - public String debugString() { return TAG + " { " + "visibility: " + getVisibility() diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java index b6aec83ae600..b6050c11d6e5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java @@ -16,16 +16,11 @@ package com.android.systemui.statusbar.notification.stack; -import android.content.res.Resources; -import android.util.MathUtils; - import androidx.annotation.NonNull; import com.android.systemui.Dumpable; -import com.android.systemui.R; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dump.DumpManager; -import com.android.systemui.statusbar.notification.LegacySourceType; import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager; import com.android.systemui.statusbar.notification.Roundable; import com.android.systemui.statusbar.notification.SourceType; @@ -65,7 +60,6 @@ public class NotificationRoundnessManager implements Dumpable { private ExpandableView mSwipedView = null; private Roundable mViewBeforeSwipedView = null; private Roundable mViewAfterSwipedView = null; - private boolean mUseRoundnessSourceTypes; @Inject NotificationRoundnessManager( @@ -79,7 +73,6 @@ public class NotificationRoundnessManager implements Dumpable { mTmpLastInSectionViews = new ExpandableView[numberOfSections]; mNotifLogger = notifLogger; mDumpManager = dumpManager; - mUseRoundnessSourceTypes = true; mDumpManager.registerDumpable(TAG, this); } @@ -98,11 +91,6 @@ public class NotificationRoundnessManager implements Dumpable { } public void updateView(ExpandableView view, boolean animate) { - if (mUseRoundnessSourceTypes) return; - boolean changed = updateViewWithoutCallback(view, animate); - if (changed) { - mRoundingChangedCallback.run(); - } } public boolean isViewAffectedBySwipe(ExpandableView expandableView) { @@ -115,52 +103,14 @@ public class NotificationRoundnessManager implements Dumpable { boolean updateViewWithoutCallback( ExpandableView view, boolean animate) { - if (mUseRoundnessSourceTypes) return false; - if (view == null - || view == mViewBeforeSwipedView - || view == mViewAfterSwipedView) { - return false; - } - - final boolean isTopChanged = view.requestTopRoundness( - getRoundnessDefaultValue(view, true /* top */), - LegacySourceType.DefaultValue, - animate); - - final boolean isBottomChanged = view.requestBottomRoundness( - getRoundnessDefaultValue(view, /* top = */ false), - LegacySourceType.DefaultValue, - animate); - - final boolean isFirstInSection = isFirstInSection(view); - final boolean isLastInSection = isLastInSection(view); - - view.setFirstInSection(isFirstInSection); - view.setLastInSection(isLastInSection); - - mNotifLogger.onCornersUpdated(view, isFirstInSection, - isLastInSection, isTopChanged, isBottomChanged); - - return (isFirstInSection || isLastInSection) && (isTopChanged || isBottomChanged); + return false; } private boolean isFirstInSection(ExpandableView view) { - if (mUseRoundnessSourceTypes) return false; - for (int i = 0; i < mFirstInSectionViews.length; i++) { - if (view == mFirstInSectionViews[i]) { - return true; - } - } return false; } private boolean isLastInSection(ExpandableView view) { - if (mUseRoundnessSourceTypes) return false; - for (int i = mLastInSectionViews.length - 1; i >= 0; i--) { - if (view == mLastInSectionViews[i]) { - return true; - } - } return false; } @@ -177,34 +127,27 @@ public class NotificationRoundnessManager implements Dumpable { if (mSwipedView != null) oldViews.add(mSwipedView); if (mViewAfterSwipedView != null) oldViews.add(mViewAfterSwipedView); - final SourceType source; - if (mUseRoundnessSourceTypes) { - source = DISMISS_ANIMATION; - } else { - source = LegacySourceType.OnDismissAnimation; - } - mViewBeforeSwipedView = viewBefore; if (viewBefore != null) { oldViews.remove(viewBefore); - viewBefore.requestRoundness(/* top = */ 0f, /* bottom = */ 1f, source); + viewBefore.requestRoundness(/* top = */ 0f, /* bottom = */ 1f, DISMISS_ANIMATION); } mSwipedView = viewSwiped; if (viewSwiped != null) { oldViews.remove(viewSwiped); - viewSwiped.requestRoundness(/* top = */ 1f, /* bottom = */ 1f, source); + viewSwiped.requestRoundness(/* top = */ 1f, /* bottom = */ 1f, DISMISS_ANIMATION); } mViewAfterSwipedView = viewAfter; if (viewAfter != null) { oldViews.remove(viewAfter); - viewAfter.requestRoundness(/* top = */ 1f, /* bottom = */ 0f, source); + viewAfter.requestRoundness(/* top = */ 1f, /* bottom = */ 0f, DISMISS_ANIMATION); } // After setting the current Views, reset the views that are still present in the set. for (Roundable oldView : oldViews) { - oldView.requestRoundnessReset(source); + oldView.requestRoundnessReset(DISMISS_ANIMATION); } } @@ -227,140 +170,28 @@ public class NotificationRoundnessManager implements Dumpable { } private float getRoundnessDefaultValue(Roundable view, boolean top) { - if (mUseRoundnessSourceTypes) return 0f; - - if (view == null) { - return 0f; - } - if (view == mViewBeforeSwipedView - || view == mSwipedView - || view == mViewAfterSwipedView) { - return 1f; - } - if (view instanceof ExpandableNotificationRow - && ((ExpandableNotificationRow) view).canViewBeCleared() - && mIsClearAllInProgress) { - return 1.0f; - } - if (view instanceof ExpandableView) { - ExpandableView expandableView = (ExpandableView) view; - if ((expandableView.isPinned() - || (expandableView.isHeadsUpAnimatingAway()) && !mExpanded)) { - return 1.0f; - } - if (isFirstInSection(expandableView) && top) { - return 1.0f; - } - if (isLastInSection(expandableView) && !top) { - return 1.0f; - } - - if (view == mTrackedHeadsUp) { - // If we're pushing up on a headsup the appear fraction is < 0 and it needs to - // still be rounded. - return MathUtils.saturate(1.0f - mAppearFraction); - } - if (expandableView.showingPulsing() && mRoundForPulsingViews) { - return 1.0f; - } - if (expandableView.isChildInGroup()) { - return 0f; - } - final Resources resources = expandableView.getResources(); - return resources.getDimension(R.dimen.notification_corner_radius_small) - / resources.getDimension(R.dimen.notification_corner_radius); - } return 0f; + } public void setExpanded(float expandedHeight, float appearFraction) { - if (mUseRoundnessSourceTypes) return; - mExpanded = expandedHeight != 0.0f; - mAppearFraction = appearFraction; - if (mTrackedHeadsUp != null) { - updateView(mTrackedHeadsUp, false /* animate */); - } } public void updateRoundedChildren(NotificationSection[] sections) { - if (mUseRoundnessSourceTypes) return; - boolean anyChanged = false; - for (int i = 0; i < sections.length; i++) { - mTmpFirstInSectionViews[i] = mFirstInSectionViews[i]; - mTmpLastInSectionViews[i] = mLastInSectionViews[i]; - mFirstInSectionViews[i] = sections[i].getFirstVisibleChild(); - mLastInSectionViews[i] = sections[i].getLastVisibleChild(); - } - anyChanged |= handleRemovedOldViews(sections, mTmpFirstInSectionViews, true); - anyChanged |= handleRemovedOldViews(sections, mTmpLastInSectionViews, false); - anyChanged |= handleAddedNewViews(sections, mTmpFirstInSectionViews, true); - anyChanged |= handleAddedNewViews(sections, mTmpLastInSectionViews, false); - if (anyChanged) { - mRoundingChangedCallback.run(); - } - - mNotifLogger.onSectionCornersUpdated(sections, anyChanged); } private boolean handleRemovedOldViews( NotificationSection[] sections, ExpandableView[] oldViews, boolean first) { - if (mUseRoundnessSourceTypes) return false; - boolean anyChanged = false; - for (ExpandableView oldView : oldViews) { - if (oldView != null) { - boolean isStillPresent = false; - boolean adjacentSectionChanged = false; - for (NotificationSection section : sections) { - ExpandableView newView = - (first ? section.getFirstVisibleChild() - : section.getLastVisibleChild()); - if (newView == oldView) { - isStillPresent = true; - if (oldView.isFirstInSection() != isFirstInSection(oldView) - || oldView.isLastInSection() != isLastInSection(oldView)) { - adjacentSectionChanged = true; - } - break; - } - } - if (!isStillPresent || adjacentSectionChanged) { - anyChanged = true; - if (!oldView.isRemoved()) { - updateViewWithoutCallback(oldView, oldView.isShown()); - } - } - } - } - return anyChanged; + return false; } private boolean handleAddedNewViews( NotificationSection[] sections, ExpandableView[] oldViews, boolean first) { - if (mUseRoundnessSourceTypes) return false; - boolean anyChanged = false; - for (NotificationSection section : sections) { - ExpandableView newView = - (first ? section.getFirstVisibleChild() : section.getLastVisibleChild()); - if (newView != null) { - boolean wasAlreadyPresent = false; - for (ExpandableView oldView : oldViews) { - if (oldView == newView) { - wasAlreadyPresent = true; - break; - } - } - if (!wasAlreadyPresent) { - anyChanged = true; - updateViewWithoutCallback(newView, - newView.isShown() && !mAnimatedChildren.contains(newView)); - } - } - } - return anyChanged; + return false; } public void setAnimatedChildren(HashSet<ExpandableView> animatedChildren) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.kt index 57b6dbce5398..fd064eeab2ab 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.kt @@ -52,8 +52,6 @@ class NotificationSectionsManager @Inject internal constructor( @SilentHeader private val silentHeaderController: SectionHeaderController ) : SectionProvider { - private val useRoundnessSourceTypes = true - private val configurationListener = object : ConfigurationController.ConfigurationListener { override fun onLocaleListChanged() { reinflateViews() @@ -193,35 +191,33 @@ class NotificationSectionsManager @Inject internal constructor( isSectionChanged || changed } - if (useRoundnessSourceTypes) { - val newFirstChildren = sections.mapNotNull { it.firstVisibleChild } - val newLastChildren = sections.mapNotNull { it.lastVisibleChild } + val newFirstChildren = sections.mapNotNull { it.firstVisibleChild } + val newLastChildren = sections.mapNotNull { it.lastVisibleChild } - // Update the roundness of Views that weren't already in the first/last position - newFirstChildren.forEach { firstChild -> - val wasFirstChild = oldFirstChildren.remove(firstChild) - if (!wasFirstChild) { - val notAnimatedChild = !notificationRoundnessManager.isAnimatedChild(firstChild) - val animated = firstChild.isShown && notAnimatedChild - firstChild.requestTopRoundness(1f, SECTION, animated) - } + // Update the roundness of Views that weren't already in the first/last position + newFirstChildren.forEach { firstChild -> + val wasFirstChild = oldFirstChildren.remove(firstChild) + if (!wasFirstChild) { + val notAnimatedChild = !notificationRoundnessManager.isAnimatedChild(firstChild) + val animated = firstChild.isShown && notAnimatedChild + firstChild.requestTopRoundness(1f, SECTION, animated) } - newLastChildren.forEach { lastChild -> - val wasLastChild = oldLastChildren.remove(lastChild) - if (!wasLastChild) { - val notAnimatedChild = !notificationRoundnessManager.isAnimatedChild(lastChild) - val animated = lastChild.isShown && notAnimatedChild - lastChild.requestBottomRoundness(1f, SECTION, animated) - } + } + newLastChildren.forEach { lastChild -> + val wasLastChild = oldLastChildren.remove(lastChild) + if (!wasLastChild) { + val notAnimatedChild = !notificationRoundnessManager.isAnimatedChild(lastChild) + val animated = lastChild.isShown && notAnimatedChild + lastChild.requestBottomRoundness(1f, SECTION, animated) } + } - // The Views left in the set are no longer in the first/last position - oldFirstChildren.forEach { noMoreFirstChild -> - noMoreFirstChild.requestTopRoundness(0f, SECTION) - } - oldLastChildren.forEach { noMoreLastChild -> - noMoreLastChild.requestBottomRoundness(0f, SECTION) - } + // The Views left in the set are no longer in the first/last position + oldFirstChildren.forEach { noMoreFirstChild -> + noMoreFirstChild.requestTopRoundness(0f, SECTION) + } + oldLastChildren.forEach { noMoreLastChild -> + noMoreLastChild.requestBottomRoundness(0f, SECTION) } if (DEBUG) { 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 abcb825c3e18..edff8770479a 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 @@ -200,7 +200,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private Set<Integer> mDebugTextUsedYPositions; private final boolean mDebugRemoveAnimation; private final boolean mSimplifiedAppearFraction; - private final boolean mUseRoundnessSourceTypes; private final boolean mSensitiveRevealAnimEndabled; private boolean mAnimatedInsets; @@ -625,7 +624,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mDebugLines = featureFlags.isEnabled(Flags.NSSL_DEBUG_LINES); mDebugRemoveAnimation = featureFlags.isEnabled(Flags.NSSL_DEBUG_REMOVE_ANIMATION); mSimplifiedAppearFraction = featureFlags.isEnabled(Flags.SIMPLIFIED_APPEAR_FRACTION); - mUseRoundnessSourceTypes = true; mSensitiveRevealAnimEndabled = featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM); setAnimatedInsetsEnabled(featureFlags.isEnabled(Flags.ANIMATED_NOTIFICATION_SHADE_INSETS)); mSectionsManager = Dependency.get(NotificationSectionsManager.class); @@ -3134,10 +3132,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mAnimateNextSectionBoundsChange = false; } mAmbientState.setLastVisibleBackgroundChild(lastChild); - if (!mUseRoundnessSourceTypes) { - // TODO: Refactor SectionManager and put the RoundnessManager there. - mController.getNotificationRoundnessManager().updateRoundedChildren(mSections); - } mAnimateBottomOnLayout = false; invalidate(); } @@ -3584,9 +3578,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable @ShadeViewRefactor(RefactorComponent.LAYOUT_ALGORITHM) protected StackScrollAlgorithm createStackScrollAlgorithm(Context context) { - StackScrollAlgorithm stackScrollAlgorithm = new StackScrollAlgorithm(context, this); - stackScrollAlgorithm.useRoundnessSourceTypes(mUseRoundnessSourceTypes); - return stackScrollAlgorithm; + return new StackScrollAlgorithm(context, this); } /** 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 d96a2cd4f760..83fde5280166 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 @@ -192,7 +192,6 @@ public class NotificationStackScrollLayoutController { private int mBarState; private HeadsUpAppearanceController mHeadsUpAppearanceController; private final FeatureFlags mFeatureFlags; - private final boolean mUseRoundnessSourceTypes; private final NotificationTargetsHelper mNotificationTargetsHelper; private final SecureSettings mSecureSettings; private final NotificationDismissibilityProvider mDismissibilityProvider; @@ -591,36 +590,12 @@ public class NotificationStackScrollLayoutController { } @Override - public void onHeadsUpPinned(NotificationEntry entry) { - if (!mUseRoundnessSourceTypes) { - mNotificationRoundnessManager.updateView( - entry.getRow(), - /* animate = */ false); - } - } - - @Override - public void onHeadsUpUnPinned(NotificationEntry entry) { - if (!mUseRoundnessSourceTypes) { - ExpandableNotificationRow row = entry.getRow(); - // update the roundedness posted, because we might be animating away the - // headsup soon, so no need to set the roundedness to 0 and then back to 1. - row.post(() -> mNotificationRoundnessManager.updateView(row, - true /* animate */)); - } - } - - @Override public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) { long numEntries = mHeadsUpManager.getAllEntries().count(); NotificationEntry topEntry = mHeadsUpManager.getTopEntry(); mView.setNumHeadsUp(numEntries); mView.setTopHeadsUpEntry(topEntry); generateHeadsUpAnimation(entry, isHeadsUp); - if (!mUseRoundnessSourceTypes) { - ExpandableNotificationRow row = entry.getRow(); - mNotificationRoundnessManager.updateView(row, true /* animate */); - } } }; @@ -720,7 +695,6 @@ public class NotificationStackScrollLayoutController { mShadeController = shadeController; mNotifIconAreaController = notifIconAreaController; mFeatureFlags = featureFlags; - mUseRoundnessSourceTypes = true; mNotificationTargetsHelper = notificationTargetsHelper; mSecureSettings = secureSettings; mDismissibilityProvider = dismissibilityProvider; @@ -788,11 +762,6 @@ public class NotificationStackScrollLayoutController { mLockscreenUserManager.addUserChangedListener(mLockscreenUserChangeListener); - if (!mUseRoundnessSourceTypes) { - mNotificationRoundnessManager.setOnRoundingChangedCallback(mView::invalidate); - mView.addOnExpandedHeightChangedListener(mNotificationRoundnessManager::setExpanded); - } - mVisibilityLocationProviderDelegator.setDelegate(this::isInVisibleLocation); mTunerService.addTunable( @@ -1776,9 +1745,6 @@ public class NotificationStackScrollLayoutController { @Override public void bindRow(ExpandableNotificationRow row) { row.setHeadsUpAnimatingAwayListener(animatingAway -> { - if (!mUseRoundnessSourceTypes) { - mNotificationRoundnessManager.updateView(row, false); - } NotificationEntry entry = row.getEntry(); mHeadsUpAppearanceController.updateHeader(entry); mHeadsUpAppearanceController.updateHeadsUpAndPulsingRoundness(entry); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java index 2d0a6cf8e5a7..993c3801cecd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java @@ -68,7 +68,6 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc private boolean mIsExpanded; private boolean mPulsing; private final NotificationRoundnessManager mNotificationRoundnessManager; - private final boolean mUseRoundnessSourceTypes; NotificationSwipeHelper( Resources resources, @@ -80,7 +79,6 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc NotificationRoundnessManager notificationRoundnessManager) { super(callback, resources, viewConfiguration, falsingManager, featureFlags); mNotificationRoundnessManager = notificationRoundnessManager; - mUseRoundnessSourceTypes = true; mMenuListener = menuListener; mCallback = callback; mFalsingCheck = () -> resetExposedMenuView(true /* animate */, true /* force */); @@ -322,8 +320,7 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc protected void prepareDismissAnimation(View view, Animator anim) { super.prepareDismissAnimation(view, anim); - if (mUseRoundnessSourceTypes - && view instanceof ExpandableNotificationRow + if (view instanceof ExpandableNotificationRow && mNotificationRoundnessManager.isClearAllInProgress()) { ExpandableNotificationRow row = (ExpandableNotificationRow) view; anim.addListener(new AnimatorListenerAdapter() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationTargetsHelper.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationTargetsHelper.kt index cd0c1b153816..02662f409a87 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationTargetsHelper.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationTargetsHelper.kt @@ -4,7 +4,6 @@ import androidx.core.view.children import androidx.core.view.isVisible import com.android.systemui.dagger.SysUISingleton import com.android.systemui.flags.FeatureFlags -import com.android.systemui.flags.Flags import com.android.systemui.statusbar.notification.Roundable import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableView @@ -20,7 +19,6 @@ class NotificationTargetsHelper constructor( featureFlags: FeatureFlags, ) { - private val useRoundnessSourceTypes = true /** * This method looks for views that can be rounded (and implement [Roundable]) during a @@ -48,10 +46,6 @@ constructor( if (notificationParent != null && childrenContainer != null) { // We are inside a notification group - if (!useRoundnessSourceTypes) { - return RoundableTargets(null, null, null) - } - val visibleGroupChildren = childrenContainer.attachedChildren.filter { it.isVisible } val indexOfParentSwipedView = visibleGroupChildren.indexOf(viewSwiped) 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 306047388381..92d767a419f1 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 @@ -34,7 +34,6 @@ import com.android.systemui.flags.Flags; import com.android.systemui.shade.transition.LargeScreenShadeInterpolator; import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.NotificationShelf; -import com.android.systemui.statusbar.notification.LegacySourceType; import com.android.systemui.statusbar.notification.SourceType; import com.android.systemui.statusbar.notification.row.ActivatableNotificationView; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; @@ -75,7 +74,6 @@ public class StackScrollAlgorithm { private float mQuickQsOffsetHeight; private float mSmallCornerRadius; private float mLargeCornerRadius; - private boolean mUseRoundnessSourceTypes; public StackScrollAlgorithm( Context context, @@ -836,12 +834,8 @@ public class StackScrollAlgorithm { row.isLastInSection() ? 1f : (mSmallCornerRadius / mLargeCornerRadius); final float bottomValue = computeCornerRoundnessForPinnedHun(mHostView.getHeight(), ambientState.getStackY(), getMaxAllowedChildHeight(row), originalCornerRadius); - if (mUseRoundnessSourceTypes) { - row.requestBottomRoundness(bottomValue, STACK_SCROLL_ALGO); - row.addOnDetachResetRoundness(STACK_SCROLL_ALGO); - } else { - row.requestBottomRoundness(bottomValue, LegacySourceType.OnScroll); - } + row.requestBottomRoundness(bottomValue, STACK_SCROLL_ALGO); + row.addOnDetachResetRoundness(STACK_SCROLL_ALGO); } @VisibleForTesting @@ -979,14 +973,6 @@ public class StackScrollAlgorithm { this.mIsExpanded = isExpanded; } - /** - * Enable the support for rounded corner based on the SourceType - * @param enabled true if is supported - */ - public void useRoundnessSourceTypes(boolean enabled) { - mUseRoundnessSourceTypes = enabled; - } - public static class StackScrollAlgorithmState { /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java index 0c4821c003dd..f15dcc310837 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java @@ -76,7 +76,6 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar private final DarkIconDispatcher mDarkIconDispatcher; private final ShadeViewController mShadeViewController; private final NotificationRoundnessManager mNotificationRoundnessManager; - private final boolean mUseRoundnessSourceTypes; private final Consumer<ExpandableNotificationRow> mSetTrackingHeadsUp = this::setTrackingHeadsUp; private final BiConsumer<Float, Float> mSetExpandedHeight = this::setAppearFraction; @@ -124,7 +123,6 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar super(headsUpStatusBarView); mNotificationIconAreaController = notificationIconAreaController; mNotificationRoundnessManager = notificationRoundnessManager; - mUseRoundnessSourceTypes = true; mHeadsUpManager = headsUpManager; // We may be mid-HUN-expansion when this controller is re-created (for example, if the user @@ -405,21 +403,19 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar * @param entry target notification */ public void updateHeadsUpAndPulsingRoundness(NotificationEntry entry) { - if (mUseRoundnessSourceTypes) { - ExpandableNotificationRow row = entry.getRow(); - boolean isTrackedChild = row == mTrackedChild; - if (row.isPinned() || row.isHeadsUpAnimatingAway() || isTrackedChild) { - float roundness = MathUtils.saturate(1f - mAppearFraction); - row.requestRoundness(roundness, roundness, HEADS_UP); + ExpandableNotificationRow row = entry.getRow(); + boolean isTrackedChild = row == mTrackedChild; + if (row.isPinned() || row.isHeadsUpAnimatingAway() || isTrackedChild) { + float roundness = MathUtils.saturate(1f - mAppearFraction); + row.requestRoundness(roundness, roundness, HEADS_UP); + } else { + row.requestRoundnessReset(HEADS_UP); + } + if (mNotificationRoundnessManager.shouldRoundNotificationPulsing()) { + if (row.showingPulsing()) { + row.requestRoundness(/* top = */ 1f, /* bottom = */ 1f, PULSING); } else { - row.requestRoundnessReset(HEADS_UP); - } - if (mNotificationRoundnessManager.shouldRoundNotificationPulsing()) { - if (row.showingPulsing()) { - row.requestRoundness(/* top = */ 1f, /* bottom = */ 1f, PULSING); - } else { - row.requestRoundnessReset(PULSING); - } + row.requestRoundnessReset(PULSING); } } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java index 9186c35e2b47..4c83194783ab 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java @@ -617,24 +617,9 @@ public class ExpandableNotificationRowTest extends SysuiTestCase { } @Test - public void applyRoundnessAndInv_should_be_immediately_applied_on_childrenContainer_legacy() - throws Exception { - ExpandableNotificationRow group = mNotificationTestHelper.createGroup(); - group.useRoundnessSourceTypes(false); - Assert.assertEquals(0f, group.getBottomRoundness(), 0.001f); - Assert.assertEquals(0f, group.getChildrenContainer().getBottomRoundness(), 0.001f); - - group.requestBottomRoundness(1f, SourceType.from(""), false); - - Assert.assertEquals(1f, group.getBottomRoundness(), 0.001f); - Assert.assertEquals(1f, group.getChildrenContainer().getBottomRoundness(), 0.001f); - } - - @Test public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_childrenContainer() throws Exception { ExpandableNotificationRow group = mNotificationTestHelper.createGroup(); - group.useRoundnessSourceTypes(true); Assert.assertEquals(0f, group.getBottomRoundness(), 0.001f); Assert.assertEquals(0f, group.getChildrenContainer().getBottomRoundness(), 0.001f); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java index e41929f7d578..be976a1c9eaf 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java @@ -25,7 +25,6 @@ import android.view.View; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; -import com.android.systemui.statusbar.notification.LegacySourceType; import com.android.systemui.statusbar.notification.SourceType; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.NotificationTestHelper; @@ -158,55 +157,7 @@ public class NotificationChildrenContainerTest extends SysuiTestCase { } @Test - public void addNotification_shouldResetOnScrollRoundness() throws Exception { - ExpandableNotificationRow row = mNotificationTestHelper.createRowWithRoundness( - /* topRoundness = */ 1f, - /* bottomRoundness = */ 1f, - /* sourceType = */ LegacySourceType.OnScroll); - - mChildrenContainer.addNotification(row, 0); - - Assert.assertEquals(0f, row.getTopRoundness(), /* delta = */ 0f); - Assert.assertEquals(0f, row.getBottomRoundness(), /* delta = */ 0f); - } - - @Test - public void addNotification_shouldNotResetOtherRoundness() throws Exception { - ExpandableNotificationRow row1 = mNotificationTestHelper.createRowWithRoundness( - /* topRoundness = */ 1f, - /* bottomRoundness = */ 1f, - /* sourceType = */ LegacySourceType.DefaultValue); - ExpandableNotificationRow row2 = mNotificationTestHelper.createRowWithRoundness( - /* topRoundness = */ 1f, - /* bottomRoundness = */ 1f, - /* sourceType = */ LegacySourceType.OnDismissAnimation); - - mChildrenContainer.addNotification(row1, 0); - mChildrenContainer.addNotification(row2, 0); - - Assert.assertEquals(1f, row1.getTopRoundness(), /* delta = */ 0f); - Assert.assertEquals(1f, row1.getBottomRoundness(), /* delta = */ 0f); - Assert.assertEquals(1f, row2.getTopRoundness(), /* delta = */ 0f); - Assert.assertEquals(1f, row2.getBottomRoundness(), /* delta = */ 0f); - } - - @Test - public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_last_child_legacy() { - mChildrenContainer.useRoundnessSourceTypes(false); - List<ExpandableNotificationRow> children = mChildrenContainer.getAttachedChildren(); - ExpandableNotificationRow notificationRow = children.get(children.size() - 1); - Assert.assertEquals(0f, mChildrenContainer.getBottomRoundness(), 0.001f); - Assert.assertEquals(0f, notificationRow.getBottomRoundness(), 0.001f); - - mChildrenContainer.requestBottomRoundness(1f, SourceType.from(""), false); - - Assert.assertEquals(1f, mChildrenContainer.getBottomRoundness(), 0.001f); - Assert.assertEquals(1f, notificationRow.getBottomRoundness(), 0.001f); - } - - @Test public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_last_child() { - mChildrenContainer.useRoundnessSourceTypes(true); List<ExpandableNotificationRow> children = mChildrenContainer.getAttachedChildren(); ExpandableNotificationRow notificationRow = children.get(children.size() - 1); Assert.assertEquals(0f, mChildrenContainer.getBottomRoundness(), 0.001f); @@ -220,8 +171,6 @@ public class NotificationChildrenContainerTest extends SysuiTestCase { @Test public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_header() { - mChildrenContainer.useRoundnessSourceTypes(true); - NotificationHeaderViewWrapper header = mChildrenContainer.getNotificationHeaderWrapper(); Assert.assertEquals(0f, header.getTopRoundness(), 0.001f); @@ -232,7 +181,6 @@ public class NotificationChildrenContainerTest extends SysuiTestCase { @Test public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_headerLowPriority() { - mChildrenContainer.useRoundnessSourceTypes(true); mChildrenContainer.setIsLowPriority(true); NotificationHeaderViewWrapper header = mChildrenContainer.getNotificationHeaderWrapper(); |