summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt14
-rw-r--r--packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt28
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt25
3 files changed, 17 insertions, 50 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt
index 9963f813b884..5b2377f7f610 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt
@@ -96,6 +96,7 @@ interface ShadeViewController {
val shadeHeadsUpTracker: ShadeHeadsUpTracker
/** Returns the ShadeFoldAnimator. */
+ @Deprecated("This interface is deprecated in Scene Container")
val shadeFoldAnimator: ShadeFoldAnimator
companion object {
@@ -142,9 +143,10 @@ interface ShadeHeadsUpTracker {
}
/** Handles the lifecycle of the shade's animation that happens when folding a foldable. */
+@Deprecated("This interface should not be used in scene container.")
interface ShadeFoldAnimator {
/** Updates the views to the initial state for the fold to AOD animation. */
- fun prepareFoldToAodAnimation()
+ @Deprecated("Not used when migrateClocksToBlueprint enabled") fun prepareFoldToAodAnimation()
/**
* Starts fold to AOD animation.
@@ -153,21 +155,24 @@ interface ShadeFoldAnimator {
* @param endAction invoked when the animation finishes, also if it was cancelled.
* @param cancelAction invoked when the animation is cancelled, before endAction.
*/
+ @Deprecated("Not used when migrateClocksToBlueprint enabled")
fun startFoldToAodAnimation(startAction: Runnable, endAction: Runnable, cancelAction: Runnable)
/** Cancels fold to AOD transition and resets view state. */
- fun cancelFoldToAodAnimation()
+ @Deprecated("Not used when migrateClocksToBlueprint enabled") fun cancelFoldToAodAnimation()
/** Returns the main view of the shade. */
- val view: ViewGroup?
+ @Deprecated("Not used in Scene Container") val view: ViewGroup?
}
/**
* An interface that provides the current state of the notification panel and related views, which
* is needed to calculate [KeyguardStatusBarView]'s state in [KeyguardStatusBarViewController].
*/
+@Deprecated("This interface should not be used in scene container.")
interface ShadeViewStateProvider {
/** Returns the expanded height of the panel view. */
+ @Deprecated("deprecated by migrate_keyguard_status_bar_view flag")
val panelViewExpandedHeight: Float
/**
@@ -176,8 +181,9 @@ interface ShadeViewStateProvider {
* TODO(b/138786270): If HeadsUpAppearanceController was injectable, we could inject it into
* [KeyguardStatusBarViewController] and remove this method.
*/
- fun shouldHeadsUpBeVisible(): Boolean
+ @Deprecated("deprecated in Flexiglass.") fun shouldHeadsUpBeVisible(): Boolean
/** Return the fraction of the shade that's expanded, when in lockscreen. */
+ @Deprecated("deprecated by migrate_keyguard_status_bar_view flag")
val lockscreenShadeDragProgress: Float
}
diff --git a/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt b/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt
index 098d51e94fc7..81c8d5039d1d 100644
--- a/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt
+++ b/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt
@@ -21,15 +21,12 @@ import android.content.Context
import android.hardware.devicestate.DeviceStateManager
import android.os.PowerManager
import android.provider.Settings
-import androidx.annotation.VisibleForTesting
import androidx.core.view.OneShotPreDrawListener
-import androidx.lifecycle.Lifecycle
-import androidx.lifecycle.repeatOnLifecycle
import com.android.internal.util.LatencyTracker
+import com.android.systemui.Flags.migrateClocksToBlueprint
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
-import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.shade.ShadeFoldAnimator
import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.LightRevealScrim
@@ -40,9 +37,6 @@ import com.android.systemui.unfold.FoldAodAnimationController.FoldAodAnimationSt
import com.android.systemui.util.concurrency.DelayableExecutor
import com.android.systemui.util.settings.GlobalSettings
import dagger.Lazy
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.Job
-import kotlinx.coroutines.launch
import java.util.function.Consumer
import javax.inject.Inject
@@ -69,7 +63,6 @@ constructor(
private var isFoldHandled = true
private var alwaysOnEnabled: Boolean = false
- private var isDozing: Boolean = false
private var isScrimOpaque: Boolean = false
private var pendingScrimReadyCallback: Runnable? = null
@@ -97,11 +90,6 @@ constructor(
deviceStateManager.registerCallback(mainExecutor, FoldListener())
wakefulnessLifecycle.addObserver(this)
-
- // TODO(b/254878364): remove this call to NPVC.getView()
- getShadeFoldAnimator().view?.repeatWhenAttached {
- repeatOnLifecycle(Lifecycle.State.STARTED) { listenForDozing(this) }
- }
}
/** Returns true if we should run fold to AOD animation */
@@ -158,7 +146,8 @@ constructor(
} else {
pendingScrimReadyCallback = onReady
}
- } else if (isFolded && !isFoldHandled && alwaysOnEnabled && isDozing) {
+ } else if (isFolded && !isFoldHandled && alwaysOnEnabled &&
+ keyguardInteractor.get().isDozing.value) {
setAnimationState(playing = true)
getShadeFoldAnimator().prepareFoldToAodAnimation()
@@ -166,8 +155,10 @@ constructor(
// but we should wait for the initial animation preparations to be drawn
// (setting initial alpha/translation)
// TODO(b/254878364): remove this call to NPVC.getView()
- getShadeFoldAnimator().view?.let {
- OneShotPreDrawListener.add(it, onReady)
+ if (!migrateClocksToBlueprint()) {
+ getShadeFoldAnimator().view?.let {
+ OneShotPreDrawListener.add(it, onReady)
+ }
}
} else {
// No animation, call ready callback immediately
@@ -233,11 +224,6 @@ constructor(
statusListeners.remove(listener)
}
- @VisibleForTesting
- internal suspend fun listenForDozing(scope: CoroutineScope): Job {
- return scope.launch { keyguardInteractor.get().isDozing.collect { isDozing = it } }
- }
-
interface FoldAodAnimationStatus {
fun onFoldToAodAnimationChanged()
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt
index 10aab96e6036..cb7d2764bb49 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt
@@ -133,47 +133,34 @@ class FoldAodAnimationControllerTest : SysuiTestCase() {
@Test
fun onFolded_aodDisabled_doesNotLogLatency() =
runBlocking(IMMEDIATE) {
- val job = underTest.listenForDozing(this)
keyguardRepository.setIsDozing(true)
setAodEnabled(enabled = false)
- yield()
-
fold()
simulateScreenTurningOn()
verifyNoMoreInteractions(latencyTracker)
-
- job.cancel()
}
@Test
fun onFolded_aodEnabled_logsLatency() =
runBlocking(IMMEDIATE) {
- val job = underTest.listenForDozing(this)
keyguardRepository.setIsDozing(true)
setAodEnabled(enabled = true)
- yield()
-
fold()
simulateScreenTurningOn()
verify(latencyTracker).onActionStart(any())
verify(latencyTracker).onActionEnd(any())
-
- job.cancel()
}
@Test
fun onFolded_onScreenTurningOnInvokedTwice_doesNotLogLatency() =
runBlocking(IMMEDIATE) {
- val job = underTest.listenForDozing(this)
keyguardRepository.setIsDozing(true)
setAodEnabled(enabled = true)
- yield()
-
fold()
simulateScreenTurningOn()
reset(latencyTracker)
@@ -183,19 +170,14 @@ class FoldAodAnimationControllerTest : SysuiTestCase() {
verify(latencyTracker, never()).onActionStart(any())
verify(latencyTracker, never()).onActionEnd(any())
-
- job.cancel()
}
@Test
fun onFolded_onScreenTurningOnWithoutDozingThenWithDozing_doesNotLogLatency() =
runBlocking(IMMEDIATE) {
- val job = underTest.listenForDozing(this)
keyguardRepository.setIsDozing(false)
setAodEnabled(enabled = true)
- yield()
-
fold()
simulateScreenTurningOn()
reset(latencyTracker)
@@ -208,19 +190,14 @@ class FoldAodAnimationControllerTest : SysuiTestCase() {
verify(latencyTracker, never()).onActionStart(any())
verify(latencyTracker, never()).onActionEnd(any())
-
- job.cancel()
}
@Test
fun onFolded_animationCancelled_doesNotLogLatency() =
runBlocking(IMMEDIATE) {
- val job = underTest.listenForDozing(this)
keyguardRepository.setIsDozing(true)
setAodEnabled(enabled = true)
- yield()
-
fold()
underTest.onScreenTurningOn({})
// The body of onScreenTurningOn is executed on fakeExecutor,
@@ -230,8 +207,6 @@ class FoldAodAnimationControllerTest : SysuiTestCase() {
verify(latencyTracker).onActionStart(any())
verify(latencyTracker).onActionCancel(any())
-
- job.cancel()
}
private fun simulateScreenTurningOn() {