Merge "Rewrite dumping NSSL hierarchy" into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2021-11-01 20:08:58 +00:00
committed by Android (Google) Code Review
7 changed files with 186 additions and 85 deletions

View File

@@ -107,6 +107,7 @@ import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.statusbar.policy.InflatedSmartReplyState; import com.android.systemui.statusbar.policy.InflatedSmartReplyState;
import com.android.systemui.util.DumpUtilsKt;
import com.android.systemui.wmshell.BubblesManager; import com.android.systemui.wmshell.BubblesManager;
import java.io.FileDescriptor; import java.io.FileDescriptor;
@@ -3305,40 +3306,45 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
@Override @Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
super.dump(fd, pw, args); // Skip super call; dump viewState ourselves
pw.println(" Notification: " + mEntry.getKey()); pw.println("Notification: " + mEntry.getKey());
pw.print(" visibility: " + getVisibility()); DumpUtilsKt.withIndenting(pw, ipw -> {
pw.print(", alpha: " + getAlpha()); ipw.print("visibility: " + getVisibility());
pw.print(", translation: " + getTranslation()); ipw.print(", alpha: " + getAlpha());
pw.print(", removed: " + isRemoved()); ipw.print(", translation: " + getTranslation());
pw.print(", expandAnimationRunning: " + mExpandAnimationRunning); ipw.print(", removed: " + isRemoved());
NotificationContentView showingLayout = getShowingLayout(); ipw.print(", expandAnimationRunning: " + mExpandAnimationRunning);
pw.print(", privateShowing: " + (showingLayout == mPrivateLayout)); NotificationContentView showingLayout = getShowingLayout();
pw.println(); ipw.print(", privateShowing: " + (showingLayout == mPrivateLayout));
showingLayout.dump(fd, pw, args); ipw.println();
pw.print(" "); showingLayout.dump(fd, ipw, args);
if (getViewState() != null) {
getViewState().dump(fd, pw, args); if (getViewState() != null) {
} else { getViewState().dump(fd, ipw, args);
pw.print("no viewState!!!"); ipw.println();
} } else {
pw.println(); ipw.println("no viewState!!!");
pw.println();
if (mIsSummaryWithChildren) {
pw.print(" ChildrenContainer");
pw.print(" visibility: " + mChildrenContainer.getVisibility());
pw.print(", alpha: " + mChildrenContainer.getAlpha());
pw.print(", translationY: " + mChildrenContainer.getTranslationY());
pw.println();
List<ExpandableNotificationRow> notificationChildren = getAttachedChildren();
pw.println(" Children: " + notificationChildren.size());
pw.println(" {");
for(ExpandableNotificationRow child : notificationChildren) {
child.dump(fd, pw, args);
} }
pw.println(" }");
pw.println(); if (mIsSummaryWithChildren) {
} ipw.println();
ipw.print("ChildrenContainer");
ipw.print(" visibility: " + mChildrenContainer.getVisibility());
ipw.print(", alpha: " + mChildrenContainer.getAlpha());
ipw.print(", translationY: " + mChildrenContainer.getTranslationY());
ipw.println();
List<ExpandableNotificationRow> notificationChildren = getAttachedChildren();
ipw.println("Children: " + notificationChildren.size());
ipw.print("{");
ipw.increaseIndent();
for (ExpandableNotificationRow child : notificationChildren) {
ipw.println();
child.dump(fd, ipw, args);
}
ipw.decreaseIndent();
ipw.println("}");
}
});
} }
/** /**

View File

@@ -34,6 +34,7 @@ import com.android.systemui.animation.Interpolators;
import com.android.systemui.statusbar.StatusBarIconView; import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.notification.stack.ExpandableViewState; import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.util.DumpUtilsKt;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.PrintWriter; import java.io.PrintWriter;
@@ -743,6 +744,16 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {
@Override @Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println(getClass().getSimpleName());
DumpUtilsKt.withIndenting(pw, ipw -> {
ExpandableViewState viewState = getViewState();
if (viewState == null) {
ipw.println("no viewState!!!");
} else {
viewState.dump(fd, ipw, args);
ipw.println();
}
});
} }
/** /**

View File

@@ -25,6 +25,10 @@ import android.view.View;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.statusbar.notification.stack.ExpandableViewState; import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
import com.android.systemui.statusbar.notification.stack.ViewState; import com.android.systemui.statusbar.notification.stack.ViewState;
import com.android.systemui.util.DumpUtilsKt;
import java.io.FileDescriptor;
import java.io.PrintWriter;
public class FooterView extends StackScrollerDecorView { public class FooterView extends StackScrollerDecorView {
private FooterViewButton mDismissButton; private FooterViewButton mDismissButton;
@@ -44,6 +48,19 @@ public class FooterView extends StackScrollerDecorView {
return findViewById(R.id.dismiss_text); return findViewById(R.id.dismiss_text);
} }
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
super.dump(fd, pw, args);
DumpUtilsKt.withIndenting(pw, ipw -> {
ipw.println("visibility: " + DumpUtilsKt.visibilityString(getVisibility()));
ipw.println("manageButton showHistory: " + mShowHistory);
ipw.println("manageButton visibility: "
+ DumpUtilsKt.visibilityString(mDismissButton.getVisibility()));
ipw.println("dismissButton visibility: "
+ DumpUtilsKt.visibilityString(mDismissButton.getVisibility()));
});
}
@Override @Override
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();

View File

@@ -1938,7 +1938,6 @@ public class NotificationContentView extends FrameLayout {
} }
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.print(" ");
pw.print("contentView visibility: " + getVisibility()); pw.print("contentView visibility: " + getVisibility());
pw.print(", alpha: " + getAlpha()); pw.print(", alpha: " + getAlpha());
pw.print(", clipBounds: " + getClipBounds()); pw.print(", clipBounds: " + getClipBounds());

View File

@@ -109,6 +109,7 @@ import com.android.systemui.statusbar.phone.UnlockedScreenOffAnimationController
import com.android.systemui.statusbar.policy.HeadsUpUtil; import com.android.systemui.statusbar.policy.HeadsUpUtil;
import com.android.systemui.statusbar.policy.ScrollAdapter; import com.android.systemui.statusbar.policy.ScrollAdapter;
import com.android.systemui.util.Assert; import com.android.systemui.util.Assert;
import com.android.systemui.util.DumpUtilsKt;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.PrintWriter; import java.io.PrintWriter;
@@ -4899,54 +4900,42 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW) @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println(String.format("[%s: pulsing=%s visibility=%s" StringBuilder sb = new StringBuilder("[")
+ " alpha=%f scrollY:%d maxTopPadding=%d showShelfOnly=%s" .append(this.getClass().getSimpleName()).append(":")
+ " qsExpandFraction=%f" .append(" pulsing=").append(mPulsing ? "T" : "f")
+ " hideAmount=%f]", .append(" visibility=").append(DumpUtilsKt.visibilityString(getVisibility()))
this.getClass().getSimpleName(), .append(" alpha=").append(getAlpha())
mPulsing ? "T" : "f", .append(" scrollY=").append(mAmbientState.getScrollY())
getVisibility() == View.VISIBLE ? "visible" .append(" maxTopPadding=").append(mMaxTopPadding)
: getVisibility() == View.GONE ? "gone" .append(" showShelfOnly=").append(mShouldShowShelfOnly ? "T" : "f")
: "invisible", .append(" qsExpandFraction=").append(mQsExpansionFraction)
getAlpha(), .append(" isCurrentUserSetup=").append(mIsCurrentUserSetup)
mAmbientState.getScrollY(), .append(" hideAmount=").append(mAmbientState.getHideAmount())
mMaxTopPadding, .append("]");
mShouldShowShelfOnly ? "T" : "f", pw.println(sb.toString());
mQsExpansionFraction, DumpUtilsKt.withIndenting(pw, ipw -> {
mAmbientState.getHideAmount())); int childCount = getChildCount();
int childCount = getChildCount(); ipw.println("Number of children: " + childCount);
pw.println(" Number of children: " + childCount); ipw.println();
pw.println();
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
ExpandableView child = (ExpandableView) getChildAt(i); ExpandableView child = (ExpandableView) getChildAt(i);
child.dump(fd, pw, args); child.dump(fd, ipw, args);
if (!(child instanceof ExpandableNotificationRow)) { ipw.println();
pw.println(" " + child.getClass().getSimpleName());
// Notifications dump it's viewstate as part of their dump to support children
ExpandableViewState viewState = child.getViewState();
if (viewState == null) {
pw.println(" no viewState!!!");
} else {
pw.print(" ");
viewState.dump(fd, pw, args);
pw.println();
pw.println();
}
} }
} int transientViewCount = getTransientViewCount();
int transientViewCount = getTransientViewCount(); pw.println("Transient Views: " + transientViewCount);
pw.println(" Transient Views: " + transientViewCount); for (int i = 0; i < transientViewCount; i++) {
for (int i = 0; i < transientViewCount; i++) { ExpandableView child = (ExpandableView) getTransientView(i);
ExpandableView child = (ExpandableView) getTransientView(i); child.dump(fd, pw, args);
child.dump(fd, pw, args); }
} View swipedView = mSwipeHelper.getSwipedView();
View swipedView = mSwipeHelper.getSwipedView(); pw.println("Swiped view: " + swipedView);
pw.println(" Swiped view: " + swipedView); if (swipedView instanceof ExpandableView) {
if (swipedView instanceof ExpandableView) { ExpandableView expandableView = (ExpandableView) swipedView;
ExpandableView expandableView = (ExpandableView) swipedView; expandableView.dump(fd, pw, args);
expandableView.dump(fd, pw, args); }
} });
} }
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW) @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)

View File

@@ -129,7 +129,6 @@ import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.ActivityIntentHelper; import com.android.systemui.ActivityIntentHelper;
import com.android.systemui.AutoReinflateContainer; import com.android.systemui.AutoReinflateContainer;
import com.android.systemui.DejankUtils; import com.android.systemui.DejankUtils;
import com.android.systemui.Dumpable;
import com.android.systemui.EventLogTags; import com.android.systemui.EventLogTags;
import com.android.systemui.InitController; import com.android.systemui.InitController;
import com.android.systemui.Prefs; import com.android.systemui.Prefs;
@@ -235,6 +234,7 @@ import com.android.systemui.unfold.UnfoldLightRevealOverlayAnimation;
import com.android.systemui.unfold.UnfoldTransitionWallpaperController; import com.android.systemui.unfold.UnfoldTransitionWallpaperController;
import com.android.systemui.unfold.config.UnfoldTransitionConfig; import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.systemui.unfold.util.NaturalRotationUnfoldProgressProvider; import com.android.systemui.unfold.util.NaturalRotationUnfoldProgressProvider;
import com.android.systemui.util.DumpUtilsKt;
import com.android.systemui.util.WallpaperController; import com.android.systemui.util.WallpaperController;
import com.android.systemui.util.concurrency.DelayableExecutor; import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.concurrency.MessageRouter; import com.android.systemui.util.concurrency.MessageRouter;
@@ -936,8 +936,6 @@ public class StatusBar extends SystemUI implements
data -> mCommandQueueCallbacks.animateExpandSettingsPanel(data.mSubpanel)); data -> mCommandQueueCallbacks.animateExpandSettingsPanel(data.mSubpanel));
mMessageRouter.subscribeTo(MSG_LAUNCH_TRANSITION_TIMEOUT, mMessageRouter.subscribeTo(MSG_LAUNCH_TRANSITION_TIMEOUT,
id -> onLaunchTransitionTimeout()); id -> onLaunchTransitionTimeout());
dumpManager.registerDumpable(this);
} }
@Override @Override
@@ -2445,8 +2443,14 @@ public class StatusBar extends SystemUI implements
} }
pw.println(" mStackScroller: "); pw.println(" mStackScroller: ");
if (mStackScroller != null) { if (mStackScroller != null) {
pw.print (" "); DumpUtilsKt.withIndenting(pw, ipw -> {
((Dumpable) mStackScroller).dump(fd, pw, args); // Triple indent until we rewrite the rest of this dump()
ipw.increaseIndent();
ipw.increaseIndent();
mStackScroller.dump(fd, ipw, args);
ipw.decreaseIndent();
ipw.decreaseIndent();
});
} }
pw.println(" Theme:"); pw.println(" Theme:");
String nightMode = mUiModeManager == null ? "null" : mUiModeManager.getNightMode() + ""; String nightMode = mUiModeManager == null ? "null" : mUiModeManager.getNightMode() + "";

View File

@@ -0,0 +1,75 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.util
import android.util.IndentingPrintWriter
import android.view.View
import java.io.PrintWriter
import java.util.function.Consumer
/**
* Run some code that will print to an [IndentingPrintWriter] that wraps the given [PrintWriter].
*
* If the given [PrintWriter] is an [IndentingPrintWriter], the block will be passed that same
* instance with [IndentingPrintWriter.increaseIndent] having been called, and calling
* [IndentingPrintWriter.decreaseIndent] after completion of the block, so the passed [PrintWriter]
* should not be used before the block completes.
*/
inline fun PrintWriter.withIndenting(block: (IndentingPrintWriter) -> Unit) {
if (this is IndentingPrintWriter) {
this.withIncreasedIndent { block(this) }
} else {
block(IndentingPrintWriter(this))
}
}
/**
* Run some code that will print to an [IndentingPrintWriter] that wraps the given [PrintWriter].
*
* If the given [PrintWriter] is an [IndentingPrintWriter], the block will be passed that same
* instance with [IndentingPrintWriter.increaseIndent] having been called, and calling
* [IndentingPrintWriter.decreaseIndent] after completion of the block, so the passed [PrintWriter]
* should not be used before the block completes.
*/
fun PrintWriter.withIndenting(consumer: Consumer<IndentingPrintWriter>) {
if (this is IndentingPrintWriter) {
this.withIncreasedIndent { consumer.accept(this) }
} else {
consumer.accept(IndentingPrintWriter(this))
}
}
/**
* Run some code inside a block, with [IndentingPrintWriter.increaseIndent] having been called on
* the given argument, and calling [IndentingPrintWriter.decreaseIndent] after completion.
*/
inline fun IndentingPrintWriter.withIncreasedIndent(block: () -> Unit) {
this.increaseIndent()
try {
block()
} finally {
this.decreaseIndent()
}
}
/** Return a readable string for the visibility */
fun visibilityString(@View.Visibility visibility: Int): String = when (visibility) {
View.GONE -> "gone"
View.VISIBLE -> "visible"
View.INVISIBLE -> "invisible"
else -> "unknown:$visibility"
}