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

Commit 92d95cfa authored by Julia Tuttle's avatar Julia Tuttle Committed by Cherrypicker Worker
Browse files

NSSL: Log more about side padding decisions

Turns out that updateSidePadding doesn't tell the whole story, so
collect and dump *all* all of the inputs.

Bug: 328588062
Test: manual
Flag: NA
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:73ba75733e799f362fbb246ec5cfbefcb4577254)
Merged-In: I90cb8b1c757faf9667e7d8acd877c7f17100ff5d
Change-Id: I90cb8b1c757faf9667e7d8acd877c7f17100ff5d
parent 62f4d08d
Loading
Loading
Loading
Loading
+39 −4
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.SystemClock;
import android.os.Trace;
import android.provider.Settings;
import android.util.AttributeSet;
@@ -221,6 +222,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    private float mQsExpansionFraction;
    private final int mSplitShadeMinContentHeight;
    private String mLastUpdateSidePaddingDumpString;
    private long mLastUpdateSidePaddingElapsedRealtime;
    private String mLastInitViewDumpString;
    private long mLastInitViewElapsedRealtime;

    /**
     * The algorithm which calculates the properties for our children
@@ -1094,17 +1098,34 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        mOverflingDistance = configuration.getScaledOverflingDistance();

        Resources res = context.getResources();
        final boolean isSmallScreenLandscape = res.getBoolean(R.bool.is_small_screen_landscape);
        boolean useSmallLandscapeLockscreenResources = mIsSmallLandscapeLockscreenEnabled
                && res.getBoolean(R.bool.is_small_screen_landscape);
                && isSmallScreenLandscape;
        // TODO (b/293252410) remove condition here when flag is launched
        //  Instead update the config_skinnyNotifsInLandscape to be false whenever
        //  is_small_screen_landscape is true. Then, only use the config_skinnyNotifsInLandscape.
        final boolean configSkinnyNotifsInLandscape = res.getBoolean(
                R.bool.config_skinnyNotifsInLandscape);
        if (useSmallLandscapeLockscreenResources) {
            mSkinnyNotifsInLandscape = false;
        } else {
            mSkinnyNotifsInLandscape = res.getBoolean(
                    R.bool.config_skinnyNotifsInLandscape);
            mSkinnyNotifsInLandscape = configSkinnyNotifsInLandscape;
        }

        mLastInitViewDumpString =
                "mIsSmallLandscapeLockscreenEnabled=" + mIsSmallLandscapeLockscreenEnabled
                        + " isSmallScreenLandscape=" + isSmallScreenLandscape
                        + " useSmallLandscapeLockscreenResources="
                        + useSmallLandscapeLockscreenResources
                        + " skinnyNotifsInLandscape=" + configSkinnyNotifsInLandscape
                        + " mSkinnyNotifsInLandscape=" + mSkinnyNotifsInLandscape;
        mLastInitViewElapsedRealtime = SystemClock.elapsedRealtime();

        if (DEBUG_UPDATE_SIDE_PADDING) {
            Log.v(TAG, "initView @ elapsedRealtime " + mLastInitViewElapsedRealtime + ": "
                    + mLastInitViewDumpString);
        }

        mGapHeight = res.getDimensionPixelSize(R.dimen.notification_section_divider_height);
        mStackScrollAlgorithm.initView(context);
        mStateAnimator.initView(context);
@@ -1132,9 +1153,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        mLastUpdateSidePaddingDumpString = "viewWidth=" + viewWidth
                + " skinnyNotifsInLandscape=" + mSkinnyNotifsInLandscape
                + " orientation=" + orientation;
        mLastUpdateSidePaddingElapsedRealtime = SystemClock.elapsedRealtime();

        if (DEBUG_UPDATE_SIDE_PADDING) {
            Log.v(TAG, "updateSidePadding: " + mLastUpdateSidePaddingDumpString);
            Log.v(TAG,
                    "updateSidePadding @ elapsedRealtime " + mLastUpdateSidePaddingElapsedRealtime
                            + ": " + mLastUpdateSidePaddingDumpString);
        }

        if (viewWidth == 0 || !mSkinnyNotifsInLandscape) {
@@ -5312,6 +5336,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable

    public void dump(PrintWriter pwOriginal, String[] args) {
        IndentingPrintWriter pw = DumpUtilsKt.asIndenting(pwOriginal);
        final long elapsedRealtime = SystemClock.elapsedRealtime();
        pw.println("Internal state:");
        DumpUtilsKt.withIncreasedIndent(pw, () -> {
            println(pw, "pulsing", mPulsing);
@@ -5342,7 +5367,17 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
            println(pw, "minimumPaddings", mMinimumPaddings);
            println(pw, "qsTilePadding", mQsTilePadding);
            println(pw, "sidePaddings", mSidePaddings);
            println(pw, "elapsedRealtime", elapsedRealtime);
            println(pw, "lastInitView", mLastInitViewDumpString);
            println(pw, "lastInitViewElapsedRealtime", mLastInitViewElapsedRealtime);
            println(pw, "lastInitViewMillisAgo", elapsedRealtime - mLastInitViewElapsedRealtime);
            println(pw, "shouldUseSplitNotificationShade", mShouldUseSplitNotificationShade);
            println(pw, "lastUpdateSidePadding", mLastUpdateSidePaddingDumpString);
            println(pw, "lastUpdateSidePaddingElapsedRealtime",
                    mLastUpdateSidePaddingElapsedRealtime);
            println(pw, "lastUpdateSidePaddingMillisAgo",
                    elapsedRealtime - mLastUpdateSidePaddingElapsedRealtime);
            println(pw, "isSmallLandscapeLockscreenEnabled", mIsSmallLandscapeLockscreenEnabled);
            mNotificationStackSizeCalculator.dump(pw, args);
        });
        pw.println();