Merge "Set views below shelf explicitly invisible to skip hardware rendering" into sc-dev am: 1da11b55e9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15261872

Change-Id: Ia1299d9b26931e403df6ea59b0d21b82ce575eed
This commit is contained in:
Lyn Han
2021-07-15 20:35:34 +00:00
committed by Automerger Merge Worker

View File

@@ -148,8 +148,22 @@ public class StackScrollAlgorithm {
AmbientState ambientState) { AmbientState ambientState) {
NotificationShelf shelf = ambientState.getShelf(); NotificationShelf shelf = ambientState.getShelf();
if (shelf != null) { if (shelf == null) {
return;
}
shelf.updateState(algorithmState, ambientState); 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.
final float shelfTop = shelf.getViewState().yTranslation;
for (ExpandableView view : algorithmState.visibleChildren) {
final float viewTop = view.getViewState().yTranslation;
if (viewTop >= shelfTop) {
view.getViewState().hidden = true;
}
} }
} }
@@ -411,8 +425,7 @@ public class StackScrollAlgorithm {
} else { } else {
if (view != ambientState.getTrackedHeadsUpRow()) { if (view != ambientState.getTrackedHeadsUpRow()) {
if (ambientState.isExpansionChanging()) { if (ambientState.isExpansionChanging()) {
// Show all views. Views below the shelf will later be clipped (essentially // We later update shelf state, then hide views below the shelf.
// hidden) in NotificationShelf.
viewState.hidden = false; viewState.hidden = false;
viewState.inShelf = algorithmState.firstViewInShelf != null viewState.inShelf = algorithmState.firstViewInShelf != null
&& i >= algorithmState.visibleChildren.indexOf( && i >= algorithmState.visibleChildren.indexOf(