Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java +6 −0 Original line number Diff line number Diff line Loading @@ -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; /** Loading Loading @@ -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) { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +55 −2 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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) { Loading @@ -232,6 +239,7 @@ public class AmbientState { mBypassController = bypassController; mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; reload(context); dumpManager.registerDumpable(this); } /** Loading Loading @@ -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); } } packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +6 −0 Original line number Diff line number Diff line Loading @@ -5067,6 +5067,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, () -> { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +7 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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 Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt +6 −3 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading Loading @@ -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) } Loading @@ -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) } Loading @@ -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) } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java +6 −0 Original line number Diff line number Diff line Loading @@ -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; /** Loading Loading @@ -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) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +55 −2 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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) { Loading @@ -232,6 +239,7 @@ public class AmbientState { mBypassController = bypassController; mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; reload(context); dumpManager.registerDumpable(this); } /** Loading Loading @@ -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); } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +6 −0 Original line number Diff line number Diff line Loading @@ -5067,6 +5067,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, () -> { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +7 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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 Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt +6 −3 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading Loading @@ -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) } Loading @@ -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) } Loading @@ -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) } }