Merge changes I7f59d2a1,I9fc39c85,I8ba8af41 into udc-dev

* changes:
  Flag roundness/4: Remove LegacySourceType
  Flag roundness/3: Clean up NotificationRoundnessManager
  Flag roundness/2: Remove methods/properties
This commit is contained in:
Omar Miatello
2023-04-27 08:40:45 +00:00
committed by Android (Google) Code Review
21 changed files with 88 additions and 703 deletions

View File

@@ -52,7 +52,6 @@ public class LegacyNotificationShelfControllerImpl implements NotificationShelfC
mActivatableNotificationViewController = activatableNotificationViewController; mActivatableNotificationViewController = activatableNotificationViewController;
mKeyguardBypassController = keyguardBypassController; mKeyguardBypassController = keyguardBypassController;
mStatusBarStateController = statusBarStateController; mStatusBarStateController = statusBarStateController;
mView.useRoundnessSourceTypes(true);
mView.setSensitiveRevealAnimEndabled(featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM)); mView.setSensitiveRevealAnimEndabled(featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM));
mOnAttachStateChangeListener = new View.OnAttachStateChangeListener() { mOnAttachStateChangeListener = new View.OnAttachStateChangeListener() {
@Override @Override

View File

@@ -44,7 +44,6 @@ import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags; import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener; import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
import com.android.systemui.shade.transition.LargeScreenShadeInterpolator; import com.android.systemui.shade.transition.LargeScreenShadeInterpolator;
import com.android.systemui.statusbar.notification.LegacySourceType;
import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.notification.SourceType; import com.android.systemui.statusbar.notification.SourceType;
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView; import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
@@ -128,13 +127,6 @@ public class NotificationShelf extends ActivatableNotificationView implements St
setClipToPadding(false); setClipToPadding(false);
mShelfIcons.setIsStaticLayout(false); mShelfIcons.setIsStaticLayout(false);
requestRoundness(/* top = */ 1f, /* bottom = */ 1f, BASE_VALUE, /* animate = */ 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(); updateResources();
} }
@@ -569,17 +561,8 @@ public class NotificationShelf extends ActivatableNotificationView implements St
* mAmbientState.getExpansionFraction(); * mAmbientState.getExpansionFraction();
final float cornerAnimationTop = shelfStart - cornerAnimationDistance; final float cornerAnimationTop = shelfStart - cornerAnimationDistance;
final SourceType sourceType;
if (mUseRoundnessSourceTypes) {
sourceType = SHELF_SCROLL;
} else {
sourceType = LegacySourceType.OnScroll;
}
final float topValue; final float topValue;
if (!mUseRoundnessSourceTypes && anv.isFirstInSection()) { if (viewStart >= cornerAnimationTop) {
topValue = 1f;
} else if (viewStart >= cornerAnimationTop) {
// Round top corners within animation bounds // Round top corners within animation bounds
topValue = MathUtils.saturate( topValue = MathUtils.saturate(
(viewStart - cornerAnimationTop) / cornerAnimationDistance); (viewStart - cornerAnimationTop) / cornerAnimationDistance);
@@ -588,12 +571,10 @@ public class NotificationShelf extends ActivatableNotificationView implements St
// Reset top and bottom corners outside of animation bounds. // Reset top and bottom corners outside of animation bounds.
topValue = 0f; topValue = 0f;
} }
anv.requestTopRoundness(topValue, sourceType, /* animate = */ false); anv.requestTopRoundness(topValue, SHELF_SCROLL, /* animate = */ false);
final float bottomValue; final float bottomValue;
if (!mUseRoundnessSourceTypes && anv.isLastInSection()) { if (viewEnd >= cornerAnimationTop) {
bottomValue = 1f;
} else if (viewEnd >= cornerAnimationTop) {
// Round bottom corners within animation bounds // Round bottom corners within animation bounds
bottomValue = MathUtils.saturate( bottomValue = MathUtils.saturate(
(viewEnd - cornerAnimationTop) / cornerAnimationDistance); (viewEnd - cornerAnimationTop) / cornerAnimationDistance);
@@ -602,7 +583,7 @@ public class NotificationShelf extends ActivatableNotificationView implements St
// Reset top and bottom corners outside of animation bounds. // Reset top and bottom corners outside of animation bounds.
bottomValue = 0f; bottomValue = 0f;
} }
anv.requestBottomRoundness(bottomValue, sourceType, /* animate = */ false); anv.requestBottomRoundness(bottomValue, SHELF_SCROLL, /* animate = */ false);
} }
private boolean isViewAffectedBySwipe(ExpandableView expandableView) { private boolean isViewAffectedBySwipe(ExpandableView expandableView) {
@@ -1100,15 +1081,6 @@ public class NotificationShelf extends ActivatableNotificationView implements St
child.requestRoundnessReset(SHELF_SCROLL); child.requestRoundnessReset(SHELF_SCROLL);
} }
/**
* This method resets the OnScroll roundness of a view to 0f
* <p>
* Note: This should be the only class that handles roundness {@code SourceType.OnScroll}
*/
public static void resetLegacyOnScrollRoundness(ExpandableView expandableView) {
expandableView.requestRoundnessReset(LegacySourceType.OnScroll);
}
@Override @Override
public void dump(PrintWriter pwOriginal, String[] args) { public void dump(PrintWriter pwOriginal, String[] args) {
IndentingPrintWriter pw = DumpUtilsKt.asIndenting(pwOriginal); IndentingPrintWriter pw = DumpUtilsKt.asIndenting(pwOriginal);

View File

@@ -87,13 +87,8 @@ constructor(
bypassController.isPulseExpanding = value bypassController.isPulseExpanding = value
if (changed) { if (changed) {
if (value) { if (value) {
val topEntry = headsUpManager.topEntry
topEntry?.let {
roundnessManager.setTrackingHeadsUp(it.row)
}
lockscreenShadeTransitionController.onPulseExpansionStarted() lockscreenShadeTransitionController.onPulseExpansionStarted()
} else { } else {
roundnessManager.setTrackingHeadsUp(null)
if (!leavingLockscreen) { if (!leavingLockscreen) {
bypassController.maybePerformPendingUnlock() bypassController.maybePerformPendingUnlock()
pulseExpandAbortListener?.run() pulseExpandAbortListener?.run()

View File

@@ -448,10 +448,3 @@ interface SourceType {
} }
} }
} }
@Deprecated("Use SourceType.from() instead", ReplaceWith("SourceType.from()"))
enum class LegacySourceType : SourceType {
DefaultValue,
OnDismissAnimation,
OnScroll,
}

View File

@@ -110,7 +110,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
protected Point mTargetPoint; protected Point mTargetPoint;
private boolean mDismissed; private boolean mDismissed;
private boolean mRefocusOnDismiss; private boolean mRefocusOnDismiss;
protected boolean mUseRoundnessSourceTypes;
public ActivatableNotificationView(Context context, AttributeSet attrs) { public ActivatableNotificationView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
@@ -709,18 +708,10 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
mTouchHandler = touchHandler; 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 @Override
protected void onDetachedFromWindow() { protected void onDetachedFromWindow() {
super.onDetachedFromWindow(); super.onDetachedFromWindow();
if (mUseRoundnessSourceTypes && !mOnDetachResetRoundness.isEmpty()) { if (!mOnDetachResetRoundness.isEmpty()) {
for (SourceType sourceType : mOnDetachResetRoundness) { for (SourceType sourceType : mOnDetachResetRoundness) {
requestRoundnessReset(sourceType); requestRoundnessReset(sourceType);
} }

View File

@@ -87,7 +87,6 @@ import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.notification.AboveShelfChangedListener; import com.android.systemui.statusbar.notification.AboveShelfChangedListener;
import com.android.systemui.statusbar.notification.FeedbackIcon; import com.android.systemui.statusbar.notification.FeedbackIcon;
import com.android.systemui.statusbar.notification.LaunchAnimationParameters; 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.NotificationFadeAware;
import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorController; import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorController;
import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.NotificationUtils;
@@ -866,9 +865,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
} }
onAttachedChildrenCountChanged(); onAttachedChildrenCountChanged();
row.setIsChildInGroup(false, null); 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()) { if (child.keepInParentForDismissAnimation()) {
mChildrenContainer.removeNotification(child); mChildrenContainer.removeNotification(child);
child.setIsChildInGroup(false, null); child.setIsChildInGroup(false, null);
if (!mUseRoundnessSourceTypes) {
LegacySourceType sourceType = LegacySourceType.DefaultValue;
child.requestBottomRoundness(0f, sourceType, /* animate = */ false);
}
child.setKeepInParentForDismissAnimation(false); child.setKeepInParentForDismissAnimation(false);
logKeepInParentChildDetached(child); logKeepInParentChildDetached(child);
childCountChanged = true; childCountChanged = true;
@@ -942,9 +934,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
mNotificationParent.updateBackgroundForGroupState(); mNotificationParent.updateBackgroundForGroupState();
} }
updateBackgroundClipping(); updateBackgroundClipping();
if (mUseRoundnessSourceTypes) { updateBaseRoundness();
updateBaseRoundness();
}
} }
@Override @Override
@@ -1054,15 +1044,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
if (isAboveShelf() != wasAboveShelf) { if (isAboveShelf() != wasAboveShelf) {
mAboveShelfChangedListener.onAboveShelfStateChanged(!wasAboveShelf); mAboveShelfChangedListener.onAboveShelfStateChanged(!wasAboveShelf);
} }
if (mUseRoundnessSourceTypes) { if (pinned) {
if (pinned) { // Should be animated if someone explicitly set it to 0 and the row is shown.
// Should be animated if someone explicitly set it to 0 and the row is shown. boolean animated = mAnimatePinnedRoundness && isShown();
boolean animated = mAnimatePinnedRoundness && isShown(); requestRoundness(/* top = */ 1f, /* bottom = */ 1f, PINNED, animated);
requestRoundness(/* top = */ 1f, /* bottom = */ 1f, PINNED, animated); } else {
} else { requestRoundnessReset(PINNED);
requestRoundnessReset(PINNED); mAnimatePinnedRoundness = true;
mAnimatePinnedRoundness = true;
}
} }
} }
@@ -1879,7 +1867,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
mChildrenContainer.setIsLowPriority(mIsLowPriority); mChildrenContainer.setIsLowPriority(mIsLowPriority);
mChildrenContainer.setContainingNotification(ExpandableNotificationRow.this); mChildrenContainer.setContainingNotification(ExpandableNotificationRow.this);
mChildrenContainer.onNotificationUpdated(); mChildrenContainer.onNotificationUpdated();
mChildrenContainer.useRoundnessSourceTypes(mUseRoundnessSourceTypes);
mTranslateableViews.add(mChildrenContainer); mTranslateableViews.add(mChildrenContainer);
}); });
@@ -2308,24 +2295,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
mBackgroundNormal.setExpandAnimationSize(params.getWidth(), actualHeight); 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) { public void setExpandAnimationRunning(boolean expandAnimationRunning) {
if (expandAnimationRunning) { if (expandAnimationRunning) {
setAboveShelf(true); setAboveShelf(true);
@@ -3481,18 +3450,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
private void applyChildrenRoundness() { private void applyChildrenRoundness() {
if (mIsSummaryWithChildren) { if (mIsSummaryWithChildren) {
if (mUseRoundnessSourceTypes) { mChildrenContainer.requestRoundness(
mChildrenContainer.requestRoundness( /* top = */ getTopRoundness(),
/* top = */ getTopRoundness(), /* bottom = */ getBottomRoundness(),
/* bottom = */ getBottomRoundness(), /* sourceType = */ FROM_PARENT,
/* sourceType = */ FROM_PARENT, /* animate = */ false);
/* animate = */ false);
} else {
mChildrenContainer.requestBottomRoundness(
getBottomRoundness(),
LegacySourceType.DefaultValue,
/* 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 @Override
protected void onAttachedToWindow() { protected void onAttachedToWindow() {
super.onAttachedToWindow(); super.onAttachedToWindow();
if (mUseRoundnessSourceTypes) { updateBaseRoundness();
updateBaseRoundness();
}
} }
/** Set whether this notification may show a snooze action. */ /** Set whether this notification may show a snooze action. */

View File

@@ -261,7 +261,6 @@ public class ExpandableNotificationRowController implements NotifViewController
mStatusBarStateController.removeCallback(mStatusBarStateListener); mStatusBarStateController.removeCallback(mStatusBarStateListener);
} }
}); });
mView.useRoundnessSourceTypes(true);
} }
private final StatusBarStateController.StateListener mStatusBarStateListener = private final StatusBarStateController.StateListener mStatusBarStateListener =

View File

@@ -72,7 +72,6 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper imple
private View mFeedbackIcon; private View mFeedbackIcon;
private boolean mIsLowPriority; private boolean mIsLowPriority;
private boolean mTransformLowPriorityTitle; private boolean mTransformLowPriorityTitle;
private boolean mUseRoundnessSourceTypes;
private RoundnessChangedListener mRoundnessChangedListener; private RoundnessChangedListener mRoundnessChangedListener;
protected NotificationHeaderViewWrapper(Context ctx, View view, ExpandableNotificationRow row) { protected NotificationHeaderViewWrapper(Context ctx, View view, ExpandableNotificationRow row) {
@@ -122,7 +121,7 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper imple
@Override @Override
public void applyRoundnessAndInvalidate() { 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 // We cannot apply the rounded corner to this View, so our parents (in drawChild()) will
// clip our canvas. So we should invalidate our parent. // clip our canvas. So we should invalidate our parent.
mRoundnessChangedListener.applyRoundnessAndInvalidate(); mRoundnessChangedListener.applyRoundnessAndInvalidate();
@@ -376,15 +375,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 * Interface that handle the Roundness changes
*/ */

View File

@@ -81,7 +81,6 @@ object NotificationShelfViewBinder {
ActivatableNotificationViewBinder.bind(viewModel, shelf, falsingManager) ActivatableNotificationViewBinder.bind(viewModel, shelf, falsingManager)
shelf.apply { shelf.apply {
setRefactorFlagEnabled(true) setRefactorFlagEnabled(true)
useRoundnessSourceTypes(true)
setSensitiveRevealAnimEndabled(featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM)) setSensitiveRevealAnimEndabled(featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM))
// TODO(278765923): Replace with eventual NotificationIconContainerViewBinder#bind() // TODO(278765923): Replace with eventual NotificationIconContainerViewBinder#bind()
notificationIconAreaController.setShelfIcons(shelfIcons) notificationIconAreaController.setShelfIcons(shelfIcons)

View File

@@ -45,9 +45,7 @@ import com.android.internal.widget.NotificationExpandButton;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.statusbar.CrossFadeHelper; import com.android.systemui.statusbar.CrossFadeHelper;
import com.android.systemui.statusbar.NotificationGroupingUtil; 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.FeedbackIcon;
import com.android.systemui.statusbar.notification.LegacySourceType;
import com.android.systemui.statusbar.notification.NotificationFadeAware; import com.android.systemui.statusbar.notification.NotificationFadeAware;
import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.notification.Roundable; import com.android.systemui.statusbar.notification.Roundable;
@@ -133,7 +131,6 @@ public class NotificationChildrenContainer extends ViewGroup
private int mUntruncatedChildCount; private int mUntruncatedChildCount;
private boolean mContainingNotificationIsFaded = false; private boolean mContainingNotificationIsFaded = false;
private RoundableState mRoundableState; private RoundableState mRoundableState;
private boolean mUseRoundnessSourceTypes;
public NotificationChildrenContainer(Context context) { public NotificationChildrenContainer(Context context) {
this(context, null); this(context, null);
@@ -328,13 +325,6 @@ public class NotificationChildrenContainer extends ViewGroup
row.setContentTransformationAmount(0, false /* isLastChild */); row.setContentTransformationAmount(0, false /* isLastChild */);
row.setNotificationFaded(mContainingNotificationIsFaded); 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! // It doesn't make sense to keep old animations around, lets cancel them!
ExpandableViewState viewState = row.getViewState(); ExpandableViewState viewState = row.getViewState();
if (viewState != null) { if (viewState != null) {
@@ -342,9 +332,7 @@ public class NotificationChildrenContainer extends ViewGroup
row.cancelAppearDrawing(); row.cancelAppearDrawing();
} }
if (mUseRoundnessSourceTypes) { applyRoundnessAndInvalidate();
applyRoundnessAndInvalidate();
}
} }
private void ensureRemovedFromTransientContainer(View v) { private void ensureRemovedFromTransientContainer(View v) {
@@ -379,10 +367,8 @@ public class NotificationChildrenContainer extends ViewGroup
mGroupingUtil.restoreChildNotification(row); mGroupingUtil.restoreChildNotification(row);
} }
if (mUseRoundnessSourceTypes) { row.requestRoundnessReset(FROM_PARENT, /* animate = */ false);
row.requestRoundnessReset(FROM_PARENT, /* animate = */ false); applyRoundnessAndInvalidate();
applyRoundnessAndInvalidate();
}
} }
/** /**
@@ -409,10 +395,7 @@ public class NotificationChildrenContainer extends ViewGroup
getContext(), getContext(),
mNotificationHeader, mNotificationHeader,
mContainingNotification); mContainingNotification);
mNotificationHeaderWrapper.useRoundnessSourceTypes(mUseRoundnessSourceTypes); mNotificationHeaderWrapper.setOnRoundnessChangedListener(this::invalidate);
if (mUseRoundnessSourceTypes) {
mNotificationHeaderWrapper.setOnRoundnessChangedListener(this::invalidate);
}
addView(mNotificationHeader, 0); addView(mNotificationHeader, 0);
invalidate(); invalidate();
} else { } else {
@@ -450,12 +433,7 @@ public class NotificationChildrenContainer extends ViewGroup
getContext(), getContext(),
mNotificationHeaderLowPriority, mNotificationHeaderLowPriority,
mContainingNotification); mContainingNotification);
mNotificationHeaderWrapperLowPriority.useRoundnessSourceTypes( mNotificationHeaderWrapper.setOnRoundnessChangedListener(this::invalidate);
mUseRoundnessSourceTypes
);
if (mUseRoundnessSourceTypes) {
mNotificationHeaderWrapper.setOnRoundnessChangedListener(this::invalidate);
}
addView(mNotificationHeaderLowPriority, 0); addView(mNotificationHeaderLowPriority, 0);
invalidate(); invalidate();
} else { } else {
@@ -891,7 +869,7 @@ public class NotificationChildrenContainer extends ViewGroup
isCanvasChanged = true; isCanvasChanged = true;
canvas.save(); canvas.save();
if (mUseRoundnessSourceTypes && translation != 0f) { if (translation != 0f) {
clipPath.offset(translation, 0f); clipPath.offset(translation, 0f);
canvas.clipPath(clipPath); canvas.clipPath(clipPath);
clipPath.offset(-translation, 0f); clipPath.offset(-translation, 0f);
@@ -1444,40 +1422,30 @@ public class NotificationChildrenContainer extends ViewGroup
@Override @Override
public void applyRoundnessAndInvalidate() { public void applyRoundnessAndInvalidate() {
boolean last = true; boolean last = true;
if (mUseRoundnessSourceTypes) { if (mNotificationHeaderWrapper != null) {
if (mNotificationHeaderWrapper != null) { mNotificationHeaderWrapper.requestTopRoundness(
mNotificationHeaderWrapper.requestTopRoundness( /* value = */ getTopRoundness(),
/* value = */ getTopRoundness(), /* sourceType = */ FROM_PARENT,
/* sourceType = */ FROM_PARENT, /* animate = */ false
/* animate = */ false );
); }
} if (mNotificationHeaderWrapperLowPriority != null) {
if (mNotificationHeaderWrapperLowPriority != null) { mNotificationHeaderWrapperLowPriority.requestTopRoundness(
mNotificationHeaderWrapperLowPriority.requestTopRoundness( /* value = */ getTopRoundness(),
/* value = */ getTopRoundness(), /* sourceType = */ FROM_PARENT,
/* sourceType = */ FROM_PARENT, /* animate = */ false
/* animate = */ false );
);
}
} }
for (int i = mAttachedChildren.size() - 1; i >= 0; i--) { for (int i = mAttachedChildren.size() - 1; i >= 0; i--) {
ExpandableNotificationRow child = mAttachedChildren.get(i); ExpandableNotificationRow child = mAttachedChildren.get(i);
if (child.getVisibility() == View.GONE) { if (child.getVisibility() == View.GONE) {
continue; continue;
} }
if (mUseRoundnessSourceTypes) { child.requestRoundness(
child.requestRoundness( /* top = */ 0f,
/* top = */ 0f, /* bottom = */ last ? getBottomRoundness() : 0f,
/* bottom = */ last ? getBottomRoundness() : 0f, /* sourceType = */ FROM_PARENT,
/* sourceType = */ FROM_PARENT, /* animate = */ false);
/* animate = */ false);
} else {
child.requestRoundness(
/* top = */ 0f,
/* bottom = */ last ? getBottomRoundness() : 0f,
LegacySourceType.DefaultValue,
/* animate = */ isShown());
}
last = false; last = false;
} }
Roundable.super.applyRoundnessAndInvalidate(); Roundable.super.applyRoundnessAndInvalidate();
@@ -1537,15 +1505,6 @@ public class NotificationChildrenContainer extends ViewGroup
return mNotificationHeaderWrapper; 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() { public String debugString() {
return TAG + " { " return TAG + " { "
+ "visibility: " + getVisibility() + "visibility: " + getVisibility()

View File

@@ -16,22 +16,13 @@
package com.android.systemui.statusbar.notification.stack; package com.android.systemui.statusbar.notification.stack;
import android.content.res.Resources;
import android.util.MathUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.android.systemui.Dumpable; import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dump.DumpManager; 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.Roundable;
import com.android.systemui.statusbar.notification.SourceType; import com.android.systemui.statusbar.notification.SourceType;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.logging.NotificationRoundnessLogger;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableView; import com.android.systemui.statusbar.notification.row.ExpandableView;
import java.io.PrintWriter; import java.io.PrintWriter;
@@ -48,63 +39,27 @@ public class NotificationRoundnessManager implements Dumpable {
private static final String TAG = "NotificationRoundnessManager"; private static final String TAG = "NotificationRoundnessManager";
private static final SourceType DISMISS_ANIMATION = SourceType.from("DismissAnimation"); private static final SourceType DISMISS_ANIMATION = SourceType.from("DismissAnimation");
private final ExpandableView[] mFirstInSectionViews;
private final ExpandableView[] mLastInSectionViews;
private final ExpandableView[] mTmpFirstInSectionViews;
private final ExpandableView[] mTmpLastInSectionViews;
private final NotificationRoundnessLogger mNotifLogger;
private final DumpManager mDumpManager; private final DumpManager mDumpManager;
private boolean mExpanded;
private HashSet<ExpandableView> mAnimatedChildren; private HashSet<ExpandableView> mAnimatedChildren;
private Runnable mRoundingChangedCallback;
private ExpandableNotificationRow mTrackedHeadsUp;
private float mAppearFraction;
private boolean mRoundForPulsingViews; private boolean mRoundForPulsingViews;
private boolean mIsClearAllInProgress; private boolean mIsClearAllInProgress;
private ExpandableView mSwipedView = null; private ExpandableView mSwipedView = null;
private Roundable mViewBeforeSwipedView = null; private Roundable mViewBeforeSwipedView = null;
private Roundable mViewAfterSwipedView = null; private Roundable mViewAfterSwipedView = null;
private boolean mUseRoundnessSourceTypes;
@Inject @Inject
NotificationRoundnessManager( NotificationRoundnessManager(DumpManager dumpManager) {
NotificationSectionsFeatureManager sectionsFeatureManager,
NotificationRoundnessLogger notifLogger,
DumpManager dumpManager) {
int numberOfSections = sectionsFeatureManager.getNumberOfBuckets();
mFirstInSectionViews = new ExpandableView[numberOfSections];
mLastInSectionViews = new ExpandableView[numberOfSections];
mTmpFirstInSectionViews = new ExpandableView[numberOfSections];
mTmpLastInSectionViews = new ExpandableView[numberOfSections];
mNotifLogger = notifLogger;
mDumpManager = dumpManager; mDumpManager = dumpManager;
mUseRoundnessSourceTypes = true;
mDumpManager.registerDumpable(TAG, this); mDumpManager.registerDumpable(TAG, this);
} }
@Override @Override
public void dump(@NonNull PrintWriter pw, @NonNull String[] args) { public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
pw.println("mFirstInSectionViews: length=" + mFirstInSectionViews.length);
pw.println(dumpViews(mFirstInSectionViews));
pw.println("mLastInSectionViews: length=" + mLastInSectionViews.length);
pw.println(dumpViews(mFirstInSectionViews));
if (mTrackedHeadsUp != null) {
pw.println("trackedHeadsUp=" + mTrackedHeadsUp.getEntry());
}
pw.println("roundForPulsingViews=" + mRoundForPulsingViews); pw.println("roundForPulsingViews=" + mRoundForPulsingViews);
pw.println("isClearAllInProgress=" + mIsClearAllInProgress); pw.println("isClearAllInProgress=" + mIsClearAllInProgress);
} }
public void updateView(ExpandableView view, boolean animate) {
if (mUseRoundnessSourceTypes) return;
boolean changed = updateViewWithoutCallback(view, animate);
if (changed) {
mRoundingChangedCallback.run();
}
}
public boolean isViewAffectedBySwipe(ExpandableView expandableView) { public boolean isViewAffectedBySwipe(ExpandableView expandableView) {
return expandableView != null return expandableView != null
&& (expandableView == mSwipedView && (expandableView == mSwipedView
@@ -112,58 +67,6 @@ public class NotificationRoundnessManager implements Dumpable {
|| expandableView == mViewAfterSwipedView); || expandableView == mViewAfterSwipedView);
} }
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);
}
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;
}
void setViewsAffectedBySwipe( void setViewsAffectedBySwipe(
Roundable viewBefore, Roundable viewBefore,
ExpandableView viewSwiped, ExpandableView viewSwiped,
@@ -177,34 +80,27 @@ public class NotificationRoundnessManager implements Dumpable {
if (mSwipedView != null) oldViews.add(mSwipedView); if (mSwipedView != null) oldViews.add(mSwipedView);
if (mViewAfterSwipedView != null) oldViews.add(mViewAfterSwipedView); if (mViewAfterSwipedView != null) oldViews.add(mViewAfterSwipedView);
final SourceType source;
if (mUseRoundnessSourceTypes) {
source = DISMISS_ANIMATION;
} else {
source = LegacySourceType.OnDismissAnimation;
}
mViewBeforeSwipedView = viewBefore; mViewBeforeSwipedView = viewBefore;
if (viewBefore != null) { if (viewBefore != null) {
oldViews.remove(viewBefore); oldViews.remove(viewBefore);
viewBefore.requestRoundness(/* top = */ 0f, /* bottom = */ 1f, source); viewBefore.requestRoundness(/* top = */ 0f, /* bottom = */ 1f, DISMISS_ANIMATION);
} }
mSwipedView = viewSwiped; mSwipedView = viewSwiped;
if (viewSwiped != null) { if (viewSwiped != null) {
oldViews.remove(viewSwiped); oldViews.remove(viewSwiped);
viewSwiped.requestRoundness(/* top = */ 1f, /* bottom = */ 1f, source); viewSwiped.requestRoundness(/* top = */ 1f, /* bottom = */ 1f, DISMISS_ANIMATION);
} }
mViewAfterSwipedView = viewAfter; mViewAfterSwipedView = viewAfter;
if (viewAfter != null) { if (viewAfter != null) {
oldViews.remove(viewAfter); 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. // After setting the current Views, reset the views that are still present in the set.
for (Roundable oldView : oldViews) { for (Roundable oldView : oldViews) {
oldView.requestRoundnessReset(source); oldView.requestRoundnessReset(DISMISS_ANIMATION);
} }
} }
@@ -226,143 +122,6 @@ public class NotificationRoundnessManager implements Dumpable {
return mRoundForPulsingViews; return mRoundForPulsingViews;
} }
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;
}
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;
}
public void setAnimatedChildren(HashSet<ExpandableView> animatedChildren) { public void setAnimatedChildren(HashSet<ExpandableView> animatedChildren) {
mAnimatedChildren = animatedChildren; mAnimatedChildren = animatedChildren;
} }
@@ -376,51 +135,7 @@ public class NotificationRoundnessManager implements Dumpable {
return mAnimatedChildren.contains(view); return mAnimatedChildren.contains(view);
} }
public void setOnRoundingChangedCallback(Runnable roundingChangedCallback) {
mRoundingChangedCallback = roundingChangedCallback;
}
public void setTrackingHeadsUp(ExpandableNotificationRow row) {
ExpandableNotificationRow previous = mTrackedHeadsUp;
mTrackedHeadsUp = row;
if (previous != null) {
updateView(previous, true /* animate */);
}
}
public void setShouldRoundPulsingViews(boolean shouldRoundPulsingViews) { public void setShouldRoundPulsingViews(boolean shouldRoundPulsingViews) {
mRoundForPulsingViews = shouldRoundPulsingViews; mRoundForPulsingViews = shouldRoundPulsingViews;
} }
private String dumpViews(ExpandableView[] views) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < views.length; i++) {
if (views[i] == null) continue;
sb.append("\t")
.append("[").append(i).append("] ")
.append("isPinned=").append(views[i].isPinned()).append(" ")
.append("isFirstInSection=").append(views[i].isFirstInSection()).append(" ")
.append("isLastInSection=").append(views[i].isLastInSection()).append(" ");
if (views[i] instanceof ExpandableNotificationRow) {
sb.append("entry=");
dumpEntry(((ExpandableNotificationRow) views[i]).getEntry(), sb);
}
sb.append("\n");
}
return sb.toString();
}
private void dumpEntry(NotificationEntry entry, StringBuilder sb) {
sb.append("NotificationEntry{key=").append(entry.getKey()).append(" ");
if (entry.getSection() != null) {
sb.append(" section=")
.append(entry.getSection().getLabel());
}
sb.append("}");
}
} }

View File

@@ -52,8 +52,6 @@ class NotificationSectionsManager @Inject internal constructor(
@SilentHeader private val silentHeaderController: SectionHeaderController @SilentHeader private val silentHeaderController: SectionHeaderController
) : SectionProvider { ) : SectionProvider {
private val useRoundnessSourceTypes = true
private val configurationListener = object : ConfigurationController.ConfigurationListener { private val configurationListener = object : ConfigurationController.ConfigurationListener {
override fun onLocaleListChanged() { override fun onLocaleListChanged() {
reinflateViews() reinflateViews()
@@ -193,35 +191,33 @@ class NotificationSectionsManager @Inject internal constructor(
isSectionChanged || changed isSectionChanged || changed
} }
if (useRoundnessSourceTypes) { val newFirstChildren = sections.mapNotNull { it.firstVisibleChild }
val newFirstChildren = sections.mapNotNull { it.firstVisibleChild } val newLastChildren = sections.mapNotNull { it.lastVisibleChild }
val newLastChildren = sections.mapNotNull { it.lastVisibleChild }
// Update the roundness of Views that weren't already in the first/last position // Update the roundness of Views that weren't already in the first/last position
newFirstChildren.forEach { firstChild -> newFirstChildren.forEach { firstChild ->
val wasFirstChild = oldFirstChildren.remove(firstChild) val wasFirstChild = oldFirstChildren.remove(firstChild)
if (!wasFirstChild) { if (!wasFirstChild) {
val notAnimatedChild = !notificationRoundnessManager.isAnimatedChild(firstChild) val notAnimatedChild = !notificationRoundnessManager.isAnimatedChild(firstChild)
val animated = firstChild.isShown && notAnimatedChild val animated = firstChild.isShown && notAnimatedChild
firstChild.requestTopRoundness(1f, SECTION, animated) firstChild.requestTopRoundness(1f, SECTION, animated)
}
} }
newLastChildren.forEach { lastChild -> }
val wasLastChild = oldLastChildren.remove(lastChild) newLastChildren.forEach { lastChild ->
if (!wasLastChild) { val wasLastChild = oldLastChildren.remove(lastChild)
val notAnimatedChild = !notificationRoundnessManager.isAnimatedChild(lastChild) if (!wasLastChild) {
val animated = lastChild.isShown && notAnimatedChild val notAnimatedChild = !notificationRoundnessManager.isAnimatedChild(lastChild)
lastChild.requestBottomRoundness(1f, SECTION, animated) val animated = lastChild.isShown && notAnimatedChild
} lastChild.requestBottomRoundness(1f, SECTION, animated)
} }
}
// The Views left in the set are no longer in the first/last position // The Views left in the set are no longer in the first/last position
oldFirstChildren.forEach { noMoreFirstChild -> oldFirstChildren.forEach { noMoreFirstChild ->
noMoreFirstChild.requestTopRoundness(0f, SECTION) noMoreFirstChild.requestTopRoundness(0f, SECTION)
} }
oldLastChildren.forEach { noMoreLastChild -> oldLastChildren.forEach { noMoreLastChild ->
noMoreLastChild.requestBottomRoundness(0f, SECTION) noMoreLastChild.requestBottomRoundness(0f, SECTION)
}
} }
if (DEBUG) { if (DEBUG) {

View File

@@ -200,7 +200,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
private Set<Integer> mDebugTextUsedYPositions; private Set<Integer> mDebugTextUsedYPositions;
private final boolean mDebugRemoveAnimation; private final boolean mDebugRemoveAnimation;
private final boolean mSimplifiedAppearFraction; private final boolean mSimplifiedAppearFraction;
private final boolean mUseRoundnessSourceTypes;
private final boolean mSensitiveRevealAnimEndabled; private final boolean mSensitiveRevealAnimEndabled;
private boolean mAnimatedInsets; private boolean mAnimatedInsets;
@@ -625,7 +624,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mDebugLines = featureFlags.isEnabled(Flags.NSSL_DEBUG_LINES); mDebugLines = featureFlags.isEnabled(Flags.NSSL_DEBUG_LINES);
mDebugRemoveAnimation = featureFlags.isEnabled(Flags.NSSL_DEBUG_REMOVE_ANIMATION); mDebugRemoveAnimation = featureFlags.isEnabled(Flags.NSSL_DEBUG_REMOVE_ANIMATION);
mSimplifiedAppearFraction = featureFlags.isEnabled(Flags.SIMPLIFIED_APPEAR_FRACTION); mSimplifiedAppearFraction = featureFlags.isEnabled(Flags.SIMPLIFIED_APPEAR_FRACTION);
mUseRoundnessSourceTypes = true;
mSensitiveRevealAnimEndabled = featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM); mSensitiveRevealAnimEndabled = featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM);
setAnimatedInsetsEnabled(featureFlags.isEnabled(Flags.ANIMATED_NOTIFICATION_SHADE_INSETS)); setAnimatedInsetsEnabled(featureFlags.isEnabled(Flags.ANIMATED_NOTIFICATION_SHADE_INSETS));
mSectionsManager = Dependency.get(NotificationSectionsManager.class); mSectionsManager = Dependency.get(NotificationSectionsManager.class);
@@ -3134,10 +3132,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
mAnimateNextSectionBoundsChange = false; mAnimateNextSectionBoundsChange = false;
} }
mAmbientState.setLastVisibleBackgroundChild(lastChild); mAmbientState.setLastVisibleBackgroundChild(lastChild);
if (!mUseRoundnessSourceTypes) {
// TODO: Refactor SectionManager and put the RoundnessManager there.
mController.getNotificationRoundnessManager().updateRoundedChildren(mSections);
}
mAnimateBottomOnLayout = false; mAnimateBottomOnLayout = false;
invalidate(); invalidate();
} }
@@ -3584,9 +3578,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
@ShadeViewRefactor(RefactorComponent.LAYOUT_ALGORITHM) @ShadeViewRefactor(RefactorComponent.LAYOUT_ALGORITHM)
protected StackScrollAlgorithm createStackScrollAlgorithm(Context context) { protected StackScrollAlgorithm createStackScrollAlgorithm(Context context) {
StackScrollAlgorithm stackScrollAlgorithm = new StackScrollAlgorithm(context, this); return new StackScrollAlgorithm(context, this);
stackScrollAlgorithm.useRoundnessSourceTypes(mUseRoundnessSourceTypes);
return stackScrollAlgorithm;
} }
/** /**

View File

@@ -192,7 +192,6 @@ public class NotificationStackScrollLayoutController {
private int mBarState; private int mBarState;
private HeadsUpAppearanceController mHeadsUpAppearanceController; private HeadsUpAppearanceController mHeadsUpAppearanceController;
private final FeatureFlags mFeatureFlags; private final FeatureFlags mFeatureFlags;
private final boolean mUseRoundnessSourceTypes;
private final NotificationTargetsHelper mNotificationTargetsHelper; private final NotificationTargetsHelper mNotificationTargetsHelper;
private final SecureSettings mSecureSettings; private final SecureSettings mSecureSettings;
private final NotificationDismissibilityProvider mDismissibilityProvider; private final NotificationDismissibilityProvider mDismissibilityProvider;
@@ -590,26 +589,6 @@ public class NotificationStackScrollLayoutController {
mView.setInHeadsUpPinnedMode(inPinnedMode); mView.setInHeadsUpPinnedMode(inPinnedMode);
} }
@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 @Override
public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) { public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) {
long numEntries = mHeadsUpManager.getAllEntries().count(); long numEntries = mHeadsUpManager.getAllEntries().count();
@@ -617,10 +596,6 @@ public class NotificationStackScrollLayoutController {
mView.setNumHeadsUp(numEntries); mView.setNumHeadsUp(numEntries);
mView.setTopHeadsUpEntry(topEntry); mView.setTopHeadsUpEntry(topEntry);
generateHeadsUpAnimation(entry, isHeadsUp); generateHeadsUpAnimation(entry, isHeadsUp);
if (!mUseRoundnessSourceTypes) {
ExpandableNotificationRow row = entry.getRow();
mNotificationRoundnessManager.updateView(row, true /* animate */);
}
} }
}; };
@@ -720,7 +695,6 @@ public class NotificationStackScrollLayoutController {
mShadeController = shadeController; mShadeController = shadeController;
mNotifIconAreaController = notifIconAreaController; mNotifIconAreaController = notifIconAreaController;
mFeatureFlags = featureFlags; mFeatureFlags = featureFlags;
mUseRoundnessSourceTypes = true;
mNotificationTargetsHelper = notificationTargetsHelper; mNotificationTargetsHelper = notificationTargetsHelper;
mSecureSettings = secureSettings; mSecureSettings = secureSettings;
mDismissibilityProvider = dismissibilityProvider; mDismissibilityProvider = dismissibilityProvider;
@@ -788,11 +762,6 @@ public class NotificationStackScrollLayoutController {
mLockscreenUserManager.addUserChangedListener(mLockscreenUserChangeListener); mLockscreenUserManager.addUserChangedListener(mLockscreenUserChangeListener);
if (!mUseRoundnessSourceTypes) {
mNotificationRoundnessManager.setOnRoundingChangedCallback(mView::invalidate);
mView.addOnExpandedHeightChangedListener(mNotificationRoundnessManager::setExpanded);
}
mVisibilityLocationProviderDelegator.setDelegate(this::isInVisibleLocation); mVisibilityLocationProviderDelegator.setDelegate(this::isInVisibleLocation);
mTunerService.addTunable( mTunerService.addTunable(
@@ -958,7 +927,6 @@ public class NotificationStackScrollLayoutController {
public void setTrackingHeadsUp(ExpandableNotificationRow expandableNotificationRow) { public void setTrackingHeadsUp(ExpandableNotificationRow expandableNotificationRow) {
mView.setTrackingHeadsUp(expandableNotificationRow); mView.setTrackingHeadsUp(expandableNotificationRow);
mNotificationRoundnessManager.setTrackingHeadsUp(expandableNotificationRow);
} }
public void wakeUpFromPulse() { public void wakeUpFromPulse() {
@@ -1776,9 +1744,6 @@ public class NotificationStackScrollLayoutController {
@Override @Override
public void bindRow(ExpandableNotificationRow row) { public void bindRow(ExpandableNotificationRow row) {
row.setHeadsUpAnimatingAwayListener(animatingAway -> { row.setHeadsUpAnimatingAwayListener(animatingAway -> {
if (!mUseRoundnessSourceTypes) {
mNotificationRoundnessManager.updateView(row, false);
}
NotificationEntry entry = row.getEntry(); NotificationEntry entry = row.getEntry();
mHeadsUpAppearanceController.updateHeader(entry); mHeadsUpAppearanceController.updateHeader(entry);
mHeadsUpAppearanceController.updateHeadsUpAndPulsingRoundness(entry); mHeadsUpAppearanceController.updateHeadsUpAndPulsingRoundness(entry);

View File

@@ -68,7 +68,6 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc
private boolean mIsExpanded; private boolean mIsExpanded;
private boolean mPulsing; private boolean mPulsing;
private final NotificationRoundnessManager mNotificationRoundnessManager; private final NotificationRoundnessManager mNotificationRoundnessManager;
private final boolean mUseRoundnessSourceTypes;
NotificationSwipeHelper( NotificationSwipeHelper(
Resources resources, Resources resources,
@@ -80,7 +79,6 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc
NotificationRoundnessManager notificationRoundnessManager) { NotificationRoundnessManager notificationRoundnessManager) {
super(callback, resources, viewConfiguration, falsingManager, featureFlags); super(callback, resources, viewConfiguration, falsingManager, featureFlags);
mNotificationRoundnessManager = notificationRoundnessManager; mNotificationRoundnessManager = notificationRoundnessManager;
mUseRoundnessSourceTypes = true;
mMenuListener = menuListener; mMenuListener = menuListener;
mCallback = callback; mCallback = callback;
mFalsingCheck = () -> resetExposedMenuView(true /* animate */, true /* force */); mFalsingCheck = () -> resetExposedMenuView(true /* animate */, true /* force */);
@@ -322,8 +320,7 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc
protected void prepareDismissAnimation(View view, Animator anim) { protected void prepareDismissAnimation(View view, Animator anim) {
super.prepareDismissAnimation(view, anim); super.prepareDismissAnimation(view, anim);
if (mUseRoundnessSourceTypes if (view instanceof ExpandableNotificationRow
&& view instanceof ExpandableNotificationRow
&& mNotificationRoundnessManager.isClearAllInProgress()) { && mNotificationRoundnessManager.isClearAllInProgress()) {
ExpandableNotificationRow row = (ExpandableNotificationRow) view; ExpandableNotificationRow row = (ExpandableNotificationRow) view;
anim.addListener(new AnimatorListenerAdapter() { anim.addListener(new AnimatorListenerAdapter() {

View File

@@ -4,7 +4,6 @@ import androidx.core.view.children
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.flags.FeatureFlags 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.Roundable
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.ExpandableView import com.android.systemui.statusbar.notification.row.ExpandableView
@@ -20,7 +19,6 @@ class NotificationTargetsHelper
constructor( constructor(
featureFlags: FeatureFlags, featureFlags: FeatureFlags,
) { ) {
private val useRoundnessSourceTypes = true
/** /**
* This method looks for views that can be rounded (and implement [Roundable]) during a * This method looks for views that can be rounded (and implement [Roundable]) during a
@@ -48,10 +46,6 @@ constructor(
if (notificationParent != null && childrenContainer != null) { if (notificationParent != null && childrenContainer != null) {
// We are inside a notification group // We are inside a notification group
if (!useRoundnessSourceTypes) {
return RoundableTargets(null, null, null)
}
val visibleGroupChildren = childrenContainer.attachedChildren.filter { it.isVisible } val visibleGroupChildren = childrenContainer.attachedChildren.filter { it.isVisible }
val indexOfParentSwipedView = visibleGroupChildren.indexOf(viewSwiped) val indexOfParentSwipedView = visibleGroupChildren.indexOf(viewSwiped)

View File

@@ -34,7 +34,6 @@ import com.android.systemui.flags.Flags;
import com.android.systemui.shade.transition.LargeScreenShadeInterpolator; import com.android.systemui.shade.transition.LargeScreenShadeInterpolator;
import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.EmptyShadeView;
import com.android.systemui.statusbar.NotificationShelf; 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.SourceType;
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView; import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
@@ -75,7 +74,6 @@ public class StackScrollAlgorithm {
private float mQuickQsOffsetHeight; private float mQuickQsOffsetHeight;
private float mSmallCornerRadius; private float mSmallCornerRadius;
private float mLargeCornerRadius; private float mLargeCornerRadius;
private boolean mUseRoundnessSourceTypes;
public StackScrollAlgorithm( public StackScrollAlgorithm(
Context context, Context context,
@@ -836,12 +834,8 @@ public class StackScrollAlgorithm {
row.isLastInSection() ? 1f : (mSmallCornerRadius / mLargeCornerRadius); row.isLastInSection() ? 1f : (mSmallCornerRadius / mLargeCornerRadius);
final float bottomValue = computeCornerRoundnessForPinnedHun(mHostView.getHeight(), final float bottomValue = computeCornerRoundnessForPinnedHun(mHostView.getHeight(),
ambientState.getStackY(), getMaxAllowedChildHeight(row), originalCornerRadius); ambientState.getStackY(), getMaxAllowedChildHeight(row), originalCornerRadius);
if (mUseRoundnessSourceTypes) { row.requestBottomRoundness(bottomValue, STACK_SCROLL_ALGO);
row.requestBottomRoundness(bottomValue, STACK_SCROLL_ALGO); row.addOnDetachResetRoundness(STACK_SCROLL_ALGO);
row.addOnDetachResetRoundness(STACK_SCROLL_ALGO);
} else {
row.requestBottomRoundness(bottomValue, LegacySourceType.OnScroll);
}
} }
@VisibleForTesting @VisibleForTesting
@@ -979,14 +973,6 @@ public class StackScrollAlgorithm {
this.mIsExpanded = isExpanded; 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 { public static class StackScrollAlgorithmState {
/** /**

View File

@@ -76,7 +76,6 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar
private final DarkIconDispatcher mDarkIconDispatcher; private final DarkIconDispatcher mDarkIconDispatcher;
private final ShadeViewController mShadeViewController; private final ShadeViewController mShadeViewController;
private final NotificationRoundnessManager mNotificationRoundnessManager; private final NotificationRoundnessManager mNotificationRoundnessManager;
private final boolean mUseRoundnessSourceTypes;
private final Consumer<ExpandableNotificationRow> private final Consumer<ExpandableNotificationRow>
mSetTrackingHeadsUp = this::setTrackingHeadsUp; mSetTrackingHeadsUp = this::setTrackingHeadsUp;
private final BiConsumer<Float, Float> mSetExpandedHeight = this::setAppearFraction; private final BiConsumer<Float, Float> mSetExpandedHeight = this::setAppearFraction;
@@ -124,7 +123,6 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar
super(headsUpStatusBarView); super(headsUpStatusBarView);
mNotificationIconAreaController = notificationIconAreaController; mNotificationIconAreaController = notificationIconAreaController;
mNotificationRoundnessManager = notificationRoundnessManager; mNotificationRoundnessManager = notificationRoundnessManager;
mUseRoundnessSourceTypes = true;
mHeadsUpManager = headsUpManager; mHeadsUpManager = headsUpManager;
// We may be mid-HUN-expansion when this controller is re-created (for example, if the user // 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 * @param entry target notification
*/ */
public void updateHeadsUpAndPulsingRoundness(NotificationEntry entry) { public void updateHeadsUpAndPulsingRoundness(NotificationEntry entry) {
if (mUseRoundnessSourceTypes) { ExpandableNotificationRow row = entry.getRow();
ExpandableNotificationRow row = entry.getRow(); boolean isTrackedChild = row == mTrackedChild;
boolean isTrackedChild = row == mTrackedChild; if (row.isPinned() || row.isHeadsUpAnimatingAway() || isTrackedChild) {
if (row.isPinned() || row.isHeadsUpAnimatingAway() || isTrackedChild) { float roundness = MathUtils.saturate(1f - mAppearFraction);
float roundness = MathUtils.saturate(1f - mAppearFraction); row.requestRoundness(roundness, roundness, HEADS_UP);
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 { } else {
row.requestRoundnessReset(HEADS_UP); row.requestRoundnessReset(PULSING);
}
if (mNotificationRoundnessManager.shouldRoundNotificationPulsing()) {
if (row.showingPulsing()) {
row.requestRoundness(/* top = */ 1f, /* bottom = */ 1f, PULSING);
} else {
row.requestRoundnessReset(PULSING);
}
} }
} }
} }

View File

@@ -616,25 +616,10 @@ 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 @Test
public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_childrenContainer() public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_childrenContainer()
throws Exception { throws Exception {
ExpandableNotificationRow group = mNotificationTestHelper.createGroup(); ExpandableNotificationRow group = mNotificationTestHelper.createGroup();
group.useRoundnessSourceTypes(true);
Assert.assertEquals(0f, group.getBottomRoundness(), 0.001f); Assert.assertEquals(0f, group.getBottomRoundness(), 0.001f);
Assert.assertEquals(0f, group.getChildrenContainer().getBottomRoundness(), 0.001f); Assert.assertEquals(0f, group.getChildrenContainer().getBottomRoundness(), 0.001f);

View File

@@ -25,7 +25,6 @@ import android.view.View;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import com.android.systemui.SysuiTestCase; 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.SourceType;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.NotificationTestHelper; import com.android.systemui.statusbar.notification.row.NotificationTestHelper;
@@ -157,56 +156,8 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
mChildrenContainer.getCurrentHeaderView()); mChildrenContainer.getCurrentHeaderView());
} }
@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 @Test
public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_last_child() { public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_last_child() {
mChildrenContainer.useRoundnessSourceTypes(true);
List<ExpandableNotificationRow> children = mChildrenContainer.getAttachedChildren(); List<ExpandableNotificationRow> children = mChildrenContainer.getAttachedChildren();
ExpandableNotificationRow notificationRow = children.get(children.size() - 1); ExpandableNotificationRow notificationRow = children.get(children.size() - 1);
Assert.assertEquals(0f, mChildrenContainer.getBottomRoundness(), 0.001f); Assert.assertEquals(0f, mChildrenContainer.getBottomRoundness(), 0.001f);
@@ -220,8 +171,6 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
@Test @Test
public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_header() { public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_header() {
mChildrenContainer.useRoundnessSourceTypes(true);
NotificationHeaderViewWrapper header = mChildrenContainer.getNotificationHeaderWrapper(); NotificationHeaderViewWrapper header = mChildrenContainer.getNotificationHeaderWrapper();
Assert.assertEquals(0f, header.getTopRoundness(), 0.001f); Assert.assertEquals(0f, header.getTopRoundness(), 0.001f);
@@ -232,7 +181,6 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
@Test @Test
public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_headerLowPriority() { public void applyRoundnessAndInvalidate_should_be_immediately_applied_on_headerLowPriority() {
mChildrenContainer.useRoundnessSourceTypes(true);
mChildrenContainer.setIsLowPriority(true); mChildrenContainer.setIsLowPriority(true);
NotificationHeaderViewWrapper header = mChildrenContainer.getNotificationHeaderWrapper(); NotificationHeaderViewWrapper header = mChildrenContainer.getNotificationHeaderWrapper();

View File

@@ -12,7 +12,6 @@ import com.android.systemui.flags.Flags
import com.android.systemui.shade.transition.LargeScreenShadeInterpolator import com.android.systemui.shade.transition.LargeScreenShadeInterpolator
import com.android.systemui.statusbar.NotificationShelf import com.android.systemui.statusbar.NotificationShelf
import com.android.systemui.statusbar.StatusBarIconView import com.android.systemui.statusbar.StatusBarIconView
import com.android.systemui.statusbar.notification.LegacySourceType
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.ExpandableView import com.android.systemui.statusbar.notification.row.ExpandableView
import com.android.systemui.statusbar.notification.row.NotificationTestHelper import com.android.systemui.statusbar.notification.row.NotificationTestHelper
@@ -359,39 +358,6 @@ class NotificationShelfTest : SysuiTestCase() {
) )
} }
@Test
fun resetOnScrollRoundness_shouldSetOnScrollTo0() {
val row: ExpandableNotificationRow = notificationTestHelper.createRowWithRoundness(
/* topRoundness = */ 1f,
/* bottomRoundness = */ 1f,
/* sourceType = */ LegacySourceType.OnScroll)
NotificationShelf.resetLegacyOnScrollRoundness(row)
assertEquals(0f, row.topRoundness)
assertEquals(0f, row.bottomRoundness)
}
@Test
fun resetOnScrollRoundness_shouldNotResetOtherRoundness() {
val row1: ExpandableNotificationRow = notificationTestHelper.createRowWithRoundness(
/* topRoundness = */ 1f,
/* bottomRoundness = */ 1f,
/* sourceType = */ LegacySourceType.DefaultValue)
val row2: ExpandableNotificationRow = notificationTestHelper.createRowWithRoundness(
/* topRoundness = */ 1f,
/* bottomRoundness = */ 1f,
/* sourceType = */ LegacySourceType.OnDismissAnimation)
NotificationShelf.resetLegacyOnScrollRoundness(row1)
NotificationShelf.resetLegacyOnScrollRoundness(row2)
assertEquals(1f, row1.topRoundness)
assertEquals(1f, row1.bottomRoundness)
assertEquals(1f, row2.topRoundness)
assertEquals(1f, row2.bottomRoundness)
}
private fun setFractionToShade(fraction: Float) { private fun setFractionToShade(fraction: Float) {
whenever(ambientState.fractionToShade).thenReturn(fraction) whenever(ambientState.fractionToShade).thenReturn(fraction)
} }