diff options
5 files changed, 80 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java index 7cfb1571ccf0..fb712108a787 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java @@ -25,6 +25,7 @@ import android.widget.ImageView; import com.android.internal.util.ContrastColorUtil; import com.android.systemui.R; import com.android.systemui.statusbar.notification.collection.ListEntry; +import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.util.Compile; /** @@ -89,6 +90,11 @@ public class NotificationUtils { } } + /** Get the notification key, reformatted for logging, for the (optional) row */ + public static String logKey(ExpandableNotificationRow row) { + return row == null ? "null" : logKey(row.getEntry()); + } + /** Removes newlines from the notification key to prettify apps that have these in the tag */ public static String logKey(String key) { if (key == null) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java index 9acd60eb862a..ea28452d63c4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java @@ -16,13 +16,17 @@ package com.android.systemui.statusbar.notification.stack; +import static com.android.systemui.statusbar.notification.NotificationUtils.logKey; + import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.util.MathUtils; +import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.dagger.SysUISingleton; +import com.android.systemui.dump.DumpManager; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.notification.collection.NotificationEntry; @@ -33,13 +37,15 @@ import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm.By import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm.SectionProvider; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; +import java.io.PrintWriter; + import javax.inject.Inject; /** * A global state to track all input states for the algorithm. */ @SysUISingleton -public class AmbientState { +public class AmbientState implements Dumpable { private static final float MAX_PULSE_HEIGHT = 100000f; private static final boolean NOTIFICATIONS_HAVE_SHADOWS = false; @@ -224,7 +230,8 @@ public class AmbientState { @Inject public AmbientState( - Context context, + @NonNull Context context, + @NonNull DumpManager dumpManager, @NonNull SectionProvider sectionProvider, @NonNull BypassController bypassController, @Nullable StatusBarKeyguardViewManager statusBarKeyguardViewManager) { @@ -232,6 +239,7 @@ public class AmbientState { mBypassController = bypassController; mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; reload(context); + dumpManager.registerDumpable(this); } /** @@ -695,4 +703,49 @@ public class AmbientState { return mStatusBarKeyguardViewManager != null && mStatusBarKeyguardViewManager.isBouncerInTransit(); } + + @Override + public void dump(PrintWriter pw, String[] args) { + pw.println("mTopPadding=" + mTopPadding); + pw.println("mStackTopMargin=" + mStackTopMargin); + pw.println("mStackTranslation=" + mStackTranslation); + pw.println("mLayoutMinHeight=" + mLayoutMinHeight); + pw.println("mLayoutMaxHeight=" + mLayoutMaxHeight); + pw.println("mLayoutHeight=" + mLayoutHeight); + pw.println("mContentHeight=" + mContentHeight); + pw.println("mHideSensitive=" + mHideSensitive); + pw.println("mShadeExpanded=" + mShadeExpanded); + pw.println("mClearAllInProgress=" + mClearAllInProgress); + pw.println("mDimmed=" + mDimmed); + pw.println("mStatusBarState=" + mStatusBarState); + pw.println("mExpansionChanging=" + mExpansionChanging); + pw.println("mPanelFullWidth=" + mPanelFullWidth); + pw.println("mPulsing=" + mPulsing); + pw.println("mPulseHeight=" + mPulseHeight); + pw.println("mTrackedHeadsUpRow.key=" + logKey(mTrackedHeadsUpRow)); + pw.println("mMaxHeadsUpTranslation=" + mMaxHeadsUpTranslation); + pw.println("mUnlockHintRunning=" + mUnlockHintRunning); + pw.println("mDozeAmount=" + mDozeAmount); + pw.println("mDozing=" + mDozing); + pw.println("mFractionToShade=" + mFractionToShade); + pw.println("mHideAmount=" + mHideAmount); + pw.println("mAppearFraction=" + mAppearFraction); + pw.println("mAppearing=" + mAppearing); + pw.println("mExpansionFraction=" + mExpansionFraction); + pw.println("mExpandingVelocity=" + mExpandingVelocity); + pw.println("mOverScrollTopAmount=" + mOverScrollTopAmount); + pw.println("mOverScrollBottomAmount=" + mOverScrollBottomAmount); + pw.println("mOverExpansion=" + mOverExpansion); + pw.println("mStackHeight=" + mStackHeight); + pw.println("mStackEndHeight=" + mStackEndHeight); + pw.println("mStackY=" + mStackY); + pw.println("mScrollY=" + mScrollY); + pw.println("mCurrentScrollVelocity=" + mCurrentScrollVelocity); + pw.println("mIsSwipingUp=" + mIsSwipingUp); + pw.println("mPanelTracking=" + mPanelTracking); + pw.println("mIsFlinging=" + mIsFlinging); + pw.println("mNeedFlingAfterLockscreenSwipeUp=" + mNeedFlingAfterLockscreenSwipeUp); + pw.println("mZDistanceBetweenElements=" + mZDistanceBetweenElements); + pw.println("mBaseZHeight=" + mBaseZHeight); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index b8abb256f53c..7f5ff1b17cbf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -5043,6 +5043,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable .append(" isCurrentUserSetup=").append(mIsCurrentUserSetup) .append(" hideAmount=").append(mAmbientState.getHideAmount()) .append(" ambientStateSwipingUp=").append(mAmbientState.isSwipingUp()) + .append(" maxDisplayedNotifications=").append(mMaxDisplayedNotifications) + .append(" intrinsicContentHeight=").append(mIntrinsicContentHeight) + .append(" contentHeight=").append(mContentHeight) + .append(" intrinsicPadding=").append(mIntrinsicPadding) + .append(" topPadding=").append(mTopPadding) + .append(" bottomPadding=").append(mBottomPadding) .append("]"); pw.println(sb.toString()); DumpUtilsKt.withIncreasedIndent(pw, () -> { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java index 9961aaee4224..f5fe6f3a1a5f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java @@ -57,6 +57,7 @@ import androidx.test.filters.SmallTest; import com.android.systemui.ExpandHelper; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.NotificationShelfController; @@ -101,6 +102,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Mock private SysuiStatusBarStateController mBarState; @Mock private NotificationGroupManagerLegacy mGroupMembershipManger; @Mock private NotificationGroupManagerLegacy mGroupExpansionManager; + @Mock private DumpManager mDumpManager; @Mock private ExpandHelper mExpandHelper; @Mock private EmptyShadeView mEmptyShadeView; @Mock private NotificationRoundnessManager mNotificationRoundnessManager; @@ -120,7 +122,11 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { allowTestableLooperAsMainThread(); // Interact with real instance of AmbientState. - mAmbientState = new AmbientState(mContext, mNotificationSectionsManager, mBypassController, + mAmbientState = new AmbientState( + mContext, + mDumpManager, + mNotificationSectionsManager, + mBypassController, mStatusBarKeyguardViewManager); // Inject dependencies before initializing the layout diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt index 668f7526891a..275dbfd516e4 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt @@ -5,6 +5,7 @@ import android.widget.FrameLayout import androidx.test.filters.SmallTest import com.android.systemui.R import com.android.systemui.SysuiTestCase +import com.android.systemui.dump.DumpManager import com.android.systemui.statusbar.EmptyShadeView import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableView @@ -26,10 +27,12 @@ class StackScrollAlgorithmTest : SysuiTestCase() { private val stackScrollAlgorithm = StackScrollAlgorithm(context, hostView) private val expandableViewState = ExpandableViewState() private val notificationRow = mock(ExpandableNotificationRow::class.java) + private val dumpManager = mock(DumpManager::class.java) private val mStatusBarKeyguardViewManager = mock(StatusBarKeyguardViewManager::class.java) private val ambientState = AmbientState( context, + dumpManager, SectionProvider { _, _ -> false }, BypassController { false }, mStatusBarKeyguardViewManager @@ -126,7 +129,7 @@ class StackScrollAlgorithmTest : SysuiTestCase() { val expandableViewState = ExpandableViewState() expandableViewState.yTranslation = viewStart - stackScrollAlgorithm.updateViewWithShelf(expandableView, expandableViewState, shelfStart); + stackScrollAlgorithm.updateViewWithShelf(expandableView, expandableViewState, shelfStart) assertFalse(expandableViewState.hidden) } @@ -142,7 +145,7 @@ class StackScrollAlgorithmTest : SysuiTestCase() { val expandableViewState = ExpandableViewState() expandableViewState.yTranslation = viewStart - stackScrollAlgorithm.updateViewWithShelf(expandableView, expandableViewState, shelfStart); + stackScrollAlgorithm.updateViewWithShelf(expandableView, expandableViewState, shelfStart) assertTrue(expandableViewState.hidden) } @@ -158,7 +161,7 @@ class StackScrollAlgorithmTest : SysuiTestCase() { val expandableViewState = ExpandableViewState() expandableViewState.yTranslation = viewStart - stackScrollAlgorithm.updateViewWithShelf(expandableView, expandableViewState, shelfStart); + stackScrollAlgorithm.updateViewWithShelf(expandableView, expandableViewState, shelfStart) assertFalse(expandableViewState.hidden) } } |