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

Commit 91a71acc authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz Committed by Android (Google) Code Review
Browse files

Merge "ExpandableNotificationRow: Dump content dimensions" into main

parents 23879ef4 c4173053
Loading
Loading
Loading
Loading
+37 −5
Original line number Diff line number Diff line
@@ -3083,6 +3083,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
                            onStartedRunnable.run();
                        }
                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        ExpandableNotificationRow.super.performRemoveAnimation(
@@ -3777,6 +3778,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            pw.print(", privateShowing: " + (showingLayout == mPrivateLayout));
            pw.print(", mShowNoBackground: " + mShowNoBackground);
            pw.println();
            if (NotificationContentView.INCLUDE_HEIGHTS_TO_DUMP) {
                dumpHeights(pw);
            }
            showingLayout.dump(pw, args);

            if (getViewState() != null) {
@@ -3820,6 +3824,34 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        });
    }

    private void dumpHeights(IndentingPrintWriter pw) {
        pw.print("Heights: ");
        pw.print("intrinsic", getIntrinsicHeight());
        pw.print("actual", getActualHeight());
        pw.print("maxContent", getMaxContentHeight());
        pw.print("maxExpanded", getMaxExpandHeight());
        pw.print("collapsed", getCollapsedHeight());
        pw.print("headsup", getHeadsUpHeight());
        pw.print("headsup  without header", getHeadsUpHeightWithoutHeader());
        pw.print("minHeight", getMinHeight());
        pw.print("pinned headsup", getPinnedHeadsUpHeight(
                true /* atLeastMinHeight */));
        pw.println();
        pw.print("Intrinsic Height Factors: ");
        pw.print("isUserLocked()", isUserLocked());
        pw.print("isChildInGroup()", isChildInGroup());
        pw.print("isGroupExpanded()", isGroupExpanded());
        pw.print("sensitive", mSensitive);
        pw.print("hideSensitiveForIntrinsicHeight", mHideSensitiveForIntrinsicHeight);
        pw.print("isSummaryWithChildren", mIsSummaryWithChildren);
        pw.print("canShowHeadsUp()", canShowHeadsUp());
        pw.print("isHeadsUpState()", isHeadsUpState());
        pw.print("isPinned()", isPinned());
        pw.print("headsupDisappearRunning", mHeadsupDisappearRunning);
        pw.print("isExpanded()", isExpanded());
        pw.println();
    }

    private void logKeepInParentChildDetached(ExpandableNotificationRow child) {
        if (mLogger != null) {
            mLogger.logKeepInParentChildDetached(child.getEntry(), getEntry());
+71 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ import com.android.systemui.statusbar.policy.SmartReplyStateInflaterKt;
import com.android.systemui.statusbar.policy.SmartReplyView;
import com.android.systemui.statusbar.policy.dagger.RemoteInputViewSubcomponent;
import com.android.systemui.util.Compile;
import com.android.systemui.util.DumpUtilsKt;

import java.io.PrintWriter;
import java.util.ArrayList;
@@ -97,6 +98,8 @@ public class NotificationContentView extends FrameLayout implements Notification

    private static final int UNDEFINED = -1;

    protected static final boolean INCLUDE_HEIGHTS_TO_DUMP = true;

    private final Rect mClipBounds = new Rect();

    private int mMinContractedHeight;
@@ -2196,6 +2199,11 @@ public class NotificationContentView extends FrameLayout implements Notification
            pw.print("null");
        }
        pw.println();

        if (INCLUDE_HEIGHTS_TO_DUMP) {
            dumpContentDimensions(DumpUtilsKt.asIndenting(pw));
        }

        pw.println("mBubblesEnabledForUser: " + mBubblesEnabledForUser);

        pw.print("RemoteInputViews { ");
@@ -2216,6 +2224,69 @@ public class NotificationContentView extends FrameLayout implements Notification
        pw.println(" }");
    }

    private String visibleTypeToString(int visibleType) {
        return switch (visibleType) {
            case VISIBLE_TYPE_CONTRACTED -> "CONTRACTED";
            case VISIBLE_TYPE_EXPANDED -> "EXPANDED";
            case VISIBLE_TYPE_HEADSUP -> "HEADSUP";
            case VISIBLE_TYPE_SINGLELINE -> "SINGLELINE";
            default -> "NONE";
        };
    }

    /** Add content views to dump */
    private void dumpContentDimensions(IndentingPrintWriter pw) {
        pw.print("ContentDimensions: ");
        pw.print("visibleType(String)", visibleTypeToString(mVisibleType));
        pw.print("measured width", getMeasuredWidth());
        pw.print("measured height", getMeasuredHeight());
        pw.print("maxHeight", getMaxHeight());
        pw.print("minHeight", getMinHeight());
        pw.println();
        pw.println("ChildViews:");
        DumpUtilsKt.withIncreasedIndent(pw, () -> {
            final View contractedChild = mContractedChild;
            if (contractedChild != null) {
                dumpChildViewDimensions(pw, contractedChild, "Contracted Child:");
                pw.println();
            }

            final View expandedChild = mExpandedChild;
            if (expandedChild != null) {
                dumpChildViewDimensions(pw, expandedChild, "Expanded Child:");
                pw.println();
            }

            final View headsUpChild = mHeadsUpChild;
            if (headsUpChild != null) {
                dumpChildViewDimensions(pw, headsUpChild, "HeadsUp Child:");
                pw.println();
            }
            final View singleLineView = mSingleLineView;
            if (singleLineView != null) {
                dumpChildViewDimensions(pw, singleLineView, "Single Line  View:");
                pw.println();
            }

        });
        final int expandedRemoteInputHeight = getExtraRemoteInputHeight(mExpandedRemoteInput);
        final int headsUpRemoteInputHeight = getExtraRemoteInputHeight(mHeadsUpRemoteInput);
        pw.print("expandedRemoteInputHeight", expandedRemoteInputHeight);
        pw.print("headsUpRemoteInputHeight", headsUpRemoteInputHeight);
        pw.println();
    }

    private void dumpChildViewDimensions(IndentingPrintWriter pw, View view,
            String name) {
        pw.print(name + " ");
        DumpUtilsKt.withIncreasedIndent(pw, () -> {
            pw.print("width", view.getWidth());
            pw.print("height", view.getHeight());
            pw.print("measuredWidth", view.getMeasuredWidth());
            pw.print("measuredHeight", view.getMeasuredHeight());
        });
    }

    /** Add any existing SmartReplyView to the dump */
    public void dumpSmartReplies(IndentingPrintWriter pw) {
        if (mHeadsUpSmartReplyView != null) {