Merge "Add dumpsys logs to debug lockscreen stack height" into tm-qpr-dev am: 96f5e4321e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20524361 Change-Id: Id830be282dc4f54d8df38208cf83c38b4673ea6c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -5128,6 +5128,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
println(pw, "intrinsicPadding", mIntrinsicPadding);
|
println(pw, "intrinsicPadding", mIntrinsicPadding);
|
||||||
println(pw, "topPadding", mTopPadding);
|
println(pw, "topPadding", mTopPadding);
|
||||||
println(pw, "bottomPadding", mBottomPadding);
|
println(pw, "bottomPadding", mBottomPadding);
|
||||||
|
mNotificationStackSizeCalculator.dump(pw, args);
|
||||||
});
|
});
|
||||||
pw.println();
|
pw.println();
|
||||||
pw.println("Contents:");
|
pw.println("Contents:");
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
|
|||||||
import com.android.systemui.statusbar.notification.row.ExpandableView
|
import com.android.systemui.statusbar.notification.row.ExpandableView
|
||||||
import com.android.systemui.util.Compile
|
import com.android.systemui.util.Compile
|
||||||
import com.android.systemui.util.children
|
import com.android.systemui.util.children
|
||||||
|
import java.io.PrintWriter
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
@@ -53,6 +54,8 @@ constructor(
|
|||||||
@Main private val resources: Resources
|
@Main private val resources: Resources
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
private lateinit var lastComputeHeightLog : String
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum # notifications to show on Keyguard; extras will be collapsed in an overflow shelf.
|
* 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
|
* If there are exactly 1 + mMaxKeyguardNotifications, and they fit in the available space
|
||||||
@@ -114,7 +117,9 @@ constructor(
|
|||||||
shelfIntrinsicHeight: Float
|
shelfIntrinsicHeight: Float
|
||||||
): Int {
|
): Int {
|
||||||
log { "\n" }
|
log { "\n" }
|
||||||
val stackHeightSequence = computeHeightPerNotificationLimit(stack, shelfIntrinsicHeight)
|
|
||||||
|
val stackHeightSequence = computeHeightPerNotificationLimit(stack, shelfIntrinsicHeight,
|
||||||
|
/* computeHeight= */ false)
|
||||||
|
|
||||||
var maxNotifications =
|
var maxNotifications =
|
||||||
stackHeightSequence.lastIndexWhile { heightResult ->
|
stackHeightSequence.lastIndexWhile { heightResult ->
|
||||||
@@ -157,18 +162,21 @@ constructor(
|
|||||||
shelfIntrinsicHeight: Float
|
shelfIntrinsicHeight: Float
|
||||||
): Float {
|
): Float {
|
||||||
log { "\n" }
|
log { "\n" }
|
||||||
|
lastComputeHeightLog = ""
|
||||||
val heightPerMaxNotifications =
|
val heightPerMaxNotifications =
|
||||||
computeHeightPerNotificationLimit(stack, shelfIntrinsicHeight)
|
computeHeightPerNotificationLimit(stack, shelfIntrinsicHeight,
|
||||||
|
/* computeHeight= */ true)
|
||||||
|
|
||||||
val (notificationsHeight, shelfHeightWithSpaceBefore) =
|
val (notificationsHeight, shelfHeightWithSpaceBefore) =
|
||||||
heightPerMaxNotifications.elementAtOrElse(maxNotifications) {
|
heightPerMaxNotifications.elementAtOrElse(maxNotifications) {
|
||||||
heightPerMaxNotifications.last() // Height with all notifications visible.
|
heightPerMaxNotifications.last() // Height with all notifications visible.
|
||||||
}
|
}
|
||||||
log {
|
lastComputeHeightLog += "\ncomputeHeight(maxNotifications=$maxNotifications," +
|
||||||
"computeHeight(maxNotifications=$maxNotifications," +
|
|
||||||
"shelfIntrinsicHeight=$shelfIntrinsicHeight) -> " +
|
"shelfIntrinsicHeight=$shelfIntrinsicHeight) -> " +
|
||||||
"${notificationsHeight + shelfHeightWithSpaceBefore}" +
|
"${notificationsHeight + shelfHeightWithSpaceBefore}" +
|
||||||
" = ($notificationsHeight + $shelfHeightWithSpaceBefore)"
|
" = ($notificationsHeight + $shelfHeightWithSpaceBefore)"
|
||||||
|
log {
|
||||||
|
lastComputeHeightLog
|
||||||
}
|
}
|
||||||
return notificationsHeight + shelfHeightWithSpaceBefore
|
return notificationsHeight + shelfHeightWithSpaceBefore
|
||||||
}
|
}
|
||||||
@@ -184,7 +192,8 @@ constructor(
|
|||||||
|
|
||||||
private fun computeHeightPerNotificationLimit(
|
private fun computeHeightPerNotificationLimit(
|
||||||
stack: NotificationStackScrollLayout,
|
stack: NotificationStackScrollLayout,
|
||||||
shelfHeight: Float
|
shelfHeight: Float,
|
||||||
|
computeHeight: Boolean
|
||||||
): Sequence<StackHeight> = sequence {
|
): Sequence<StackHeight> = sequence {
|
||||||
log { "computeHeightPerNotificationLimit" }
|
log { "computeHeightPerNotificationLimit" }
|
||||||
|
|
||||||
@@ -213,9 +222,14 @@ constructor(
|
|||||||
currentIndex = firstViewInShelfIndex)
|
currentIndex = firstViewInShelfIndex)
|
||||||
spaceBeforeShelf + shelfHeight
|
spaceBeforeShelf + shelfHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val currentLog = "computeHeight | i=$i notificationsHeight=$notifications " +
|
||||||
|
"shelfHeightWithSpaceBefore=$shelfWithSpaceBefore"
|
||||||
|
if (computeHeight) {
|
||||||
|
lastComputeHeightLog += "\n" + currentLog
|
||||||
|
}
|
||||||
log {
|
log {
|
||||||
"i=$i notificationsHeight=$notifications " +
|
currentLog
|
||||||
"shelfHeightWithSpaceBefore=$shelfWithSpaceBefore"
|
|
||||||
}
|
}
|
||||||
yield(
|
yield(
|
||||||
StackHeight(
|
StackHeight(
|
||||||
@@ -260,6 +274,10 @@ constructor(
|
|||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun dump(pw: PrintWriter, args: Array<out String>) {
|
||||||
|
pw.println("NotificationStackSizeCalculator lastComputeHeightLog = $lastComputeHeightLog")
|
||||||
|
}
|
||||||
|
|
||||||
private fun ExpandableView.isShowable(onLockscreen: Boolean): Boolean {
|
private fun ExpandableView.isShowable(onLockscreen: Boolean): Boolean {
|
||||||
if (visibility == GONE || hasNoContentHeight()) return false
|
if (visibility == GONE || hasNoContentHeight()) return false
|
||||||
if (onLockscreen) {
|
if (onLockscreen) {
|
||||||
|
|||||||
Reference in New Issue
Block a user