Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt +16 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ import android.view.WindowManager.fixScale import com.android.internal.jank.InteractionJankMonitor import com.android.internal.jank.InteractionJankMonitor.CUJ_SCREEN_OFF import com.android.internal.jank.InteractionJankMonitor.CUJ_SCREEN_OFF_SHOW_AOD import com.android.systemui.DejankUtils import com.android.systemui.animation.Interpolators import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.KeyguardViewMediator Loading @@ -27,6 +28,7 @@ import com.android.systemui.statusbar.notification.PropertyAnimator import com.android.systemui.statusbar.notification.stack.AnimationProperties import com.android.systemui.statusbar.notification.stack.StackStateAnimator import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.TraceUtils import com.android.systemui.util.settings.GlobalSettings import javax.inject.Inject Loading Loading @@ -116,6 +118,11 @@ class UnlockedScreenOffAnimationController @Inject constructor( }) } // FrameCallback used to delay starting the light reveal animation until the next frame private val startLightRevealCallback = TraceUtils.namedRunnable("startLightReveal") { lightRevealAnimator.start() } val animatorDurationScaleObserver = object : ContentObserver(null) { override fun onChange(selfChange: Boolean) { updateAnimatorDurationScale() Loading Loading @@ -223,6 +230,7 @@ class UnlockedScreenOffAnimationController @Inject constructor( decidedToAnimateGoingToSleep = null shouldAnimateInKeyguard = false DejankUtils.removeCallbacks(startLightRevealCallback) lightRevealAnimator.cancel() handler.removeCallbacksAndMessages(null) } Loading Loading @@ -253,7 +261,14 @@ class UnlockedScreenOffAnimationController @Inject constructor( shouldAnimateInKeyguard = true lightRevealAnimationPlaying = true lightRevealAnimator.start() // Start the animation on the next frame. startAnimation() is called after // PhoneWindowManager makes a binder call to System UI on // IKeyguardService#onStartedGoingToSleep(). By the time we get here, system_server is // already busy making changes to PowerManager and DisplayManager. This increases our // chance of missing the first frame, so to mitigate this we should start the animation // on the next frame. DejankUtils.postAfterTraversal(startLightRevealCallback) handler.postDelayed({ // Only run this callback if the device is sleeping (not interactive). This callback // is removed in onStartedWakingUp, but since that event is asynchronously Loading packages/SystemUI/src/com/android/systemui/util/TraceUtils.kt +12 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.util import android.os.Trace import android.os.TraceNameSupplier /** * Run a block within a [Trace] section. Loading @@ -39,5 +40,16 @@ class TraceUtils { inline fun traceRunnable(tag: String, crossinline block: () -> Unit): Runnable { return Runnable { traceSection(tag) { block() } } } /** * Helper function for creating a Runnable object that implements TraceNameSupplier. * This is useful for posting Runnables to Handlers with meaningful names. */ inline fun namedRunnable(tag: String, crossinline block: () -> Unit): Runnable { return object : Runnable, TraceNameSupplier { override fun getTraceName(): String = tag override fun run() = block() } } } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt +16 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ import android.view.WindowManager.fixScale import com.android.internal.jank.InteractionJankMonitor import com.android.internal.jank.InteractionJankMonitor.CUJ_SCREEN_OFF import com.android.internal.jank.InteractionJankMonitor.CUJ_SCREEN_OFF_SHOW_AOD import com.android.systemui.DejankUtils import com.android.systemui.animation.Interpolators import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.KeyguardViewMediator Loading @@ -27,6 +28,7 @@ import com.android.systemui.statusbar.notification.PropertyAnimator import com.android.systemui.statusbar.notification.stack.AnimationProperties import com.android.systemui.statusbar.notification.stack.StackStateAnimator import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.TraceUtils import com.android.systemui.util.settings.GlobalSettings import javax.inject.Inject Loading Loading @@ -116,6 +118,11 @@ class UnlockedScreenOffAnimationController @Inject constructor( }) } // FrameCallback used to delay starting the light reveal animation until the next frame private val startLightRevealCallback = TraceUtils.namedRunnable("startLightReveal") { lightRevealAnimator.start() } val animatorDurationScaleObserver = object : ContentObserver(null) { override fun onChange(selfChange: Boolean) { updateAnimatorDurationScale() Loading Loading @@ -223,6 +230,7 @@ class UnlockedScreenOffAnimationController @Inject constructor( decidedToAnimateGoingToSleep = null shouldAnimateInKeyguard = false DejankUtils.removeCallbacks(startLightRevealCallback) lightRevealAnimator.cancel() handler.removeCallbacksAndMessages(null) } Loading Loading @@ -253,7 +261,14 @@ class UnlockedScreenOffAnimationController @Inject constructor( shouldAnimateInKeyguard = true lightRevealAnimationPlaying = true lightRevealAnimator.start() // Start the animation on the next frame. startAnimation() is called after // PhoneWindowManager makes a binder call to System UI on // IKeyguardService#onStartedGoingToSleep(). By the time we get here, system_server is // already busy making changes to PowerManager and DisplayManager. This increases our // chance of missing the first frame, so to mitigate this we should start the animation // on the next frame. DejankUtils.postAfterTraversal(startLightRevealCallback) handler.postDelayed({ // Only run this callback if the device is sleeping (not interactive). This callback // is removed in onStartedWakingUp, but since that event is asynchronously Loading
packages/SystemUI/src/com/android/systemui/util/TraceUtils.kt +12 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.util import android.os.Trace import android.os.TraceNameSupplier /** * Run a block within a [Trace] section. Loading @@ -39,5 +40,16 @@ class TraceUtils { inline fun traceRunnable(tag: String, crossinline block: () -> Unit): Runnable { return Runnable { traceSection(tag) { block() } } } /** * Helper function for creating a Runnable object that implements TraceNameSupplier. * This is useful for posting Runnables to Handlers with meaningful names. */ inline fun namedRunnable(tag: String, crossinline block: () -> Unit): Runnable { return object : Runnable, TraceNameSupplier { override fun getTraceName(): String = tag override fun run() = block() } } } }