summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt3
-rw-r--r--packages/SystemUI/customization/src/com/android/systemui/shared/clocks/LogUtil.kt32
-rw-r--r--packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/FlexClockView.kt55
-rw-r--r--packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt48
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModelTest.kt2
-rw-r--r--packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockLogger.kt118
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt5
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepository.kt26
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBlueprintViewBinder.kt67
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt10
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/transitions/IntraBlueprintTransition.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt23
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/transitions/ClockSizeTransition.kt124
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModel.kt43
-rw-r--r--packages/SystemUI/src/com/android/systemui/log/dagger/KeyguardClockLog.kt6
-rw-r--r--packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java10
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt1
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextViewTest.kt4
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepositoryKosmos.kt2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModelKosmos.kt2
20 files changed, 338 insertions, 247 deletions
diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt
index 36029177d4f6..6cc281ace481 100644
--- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt
+++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt
@@ -23,6 +23,7 @@ import com.android.systemui.log.core.MessageBuffer
import com.android.systemui.plugins.clocks.ClockController
import com.android.systemui.plugins.clocks.ClockFontAxis
import com.android.systemui.plugins.clocks.ClockFontAxisSetting
+import com.android.systemui.plugins.clocks.ClockLogger
import com.android.systemui.plugins.clocks.ClockMessageBuffers
import com.android.systemui.plugins.clocks.ClockMetadata
import com.android.systemui.plugins.clocks.ClockPickerConfig
@@ -62,7 +63,7 @@ class DefaultClockProvider(
}
return if (isClockReactiveVariantsEnabled) {
- val buffers = messageBuffers ?: ClockMessageBuffers(LogUtil.DEFAULT_MESSAGE_BUFFER)
+ val buffers = messageBuffers ?: ClockMessageBuffers(ClockLogger.DEFAULT_MESSAGE_BUFFER)
val fontAxes = ClockFontAxis.merge(FlexClockController.FONT_AXES, settings.axes)
val clockSettings = settings.copy(axes = fontAxes.map { it.toSetting() })
val typefaceCache =
diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/LogUtil.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/LogUtil.kt
deleted file mode 100644
index 34cb4ef7089d..000000000000
--- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/LogUtil.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2024 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.shared.clocks
-
-import com.android.systemui.log.core.LogLevel
-import com.android.systemui.log.core.LogcatOnlyMessageBuffer
-import com.android.systemui.log.core.Logger
-
-object LogUtil {
- // Used when MessageBuffers are not provided by the host application
- val DEFAULT_MESSAGE_BUFFER = LogcatOnlyMessageBuffer(LogLevel.INFO)
-
- // Only intended for use during initialization steps where the correct logger doesn't exist yet
- val FALLBACK_INIT_LOGGER = Logger(LogcatOnlyMessageBuffer(LogLevel.ERROR), "CLOCK_INIT")
-
- // Debug is primarially used for tests, but can also be used for tracking down hard issues.
- val DEBUG_MESSAGE_BUFFER = LogcatOnlyMessageBuffer(LogLevel.DEBUG)
-}
diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/FlexClockView.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/FlexClockView.kt
index 3eb519186a3e..55750b5e0925 100644
--- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/FlexClockView.kt
+++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/FlexClockView.kt
@@ -27,11 +27,10 @@ import android.widget.RelativeLayout
import androidx.annotation.VisibleForTesting
import com.android.app.animation.Interpolators
import com.android.systemui.customization.R
-import com.android.systemui.log.core.Logger
import com.android.systemui.plugins.clocks.ClockFontAxisSetting
+import com.android.systemui.plugins.clocks.ClockLogger
import com.android.systemui.shared.clocks.ClockContext
import com.android.systemui.shared.clocks.DigitTranslateAnimator
-import com.android.systemui.shared.clocks.LogUtil
import java.util.Locale
import kotlin.math.abs
import kotlin.math.max
@@ -40,8 +39,8 @@ import kotlin.math.min
fun clamp(value: Float, minVal: Float, maxVal: Float): Float = max(min(value, maxVal), minVal)
class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) {
- protected val logger = Logger(clockCtx.messageBuffer, this::class.simpleName!!)
- get() = field ?: LogUtil.FALLBACK_INIT_LOGGER
+ protected val logger = ClockLogger(this, clockCtx.messageBuffer, this::class.simpleName!!)
+ get() = field ?: ClockLogger.INIT_LOGGER
@VisibleForTesting
var isAnimationEnabled = true
@@ -121,11 +120,7 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) {
override fun addView(child: View?) {
if (child == null) return
- logger.d({ "addView($str1 @$int1)" }) {
- str1 = child::class.simpleName!!
- int1 = child.id
- }
-
+ logger.addView(child)
super.addView(child)
(child as? SimpleDigitalClockTextView)?.let {
it.digitTranslateAnimator = DigitTranslateAnimator(::invalidate)
@@ -135,58 +130,32 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) {
}
fun refreshTime() {
- logger.d("refreshTime()")
+ logger.refreshTime()
digitalClockTextViewMap.forEach { (_, textView) -> textView.refreshText() }
}
override fun setVisibility(visibility: Int) {
- if (visibility != this.visibility) {
- logger.d({ "setVisibility(${str1 ?: int1})" }) {
- int1 = visibility
- str1 =
- when (visibility) {
- VISIBLE -> "VISIBLE"
- INVISIBLE -> "INVISIBLE"
- GONE -> "GONE"
- else -> null
- }
- }
- }
-
+ logger.setVisibility(visibility)
super.setVisibility(visibility)
}
- private var loggedAlpha = 1000f
-
override fun setAlpha(alpha: Float) {
- val delta = if (alpha <= 0f || alpha >= 1f) 0.001f else 0.5f
- if (abs(loggedAlpha - alpha) >= delta) {
- loggedAlpha = alpha
- logger.d({ "setAlpha($double1)" }) { double1 = alpha.toDouble() }
- }
+ logger.setAlpha(alpha)
super.setAlpha(alpha)
}
- private val isDrawn: Boolean
- get() = (mPrivateFlags and 0x20 /* PFLAG_DRAWN */) > 0
-
override fun invalidate() {
- if (isDrawn && visibility == VISIBLE) {
- logger.d("invalidate()")
- }
-
+ logger.invalidate()
super.invalidate()
}
override fun requestLayout() {
- if (!isLayoutRequested()) {
- logger.d("requestLayout()")
- }
+ logger.requestLayout()
super.requestLayout()
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
- logger.d("onMeasure()")
+ logger.onMeasure()
calculateSize(widthMeasureSpec, heightMeasureSpec)?.let { size ->
setMeasuredDimension(size.x, size.y)
} ?: run { super.onMeasure(widthMeasureSpec, heightMeasureSpec) }
@@ -198,12 +167,12 @@ class FlexClockView(clockCtx: ClockContext) : FrameLayout(clockCtx.context) {
}
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
- logger.d("onLayout()")
+ logger.onLayout()
super.onLayout(changed, left, top, right, bottom)
}
override fun onDraw(canvas: Canvas) {
- logger.d("onDraw()")
+ logger.onDraw()
super.onDraw(canvas)
digitalClockTextViewMap.forEach { (id, textView) ->
diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt
index fbd5887c5b54..db39162205b2 100644
--- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt
+++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextView.kt
@@ -37,15 +37,13 @@ import com.android.internal.annotations.VisibleForTesting
import com.android.systemui.animation.GSFAxes
import com.android.systemui.animation.TextAnimator
import com.android.systemui.customization.R
-import com.android.systemui.log.core.Logger
import com.android.systemui.plugins.clocks.ClockFontAxisSetting
+import com.android.systemui.plugins.clocks.ClockLogger
import com.android.systemui.shared.clocks.ClockContext
import com.android.systemui.shared.clocks.DigitTranslateAnimator
import com.android.systemui.shared.clocks.DimensionParser
import com.android.systemui.shared.clocks.FontTextStyle
-import com.android.systemui.shared.clocks.LogUtil
import java.lang.Thread
-import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min
@@ -95,8 +93,8 @@ open class SimpleDigitalClockTextView(clockCtx: ClockContext, attrs: AttributeSe
private val prevTextBounds = Rect()
// targetTextBounds holds the state we are interpolating to
private val targetTextBounds = Rect()
- protected val logger = Logger(clockCtx.messageBuffer, this::class.simpleName!!)
- get() = field ?: LogUtil.FALLBACK_INIT_LOGGER
+ protected val logger = ClockLogger(this, clockCtx.messageBuffer, this::class.simpleName!!)
+ get() = field ?: ClockLogger.INIT_LOGGER
private var aodDozingInterpolator: Interpolator? = null
@@ -147,7 +145,7 @@ open class SimpleDigitalClockTextView(clockCtx: ClockContext, attrs: AttributeSe
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
- logger.d("onMeasure()")
+ logger.onMeasure()
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
val layout = this.layout
@@ -208,9 +206,7 @@ open class SimpleDigitalClockTextView(clockCtx: ClockContext, attrs: AttributeSe
}
override fun onDraw(canvas: Canvas) {
- logger.d({ "onDraw(${str1?.replace("\n", "\\n")})" }) {
- str1 = textAnimator.textInterpolator.shapedText
- }
+ logger.onDraw(textAnimator.textInterpolator.shapedText)
val translation = getLocalTranslation()
canvas.translate(translation.x.toFloat(), translation.y.toFloat())
@@ -227,47 +223,23 @@ open class SimpleDigitalClockTextView(clockCtx: ClockContext, attrs: AttributeSe
}
override fun setVisibility(visibility: Int) {
- if (visibility != this.visibility) {
- logger.d({ "setVisibility(${str1 ?: int1})" }) {
- int1 = visibility
- str1 =
- when (visibility) {
- VISIBLE -> "VISIBLE"
- INVISIBLE -> "INVISIBLE"
- GONE -> "GONE"
- else -> null
- }
- }
- }
-
+ logger.setVisibility(visibility)
super.setVisibility(visibility)
}
- private var loggedAlpha = 1000f
-
override fun setAlpha(alpha: Float) {
- val delta = if (alpha <= 0f || alpha >= 1f) 0.001f else 0.5f
- if (abs(loggedAlpha - alpha) >= delta) {
- loggedAlpha = alpha
- logger.d({ "setAlpha($double1)" }) { double1 = alpha.toDouble() }
- }
+ logger.setAlpha(alpha)
super.setAlpha(alpha)
}
- private val isDrawn: Boolean
- get() = (mPrivateFlags and 0x20 /* PFLAG_DRAWN */) > 0
-
override fun invalidate() {
- if (isDrawn && visibility == VISIBLE) {
- logger.d("invalidate()")
- }
-
+ logger.invalidate()
super.invalidate()
(parent as? FlexClockView)?.invalidate()
}
fun refreshTime() {
- logger.d("refreshTime()")
+ logger.refreshTime()
refreshText()
}
@@ -472,7 +444,7 @@ open class SimpleDigitalClockTextView(clockCtx: ClockContext, attrs: AttributeSe
maxSingleDigitWidth = 0
for (i in 0..9) {
- lockScreenPaint.getTextBounds(i.toString(), 0, 1, rectForCalculate)
+ lockScreenPaint.getTextBounds("$i", 0, 1, rectForCalculate)
maxSingleDigitHeight = max(maxSingleDigitHeight, rectForCalculate.height())
maxSingleDigitWidth = max(maxSingleDigitWidth, rectForCalculate.width())
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModelTest.kt
index aab46d8cb73a..724d4c022fb2 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModelTest.kt
@@ -23,6 +23,7 @@ import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.keyguard.domain.interactor.KeyguardBlueprintInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor
+import com.android.systemui.log.logcatLogBuffer
import com.android.systemui.testKosmos
import org.junit.Before
import org.junit.Test
@@ -46,6 +47,7 @@ class KeyguardBlueprintViewModelTest : SysuiTestCase() {
handler = kosmos.fakeExecutorHandler,
keyguardBlueprintInteractor = keyguardBlueprintInteractor,
keyguardTransitionInteractor = kosmos.keyguardTransitionInteractor,
+ blueprintLog = logcatLogBuffer("blueprints"),
)
}
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockLogger.kt b/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockLogger.kt
new file mode 100644
index 000000000000..6a9bbca1d4e1
--- /dev/null
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockLogger.kt
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2025 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.plugins.clocks
+
+import android.view.View
+import com.android.systemui.log.core.LogLevel
+import com.android.systemui.log.core.LogcatOnlyMessageBuffer
+import com.android.systemui.log.core.Logger
+import com.android.systemui.log.core.MessageBuffer
+import kotlin.math.abs
+
+class ClockLogger(private val view: View?, buffer: MessageBuffer, tag: String) :
+ Logger(buffer, tag) {
+
+ private var loggedAlpha = 1000f
+ private val isDrawn: Boolean
+ get() = ((view?.mPrivateFlags ?: 0x0) and 0x20 /* PFLAG_DRAWN */) > 0
+
+ fun invalidate() {
+ if (isDrawn && view?.visibility == View.VISIBLE) {
+ d("invalidate()")
+ }
+ }
+
+ fun refreshTime() {
+ d("refreshTime()")
+ }
+
+ fun requestLayout() {
+ if (view?.isLayoutRequested() == false) {
+ d("requestLayout()")
+ }
+ }
+
+ fun onMeasure() {
+ d("onMeasure()")
+ }
+
+ fun onLayout() {
+ d("onLayout()")
+ }
+
+ fun onDraw() {
+ d("onDraw()")
+ }
+
+ fun onDraw(str: String?) {
+ d({ "onDraw(${escapeTime(str1)})" }) { str1 = str ?: "" }
+ }
+
+ fun onDraw(lsStr: String?, aodStr: String?) {
+ d({ "onDraw(ls = ${escapeTime(str1)}, aod = ${escapeTime(str2)}" }) {
+ str1 = lsStr
+ str2 = aodStr
+ }
+ }
+
+ fun setVisibility(visibility: Int) {
+ if (visibility != view?.visibility) {
+ d({ "setVisibility(${getVisText(int1)})" }) { int1 = visibility }
+ }
+ }
+
+ fun setAlpha(alpha: Float) {
+ val delta = if (alpha <= 0f || alpha >= 1f) 0.001f else 0.5f
+ if (abs(loggedAlpha - alpha) >= delta) {
+ loggedAlpha = alpha
+ d({ "setAlpha($double1)" }) { double1 = alpha.toDouble() }
+ }
+ }
+
+ fun addView(child: View) {
+ d({ "addView($str1 @$int1)" }) {
+ str1 = child::class.simpleName!!
+ int1 = child.id
+ }
+ }
+
+ companion object {
+ // Used when MessageBuffers are not provided by the host application
+ val DEFAULT_MESSAGE_BUFFER = LogcatOnlyMessageBuffer(LogLevel.INFO)
+
+ // Debug is primarially used for tests, but can also be used for tracking down hard issues.
+ val DEBUG_MESSAGE_BUFFER = LogcatOnlyMessageBuffer(LogLevel.DEBUG)
+
+ // Only intended for use during initialization steps before the logger is initialized
+ val INIT_LOGGER = ClockLogger(null, LogcatOnlyMessageBuffer(LogLevel.ERROR), "CLOCK_INIT")
+
+ @JvmStatic
+ fun getVisText(visibility: Int): String {
+ return when (visibility) {
+ View.GONE -> "GONE"
+ View.INVISIBLE -> "INVISIBLE"
+ View.VISIBLE -> "VISIBLE"
+ else -> "$visibility"
+ }
+ }
+
+ @JvmStatic
+ fun escapeTime(timeStr: String?): String? {
+ return timeStr?.replace("\n", "\\n")
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt
index f37e7685f21c..c7296d0c57b8 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt
@@ -39,6 +39,8 @@ import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardSmartspaceViewModel
import com.android.systemui.keyguard.ui.viewmodel.LightRevealScrimViewModel
import com.android.systemui.keyguard.ui.viewmodel.OccludingAppDeviceEntryMessageViewModel
+import com.android.systemui.log.LogBuffer
+import com.android.systemui.log.dagger.KeyguardBlueprintLog
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.ShadeDisplayAware
@@ -89,6 +91,7 @@ constructor(
private val wallpaperViewModel: WallpaperViewModel,
@Main private val mainDispatcher: CoroutineDispatcher,
private val msdlPlayer: MSDLPlayer,
+ @KeyguardBlueprintLog private val blueprintLog: LogBuffer,
) : CoreStartable {
private var rootViewHandle: DisposableHandle? = null
@@ -111,6 +114,7 @@ constructor(
keyguardBlueprintViewModel,
keyguardClockViewModel,
smartspaceViewModel,
+ blueprintLog,
)
}
if (deviceEntryUnlockTrackerViewBinder.isPresent) {
@@ -151,6 +155,7 @@ constructor(
statusBarKeyguardViewManager,
mainDispatcher,
msdlPlayer,
+ blueprintLog,
)
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepository.kt
index b826a002b9d9..37b657fffd80 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepository.kt
@@ -18,7 +18,6 @@
package com.android.systemui.keyguard.data.repository
import android.os.Handler
-import android.util.Log
import androidx.annotation.VisibleForTesting
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
@@ -26,6 +25,9 @@ import com.android.systemui.keyguard.shared.model.KeyguardBlueprint
import com.android.systemui.keyguard.ui.view.layout.blueprints.DefaultKeyguardBlueprint.Companion.DEFAULT
import com.android.systemui.keyguard.ui.view.layout.blueprints.KeyguardBlueprintModule
import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition.Config
+import com.android.systemui.log.LogBuffer
+import com.android.systemui.log.core.Logger
+import com.android.systemui.log.dagger.KeyguardBlueprintLog
import com.android.systemui.util.ThreadAssert
import java.io.PrintWriter
import java.util.TreeMap
@@ -51,7 +53,10 @@ constructor(
blueprints: Set<@JvmSuppressWildcards KeyguardBlueprint>,
@Main val handler: Handler,
val assert: ThreadAssert,
+ @KeyguardBlueprintLog log: LogBuffer,
) {
+ private val logger = Logger(log, "KeyguardBlueprintRepository")
+
// This is TreeMap so that we can order the blueprints and assign numerical values to the
// blueprints in the adb tool.
private val blueprintIdMap: TreeMap<String, KeyguardBlueprint> =
@@ -69,11 +74,12 @@ constructor(
fun applyBlueprint(blueprintId: String?): Boolean {
val blueprint = blueprintIdMap[blueprintId]
if (blueprint == null) {
- Log.e(
- TAG,
- "Could not find blueprint with id: $blueprintId. " +
+ logger.e({
+ "Could not find blueprint with id: $str1. " +
"Perhaps it was not added to KeyguardBlueprintModule?"
- )
+ }) {
+ str1 = blueprintId
+ }
return false
}
@@ -99,7 +105,9 @@ constructor(
targetTransitionConfig?.let {
val success = refreshTransition.tryEmit(it)
if (!success) {
- Log.e(TAG, "refreshBlueprint: Failed to emit blueprint refresh: $it")
+ logger.e({ "refreshBlueprint: Failed to emit blueprint refresh: $str1" }) {
+ str1 = "$it"
+ }
}
}
targetTransitionConfig = null
@@ -110,6 +118,8 @@ constructor(
if ((targetTransitionConfig?.type?.priority ?: Int.MIN_VALUE) < config.type.priority) {
if (targetTransitionConfig == null) scheduleCallback()
targetTransitionConfig = config
+ } else {
+ logger.i({ "Skipping low priority transition: $str1" }) { str1 = "$config" }
}
}
@@ -117,8 +127,4 @@ constructor(
fun printBlueprints(pw: PrintWriter) {
blueprintIdMap.onEachIndexed { index, entry -> pw.println("$index: ${entry.key}") }
}
-
- companion object {
- private const val TAG = "KeyguardBlueprintRepository"
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBlueprintViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBlueprintViewBinder.kt
index 261c130d0d82..5c4e34e31d58 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBlueprintViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBlueprintViewBinder.kt
@@ -17,7 +17,6 @@
package com.android.systemui.keyguard.ui.binder
-import android.util.Log
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.lifecycle.Lifecycle
@@ -25,13 +24,16 @@ import androidx.lifecycle.repeatOnLifecycle
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.systemui.customization.R as customR
import com.android.systemui.keyguard.shared.model.KeyguardBlueprint
-import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.BaseBlueprintTransition
import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition
import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition.Config
import com.android.systemui.keyguard.ui.viewmodel.KeyguardBlueprintViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardSmartspaceViewModel
import com.android.systemui.lifecycle.repeatWhenAttached
+import com.android.systemui.log.LogBuffer
+import com.android.systemui.log.core.Logger
+import com.android.systemui.log.dagger.KeyguardBlueprintLog
+import com.android.systemui.plugins.clocks.ClockLogger.Companion.getVisText
import com.android.systemui.shared.R as sharedR
import com.android.systemui.util.kotlin.pairwise
@@ -42,7 +44,9 @@ object KeyguardBlueprintViewBinder {
viewModel: KeyguardBlueprintViewModel,
clockViewModel: KeyguardClockViewModel,
smartspaceViewModel: KeyguardSmartspaceViewModel,
+ @KeyguardBlueprintLog log: LogBuffer,
) {
+ val logger = Logger(log, TAG)
constraintLayout.repeatWhenAttached {
repeatOnLifecycle(Lifecycle.State.CREATED) {
launch("$TAG#viewModel.blueprint") {
@@ -54,6 +58,7 @@ object KeyguardBlueprintViewBinder {
config,
clockViewModel,
smartspaceViewModel,
+ log,
)
viewModel.runTransition(constraintLayout, transition, config) {
@@ -74,7 +79,7 @@ object KeyguardBlueprintViewBinder {
blueprint.applyConstraints(this)
}
- logAlphaVisibilityScaleOfAppliedConstraintSet(cs, clockViewModel)
+ logger.logConstraintSet(cs, clockViewModel)
cs.applyTo(constraintLayout)
}
}
@@ -97,7 +102,7 @@ object KeyguardBlueprintViewBinder {
clone(constraintLayout)
blueprint.applyConstraints(this)
}
- logAlphaVisibilityScaleOfAppliedConstraintSet(cs, clockViewModel)
+ logger.logConstraintSet(cs, clockViewModel)
cs.applyTo(constraintLayout)
}
}
@@ -106,35 +111,33 @@ object KeyguardBlueprintViewBinder {
}
}
- private fun logAlphaVisibilityScaleOfAppliedConstraintSet(
- cs: ConstraintSet,
- viewModel: KeyguardClockViewModel,
- ) {
+ private fun Logger.logConstraintSet(cs: ConstraintSet, viewModel: KeyguardClockViewModel) {
val currentClock = viewModel.currentClock.value
- if (!DEBUG || currentClock == null) return
- val smallClockViewId = customR.id.lockscreen_clock_view
- val largeClockViewId = currentClock.largeClock.layout.views[0].id
- val smartspaceDateId = sharedR.id.date_smartspace_view
- Log.i(
- TAG,
- "applyCsToSmallClock: vis=${cs.getVisibility(smallClockViewId)} " +
- "alpha=${cs.getConstraint(smallClockViewId).propertySet.alpha} " +
- "scale=${cs.getConstraint(smallClockViewId).transform.scaleX} ",
- )
- Log.i(
- TAG,
- "applyCsToLargeClock: vis=${cs.getVisibility(largeClockViewId)} " +
- "alpha=${cs.getConstraint(largeClockViewId).propertySet.alpha} " +
- "scale=${cs.getConstraint(largeClockViewId).transform.scaleX} " +
- "pivotX=${cs.getConstraint(largeClockViewId).transform.transformPivotX} ",
- )
- Log.i(
- TAG,
- "applyCsToSmartspaceDate: vis=${cs.getVisibility(smartspaceDateId)} " +
- "alpha=${cs.getConstraint(smartspaceDateId).propertySet.alpha}",
- )
+ if (currentClock == null) return
+
+ this.i({ "applyCsToSmallClock: vis=${getVisText(int1)}; alpha=$str1; scale=$str2" }) {
+ val smallClockViewId = customR.id.lockscreen_clock_view
+ int1 = cs.getVisibility(smallClockViewId)
+ str1 = "${cs.getConstraint(smallClockViewId).propertySet.alpha}"
+ str2 = "${cs.getConstraint(smallClockViewId).transform.scaleX}"
+ }
+
+ this.i({
+ "applyCsToLargeClock: vis=${getVisText(int1)}; alpha=$str1; scale=$str2; pivotX=$str3"
+ }) {
+ val largeClockViewId = currentClock.largeClock.layout.views[0].id
+ int1 = cs.getVisibility(largeClockViewId)
+ str1 = "${cs.getConstraint(largeClockViewId).propertySet.alpha}"
+ str2 = "${cs.getConstraint(largeClockViewId).transform.scaleX}"
+ str3 = "${cs.getConstraint(largeClockViewId).transform.transformPivotX}"
+ }
+
+ this.i({ "applyCsToSmartspaceDate: vis=${getVisText(int1)}; alpha=$str1" }) {
+ val smartspaceDateId = sharedR.id.date_smartspace_view
+ int1 = cs.getVisibility(smartspaceDateId)
+ str1 = "${cs.getConstraint(smartspaceDateId).propertySet.alpha}"
+ }
}
- private const val TAG = "KeyguardBlueprintViewBinder"
- private const val DEBUG = false
+ private val TAG = "KeyguardBlueprintViewBinder"
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt
index d8bd4452f2a6..2f92374a18b5 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt
@@ -22,7 +22,6 @@ import android.annotation.DrawableRes
import android.annotation.SuppressLint
import android.graphics.Point
import android.graphics.Rect
-import android.util.Log
import android.view.HapticFeedbackConstants
import android.view.InputDevice
import android.view.MotionEvent
@@ -65,6 +64,9 @@ import com.android.systemui.keyguard.ui.viewmodel.OccludingAppDeviceEntryMessage
import com.android.systemui.keyguard.ui.viewmodel.TransitionData
import com.android.systemui.keyguard.ui.viewmodel.ViewStateAccessor
import com.android.systemui.lifecycle.repeatWhenAttached
+import com.android.systemui.log.LogBuffer
+import com.android.systemui.log.core.Logger
+import com.android.systemui.log.dagger.KeyguardBlueprintLog
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.SceneContainerFlag
@@ -117,6 +119,7 @@ object KeyguardRootViewBinder {
statusBarKeyguardViewManager: StatusBarKeyguardViewManager?,
mainImmediateDispatcher: CoroutineDispatcher,
msdlPlayer: MSDLPlayer?,
+ @KeyguardBlueprintLog blueprintLog: LogBuffer,
): DisposableHandle {
val disposables = DisposableHandles()
val childViews = mutableMapOf<Int, View>()
@@ -406,6 +409,7 @@ object KeyguardRootViewBinder {
clockViewModel,
childViews,
burnInParams,
+ Logger(blueprintLog, TAG),
)
)
@@ -463,6 +467,7 @@ object KeyguardRootViewBinder {
private val clockViewModel: KeyguardClockViewModel,
private val childViews: Map<Int, View>,
private val burnInParams: MutableStateFlow<BurnInParameters>,
+ private val logger: Logger,
) : OnLayoutChangeListener {
var prevTransition: TransitionData? = null
@@ -483,7 +488,7 @@ object KeyguardRootViewBinder {
val transition = blueprintViewModel.currentTransition.value
val shouldAnimate = transition != null && transition.config.type.animateNotifChanges
if (prevTransition == transition && shouldAnimate) {
- if (DEBUG) Log.w(TAG, "Skipping; layout during transition")
+ logger.w("Skipping; layout during transition")
return
}
@@ -573,5 +578,4 @@ object KeyguardRootViewBinder {
private const val ID = "occluding_app_device_entry_unlock_msg"
private const val AOD_ICONS_APPEAR_DURATION: Long = 200
private const val TAG = "KeyguardRootViewBinder"
- private const val DEBUG = false
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/transitions/IntraBlueprintTransition.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/transitions/IntraBlueprintTransition.kt
index 9a55f7bab33b..0fb1af3e232d 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/transitions/IntraBlueprintTransition.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/transitions/IntraBlueprintTransition.kt
@@ -22,11 +22,13 @@ import com.android.systemui.keyguard.ui.view.layout.sections.transitions.ClockSi
import com.android.systemui.keyguard.ui.view.layout.sections.transitions.DefaultClockSteppingTransition
import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardSmartspaceViewModel
+import com.android.systemui.log.LogBuffer
class IntraBlueprintTransition(
config: IntraBlueprintTransition.Config,
clockViewModel: KeyguardClockViewModel,
smartspaceViewModel: KeyguardSmartspaceViewModel,
+ logBuffer: LogBuffer,
) : TransitionSet() {
enum class Type(val priority: Int, val animateNotifChanges: Boolean) {
@@ -63,7 +65,7 @@ class IntraBlueprintTransition(
addTransition(
clockViewModel.currentClock.value?.let { DefaultClockSteppingTransition(it) }
)
- else -> addTransition(ClockSizeTransition(config, clockViewModel))
+ else -> addTransition(ClockSizeTransition(config, clockViewModel, logBuffer))
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt
index e8fce9ca4aa8..8d651bfa58b0 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt
@@ -21,7 +21,6 @@ import android.content.Context
import android.graphics.Point
import android.graphics.Rect
import android.util.DisplayMetrics
-import android.util.Log
import android.view.WindowManager
import androidx.annotation.VisibleForTesting
import androidx.constraintlayout.widget.ConstraintLayout
@@ -39,6 +38,8 @@ import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryForegroundViewModel
import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryIconViewModel
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LongPressHandlingViewLogger
+import com.android.systemui.log.core.Logger
+import com.android.systemui.log.dagger.KeyguardBlueprintLog
import com.android.systemui.log.dagger.LongPressTouchLog
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.res.R
@@ -68,7 +69,9 @@ constructor(
private val falsingManager: Lazy<FalsingManager>,
private val vibratorHelper: Lazy<VibratorHelper>,
@LongPressTouchLog private val logBuffer: LogBuffer,
+ @KeyguardBlueprintLog blueprintLogBuffer: LogBuffer,
) : KeyguardSection() {
+ private val blueprintLogger = Logger(blueprintLogBuffer, TAG)
private val deviceEntryIconViewId = R.id.device_entry_icon_view
private var disposableHandle: DisposableHandle? = null
@@ -101,11 +104,8 @@ constructor(
}
override fun applyConstraints(constraintSet: ConstraintSet) {
- Log.d(
- "DefaultDeviceEntrySection",
- "isUdfpsSupported=${deviceEntryIconViewModel.get().isUdfpsSupported.value}",
- )
val isUdfpsSupported = deviceEntryIconViewModel.get().isUdfpsSupported.value
+ blueprintLogger.d({ "isUdfpsSupported=$bool1" }) { bool1 = isUdfpsSupported }
val scaleFactor: Float = authController.scaleFactor
val mBottomPaddingPx =
@@ -126,12 +126,13 @@ constructor(
if (isUdfpsSupported) {
deviceEntryIconViewModel.get().udfpsLocation.value?.let { udfpsLocation ->
- Log.d(
- "DeviceEntrySection",
- "udfpsLocation=$udfpsLocation, " +
- "scaledLocation=(${udfpsLocation.centerX},${udfpsLocation.centerY}), " +
- "unusedAuthController=${authController.udfpsLocation}",
- )
+ blueprintLogger.d({
+ "udfpsLocation=$str1, scaledLocation=$str2, unusedAuthController=$str3"
+ }) {
+ str1 = "$udfpsLocation"
+ str2 = "(${udfpsLocation.centerX}, ${udfpsLocation.centerY})"
+ str3 = "${authController.udfpsLocation}"
+ }
centerIcon(
Point(udfpsLocation.centerX.toInt(), udfpsLocation.centerY.toInt()),
udfpsLocation.radius,
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/transitions/ClockSizeTransition.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/transitions/ClockSizeTransition.kt
index 29bda7623675..fdd9355805b5 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/transitions/ClockSizeTransition.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/transitions/ClockSizeTransition.kt
@@ -24,7 +24,6 @@ import android.transition.Transition
import android.transition.TransitionListenerAdapter
import android.transition.TransitionSet
import android.transition.TransitionValues
-import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.view.ViewTreeObserver.OnPreDrawListener
@@ -35,6 +34,9 @@ import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.Intra
import com.android.systemui.keyguard.ui.view.layout.sections.transitions.ClockSizeTransition.SmartspaceMoveTransition.Companion.STATUS_AREA_MOVE_DOWN_MILLIS
import com.android.systemui.keyguard.ui.view.layout.sections.transitions.ClockSizeTransition.SmartspaceMoveTransition.Companion.STATUS_AREA_MOVE_UP_MILLIS
import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel
+import com.android.systemui.log.LogBuffer
+import com.android.systemui.log.core.Logger
+import com.android.systemui.plugins.clocks.ClockLogger.Companion.getVisText
import com.android.systemui.res.R
import com.android.systemui.shared.R as sharedR
import com.google.android.material.math.MathUtils
@@ -48,19 +50,21 @@ internal fun View.setRect(rect: Rect) =
class ClockSizeTransition(
config: IntraBlueprintTransition.Config,
clockViewModel: KeyguardClockViewModel,
+ logBuffer: LogBuffer,
) : TransitionSet() {
+
init {
ordering = ORDERING_TOGETHER
if (config.type != Type.SmartspaceVisibility) {
- addTransition(ClockFaceOutTransition(config, clockViewModel))
- addTransition(ClockFaceInTransition(config, clockViewModel))
+ addTransition(ClockFaceOutTransition(config, clockViewModel, logBuffer))
+ addTransition(ClockFaceInTransition(config, clockViewModel, logBuffer))
}
- addTransition(SmartspaceMoveTransition(config, clockViewModel))
+ addTransition(SmartspaceMoveTransition(config, clockViewModel, logBuffer))
}
- abstract class VisibilityBoundsTransition() : Transition() {
+ abstract class VisibilityBoundsTransition(logBuffer: LogBuffer) : Transition() {
+ protected val logger = Logger(logBuffer, this::class.simpleName!!)
abstract val captureSmartspace: Boolean
- protected val TAG = this::class.simpleName!!
override fun captureEndValues(transition: TransitionValues) = captureValues(transition)
@@ -80,7 +84,9 @@ class ClockSizeTransition(
parent.findViewById<View>(sharedR.id.bc_smartspace_view)
?: parent.findViewById<View>(R.id.keyguard_slice_view)
if (targetSSView == null) {
- Log.e(TAG, "Failed to find smartspace equivalent target under $parent")
+ logger.e({ "Failed to find smartspace equivalent target under $str1" }) {
+ str1 = "$parent"
+ }
return
}
transition.values[SMARTSPACE_BOUNDS] = targetSSView.getRect()
@@ -143,10 +149,10 @@ class ClockSizeTransition(
endValues: TransitionValues?,
): Animator? {
if (startValues == null || endValues == null) {
- Log.w(
- TAG,
- "Couldn't create animator: startValues=$startValues; endValues=$endValues",
- )
+ logger.w({ "Couldn't create animator: startValues=$str1; endValues=$str2" }) {
+ str1 = "$startValues"
+ str2 = "$endValues"
+ }
return null
}
@@ -156,15 +162,18 @@ class ClockSizeTransition(
mutateTargets(from, to)
if (from.isVisible == to.isVisible && from.bounds.equals(to.bounds)) {
- if (DEBUG) {
- Log.w(
- TAG,
- "Skipping no-op transition: ${to.view}; " +
- "vis: ${from.visibility} -> ${to.visibility}; " +
- "alpha: ${from.alpha} -> ${to.alpha}; " +
- "bounds: ${from.bounds} -> ${to.bounds}; ",
- )
+ logger.w({
+ "Skipping no-op transition: $str1; " +
+ "vis: ${getVisText(int1)} -> ${getVisText(int2)}; " +
+ "alpha: $str2; bounds: $str3; "
+ }) {
+ str1 = "${to.view}"
+ int1 = from.visibility
+ int2 = to.visibility
+ str2 = "${from.alpha} -> ${to.alpha}"
+ str3 = "${from.bounds} -> ${to.bounds}"
}
+
return null
}
@@ -179,15 +188,27 @@ class ClockSizeTransition(
lerp(from.bounds.bottom, to.bounds.bottom, fract),
)
- fun assignAnimValues(src: String, fract: Float, vis: Int? = null) {
+ fun assignAnimValues(
+ src: String,
+ fract: Float,
+ vis: Int? = null,
+ log: Boolean = false,
+ ) {
mutateTargets(from, to)
val bounds = computeBounds(fract)
val alpha = MathUtils.lerp(from.alpha, to.alpha, fract)
- if (DEBUG) {
- Log.i(
- TAG,
- "$src: ${to.view}; fract=$fract; alpha=$alpha; vis=$vis; bounds=$bounds;",
- )
+ if (log) {
+ logger.i({
+ "$str1: $str2; fract=$int1%; alpha=$double1; " +
+ "vis=${getVisText(int2)}; bounds=$str3;"
+ }) {
+ str1 = src
+ str2 = "${to.view}"
+ int1 = (fract * 100).toInt()
+ double1 = alpha.toDouble()
+ int2 = vis ?: View.VISIBLE
+ str3 = "$bounds"
+ }
}
to.view.setVisibility(vis ?: View.VISIBLE)
@@ -195,14 +216,15 @@ class ClockSizeTransition(
to.view.setRect(bounds)
}
- if (DEBUG) {
- Log.i(
- TAG,
- "transitioning: ${to.view}; " +
- "vis: ${from.visibility} -> ${to.visibility}; " +
- "alpha: ${from.alpha} -> ${to.alpha}; " +
- "bounds: ${from.bounds} -> ${to.bounds}; ",
- )
+ logger.i({
+ "transitioning: $str1; vis: ${getVisText(int1)} -> ${getVisText(int2)}; " +
+ "alpha: $str2; bounds: $str3;"
+ }) {
+ str1 = "${to.view}"
+ int1 = from.visibility
+ int2 = to.visibility
+ str2 = "${from.alpha} -> ${to.alpha}"
+ str3 = "${from.bounds} -> ${to.bounds}"
}
return ValueAnimator.ofFloat(0f, 1f).also { anim ->
@@ -210,7 +232,7 @@ class ClockSizeTransition(
// predraw listener. This is suboptimal but prevents issues with layout passes
// overwriting the animation for individual frames.
val predrawCallback = OnPreDrawListener {
- assignAnimValues("predraw", anim.animatedFraction)
+ assignAnimValues("predraw", anim.animatedFraction, log = false)
return@OnPreDrawListener true
}
@@ -229,17 +251,17 @@ class ClockSizeTransition(
val listener =
object : AnimatorListenerAdapter() {
override fun onAnimationStart(anim: Animator) {
- assignAnimValues("start", 0f, from.visibility)
+ assignAnimValues("start", 0f, from.visibility, log = true)
}
override fun onAnimationEnd(anim: Animator) {
- assignAnimValues("end", 1f, to.visibility)
+ assignAnimValues("end", 1f, to.visibility, log = true)
if (sendToBack) to.view.translationZ = 0f
}
}
anim.addListener(listener)
- assignAnimValues("init", 0f, from.visibility)
+ assignAnimValues("init", 0f, from.visibility, log = true)
}
}
@@ -256,7 +278,8 @@ class ClockSizeTransition(
abstract class ClockFaceTransition(
config: IntraBlueprintTransition.Config,
val viewModel: KeyguardClockViewModel,
- ) : VisibilityBoundsTransition() {
+ logBuffer: LogBuffer,
+ ) : VisibilityBoundsTransition(logBuffer) {
protected abstract val isLargeClock: Boolean
protected abstract val smallClockMoveScale: Float
override val captureSmartspace
@@ -265,15 +288,17 @@ class ClockSizeTransition(
protected fun addTargets() {
if (isLargeClock) {
viewModel.currentClock.value?.let {
- if (DEBUG) Log.i(TAG, "Adding large clock views: ${it.largeClock.layout.views}")
+ logger.i({ "Adding large clock views: $str1" }) {
+ str1 = "${it.largeClock.layout.views}"
+ }
it.largeClock.layout.views.forEach { addTarget(it) }
}
?: run {
- Log.e(TAG, "No large clock set, falling back")
+ logger.e("No large clock set, falling back")
addTarget(customR.id.lockscreen_clock_view_large)
}
} else {
- if (DEBUG) Log.i(TAG, "Adding small clock")
+ logger.i("Adding small clock")
addTarget(customR.id.lockscreen_clock_view)
}
}
@@ -294,7 +319,7 @@ class ClockSizeTransition(
from.bounds.top = to.bounds.top - ssTranslation
from.bounds.bottom = to.bounds.bottom - ssTranslation
} else {
- Log.e(TAG, "initTargets: smallClock received no smartspace bounds")
+ logger.e("initTargets: smallClock received no smartspace bounds")
}
}
}
@@ -302,7 +327,8 @@ class ClockSizeTransition(
class ClockFaceInTransition(
config: IntraBlueprintTransition.Config,
viewModel: KeyguardClockViewModel,
- ) : ClockFaceTransition(config, viewModel) {
+ logBuffer: LogBuffer,
+ ) : ClockFaceTransition(config, viewModel, logBuffer) {
override val isLargeClock = viewModel.isLargeClockVisible.value
override val smallClockMoveScale = CLOCK_IN_MILLIS / STATUS_AREA_MOVE_DOWN_MILLIS.toFloat()
@@ -323,7 +349,8 @@ class ClockSizeTransition(
class ClockFaceOutTransition(
config: IntraBlueprintTransition.Config,
viewModel: KeyguardClockViewModel,
- ) : ClockFaceTransition(config, viewModel) {
+ logBuffer: LogBuffer,
+ ) : ClockFaceTransition(config, viewModel, logBuffer) {
override val isLargeClock = !viewModel.isLargeClockVisible.value
override val smallClockMoveScale = CLOCK_OUT_MILLIS / STATUS_AREA_MOVE_UP_MILLIS.toFloat()
@@ -342,7 +369,8 @@ class ClockSizeTransition(
class SmartspaceMoveTransition(
val config: IntraBlueprintTransition.Config,
val viewModel: KeyguardClockViewModel,
- ) : VisibilityBoundsTransition() {
+ logBuffer: LogBuffer,
+ ) : VisibilityBoundsTransition(logBuffer) {
private val isLargeClock = viewModel.isLargeClockVisible.value
override val captureSmartspace = false
@@ -361,7 +389,7 @@ class ClockSizeTransition(
override fun initTargets(from: Target, to: Target) {
// If view is changing visibility, hold it in place
if (from.isVisible == to.isVisible) return
- if (DEBUG) Log.i(TAG, "Holding position of ${to.view.id}")
+ logger.i({ "Holding position of $int1" }) { int1 = to.view.id }
if (from.isVisible) {
to.bounds.set(from.bounds)
@@ -383,8 +411,4 @@ class ClockSizeTransition(
const val STATUS_AREA_MOVE_DOWN_MILLIS = 467L
}
}
-
- companion object {
- val DEBUG = false
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModel.kt
index 1289036c7ae0..d7be356f99e3 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModel.kt
@@ -20,7 +20,6 @@ package com.android.systemui.keyguard.ui.viewmodel
import android.os.Handler
import android.transition.Transition
import android.transition.TransitionManager
-import android.util.Log
import androidx.constraintlayout.widget.ConstraintLayout
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.domain.interactor.KeyguardBlueprintInteractor
@@ -29,6 +28,9 @@ import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition
import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition.Config
import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition.Type
+import com.android.systemui.log.LogBuffer
+import com.android.systemui.log.core.Logger
+import com.android.systemui.log.dagger.KeyguardBlueprintLog
import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
@@ -41,7 +43,9 @@ constructor(
@Main private val handler: Handler,
private val keyguardBlueprintInteractor: KeyguardBlueprintInteractor,
private val keyguardTransitionInteractor: KeyguardTransitionInteractor,
+ @KeyguardBlueprintLog private val blueprintLog: LogBuffer,
) {
+ private val logger = Logger(blueprintLog, "KeyguardBlueprintViewModel")
val blueprint = keyguardBlueprintInteractor.blueprint
val blueprintId = keyguardBlueprintInteractor.blueprintId
val refreshTransition = keyguardBlueprintInteractor.refreshTransition
@@ -53,27 +57,27 @@ constructor(
private val transitionListener =
object : Transition.TransitionListener {
override fun onTransitionCancel(transition: Transition) {
- if (DEBUG) Log.w(TAG, "onTransitionCancel: ${transition::class.simpleName}")
+ logger.w({ "onTransitionCancel: $str1" }) { str1 = transition::class.simpleName }
updateTransitions(null) { remove(transition) }
}
override fun onTransitionEnd(transition: Transition) {
- if (DEBUG) Log.i(TAG, "onTransitionEnd: ${transition::class.simpleName}")
+ logger.i({ "onTransitionEnd: $str1" }) { str1 = transition::class.simpleName }
updateTransitions(null) { remove(transition) }
}
override fun onTransitionPause(transition: Transition) {
- if (DEBUG) Log.i(TAG, "onTransitionPause: ${transition::class.simpleName}")
+ logger.i({ "onTransitionPause: $str1" }) { str1 = transition::class.simpleName }
updateTransitions(null) { remove(transition) }
}
override fun onTransitionResume(transition: Transition) {
- if (DEBUG) Log.i(TAG, "onTransitionResume: ${transition::class.simpleName}")
+ logger.i({ "onTransitionResume: $str1" }) { str1 = transition::class.simpleName }
updateTransitions(null) { add(transition) }
}
override fun onTransitionStart(transition: Transition) {
- if (DEBUG) Log.i(TAG, "onTransitionStart: ${transition::class.simpleName}")
+ logger.i({ "onTransitionStart: $str1" }) { str1 = transition::class.simpleName }
updateTransitions(null) { add(transition) }
}
}
@@ -104,7 +108,7 @@ constructor(
runTransition(
constraintLayout,
- IntraBlueprintTransition(newConfig, clockViewModel, smartspaceViewModel),
+ IntraBlueprintTransition(newConfig, clockViewModel, smartspaceViewModel, blueprintLog),
config,
apply,
)
@@ -118,12 +122,10 @@ constructor(
) {
val currentPriority = currentTransition.value?.let { it.config.type.priority } ?: -1
if (config.checkPriority && config.type.priority < currentPriority) {
- if (DEBUG) {
- Log.w(
- TAG,
- "runTransition: skipping ${transition::class.simpleName}: " +
- "currentPriority=$currentPriority; config=$config",
- )
+ logger.w({ "runTransition: skipping $str1: currentPriority=$int1; config=$str2" }) {
+ str1 = transition::class.simpleName
+ int1 = currentPriority
+ str2 = "$config"
}
apply()
return
@@ -137,12 +139,10 @@ constructor(
config
}
- if (DEBUG) {
- Log.i(
- TAG,
- "runTransition: running ${transition::class.simpleName}: " +
- "currentPriority=$currentPriority; config=$newConfig",
- )
+ logger.i({ "runTransition: running $str1: currentPriority=$int1; config=$str2" }) {
+ str1 = transition::class.simpleName
+ int1 = currentPriority
+ str2 = "$newConfig"
}
// beginDelayedTransition makes a copy, so we temporarially add the uncopied transition to
@@ -162,9 +162,4 @@ constructor(
handler.post { updateTransitions(null) { remove(transition) } }
}
}
-
- companion object {
- private const val TAG = "KeyguardBlueprintViewModel"
- private const val DEBUG = false
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/log/dagger/KeyguardClockLog.kt b/packages/SystemUI/src/com/android/systemui/log/dagger/KeyguardClockLog.kt
index 8732ef576335..50979682f553 100644
--- a/packages/SystemUI/src/com/android/systemui/log/dagger/KeyguardClockLog.kt
+++ b/packages/SystemUI/src/com/android/systemui/log/dagger/KeyguardClockLog.kt
@@ -24,6 +24,12 @@ import javax.inject.Qualifier
@Retention(AnnotationRetention.RUNTIME)
annotation class KeyguardClockLog
+/** A [com.android.systemui.log.LogBuffer] for keyguard blueprint logs. */
+@Qualifier
+@MustBeDocumented
+@Retention(AnnotationRetention.RUNTIME)
+annotation class KeyguardBlueprintLog
+
/** A [com.android.systemui.log.LogBuffer] for small keyguard clock logs. */
@Qualifier
@MustBeDocumented
diff --git a/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java b/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java
index 8097d9585fb5..faa6c52162ce 100644
--- a/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java
+++ b/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java
@@ -321,6 +321,16 @@ public class LogModule {
}
/**
+ * Provides a {@link LogBuffer} for keyguard blueprint logs.
+ */
+ @Provides
+ @SysUISingleton
+ @KeyguardBlueprintLog
+ public static LogBuffer provideKeyguardBlueprintLog(LogBufferFactory factory) {
+ return factory.create("KeyguardBlueprintLog", 100);
+ }
+
+ /**
* Provides a {@link LogBuffer} for general keyguard clock logs.
*/
@Provides
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt
index 222a7fe05778..418972055324 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt
@@ -81,6 +81,7 @@ class DefaultDeviceEntrySectionTest : SysuiTestCase() {
{ falsingManager },
{ mock(VibratorHelper::class.java) },
logcatLogBuffer(),
+ logcatLogBuffer("blueprints"),
)
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextViewTest.kt
index b3a5872a7dec..57c28580c063 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextViewTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/view/SimpleDigitalClockTextViewTest.kt
@@ -19,11 +19,11 @@ import android.graphics.Typeface
import android.testing.AndroidTestingRunner
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
+import com.android.systemui.plugins.clocks.ClockLogger
import com.android.systemui.plugins.clocks.ClockMessageBuffers
import com.android.systemui.plugins.clocks.ClockSettings
import com.android.systemui.shared.clocks.ClockContext
import com.android.systemui.shared.clocks.FontTextStyle
-import com.android.systemui.shared.clocks.LogUtil
import com.android.systemui.shared.clocks.TypefaceCache
import com.android.systemui.shared.clocks.view.SimpleDigitalClockTextView
import org.junit.Assert.assertEquals
@@ -34,7 +34,7 @@ import org.junit.runner.RunWith
@SmallTest
@RunWith(AndroidTestingRunner::class)
class SimpleDigitalClockTextViewTest : SysuiTestCase() {
- private val messageBuffer = LogUtil.DEBUG_MESSAGE_BUFFER
+ private val messageBuffer = ClockLogger.DEBUG_MESSAGE_BUFFER
private lateinit var underTest: SimpleDigitalClockTextView
private val defaultLargeClockTextSize = 500F
private val smallerTextSize = 300F
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepositoryKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepositoryKosmos.kt
index a91ed0f4b904..ef9bd8282090 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepositoryKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/KeyguardBlueprintRepositoryKosmos.kt
@@ -29,6 +29,7 @@ import com.android.systemui.keyguard.ui.viewmodel.keyguardClockViewModel
import com.android.systemui.keyguard.ui.viewmodel.keyguardRootViewModel
import com.android.systemui.keyguard.ui.viewmodel.keyguardSmartspaceViewModel
import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.log.logcatLogBuffer
import com.android.systemui.shade.LargeScreenHeaderHelper
import java.util.Optional
import org.mockito.Mockito.spy
@@ -99,6 +100,7 @@ val Kosmos.keyguardBlueprintRepository by
blueprints = setOf(defaultKeyguardBlueprint, splitShadeBlueprint),
handler = fakeExecutorHandler,
assert = mock(),
+ log = logcatLogBuffer("blueprints"),
)
)
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModelKosmos.kt
index ab7ccb3bc029..b33d70298388 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModelKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBlueprintViewModelKosmos.kt
@@ -20,6 +20,7 @@ import android.os.fakeExecutorHandler
import com.android.systemui.keyguard.domain.interactor.keyguardBlueprintInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor
import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.log.logcatLogBuffer
val Kosmos.keyguardBlueprintViewModel by
Kosmos.Fixture {
@@ -27,5 +28,6 @@ val Kosmos.keyguardBlueprintViewModel by
fakeExecutorHandler,
keyguardBlueprintInteractor,
keyguardTransitionInteractor,
+ blueprintLog = logcatLogBuffer("blueprints"),
)
}