From ef12c7a2b208d0828d2eefa5f9f49941b23c4b0b Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Mon, 19 Jul 2021 15:31:36 -0500 Subject: [PATCH] Use alpha instead of invisible for views below shelf to skip redraw Also skip this for heads up notifications Fixes: 193912541 Test: treehugger Change-Id: I3c81611696f7918a0f18d4c503b80a6b78ed2c43 --- .../notification/stack/StackScrollAlgorithm.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java index f460a132d65c6..23e3742c2bdfb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java @@ -154,15 +154,21 @@ public class StackScrollAlgorithm { shelf.updateState(algorithmState, ambientState); - // After the shelf has updated its yTranslation, - // explicitly hide views below the shelf to skip rendering them in the hardware layer. + // After the shelf has updated its yTranslation, explicitly set alpha=0 for view below shelf + // to skip rendering them in the hardware layer. We do not set them invisible because that + // runs invalidate & onDraw when these views return onscreen, which is more expensive. final float shelfTop = shelf.getViewState().yTranslation; for (ExpandableView view : algorithmState.visibleChildren) { + if (view instanceof ExpandableNotificationRow) { + ExpandableNotificationRow row = (ExpandableNotificationRow) view; + if (row.isHeadsUp() || row.isHeadsUpAnimatingAway()) { + continue; + } + } final float viewTop = view.getViewState().yTranslation; - if (viewTop >= shelfTop) { - view.getViewState().hidden = true; + view.getViewState().alpha = 0; } } }