Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromGoneTransitionInteractor.kt +3 −0 Original line number Diff line number Diff line Loading @@ -131,13 +131,16 @@ constructor( when (toState) { KeyguardState.DREAMING -> TO_DREAMING_DURATION KeyguardState.AOD -> TO_AOD_DURATION KeyguardState.LOCKSCREEN -> TO_LOCKSCREEN_DURATION else -> DEFAULT_DURATION }.inWholeMilliseconds } } companion object { private val DEFAULT_DURATION = 500.milliseconds val TO_DREAMING_DURATION = 933.milliseconds val TO_AOD_DURATION = 1300.milliseconds val TO_LOCKSCREEN_DURATION = DEFAULT_DURATION } } packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt +4 −0 Original line number Diff line number Diff line Loading @@ -380,6 +380,8 @@ constructor( KeyguardState.DREAMING -> TO_DREAMING_DURATION KeyguardState.OCCLUDED -> TO_OCCLUDED_DURATION KeyguardState.AOD -> TO_AOD_DURATION KeyguardState.DOZING -> TO_DOZING_DURATION KeyguardState.DREAMING_LOCKSCREEN_HOSTED -> TO_DREAMING_HOSTED_DURATION else -> DEFAULT_DURATION }.inWholeMilliseconds } Loading @@ -388,7 +390,9 @@ constructor( companion object { const val TAG = "FromLockscreenTransitionInteractor" private val DEFAULT_DURATION = 400.milliseconds val TO_DOZING_DURATION = 500.milliseconds val TO_DREAMING_DURATION = 933.milliseconds val TO_DREAMING_HOSTED_DURATION = 933.milliseconds val TO_OCCLUDED_DURATION = 450.milliseconds val TO_AOD_DURATION = 500.milliseconds val TO_PRIMARY_BOUNCER_DURATION = DEFAULT_DURATION Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractor.kt +11 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,10 @@ constructor( val fromDreamingTransition: Flow<TransitionStep> = repository.transitions.filter { step -> step.from == DREAMING } /** LOCKSCREEN->(any) transition information. */ val fromLockscreenTransition: Flow<TransitionStep> = repository.transitions.filter { step -> step.from == LOCKSCREEN } /** (any)->Lockscreen transition information */ val anyStateToLockscreenTransition: Flow<TransitionStep> = repository.transitions.filter { step -> step.to == LOCKSCREEN } Loading Loading @@ -113,9 +117,16 @@ constructor( val goneToDreamingLockscreenHostedTransition: Flow<TransitionStep> = repository.transition(GONE, DREAMING_LOCKSCREEN_HOSTED) /** GONE->LOCKSCREEN transition information. */ val goneToLockscreenTransition: Flow<TransitionStep> = repository.transition(GONE, LOCKSCREEN) /** LOCKSCREEN->AOD transition information. */ val lockscreenToAodTransition: Flow<TransitionStep> = repository.transition(LOCKSCREEN, AOD) /** LOCKSCREEN->DOZING transition information. */ val lockscreenToDozingTransition: Flow<TransitionStep> = repository.transition(LOCKSCREEN, DOZING) /** LOCKSCREEN->DREAMING transition information. */ val lockscreenToDreamingTransition: Flow<TransitionStep> = repository.transition(LOCKSCREEN, DREAMING) Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt +19 −41 Original line number Diff line number Diff line Loading @@ -30,9 +30,7 @@ import androidx.core.view.isVisible import androidx.core.view.updateLayoutParams import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.animation.Interpolators import com.android.settingslib.Utils import com.android.systemui.res.R import com.android.systemui.animation.Expandable import com.android.systemui.animation.view.LaunchableImageView import com.android.systemui.common.shared.model.Icon Loading @@ -40,6 +38,7 @@ import com.android.systemui.common.ui.binder.IconViewBinder import com.android.systemui.keyguard.ui.viewmodel.KeyguardQuickAffordanceViewModel import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.FalsingManager import com.android.systemui.res.R import com.android.systemui.statusbar.VibratorHelper import com.android.systemui.util.doOnEnd import kotlinx.coroutines.flow.Flow Loading @@ -48,9 +47,7 @@ import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch /** * This is only for a SINGLE Quick affordance */ /** This is only for a SINGLE Quick affordance */ object KeyguardQuickAffordanceViewBinder { private const val EXIT_DOZE_BUTTON_REVEAL_ANIMATION_DURATION_MS = 250L Loading Loading @@ -135,28 +132,12 @@ object KeyguardQuickAffordanceViewBinder { vibratorHelper: VibratorHelper?, ) { if (!viewModel.isVisible) { view.alpha = 1f view .animate() .alpha(0f) .setInterpolator(Interpolators.FAST_OUT_LINEAR_IN) .setDuration(EXIT_DOZE_BUTTON_REVEAL_ANIMATION_DURATION_MS) .withEndAction { view.isInvisible = true } .start() view.isInvisible = true return } if (!view.isVisible) { view.isVisible = true if (viewModel.animateReveal) { view.alpha = 0f view .animate() .alpha(1f) .setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN) .setDuration(EXIT_DOZE_BUTTON_REVEAL_ANIMATION_DURATION_MS) .start() } } IconViewBinder.bind(viewModel.icon, view) Loading Loading @@ -216,7 +197,8 @@ object KeyguardQuickAffordanceViewBinder { view.isClickable = viewModel.isClickable if (viewModel.isClickable) { if (viewModel.useLongPress) { val onTouchListener = KeyguardQuickAffordanceOnTouchListener( val onTouchListener = KeyguardQuickAffordanceOnTouchListener( view, viewModel, messageDisplayer, Loading @@ -241,9 +223,7 @@ object KeyguardQuickAffordanceViewBinder { KeyguardBottomAreaVibrations.ShakeAnimationDuration.inWholeMilliseconds shakeAnimator.interpolator = CycleInterpolator(KeyguardBottomAreaVibrations.ShakeAnimationCycles) shakeAnimator.doOnEnd { view.translationX = 0f } shakeAnimator.doOnEnd { view.translationX = 0f } shakeAnimator.start() vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) Loading Loading @@ -337,11 +317,9 @@ object KeyguardQuickAffordanceViewBinder { } override fun onLongClickUseDefaultHapticFeedback(view: View) = false } private data class ConfigurationBasedDimensions( val buttonSizePx: Size, ) } packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt +34 −33 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ import dagger.assisted.AssistedInject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.DisposableHandle import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.runBlocking /** Renders the preview of the lock screen. */ Loading Loading @@ -158,7 +159,6 @@ constructor( init { if (keyguardBottomAreaRefactor()) { keyguardRootViewModel.enablePreviewMode() quickAffordancesCombinedViewModel.enablePreviewMode( initiallySelectedSlotId = bundle.getString( Loading Loading @@ -338,10 +338,10 @@ constructor( ), ) } @OptIn(ExperimentalCoroutinesApi::class) private fun setupKeyguardRootView(previewContext: Context, rootView: FrameLayout) { val keyguardRootView = KeyguardRootView(previewContext, null) if (!keyguardBottomAreaRefactor()) { disposables.add( KeyguardRootViewBinder.bind( keyguardRootView, Loading @@ -354,10 +354,11 @@ constructor( shadeInteractor, null, // clock provider only needed for burn in null, // jank monitor not required for preview mode null, // device entry haptics not required for preview mode null, // device entry haptics not required preview mode null, // device entry haptics not required for preview mode ) ) } rootView.addView( keyguardRootView, FrameLayout.LayoutParams( Loading Loading @@ -392,30 +393,30 @@ constructor( } private fun setupShortcuts(keyguardRootView: ConstraintLayout) { keyguardRootView.findViewById<LaunchableImageView?>(R.id.start_button)?.let { keyguardRootView.findViewById<LaunchableImageView?>(R.id.start_button)?.let { imageView -> shortcutsBindings.add( KeyguardQuickAffordanceViewBinder.bind( it, quickAffordancesCombinedViewModel.startButton, keyguardRootViewModel.alpha, falsingManager, vibratorHelper, ) { indicationController.showTransientIndication(it) view = imageView, viewModel = quickAffordancesCombinedViewModel.startButton, alpha = flowOf(1f), falsingManager = falsingManager, vibratorHelper = vibratorHelper, ) { message -> indicationController.showTransientIndication(message) } ) } keyguardRootView.findViewById<LaunchableImageView?>(R.id.end_button)?.let { keyguardRootView.findViewById<LaunchableImageView?>(R.id.end_button)?.let { imageView -> shortcutsBindings.add( KeyguardQuickAffordanceViewBinder.bind( it, quickAffordancesCombinedViewModel.endButton, keyguardRootViewModel.alpha, falsingManager, vibratorHelper, ) { indicationController.showTransientIndication(it) view = imageView, viewModel = quickAffordancesCombinedViewModel.endButton, alpha = flowOf(1f), falsingManager = falsingManager, vibratorHelper = vibratorHelper, ) { message -> indicationController.showTransientIndication(message) } ) } Loading Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromGoneTransitionInteractor.kt +3 −0 Original line number Diff line number Diff line Loading @@ -131,13 +131,16 @@ constructor( when (toState) { KeyguardState.DREAMING -> TO_DREAMING_DURATION KeyguardState.AOD -> TO_AOD_DURATION KeyguardState.LOCKSCREEN -> TO_LOCKSCREEN_DURATION else -> DEFAULT_DURATION }.inWholeMilliseconds } } companion object { private val DEFAULT_DURATION = 500.milliseconds val TO_DREAMING_DURATION = 933.milliseconds val TO_AOD_DURATION = 1300.milliseconds val TO_LOCKSCREEN_DURATION = DEFAULT_DURATION } }
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt +4 −0 Original line number Diff line number Diff line Loading @@ -380,6 +380,8 @@ constructor( KeyguardState.DREAMING -> TO_DREAMING_DURATION KeyguardState.OCCLUDED -> TO_OCCLUDED_DURATION KeyguardState.AOD -> TO_AOD_DURATION KeyguardState.DOZING -> TO_DOZING_DURATION KeyguardState.DREAMING_LOCKSCREEN_HOSTED -> TO_DREAMING_HOSTED_DURATION else -> DEFAULT_DURATION }.inWholeMilliseconds } Loading @@ -388,7 +390,9 @@ constructor( companion object { const val TAG = "FromLockscreenTransitionInteractor" private val DEFAULT_DURATION = 400.milliseconds val TO_DOZING_DURATION = 500.milliseconds val TO_DREAMING_DURATION = 933.milliseconds val TO_DREAMING_HOSTED_DURATION = 933.milliseconds val TO_OCCLUDED_DURATION = 450.milliseconds val TO_AOD_DURATION = 500.milliseconds val TO_PRIMARY_BOUNCER_DURATION = DEFAULT_DURATION Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractor.kt +11 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,10 @@ constructor( val fromDreamingTransition: Flow<TransitionStep> = repository.transitions.filter { step -> step.from == DREAMING } /** LOCKSCREEN->(any) transition information. */ val fromLockscreenTransition: Flow<TransitionStep> = repository.transitions.filter { step -> step.from == LOCKSCREEN } /** (any)->Lockscreen transition information */ val anyStateToLockscreenTransition: Flow<TransitionStep> = repository.transitions.filter { step -> step.to == LOCKSCREEN } Loading Loading @@ -113,9 +117,16 @@ constructor( val goneToDreamingLockscreenHostedTransition: Flow<TransitionStep> = repository.transition(GONE, DREAMING_LOCKSCREEN_HOSTED) /** GONE->LOCKSCREEN transition information. */ val goneToLockscreenTransition: Flow<TransitionStep> = repository.transition(GONE, LOCKSCREEN) /** LOCKSCREEN->AOD transition information. */ val lockscreenToAodTransition: Flow<TransitionStep> = repository.transition(LOCKSCREEN, AOD) /** LOCKSCREEN->DOZING transition information. */ val lockscreenToDozingTransition: Flow<TransitionStep> = repository.transition(LOCKSCREEN, DOZING) /** LOCKSCREEN->DREAMING transition information. */ val lockscreenToDreamingTransition: Flow<TransitionStep> = repository.transition(LOCKSCREEN, DREAMING) Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt +19 −41 Original line number Diff line number Diff line Loading @@ -30,9 +30,7 @@ import androidx.core.view.isVisible import androidx.core.view.updateLayoutParams import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.animation.Interpolators import com.android.settingslib.Utils import com.android.systemui.res.R import com.android.systemui.animation.Expandable import com.android.systemui.animation.view.LaunchableImageView import com.android.systemui.common.shared.model.Icon Loading @@ -40,6 +38,7 @@ import com.android.systemui.common.ui.binder.IconViewBinder import com.android.systemui.keyguard.ui.viewmodel.KeyguardQuickAffordanceViewModel import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.FalsingManager import com.android.systemui.res.R import com.android.systemui.statusbar.VibratorHelper import com.android.systemui.util.doOnEnd import kotlinx.coroutines.flow.Flow Loading @@ -48,9 +47,7 @@ import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch /** * This is only for a SINGLE Quick affordance */ /** This is only for a SINGLE Quick affordance */ object KeyguardQuickAffordanceViewBinder { private const val EXIT_DOZE_BUTTON_REVEAL_ANIMATION_DURATION_MS = 250L Loading Loading @@ -135,28 +132,12 @@ object KeyguardQuickAffordanceViewBinder { vibratorHelper: VibratorHelper?, ) { if (!viewModel.isVisible) { view.alpha = 1f view .animate() .alpha(0f) .setInterpolator(Interpolators.FAST_OUT_LINEAR_IN) .setDuration(EXIT_DOZE_BUTTON_REVEAL_ANIMATION_DURATION_MS) .withEndAction { view.isInvisible = true } .start() view.isInvisible = true return } if (!view.isVisible) { view.isVisible = true if (viewModel.animateReveal) { view.alpha = 0f view .animate() .alpha(1f) .setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN) .setDuration(EXIT_DOZE_BUTTON_REVEAL_ANIMATION_DURATION_MS) .start() } } IconViewBinder.bind(viewModel.icon, view) Loading Loading @@ -216,7 +197,8 @@ object KeyguardQuickAffordanceViewBinder { view.isClickable = viewModel.isClickable if (viewModel.isClickable) { if (viewModel.useLongPress) { val onTouchListener = KeyguardQuickAffordanceOnTouchListener( val onTouchListener = KeyguardQuickAffordanceOnTouchListener( view, viewModel, messageDisplayer, Loading @@ -241,9 +223,7 @@ object KeyguardQuickAffordanceViewBinder { KeyguardBottomAreaVibrations.ShakeAnimationDuration.inWholeMilliseconds shakeAnimator.interpolator = CycleInterpolator(KeyguardBottomAreaVibrations.ShakeAnimationCycles) shakeAnimator.doOnEnd { view.translationX = 0f } shakeAnimator.doOnEnd { view.translationX = 0f } shakeAnimator.start() vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) Loading Loading @@ -337,11 +317,9 @@ object KeyguardQuickAffordanceViewBinder { } override fun onLongClickUseDefaultHapticFeedback(view: View) = false } private data class ConfigurationBasedDimensions( val buttonSizePx: Size, ) }
packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt +34 −33 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ import dagger.assisted.AssistedInject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.DisposableHandle import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.runBlocking /** Renders the preview of the lock screen. */ Loading Loading @@ -158,7 +159,6 @@ constructor( init { if (keyguardBottomAreaRefactor()) { keyguardRootViewModel.enablePreviewMode() quickAffordancesCombinedViewModel.enablePreviewMode( initiallySelectedSlotId = bundle.getString( Loading Loading @@ -338,10 +338,10 @@ constructor( ), ) } @OptIn(ExperimentalCoroutinesApi::class) private fun setupKeyguardRootView(previewContext: Context, rootView: FrameLayout) { val keyguardRootView = KeyguardRootView(previewContext, null) if (!keyguardBottomAreaRefactor()) { disposables.add( KeyguardRootViewBinder.bind( keyguardRootView, Loading @@ -354,10 +354,11 @@ constructor( shadeInteractor, null, // clock provider only needed for burn in null, // jank monitor not required for preview mode null, // device entry haptics not required for preview mode null, // device entry haptics not required preview mode null, // device entry haptics not required for preview mode ) ) } rootView.addView( keyguardRootView, FrameLayout.LayoutParams( Loading Loading @@ -392,30 +393,30 @@ constructor( } private fun setupShortcuts(keyguardRootView: ConstraintLayout) { keyguardRootView.findViewById<LaunchableImageView?>(R.id.start_button)?.let { keyguardRootView.findViewById<LaunchableImageView?>(R.id.start_button)?.let { imageView -> shortcutsBindings.add( KeyguardQuickAffordanceViewBinder.bind( it, quickAffordancesCombinedViewModel.startButton, keyguardRootViewModel.alpha, falsingManager, vibratorHelper, ) { indicationController.showTransientIndication(it) view = imageView, viewModel = quickAffordancesCombinedViewModel.startButton, alpha = flowOf(1f), falsingManager = falsingManager, vibratorHelper = vibratorHelper, ) { message -> indicationController.showTransientIndication(message) } ) } keyguardRootView.findViewById<LaunchableImageView?>(R.id.end_button)?.let { keyguardRootView.findViewById<LaunchableImageView?>(R.id.end_button)?.let { imageView -> shortcutsBindings.add( KeyguardQuickAffordanceViewBinder.bind( it, quickAffordancesCombinedViewModel.endButton, keyguardRootViewModel.alpha, falsingManager, vibratorHelper, ) { indicationController.showTransientIndication(it) view = imageView, viewModel = quickAffordancesCombinedViewModel.endButton, alpha = flowOf(1f), falsingManager = falsingManager, vibratorHelper = vibratorHelper, ) { message -> indicationController.showTransientIndication(message) } ) } Loading