Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4c3230d authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed an issue where notifications could be stuck empty

We still had some legacy code which would make sure that the alpha of
dragged views would remain the same, but that isn't just unnecessary
but could lead to bugs where the view itself was stuck with alpha 0.

Test: runtest systemui
Change-Id: I36768bebcb2831aa422bafe7b18c92a4834e7745
Fixes: 80525283
parent ff2ffece
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -3908,6 +3908,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
            mStatusBar.resetUserExpandedStates();
            clearTemporaryViews();
            clearUserLockedViews();
            ArrayList<View> draggedViews = mAmbientState.getDraggedViews();
            if (draggedViews.size() > 0) {
                draggedViews.clear();
                updateContinuousShadowDrawing();
            }
        }
    }

@@ -4938,12 +4943,19 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
                }
            }
        }
        pw.println("  Transient Views: " + childCount);
        int transientViewCount = getTransientViewCount();
        pw.println("  Transient Views: " + transientViewCount);
        for (int i = 0; i < transientViewCount; i++) {
            ExpandableView child = (ExpandableView) getTransientView(i);
            child.dump(fd, pw, args);
        }
        ArrayList<View> draggedViews = mAmbientState.getDraggedViews();
        int draggedCount = draggedViews.size();
        pw.println("  Dragged Views: " + draggedCount);
        for (int i = 0; i < draggedCount; i++) {
            ExpandableView child = (ExpandableView) draggedViews.get(i);
            child.dump(fd, pw, args);
        }
    }

    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
+0 −30
Original line number Diff line number Diff line
@@ -95,7 +95,6 @@ public class StackScrollAlgorithm {

        updateHeadsUpStates(resultState, algorithmState, ambientState);

        handleDraggedViews(ambientState, resultState, algorithmState);
        updateDimmedActivatedHideSensitive(ambientState, resultState, algorithmState);
        updateClipping(resultState, algorithmState, ambientState);
        updateSpeedBumpState(resultState, algorithmState, ambientState);
@@ -210,35 +209,6 @@ public class StackScrollAlgorithm {
        }
    }

    /**
     * Handle the special state when views are being dragged
     */
    private void handleDraggedViews(AmbientState ambientState, StackScrollState resultState,
            StackScrollAlgorithmState algorithmState) {
        ArrayList<View> draggedViews = ambientState.getDraggedViews();
        for (View draggedView : draggedViews) {
            int childIndex = algorithmState.visibleChildren.indexOf(draggedView);
            if (childIndex >= 0 && childIndex < algorithmState.visibleChildren.size() - 1) {
                View nextChild = algorithmState.visibleChildren.get(childIndex + 1);
                if (!draggedViews.contains(nextChild)) {
                    // only if the view is not dragged itself we modify its state to be fully
                    // visible
                    ExpandableViewState viewState = resultState.getViewStateForView(
                            nextChild);
                    // The child below the dragged one must be fully visible
                    if (ambientState.isShadeExpanded()) {
                        viewState.hidden = false;
                    }
                }

                // Lets set the alpha to the one it currently has, as its currently being dragged
                ExpandableViewState viewState = resultState.getViewStateForView(draggedView);
                // The dragged child should keep the set alpha
                viewState.alpha = draggedView.getAlpha();
            }
        }
    }

    /**
     * Initialize the algorithm state like updating the visible children.
     */