Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e789dee authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "Add tracing to clock doze animation..." into main

parents 5830d517 f81c71a2
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.keyguard

import android.os.Trace
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
@@ -520,8 +521,12 @@ constructor(
    private fun handleDoze(doze: Float) {
        dozeAmount = doze
        clock?.run {
            Trace.beginSection("$TAG#smallClock.animations.doze")
            smallClock.animations.doze(dozeAmount)
            Trace.endSection()
            Trace.beginSection("$TAG#largeClock.animations.doze")
            largeClock.animations.doze(dozeAmount)
            Trace.endSection()
        }
        smallTimeListener?.update(doze < DOZE_TICKRATE_THRESHOLD)
        largeTimeListener?.update(doze < DOZE_TICKRATE_THRESHOLD)
@@ -536,10 +541,10 @@ constructor(
    internal fun listenForDozeAmountTransition(scope: CoroutineScope): Job {
        return scope.launch {
            merge(
                    keyguardTransitionInteractor.aodToLockscreenTransition.map { step ->
                    keyguardTransitionInteractor.transition(AOD, LOCKSCREEN).map { step ->
                        step.copy(value = 1f - step.value)
                    },
                    keyguardTransitionInteractor.lockscreenToAodTransition,
                    keyguardTransitionInteractor.transition(LOCKSCREEN, AOD),
                ).filter {
                    it.transitionState != TransitionState.FINISHED
                }
@@ -628,7 +633,7 @@ constructor(
    }

    companion object {
        private val TAG = ClockEventController::class.simpleName!!
        private val DOZE_TICKRATE_THRESHOLD = 0.99f
        private const val TAG = "ClockEventController"
        private const val DOZE_TICKRATE_THRESHOLD = 0.99f
    }
}
+12 −2
Original line number Diff line number Diff line
@@ -319,9 +319,19 @@ class ClockEventControllerTest : SysuiTestCase() {
    fun listenForDozeAmountTransition_updatesClockDozeAmount() =
        runBlocking(IMMEDIATE) {
            val transitionStep = MutableStateFlow(TransitionStep())
            whenever(keyguardTransitionInteractor.lockscreenToAodTransition)
            whenever(
                    keyguardTransitionInteractor.transition(
                        KeyguardState.LOCKSCREEN,
                        KeyguardState.AOD
                    )
                )
                .thenReturn(transitionStep)
            whenever(keyguardTransitionInteractor.aodToLockscreenTransition)
            whenever(
                    keyguardTransitionInteractor.transition(
                        KeyguardState.AOD,
                        KeyguardState.LOCKSCREEN
                    )
                )
                .thenReturn(transitionStep)

            val job = underTest.listenForDozeAmountTransition(this)