diff options
2 files changed, 33 insertions, 26 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java index 2eb20654716d..63cb4ae39a58 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java @@ -579,14 +579,24 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView if (contentView.hasOverlappingRendering()) { int layerType = contentAlpha == 0.0f || contentAlpha == 1.0f ? LAYER_TYPE_NONE : LAYER_TYPE_HARDWARE; - int currentLayerType = contentView.getLayerType(); - if (currentLayerType != layerType) { - contentView.setLayerType(layerType, null); - } + contentView.setLayerType(layerType, null); } contentView.setAlpha(contentAlpha); + // After updating the current view, reset all views. + if (contentAlpha == 1f) { + resetAllContentAlphas(); + } } + /** + * If a subclass's {@link #getContentView()} returns different views depending on state, + * this method is an opportunity to reset the alpha of ALL content views, not just the + * current one, which may prevent a content view that is temporarily hidden from being reset. + * + * This should setAlpha(1.0f) and setLayerType(LAYER_TYPE_NONE) for all content views. + */ + protected void resetAllContentAlphas() {} + @Override protected void applyRoundness() { super.applyRoundness(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index 82ed34cdf5ec..f8984704220e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -2160,15 +2160,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } public void setExpandAnimationRunning(boolean expandAnimationRunning) { - View contentView; - if (mIsSummaryWithChildren) { - contentView = mChildrenContainer; - } else { - contentView = getShowingLayout(); - } - if (mGuts != null && mGuts.isExposed()) { - contentView = mGuts; - } if (expandAnimationRunning) { setAboveShelf(true); mExpandAnimationRunning = true; @@ -2181,9 +2172,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView if (mGuts != null) { mGuts.setAlpha(1.0f); } - if (contentView != null) { - contentView.setAlpha(1.0f); - } + resetAllContentAlphas(); setExtraWidthForClipping(0.0f); if (mNotificationParent != null) { mNotificationParent.setExtraWidthForClipping(0.0f); @@ -2632,10 +2621,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mPrivateLayout.animate().cancel(); if (mChildrenContainer != null) { mChildrenContainer.animate().cancel(); - mChildrenContainer.setAlpha(1f); } - mPublicLayout.setAlpha(1f); - mPrivateLayout.setAlpha(1f); + resetAllContentAlphas(); mPublicLayout.setVisibility(mShowingPublic ? View.VISIBLE : View.INVISIBLE); updateChildrenVisibility(); } else { @@ -2662,7 +2649,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView .alpha(0f) .setStartDelay(delay) .setDuration(duration) - .withEndAction(() -> hiddenView.setVisibility(View.INVISIBLE)); + .withEndAction(() -> { + hiddenView.setVisibility(View.INVISIBLE); + resetAllContentAlphas(); + }); } for (View showView : shownChildren) { showView.setVisibility(View.VISIBLE); @@ -2785,12 +2775,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView if (wasAppearing) { // During the animation the visible view might have changed, so let's make sure all // alphas are reset - if (mChildrenContainer != null) { - mChildrenContainer.setAlpha(1.0f); - } - for (NotificationContentView l : mLayouts) { - l.setAlpha(1.0f); - } + resetAllContentAlphas(); if (FADE_LAYER_OPTIMIZATION_ENABLED) { setNotificationFaded(false); } else { @@ -2801,6 +2786,18 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } } + @Override + protected void resetAllContentAlphas() { + mPrivateLayout.setAlpha(1f); + mPrivateLayout.setLayerType(LAYER_TYPE_NONE, null); + mPublicLayout.setAlpha(1f); + mPublicLayout.setLayerType(LAYER_TYPE_NONE, null); + if (mChildrenContainer != null) { + mChildrenContainer.setAlpha(1f); + mChildrenContainer.setLayerType(LAYER_TYPE_NONE, null); + } + } + /** Gets the last value set with {@link #setNotificationFaded(boolean)} */ @Override public boolean isNotificationFaded() { |