[sb] run formatter on system event animation files
These will be modified in the next CLs to create a system event
animation state repository
Test: EXEMPT formatting
Flag: EXEMPT formatting
Bug: 364360986
Change-Id: I71b95ff43df245f42cb04810bb6841be399daa1e
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationScheduler.kt b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationScheduler.kt
index ef90890..c6f3d7d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationScheduler.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationScheduler.kt
@@ -24,7 +24,7 @@
import com.android.systemui.statusbar.policy.CallbackController
interface SystemStatusAnimationScheduler :
- CallbackController<SystemStatusAnimationCallback>, Dumpable {
+ CallbackController<SystemStatusAnimationCallback>, Dumpable {
@SystemAnimationState fun getAnimationState(): Int
@@ -44,30 +44,36 @@
*/
interface SystemStatusAnimationCallback {
/** Implement this method to return an [Animator] or [AnimatorSet] that presents the chip */
- fun onSystemEventAnimationBegin(): Animator? { return null }
+ fun onSystemEventAnimationBegin(): Animator? {
+ return null
+ }
+
/** Implement this method to return an [Animator] or [AnimatorSet] that hides the chip */
- fun onSystemEventAnimationFinish(hasPersistentDot: Boolean): Animator? { return null }
+ fun onSystemEventAnimationFinish(hasPersistentDot: Boolean): Animator? {
+ return null
+ }
// Best method name, change my mind
fun onSystemStatusAnimationTransitionToPersistentDot(contentDescription: String?): Animator? {
return null
}
- fun onHidePersistentDot(): Animator? { return null }
+
+ fun onHidePersistentDot(): Animator? {
+ return null
+ }
}
-
-/**
- * Animation state IntDef
- */
+/** Animation state IntDef */
@Retention(AnnotationRetention.SOURCE)
@IntDef(
- value = [
+ value =
+ [
IDLE,
ANIMATION_QUEUED,
ANIMATING_IN,
RUNNING_CHIP_ANIM,
ANIMATING_OUT,
- SHOWING_PERSISTENT_DOT
+ SHOWING_PERSISTENT_DOT,
]
)
annotation class SystemAnimationState
@@ -110,4 +116,4 @@
internal const val DISPLAY_LENGTH = 3000L
internal const val DISAPPEAR_ANIMATION_DURATION = 500L
-internal const val MIN_UPTIME: Long = 5 * 1000
\ No newline at end of file
+internal const val MIN_UPTIME: Long = 5 * 1000
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImpl.kt
index e34f61d..5f9e426 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImpl.kt
@@ -69,7 +69,7 @@
dumpManager: DumpManager,
private val systemClock: SystemClock,
@Application private val coroutineScope: CoroutineScope,
- private val logger: SystemStatusAnimationSchedulerLogger?
+ private val logger: SystemStatusAnimationSchedulerLogger?,
) : SystemStatusAnimationScheduler {
companion object {
@@ -122,9 +122,7 @@
}
}
- coroutineScope.launch {
- animationState.collect { logger?.logAnimationStateUpdate(it) }
- }
+ coroutineScope.launch { animationState.collect { logger?.logAnimationStateUpdate(it) } }
}
@SystemAnimationState override fun getAnimationState(): Int = animationState.value
@@ -195,7 +193,7 @@
return DeviceConfig.getBoolean(
DeviceConfig.NAMESPACE_PRIVACY,
PROPERTY_ENABLE_IMMERSIVE_INDICATOR,
- true
+ true,
)
}
@@ -262,7 +260,7 @@
private fun announceForAccessibilityIfNeeded(event: StatusEvent) {
val description = event.contentDescription ?: return
- if (!event.shouldAnnounceAccessibilityEvent) return
+ if (!event.shouldAnnounceAccessibilityEvent) return
chipAnimationController.announceForAccessibility(description)
}
@@ -356,9 +354,7 @@
logger?.logTransitionToPersistentDotCallbackInvoked()
val anims: List<Animator> =
listeners.mapNotNull {
- it.onSystemStatusAnimationTransitionToPersistentDot(
- event?.contentDescription
- )
+ it.onSystemStatusAnimationTransitionToPersistentDot(event?.contentDescription)
}
if (anims.isNotEmpty()) {
val aSet = AnimatorSet()
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarSystemEventAnimator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarSystemEventAnimator.kt
index e73063b..1f9ea08 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarSystemEventAnimator.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarSystemEventAnimator.kt
@@ -16,11 +16,11 @@
package com.android.systemui.statusbar.phone.fragment
+import android.content.res.Resources
+import android.view.View
import androidx.core.animation.Animator
import androidx.core.animation.AnimatorSet
import androidx.core.animation.ValueAnimator
-import android.content.res.Resources
-import android.view.View
import com.android.systemui.res.R
import com.android.systemui.statusbar.events.STATUS_BAR_X_MOVE_IN
import com.android.systemui.statusbar.events.STATUS_BAR_X_MOVE_OUT
@@ -33,16 +33,15 @@
* An implementation of [StatusBarSystemEventDefaultAnimator], applying the onAlphaChanged and
* onTranslationXChanged callbacks directly to the provided animatedView.
*/
-class StatusBarSystemEventAnimator @JvmOverloads constructor(
- val animatedView: View,
- resources: Resources,
- isAnimationRunning: Boolean = false
-) : StatusBarSystemEventDefaultAnimator(
+class StatusBarSystemEventAnimator
+@JvmOverloads
+constructor(val animatedView: View, resources: Resources, isAnimationRunning: Boolean = false) :
+ StatusBarSystemEventDefaultAnimator(
resources = resources,
onAlphaChanged = animatedView::setAlpha,
onTranslationXChanged = animatedView::setTranslationX,
- isAnimationRunning = isAnimationRunning
-)
+ isAnimationRunning = isAnimationRunning,
+ )
/**
* Tied directly to [SystemStatusAnimationScheduler]. Any StatusBar-like thing (keyguard, collapsed
@@ -53,34 +52,39 @@
* this class could be used directly as the animation callback, it's probably best to forward calls
* to it so that it can be recreated at any moment without needing to remove/add callback.
*/
-
-open class StatusBarSystemEventDefaultAnimator @JvmOverloads constructor(
- resources: Resources,
- private val onAlphaChanged: (Float) -> Unit,
- private val onTranslationXChanged: (Float) -> Unit,
- var isAnimationRunning: Boolean = false
+open class StatusBarSystemEventDefaultAnimator
+@JvmOverloads
+constructor(
+ resources: Resources,
+ private val onAlphaChanged: (Float) -> Unit,
+ private val onTranslationXChanged: (Float) -> Unit,
+ var isAnimationRunning: Boolean = false,
) : SystemStatusAnimationCallback {
- private val translationXIn: Int = resources.getDimensionPixelSize(
- R.dimen.ongoing_appops_chip_animation_in_status_bar_translation_x)
- private val translationXOut: Int = resources.getDimensionPixelSize(
- R.dimen.ongoing_appops_chip_animation_out_status_bar_translation_x)
+ private val translationXIn: Int =
+ resources.getDimensionPixelSize(
+ R.dimen.ongoing_appops_chip_animation_in_status_bar_translation_x
+ )
+ private val translationXOut: Int =
+ resources.getDimensionPixelSize(
+ R.dimen.ongoing_appops_chip_animation_out_status_bar_translation_x
+ )
override fun onSystemEventAnimationBegin(): Animator {
isAnimationRunning = true
- val moveOut = ValueAnimator.ofFloat(0f, 1f).apply {
- duration = 23.frames
- interpolator = STATUS_BAR_X_MOVE_OUT
- addUpdateListener {
- onTranslationXChanged(-(translationXIn * animatedValue as Float))
+ val moveOut =
+ ValueAnimator.ofFloat(0f, 1f).apply {
+ duration = 23.frames
+ interpolator = STATUS_BAR_X_MOVE_OUT
+ addUpdateListener {
+ onTranslationXChanged(-(translationXIn * animatedValue as Float))
+ }
}
- }
- val alphaOut = ValueAnimator.ofFloat(1f, 0f).apply {
- duration = 8.frames
- interpolator = null
- addUpdateListener {
- onAlphaChanged(animatedValue as Float)
+ val alphaOut =
+ ValueAnimator.ofFloat(1f, 0f).apply {
+ duration = 8.frames
+ interpolator = null
+ addUpdateListener { onAlphaChanged(animatedValue as Float) }
}
- }
val animSet = AnimatorSet()
animSet.playTogether(moveOut, alphaOut)
@@ -89,22 +93,22 @@
override fun onSystemEventAnimationFinish(hasPersistentDot: Boolean): Animator {
onTranslationXChanged(translationXOut.toFloat())
- val moveIn = ValueAnimator.ofFloat(1f, 0f).apply {
- duration = 23.frames
- startDelay = 7.frames
- interpolator = STATUS_BAR_X_MOVE_IN
- addUpdateListener {
- onTranslationXChanged(translationXOut * animatedValue as Float)
+ val moveIn =
+ ValueAnimator.ofFloat(1f, 0f).apply {
+ duration = 23.frames
+ startDelay = 7.frames
+ interpolator = STATUS_BAR_X_MOVE_IN
+ addUpdateListener {
+ onTranslationXChanged(translationXOut * animatedValue as Float)
+ }
}
- }
- val alphaIn = ValueAnimator.ofFloat(0f, 1f).apply {
- duration = 5.frames
- startDelay = 11.frames
- interpolator = null
- addUpdateListener {
- onAlphaChanged(animatedValue as Float)
+ val alphaIn =
+ ValueAnimator.ofFloat(0f, 1f).apply {
+ duration = 5.frames
+ startDelay = 11.frames
+ interpolator = null
+ addUpdateListener { onAlphaChanged(animatedValue as Float) }
}
- }
val animatorSet = AnimatorSet()
animatorSet.playTogether(moveIn, alphaIn)
@@ -112,4 +116,4 @@
animatorSet.doOnCancel { isAnimationRunning = false }
return animatorSet
}
-}
\ No newline at end of file
+}