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:
committed by
Android (Google) Code Review
commit
76f56a4e68
@@ -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
|
||||
|
||||
@@ -44,7 +44,6 @@ import com.android.systemui.flags.FeatureFlags;
|
||||
import com.android.systemui.flags.Flags;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
|
||||
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.SourceType;
|
||||
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
|
||||
@@ -128,13 +127,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 +561,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 +571,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 +583,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) {
|
||||
@@ -1100,15 +1081,6 @@ public class NotificationShelf extends ActivatableNotificationView implements St
|
||||
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
|
||||
public void dump(PrintWriter pwOriginal, String[] args) {
|
||||
IndentingPrintWriter pw = DumpUtilsKt.asIndenting(pwOriginal);
|
||||
|
||||
@@ -87,13 +87,8 @@ constructor(
|
||||
bypassController.isPulseExpanding = value
|
||||
if (changed) {
|
||||
if (value) {
|
||||
val topEntry = headsUpManager.topEntry
|
||||
topEntry?.let {
|
||||
roundnessManager.setTrackingHeadsUp(it.row)
|
||||
}
|
||||
lockscreenShadeTransitionController.onPulseExpansionStarted()
|
||||
} else {
|
||||
roundnessManager.setTrackingHeadsUp(null)
|
||||
if (!leavingLockscreen) {
|
||||
bypassController.maybePerformPendingUnlock()
|
||||
pulseExpandAbortListener?.run()
|
||||
|
||||
@@ -448,10 +448,3 @@ interface SourceType {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Use SourceType.from() instead", ReplaceWith("SourceType.from()"))
|
||||
enum class LegacySourceType : SourceType {
|
||||
DefaultValue,
|
||||
OnDismissAnimation,
|
||||
OnScroll,
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -261,7 +261,6 @@ public class ExpandableNotificationRowController implements NotifViewController
|
||||
mStatusBarStateController.removeCallback(mStatusBarStateListener);
|
||||
}
|
||||
});
|
||||
mView.useRoundnessSourceTypes(true);
|
||||
}
|
||||
|
||||
private final StatusBarStateController.StateListener mStatusBarStateListener =
|
||||
|
||||
@@ -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();
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -16,22 +16,13 @@
|
||||
|
||||
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;
|
||||
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 java.io.PrintWriter;
|
||||
@@ -48,63 +39,27 @@ public class NotificationRoundnessManager implements Dumpable {
|
||||
private static final String TAG = "NotificationRoundnessManager";
|
||||
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 boolean mExpanded;
|
||||
private HashSet<ExpandableView> mAnimatedChildren;
|
||||
private Runnable mRoundingChangedCallback;
|
||||
private ExpandableNotificationRow mTrackedHeadsUp;
|
||||
private float mAppearFraction;
|
||||
private boolean mRoundForPulsingViews;
|
||||
private boolean mIsClearAllInProgress;
|
||||
|
||||
private ExpandableView mSwipedView = null;
|
||||
private Roundable mViewBeforeSwipedView = null;
|
||||
private Roundable mViewAfterSwipedView = null;
|
||||
private boolean mUseRoundnessSourceTypes;
|
||||
|
||||
@Inject
|
||||
NotificationRoundnessManager(
|
||||
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;
|
||||
NotificationRoundnessManager(DumpManager dumpManager) {
|
||||
mDumpManager = dumpManager;
|
||||
mUseRoundnessSourceTypes = true;
|
||||
|
||||
mDumpManager.registerDumpable(TAG, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
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("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) {
|
||||
return expandableView != null
|
||||
&& (expandableView == mSwipedView
|
||||
@@ -112,58 +67,6 @@ public class NotificationRoundnessManager implements Dumpable {
|
||||
|| 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(
|
||||
Roundable viewBefore,
|
||||
ExpandableView viewSwiped,
|
||||
@@ -177,34 +80,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,143 +122,6 @@ public class NotificationRoundnessManager implements Dumpable {
|
||||
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) {
|
||||
mAnimatedChildren = animatedChildren;
|
||||
}
|
||||
@@ -376,51 +135,7 @@ public class NotificationRoundnessManager implements Dumpable {
|
||||
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) {
|
||||
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("}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
@@ -590,26 +589,6 @@ public class NotificationStackScrollLayoutController {
|
||||
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
|
||||
public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) {
|
||||
long numEntries = mHeadsUpManager.getAllEntries().count();
|
||||
@@ -617,10 +596,6 @@ public class NotificationStackScrollLayoutController {
|
||||
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(
|
||||
@@ -958,7 +927,6 @@ public class NotificationStackScrollLayoutController {
|
||||
|
||||
public void setTrackingHeadsUp(ExpandableNotificationRow expandableNotificationRow) {
|
||||
mView.setTrackingHeadsUp(expandableNotificationRow);
|
||||
mNotificationRoundnessManager.setTrackingHeadsUp(expandableNotificationRow);
|
||||
}
|
||||
|
||||
public void wakeUpFromPulse() {
|
||||
@@ -1776,9 +1744,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);
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -157,56 +156,8 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
|
||||
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
|
||||
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();
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.android.systemui.flags.Flags
|
||||
import com.android.systemui.shade.transition.LargeScreenShadeInterpolator
|
||||
import com.android.systemui.statusbar.NotificationShelf
|
||||
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.ExpandableView
|
||||
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) {
|
||||
whenever(ambientState.fractionToShade).thenReturn(fraction)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user