Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +1 −0 Original line number Diff line number Diff line Loading @@ -5128,6 +5128,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable println(pw, "intrinsicPadding", mIntrinsicPadding); println(pw, "topPadding", mTopPadding); println(pw, "bottomPadding", mBottomPadding); mNotificationStackSizeCalculator.dump(pw, args); }); pw.println(); pw.println("Contents:"); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculator.kt +25 −7 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableView import com.android.systemui.util.Compile import com.android.systemui.util.children import java.io.PrintWriter import javax.inject.Inject import kotlin.math.max import kotlin.math.min Loading @@ -53,6 +54,8 @@ constructor( @Main private val resources: Resources ) { private lateinit var lastComputeHeightLog : String /** * Maximum # notifications to show on Keyguard; extras will be collapsed in an overflow shelf. * If there are exactly 1 + mMaxKeyguardNotifications, and they fit in the available space Loading Loading @@ -114,7 +117,9 @@ constructor( shelfIntrinsicHeight: Float ): Int { log { "\n" } val stackHeightSequence = computeHeightPerNotificationLimit(stack, shelfIntrinsicHeight) val stackHeightSequence = computeHeightPerNotificationLimit(stack, shelfIntrinsicHeight, /* computeHeight= */ false) var maxNotifications = stackHeightSequence.lastIndexWhile { heightResult -> Loading Loading @@ -157,18 +162,21 @@ constructor( shelfIntrinsicHeight: Float ): Float { log { "\n" } lastComputeHeightLog = "" val heightPerMaxNotifications = computeHeightPerNotificationLimit(stack, shelfIntrinsicHeight) computeHeightPerNotificationLimit(stack, shelfIntrinsicHeight, /* computeHeight= */ true) val (notificationsHeight, shelfHeightWithSpaceBefore) = heightPerMaxNotifications.elementAtOrElse(maxNotifications) { heightPerMaxNotifications.last() // Height with all notifications visible. } log { "computeHeight(maxNotifications=$maxNotifications," + lastComputeHeightLog += "\ncomputeHeight(maxNotifications=$maxNotifications," + "shelfIntrinsicHeight=$shelfIntrinsicHeight) -> " + "${notificationsHeight + shelfHeightWithSpaceBefore}" + " = ($notificationsHeight + $shelfHeightWithSpaceBefore)" log { lastComputeHeightLog } return notificationsHeight + shelfHeightWithSpaceBefore } Loading @@ -184,7 +192,8 @@ constructor( private fun computeHeightPerNotificationLimit( stack: NotificationStackScrollLayout, shelfHeight: Float shelfHeight: Float, computeHeight: Boolean ): Sequence<StackHeight> = sequence { log { "computeHeightPerNotificationLimit" } Loading Loading @@ -213,9 +222,14 @@ constructor( currentIndex = firstViewInShelfIndex) spaceBeforeShelf + shelfHeight } log { "i=$i notificationsHeight=$notifications " + val currentLog = "computeHeight | i=$i notificationsHeight=$notifications " + "shelfHeightWithSpaceBefore=$shelfWithSpaceBefore" if (computeHeight) { lastComputeHeightLog += "\n" + currentLog } log { currentLog } yield( StackHeight( Loading Loading @@ -260,6 +274,10 @@ constructor( return size } fun dump(pw: PrintWriter, args: Array<out String>) { pw.println("NotificationStackSizeCalculator lastComputeHeightLog = $lastComputeHeightLog") } private fun ExpandableView.isShowable(onLockscreen: Boolean): Boolean { if (visibility == GONE || hasNoContentHeight()) return false if (onLockscreen) { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +1 −0 Original line number Diff line number Diff line Loading @@ -5128,6 +5128,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable println(pw, "intrinsicPadding", mIntrinsicPadding); println(pw, "topPadding", mTopPadding); println(pw, "bottomPadding", mBottomPadding); mNotificationStackSizeCalculator.dump(pw, args); }); pw.println(); pw.println("Contents:"); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculator.kt +25 −7 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableView import com.android.systemui.util.Compile import com.android.systemui.util.children import java.io.PrintWriter import javax.inject.Inject import kotlin.math.max import kotlin.math.min Loading @@ -53,6 +54,8 @@ constructor( @Main private val resources: Resources ) { private lateinit var lastComputeHeightLog : String /** * Maximum # notifications to show on Keyguard; extras will be collapsed in an overflow shelf. * If there are exactly 1 + mMaxKeyguardNotifications, and they fit in the available space Loading Loading @@ -114,7 +117,9 @@ constructor( shelfIntrinsicHeight: Float ): Int { log { "\n" } val stackHeightSequence = computeHeightPerNotificationLimit(stack, shelfIntrinsicHeight) val stackHeightSequence = computeHeightPerNotificationLimit(stack, shelfIntrinsicHeight, /* computeHeight= */ false) var maxNotifications = stackHeightSequence.lastIndexWhile { heightResult -> Loading Loading @@ -157,18 +162,21 @@ constructor( shelfIntrinsicHeight: Float ): Float { log { "\n" } lastComputeHeightLog = "" val heightPerMaxNotifications = computeHeightPerNotificationLimit(stack, shelfIntrinsicHeight) computeHeightPerNotificationLimit(stack, shelfIntrinsicHeight, /* computeHeight= */ true) val (notificationsHeight, shelfHeightWithSpaceBefore) = heightPerMaxNotifications.elementAtOrElse(maxNotifications) { heightPerMaxNotifications.last() // Height with all notifications visible. } log { "computeHeight(maxNotifications=$maxNotifications," + lastComputeHeightLog += "\ncomputeHeight(maxNotifications=$maxNotifications," + "shelfIntrinsicHeight=$shelfIntrinsicHeight) -> " + "${notificationsHeight + shelfHeightWithSpaceBefore}" + " = ($notificationsHeight + $shelfHeightWithSpaceBefore)" log { lastComputeHeightLog } return notificationsHeight + shelfHeightWithSpaceBefore } Loading @@ -184,7 +192,8 @@ constructor( private fun computeHeightPerNotificationLimit( stack: NotificationStackScrollLayout, shelfHeight: Float shelfHeight: Float, computeHeight: Boolean ): Sequence<StackHeight> = sequence { log { "computeHeightPerNotificationLimit" } Loading Loading @@ -213,9 +222,14 @@ constructor( currentIndex = firstViewInShelfIndex) spaceBeforeShelf + shelfHeight } log { "i=$i notificationsHeight=$notifications " + val currentLog = "computeHeight | i=$i notificationsHeight=$notifications " + "shelfHeightWithSpaceBefore=$shelfWithSpaceBefore" if (computeHeight) { lastComputeHeightLog += "\n" + currentLog } log { currentLog } yield( StackHeight( Loading Loading @@ -260,6 +274,10 @@ constructor( return size } fun dump(pw: PrintWriter, args: Array<out String>) { pw.println("NotificationStackSizeCalculator lastComputeHeightLog = $lastComputeHeightLog") } private fun ExpandableView.isShowable(onLockscreen: Boolean): Boolean { if (visibility == GONE || hasNoContentHeight()) return false if (onLockscreen) { Loading