Loading packages/SystemUI/animation/src/com/android/systemui/animation/TextAnimator.kt +8 −1 Original line number Diff line number Diff line Loading @@ -179,8 +179,15 @@ class TextAnimator( private val fontVariationUtils = FontVariationUtils() fun updateLayout(layout: Layout) { fun updateLayout(layout: Layout, textSize: Float = -1f) { textInterpolator.layout = layout if (textSize >= 0) { textInterpolator.targetPaint.textSize = textSize textInterpolator.basePaint.textSize = textSize textInterpolator.onTargetPaintModified() textInterpolator.onBasePaintModified() } } fun isRunning(): Boolean { Loading packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt +19 −52 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.shared.clocks import android.animation.TimeInterpolator import android.annotation.ColorInt import android.annotation.FloatRange import android.annotation.IntRange import android.annotation.SuppressLint import android.content.Context Loading @@ -27,7 +26,7 @@ import android.text.TextUtils import android.text.format.DateFormat import android.util.AttributeSet import android.util.MathUtils.constrainedMap import android.util.TypedValue import android.util.TypedValue.COMPLEX_UNIT_PX import android.view.View import android.view.View.MeasureSpec.EXACTLY import android.widget.TextView Loading Loading @@ -219,9 +218,7 @@ constructor( override fun setTextSize(type: Int, size: Float) { super.setTextSize(type, size) if (type == TypedValue.COMPLEX_UNIT_PX) { lastUnconstrainedTextSize = size } lastUnconstrainedTextSize = if (type == COMPLEX_UNIT_PX) size else Float.MAX_VALUE } @SuppressLint("DrawAllocation") Loading @@ -234,22 +231,18 @@ constructor( MeasureSpec.getMode(heightMeasureSpec) == EXACTLY ) { // Call straight into TextView.setTextSize to avoid setting lastUnconstrainedTextSize super.setTextSize( TypedValue.COMPLEX_UNIT_PX, min(lastUnconstrainedTextSize, MeasureSpec.getSize(heightMeasureSpec) / 2F) ) val size = min(lastUnconstrainedTextSize, MeasureSpec.getSize(heightMeasureSpec) / 2F) super.setTextSize(COMPLEX_UNIT_PX, size) } super.onMeasure(widthMeasureSpec, heightMeasureSpec) val animator = textAnimator if (animator == null) { textAnimator?.let { animator -> animator.updateLayout(layout, textSize) } ?: run { textAnimator = textAnimatorFactory(layout, ::invalidate)?.also { textAnimatorFactory(layout, ::invalidate).also { onTextAnimatorInitialized?.invoke(it) onTextAnimatorInitialized = null } } else { animator.updateLayout(layout) } if (migratedClocks && hasCustomPositionUpdatedAnimation) { Loading Loading @@ -307,18 +300,18 @@ constructor( logger.d("animateColorChange") setTextStyle( weight = lockScreenWeight, textSize = -1f, color = null, /* using current color */ animate = false, interpolator = null, duration = 0, delay = 0, onAnimationEnd = null ) setTextStyle( weight = lockScreenWeight, textSize = -1f, color = lockScreenColor, animate = true, interpolator = null, duration = COLOR_ANIM_DURATION, delay = 0, onAnimationEnd = null Loading @@ -329,16 +322,15 @@ constructor( logger.d("animateAppearOnLockscreen") setTextStyle( weight = dozingWeight, textSize = -1f, color = lockScreenColor, animate = false, interpolator = null, duration = 0, delay = 0, onAnimationEnd = null ) setTextStyle( weight = lockScreenWeight, textSize = -1f, color = lockScreenColor, animate = true, duration = APPEAR_ANIM_DURATION, Loading @@ -356,16 +348,15 @@ constructor( logger.d("animateFoldAppear") setTextStyle( weight = lockScreenWeightInternal, textSize = -1f, color = lockScreenColor, animate = false, interpolator = null, duration = 0, delay = 0, onAnimationEnd = null ) setTextStyle( weight = dozingWeightInternal, textSize = -1f, color = dozingColor, animate = animate, interpolator = Interpolators.EMPHASIZED_DECELERATE, Loading @@ -385,9 +376,9 @@ constructor( val startAnimPhase2 = Runnable { setTextStyle( weight = if (isDozing()) dozingWeight else lockScreenWeight, textSize = -1f, color = null, animate = true, interpolator = null, duration = CHARGE_ANIM_DURATION_PHASE_1, delay = 0, onAnimationEnd = null Loading @@ -395,9 +386,9 @@ constructor( } setTextStyle( weight = if (isDozing()) lockScreenWeight else dozingWeight, textSize = -1f, color = null, animate = true, interpolator = null, duration = CHARGE_ANIM_DURATION_PHASE_0, delay = chargeAnimationDelay.toLong(), onAnimationEnd = startAnimPhase2 Loading @@ -408,9 +399,9 @@ constructor( logger.d("animateDoze") setTextStyle( weight = if (isDozing) dozingWeight else lockScreenWeight, textSize = -1f, color = if (isDozing) dozingColor else lockScreenColor, animate = animate, interpolator = null, duration = DOZE_ANIM_DURATION, delay = 0, onAnimationEnd = null Loading Loading @@ -448,7 +439,6 @@ constructor( */ private fun setTextStyle( @IntRange(from = 0, to = 1000) weight: Int, @FloatRange(from = 0.0) textSize: Float, color: Int?, animate: Boolean, interpolator: TimeInterpolator?, Loading @@ -459,7 +449,6 @@ constructor( textAnimator?.let { it.setTextStyle( weight = weight, textSize = textSize, color = color, animate = animate && isAnimationEnabled, duration = duration, Loading @@ -474,7 +463,6 @@ constructor( onTextAnimatorInitialized = { textAnimator -> textAnimator.setTextStyle( weight = weight, textSize = textSize, color = color, animate = false, duration = duration, Loading @@ -487,27 +475,6 @@ constructor( } } private fun setTextStyle( @IntRange(from = 0, to = 1000) weight: Int, @FloatRange(from = 0.0) textSize: Float, color: Int?, animate: Boolean, duration: Long, delay: Long, onAnimationEnd: Runnable? ) { setTextStyle( weight = weight, textSize = textSize, color = color, animate = animate, interpolator = null, duration = duration, delay = delay, onAnimationEnd = onAnimationEnd ) } fun refreshFormat() = refreshFormat(DateFormat.is24HourFormat(context)) fun refreshFormat(use24HourFormat: Boolean) { Patterns.update(context) Loading packages/SystemUI/src/com/android/keyguard/ClockEventController.kt +22 −26 Original line number Diff line number Diff line Loading @@ -15,12 +15,12 @@ */ package com.android.keyguard import android.os.Trace import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter import android.content.res.Resources import android.os.Trace import android.text.format.DateFormat import android.util.Log import android.util.TypedValue Loading Loading @@ -466,15 +466,11 @@ constructor( largeRegionSampler?.stopRegionSampler() smallTimeListener?.stop() largeTimeListener?.stop() clock ?.smallClock ?.view ?.removeOnAttachStateChangeListener(smallClockOnAttachStateChangeListener) clock?.apply { smallClock.view.removeOnAttachStateChangeListener(smallClockOnAttachStateChangeListener) largeClock.view.removeOnAttachStateChangeListener(largeClockOnAttachStateChangeListener) } smallClockFrame?.viewTreeObserver?.removeOnGlobalLayoutListener(onGlobalLayoutListener) clock ?.largeClock ?.view ?.removeOnAttachStateChangeListener(largeClockOnAttachStateChangeListener) } /** Loading Loading @@ -505,15 +501,17 @@ constructor( } } private fun updateFontSizes() { fun updateFontSizes() { clock?.run { smallClock.events.onFontSettingChanged( resources.getDimensionPixelSize(R.dimen.small_clock_text_size).toFloat() ) smallClock.events.onFontSettingChanged(getSmallClockSizePx()) largeClock.events.onFontSettingChanged(getLargeClockSizePx()) } } private fun getSmallClockSizePx(): Float { return resources.getDimensionPixelSize(R.dimen.small_clock_text_size).toFloat() } private fun getLargeClockSizePx(): Float { return if (largeClockOnSecondaryDisplay) { resources.getDimensionPixelSize(R.dimen.presentation_clock_text_size).toFloat() Loading Loading @@ -549,9 +547,8 @@ constructor( it.copy(value = 1f - it.value) }, keyguardTransitionInteractor.transition(Edge.create(LOCKSCREEN, AOD)), ).filter { it.transitionState != TransitionState.FINISHED } ) .filter { it.transitionState != TransitionState.FINISHED } .collect { handleDoze(it.value) } } } Loading Loading @@ -582,8 +579,8 @@ constructor( } /** * When keyguard is displayed due to pulsing notifications when AOD is off, * we should make sure clock is in dozing state instead of LS state * When keyguard is displayed due to pulsing notifications when AOD is off, we should make sure * clock is in dozing state instead of LS state */ @VisibleForTesting internal fun listenForAnyStateToDozingTransition(scope: CoroutineScope): Job { Loading @@ -595,7 +592,6 @@ constructor( } } @VisibleForTesting internal fun listenForDozing(scope: CoroutineScope): Job { return scope.launch { Loading packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java +4 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ import com.android.systemui.dock.DockManager; import com.android.systemui.dock.DockManagerImpl; import com.android.systemui.doze.DozeHost; import com.android.systemui.keyguard.ui.composable.blueprint.DefaultBlueprintModule; import com.android.systemui.keyguard.ui.view.layout.blueprints.KeyguardBlueprintModule; import com.android.systemui.keyguard.ui.view.layout.sections.KeyguardSectionsModule; import com.android.systemui.media.dagger.MediaModule; import com.android.systemui.media.muteawait.MediaMuteAwaitConnectionCli; import com.android.systemui.media.nearby.NearbyMediaDevicesManager; Loading Loading @@ -112,6 +114,8 @@ import javax.inject.Named; GestureModule.class, HeadsUpModule.class, KeyboardShortcutsModule.class, KeyguardBlueprintModule.class, KeyguardSectionsModule.class, MediaModule.class, MediaMuteAwaitConnectionCli.StartableModule.class, MultiUserUtilsModule.class, Loading packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +0 −4 Original line number Diff line number Diff line Loading @@ -70,8 +70,6 @@ import com.android.systemui.inputmethod.InputMethodModule; import com.android.systemui.keyboard.KeyboardModule; import com.android.systemui.keyevent.data.repository.KeyEventRepositoryModule; import com.android.systemui.keyguard.ui.composable.LockscreenContent; import com.android.systemui.keyguard.ui.view.layout.blueprints.KeyguardBlueprintModule; import com.android.systemui.keyguard.ui.view.layout.sections.KeyguardSectionsModule; import com.android.systemui.log.dagger.LogModule; import com.android.systemui.log.dagger.MonitorLog; import com.android.systemui.log.table.TableLogBuffer; Loading Loading @@ -222,8 +220,6 @@ import javax.inject.Named; InputMethodModule.class, KeyEventRepositoryModule.class, KeyboardModule.class, KeyguardBlueprintModule.class, KeyguardSectionsModule.class, LetterboxModule.class, LogModule.class, MediaProjectionActivitiesModule.class, Loading Loading
packages/SystemUI/animation/src/com/android/systemui/animation/TextAnimator.kt +8 −1 Original line number Diff line number Diff line Loading @@ -179,8 +179,15 @@ class TextAnimator( private val fontVariationUtils = FontVariationUtils() fun updateLayout(layout: Layout) { fun updateLayout(layout: Layout, textSize: Float = -1f) { textInterpolator.layout = layout if (textSize >= 0) { textInterpolator.targetPaint.textSize = textSize textInterpolator.basePaint.textSize = textSize textInterpolator.onTargetPaintModified() textInterpolator.onBasePaintModified() } } fun isRunning(): Boolean { Loading
packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt +19 −52 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.shared.clocks import android.animation.TimeInterpolator import android.annotation.ColorInt import android.annotation.FloatRange import android.annotation.IntRange import android.annotation.SuppressLint import android.content.Context Loading @@ -27,7 +26,7 @@ import android.text.TextUtils import android.text.format.DateFormat import android.util.AttributeSet import android.util.MathUtils.constrainedMap import android.util.TypedValue import android.util.TypedValue.COMPLEX_UNIT_PX import android.view.View import android.view.View.MeasureSpec.EXACTLY import android.widget.TextView Loading Loading @@ -219,9 +218,7 @@ constructor( override fun setTextSize(type: Int, size: Float) { super.setTextSize(type, size) if (type == TypedValue.COMPLEX_UNIT_PX) { lastUnconstrainedTextSize = size } lastUnconstrainedTextSize = if (type == COMPLEX_UNIT_PX) size else Float.MAX_VALUE } @SuppressLint("DrawAllocation") Loading @@ -234,22 +231,18 @@ constructor( MeasureSpec.getMode(heightMeasureSpec) == EXACTLY ) { // Call straight into TextView.setTextSize to avoid setting lastUnconstrainedTextSize super.setTextSize( TypedValue.COMPLEX_UNIT_PX, min(lastUnconstrainedTextSize, MeasureSpec.getSize(heightMeasureSpec) / 2F) ) val size = min(lastUnconstrainedTextSize, MeasureSpec.getSize(heightMeasureSpec) / 2F) super.setTextSize(COMPLEX_UNIT_PX, size) } super.onMeasure(widthMeasureSpec, heightMeasureSpec) val animator = textAnimator if (animator == null) { textAnimator?.let { animator -> animator.updateLayout(layout, textSize) } ?: run { textAnimator = textAnimatorFactory(layout, ::invalidate)?.also { textAnimatorFactory(layout, ::invalidate).also { onTextAnimatorInitialized?.invoke(it) onTextAnimatorInitialized = null } } else { animator.updateLayout(layout) } if (migratedClocks && hasCustomPositionUpdatedAnimation) { Loading Loading @@ -307,18 +300,18 @@ constructor( logger.d("animateColorChange") setTextStyle( weight = lockScreenWeight, textSize = -1f, color = null, /* using current color */ animate = false, interpolator = null, duration = 0, delay = 0, onAnimationEnd = null ) setTextStyle( weight = lockScreenWeight, textSize = -1f, color = lockScreenColor, animate = true, interpolator = null, duration = COLOR_ANIM_DURATION, delay = 0, onAnimationEnd = null Loading @@ -329,16 +322,15 @@ constructor( logger.d("animateAppearOnLockscreen") setTextStyle( weight = dozingWeight, textSize = -1f, color = lockScreenColor, animate = false, interpolator = null, duration = 0, delay = 0, onAnimationEnd = null ) setTextStyle( weight = lockScreenWeight, textSize = -1f, color = lockScreenColor, animate = true, duration = APPEAR_ANIM_DURATION, Loading @@ -356,16 +348,15 @@ constructor( logger.d("animateFoldAppear") setTextStyle( weight = lockScreenWeightInternal, textSize = -1f, color = lockScreenColor, animate = false, interpolator = null, duration = 0, delay = 0, onAnimationEnd = null ) setTextStyle( weight = dozingWeightInternal, textSize = -1f, color = dozingColor, animate = animate, interpolator = Interpolators.EMPHASIZED_DECELERATE, Loading @@ -385,9 +376,9 @@ constructor( val startAnimPhase2 = Runnable { setTextStyle( weight = if (isDozing()) dozingWeight else lockScreenWeight, textSize = -1f, color = null, animate = true, interpolator = null, duration = CHARGE_ANIM_DURATION_PHASE_1, delay = 0, onAnimationEnd = null Loading @@ -395,9 +386,9 @@ constructor( } setTextStyle( weight = if (isDozing()) lockScreenWeight else dozingWeight, textSize = -1f, color = null, animate = true, interpolator = null, duration = CHARGE_ANIM_DURATION_PHASE_0, delay = chargeAnimationDelay.toLong(), onAnimationEnd = startAnimPhase2 Loading @@ -408,9 +399,9 @@ constructor( logger.d("animateDoze") setTextStyle( weight = if (isDozing) dozingWeight else lockScreenWeight, textSize = -1f, color = if (isDozing) dozingColor else lockScreenColor, animate = animate, interpolator = null, duration = DOZE_ANIM_DURATION, delay = 0, onAnimationEnd = null Loading Loading @@ -448,7 +439,6 @@ constructor( */ private fun setTextStyle( @IntRange(from = 0, to = 1000) weight: Int, @FloatRange(from = 0.0) textSize: Float, color: Int?, animate: Boolean, interpolator: TimeInterpolator?, Loading @@ -459,7 +449,6 @@ constructor( textAnimator?.let { it.setTextStyle( weight = weight, textSize = textSize, color = color, animate = animate && isAnimationEnabled, duration = duration, Loading @@ -474,7 +463,6 @@ constructor( onTextAnimatorInitialized = { textAnimator -> textAnimator.setTextStyle( weight = weight, textSize = textSize, color = color, animate = false, duration = duration, Loading @@ -487,27 +475,6 @@ constructor( } } private fun setTextStyle( @IntRange(from = 0, to = 1000) weight: Int, @FloatRange(from = 0.0) textSize: Float, color: Int?, animate: Boolean, duration: Long, delay: Long, onAnimationEnd: Runnable? ) { setTextStyle( weight = weight, textSize = textSize, color = color, animate = animate, interpolator = null, duration = duration, delay = delay, onAnimationEnd = onAnimationEnd ) } fun refreshFormat() = refreshFormat(DateFormat.is24HourFormat(context)) fun refreshFormat(use24HourFormat: Boolean) { Patterns.update(context) Loading
packages/SystemUI/src/com/android/keyguard/ClockEventController.kt +22 −26 Original line number Diff line number Diff line Loading @@ -15,12 +15,12 @@ */ package com.android.keyguard import android.os.Trace import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter import android.content.res.Resources import android.os.Trace import android.text.format.DateFormat import android.util.Log import android.util.TypedValue Loading Loading @@ -466,15 +466,11 @@ constructor( largeRegionSampler?.stopRegionSampler() smallTimeListener?.stop() largeTimeListener?.stop() clock ?.smallClock ?.view ?.removeOnAttachStateChangeListener(smallClockOnAttachStateChangeListener) clock?.apply { smallClock.view.removeOnAttachStateChangeListener(smallClockOnAttachStateChangeListener) largeClock.view.removeOnAttachStateChangeListener(largeClockOnAttachStateChangeListener) } smallClockFrame?.viewTreeObserver?.removeOnGlobalLayoutListener(onGlobalLayoutListener) clock ?.largeClock ?.view ?.removeOnAttachStateChangeListener(largeClockOnAttachStateChangeListener) } /** Loading Loading @@ -505,15 +501,17 @@ constructor( } } private fun updateFontSizes() { fun updateFontSizes() { clock?.run { smallClock.events.onFontSettingChanged( resources.getDimensionPixelSize(R.dimen.small_clock_text_size).toFloat() ) smallClock.events.onFontSettingChanged(getSmallClockSizePx()) largeClock.events.onFontSettingChanged(getLargeClockSizePx()) } } private fun getSmallClockSizePx(): Float { return resources.getDimensionPixelSize(R.dimen.small_clock_text_size).toFloat() } private fun getLargeClockSizePx(): Float { return if (largeClockOnSecondaryDisplay) { resources.getDimensionPixelSize(R.dimen.presentation_clock_text_size).toFloat() Loading Loading @@ -549,9 +547,8 @@ constructor( it.copy(value = 1f - it.value) }, keyguardTransitionInteractor.transition(Edge.create(LOCKSCREEN, AOD)), ).filter { it.transitionState != TransitionState.FINISHED } ) .filter { it.transitionState != TransitionState.FINISHED } .collect { handleDoze(it.value) } } } Loading Loading @@ -582,8 +579,8 @@ constructor( } /** * When keyguard is displayed due to pulsing notifications when AOD is off, * we should make sure clock is in dozing state instead of LS state * When keyguard is displayed due to pulsing notifications when AOD is off, we should make sure * clock is in dozing state instead of LS state */ @VisibleForTesting internal fun listenForAnyStateToDozingTransition(scope: CoroutineScope): Job { Loading @@ -595,7 +592,6 @@ constructor( } } @VisibleForTesting internal fun listenForDozing(scope: CoroutineScope): Job { return scope.launch { Loading
packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java +4 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ import com.android.systemui.dock.DockManager; import com.android.systemui.dock.DockManagerImpl; import com.android.systemui.doze.DozeHost; import com.android.systemui.keyguard.ui.composable.blueprint.DefaultBlueprintModule; import com.android.systemui.keyguard.ui.view.layout.blueprints.KeyguardBlueprintModule; import com.android.systemui.keyguard.ui.view.layout.sections.KeyguardSectionsModule; import com.android.systemui.media.dagger.MediaModule; import com.android.systemui.media.muteawait.MediaMuteAwaitConnectionCli; import com.android.systemui.media.nearby.NearbyMediaDevicesManager; Loading Loading @@ -112,6 +114,8 @@ import javax.inject.Named; GestureModule.class, HeadsUpModule.class, KeyboardShortcutsModule.class, KeyguardBlueprintModule.class, KeyguardSectionsModule.class, MediaModule.class, MediaMuteAwaitConnectionCli.StartableModule.class, MultiUserUtilsModule.class, Loading
packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +0 −4 Original line number Diff line number Diff line Loading @@ -70,8 +70,6 @@ import com.android.systemui.inputmethod.InputMethodModule; import com.android.systemui.keyboard.KeyboardModule; import com.android.systemui.keyevent.data.repository.KeyEventRepositoryModule; import com.android.systemui.keyguard.ui.composable.LockscreenContent; import com.android.systemui.keyguard.ui.view.layout.blueprints.KeyguardBlueprintModule; import com.android.systemui.keyguard.ui.view.layout.sections.KeyguardSectionsModule; import com.android.systemui.log.dagger.LogModule; import com.android.systemui.log.dagger.MonitorLog; import com.android.systemui.log.table.TableLogBuffer; Loading Loading @@ -222,8 +220,6 @@ import javax.inject.Named; InputMethodModule.class, KeyEventRepositoryModule.class, KeyboardModule.class, KeyguardBlueprintModule.class, KeyguardSectionsModule.class, LetterboxModule.class, LogModule.class, MediaProjectionActivitiesModule.class, Loading