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

Commit 1baa09c6 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

Dump FooterView visibility data

We need to investigate why Clear All Button is not shown in NotificationShade for ag/271723067. It is not clear whether it is related to Clear All or the whole footer.
That's why  we decided to extend FooterView dumps with its and its items visibility related data.

Bug: 271723067
Test: Presubmit
Change-Id: I7eb8436d95ac825456001985478a99e95edc162c
parent 8cdc4c6c
Loading
Loading
Loading
Loading
+81 −30
Original line number Diff line number Diff line
@@ -732,9 +732,21 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
            return;
        }
        // TODO: move this logic to controller, which will invoke updateFooterView directly
        boolean showDismissView = mClearAllEnabled &&
                mController.hasActiveClearableNotifications(ROWS_ALL);
        boolean showFooterView = (showDismissView || mController.getVisibleNotificationCount() > 0)
        final boolean showHistory = mController.isHistoryEnabled();
        final boolean showDismissView = shouldShowDismissView();

        updateFooterView(shouldShowFooterView(showDismissView)/* visible */,
                showDismissView /* showDismissView */,
                showHistory/* showHistory */);
    }

    private boolean shouldShowDismissView() {
        return mClearAllEnabled
                && mController.hasActiveClearableNotifications(ROWS_ALL);
    }

    private boolean shouldShowFooterView(boolean showDismissView) {
        return (showDismissView || mController.getVisibleNotificationCount() > 0)
                && mIsCurrentUserSetup // see: b/193149550
                && !onKeyguard()
                && mUpcomingStatusBarState != StatusBarState.KEYGUARD
@@ -742,9 +754,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
                && (mQsExpansionFraction != 1 || !mQsFullScreen)
                && !mScreenOffAnimationController.shouldHideNotificationsFooter()
                && !mIsRemoteInputActive;
        boolean showHistory = mController.isHistoryEnabled();

        updateFooterView(showFooterView, showDismissView, showHistory);
    }

    /**
@@ -5278,7 +5287,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        });
        pw.println();
        pw.println("Contents:");
        DumpUtilsKt.withIncreasedIndent(pw, () -> {
        DumpUtilsKt.withIncreasedIndent(
                pw,
                () -> {
                    int childCount = getChildCount();
                    pw.println("Number of children: " + childCount);
                    pw.println();
@@ -5286,6 +5297,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
                    for (int i = 0; i < childCount; i++) {
                        ExpandableView child = getChildAtIndex(i);
                        child.dump(pw, args);
                        if (child instanceof FooterView) {
                            DumpUtilsKt.withIncreasedIndent(pw, () -> dumpFooterViewVisibility(pw));
                        }
                        pw.println();
                    }
                    int transientViewCount = getTransientViewCount();
@@ -5303,6 +5317,43 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
                });
    }

    private void dumpFooterViewVisibility(IndentingPrintWriter pw) {
        final boolean showDismissView = shouldShowDismissView();

        pw.println("showFooterView: " + shouldShowFooterView(showDismissView));
        DumpUtilsKt.withIncreasedIndent(
                pw,
                () -> {
                    pw.println("showDismissView: " + showDismissView);
                    DumpUtilsKt.withIncreasedIndent(
                            pw,
                            () -> {
                                pw.println("mClearAllEnabled: " + mClearAllEnabled);
                                pw.println(
                                        "hasActiveClearableNotifications: "
                                                + mController.hasActiveClearableNotifications(
                                                        ROWS_ALL));
                            });
                    pw.println();
                    pw.println("showHistory: " + mController.isHistoryEnabled());
                    pw.println();
                    pw.println(
                            "visibleNotificationCount: "
                                    + mController.getVisibleNotificationCount());
                    pw.println("mIsCurrentUserSetup: " + mIsCurrentUserSetup);
                    pw.println("onKeyguard: " + onKeyguard());
                    pw.println("mUpcomingStatusBarState: " + mUpcomingStatusBarState);
                    pw.println("mQsExpansionFraction: " + mQsExpansionFraction);
                    pw.println("mQsFullScreen: " + mQsFullScreen);
                    pw.println(
                            "mScreenOffAnimationController"
                                    + ".shouldHideNotificationsFooter: "
                                    + mScreenOffAnimationController
                                            .shouldHideNotificationsFooter());
                    pw.println("mIsRemoteInputActive: " + mIsRemoteInputActive);
                });
    }

    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
    public boolean isFullyHidden() {
        return mAmbientState.isFullyHidden();