Merge "Revert "[Unfold animation] Do not show dark vignette when folding"" into tm-qpr-dev
This commit is contained in:
@@ -534,13 +534,6 @@ object Flags {
|
|||||||
val OUTPUT_SWITCHER_SHOW_API_ENABLED =
|
val OUTPUT_SWITCHER_SHOW_API_ENABLED =
|
||||||
unreleasedFlag(2503, "output_switcher_show_api_enabled", teamfood = true)
|
unreleasedFlag(2503, "output_switcher_show_api_enabled", teamfood = true)
|
||||||
|
|
||||||
// 2600 - unfold transitions
|
|
||||||
// TODO(b/265764985): Tracking Bug
|
|
||||||
@Keep
|
|
||||||
@JvmField
|
|
||||||
val ENABLE_DARK_VIGNETTE_WHEN_FOLDING =
|
|
||||||
unreleasedFlag(2600, "enable_dark_vignette_when_folding")
|
|
||||||
|
|
||||||
// TODO(b259590361): Tracking bug
|
// TODO(b259590361): Tracking bug
|
||||||
val EXPERIMENTAL_FLAG = unreleasedFlag(2, "exp_flag_release")
|
val EXPERIMENTAL_FLAG = unreleasedFlag(2, "exp_flag_release")
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ import android.view.SurfaceSession
|
|||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.view.WindowlessWindowManager
|
import android.view.WindowlessWindowManager
|
||||||
import com.android.systemui.dagger.qualifiers.Main
|
import com.android.systemui.dagger.qualifiers.Main
|
||||||
import com.android.systemui.flags.FeatureFlags
|
|
||||||
import com.android.systemui.flags.Flags
|
|
||||||
import com.android.systemui.statusbar.LightRevealEffect
|
import com.android.systemui.statusbar.LightRevealEffect
|
||||||
import com.android.systemui.statusbar.LightRevealScrim
|
import com.android.systemui.statusbar.LightRevealScrim
|
||||||
import com.android.systemui.statusbar.LinearLightRevealEffect
|
import com.android.systemui.statusbar.LinearLightRevealEffect
|
||||||
@@ -59,7 +57,6 @@ class UnfoldLightRevealOverlayAnimation
|
|||||||
@Inject
|
@Inject
|
||||||
constructor(
|
constructor(
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
private val featureFlags: FeatureFlags,
|
|
||||||
private val deviceStateManager: DeviceStateManager,
|
private val deviceStateManager: DeviceStateManager,
|
||||||
private val contentResolver: ContentResolver,
|
private val contentResolver: ContentResolver,
|
||||||
private val displayManager: DisplayManager,
|
private val displayManager: DisplayManager,
|
||||||
@@ -84,7 +81,6 @@ constructor(
|
|||||||
private var scrimView: LightRevealScrim? = null
|
private var scrimView: LightRevealScrim? = null
|
||||||
private var isFolded: Boolean = false
|
private var isFolded: Boolean = false
|
||||||
private var isUnfoldHandled: Boolean = true
|
private var isUnfoldHandled: Boolean = true
|
||||||
private var overlayAddReason: AddOverlayReason? = null
|
|
||||||
|
|
||||||
private var currentRotation: Int = context.display!!.rotation
|
private var currentRotation: Int = context.display!!.rotation
|
||||||
|
|
||||||
@@ -162,8 +158,6 @@ constructor(
|
|||||||
ensureInBackground()
|
ensureInBackground()
|
||||||
ensureOverlayRemoved()
|
ensureOverlayRemoved()
|
||||||
|
|
||||||
overlayAddReason = reason
|
|
||||||
|
|
||||||
val newRoot = SurfaceControlViewHost(context, context.display!!, wwm)
|
val newRoot = SurfaceControlViewHost(context, context.display!!, wwm)
|
||||||
val params = getLayoutParams()
|
val params = getLayoutParams()
|
||||||
val newView =
|
val newView =
|
||||||
@@ -176,7 +170,11 @@ constructor(
|
|||||||
.apply {
|
.apply {
|
||||||
revealEffect = createLightRevealEffect()
|
revealEffect = createLightRevealEffect()
|
||||||
isScrimOpaqueChangedListener = Consumer {}
|
isScrimOpaqueChangedListener = Consumer {}
|
||||||
revealAmount = calculateRevealAmount()
|
revealAmount =
|
||||||
|
when (reason) {
|
||||||
|
FOLD -> TRANSPARENT
|
||||||
|
UNFOLD -> BLACK
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newRoot.setView(newView, params)
|
newRoot.setView(newView, params)
|
||||||
@@ -209,31 +207,6 @@ constructor(
|
|||||||
root = newRoot
|
root = newRoot
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun calculateRevealAmount(animationProgress: Float? = null): Float {
|
|
||||||
val overlayAddReason = overlayAddReason ?: UNFOLD
|
|
||||||
|
|
||||||
if (animationProgress == null) {
|
|
||||||
// Animation progress is unknown, calculate the initial value based on the overlay
|
|
||||||
// add reason
|
|
||||||
return when (overlayAddReason) {
|
|
||||||
FOLD -> TRANSPARENT
|
|
||||||
UNFOLD -> BLACK
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val showVignetteWhenFolding =
|
|
||||||
featureFlags.isEnabled(Flags.ENABLE_DARK_VIGNETTE_WHEN_FOLDING)
|
|
||||||
|
|
||||||
return if (!showVignetteWhenFolding && overlayAddReason == FOLD) {
|
|
||||||
// Do not darken the content when SHOW_VIGNETTE_WHEN_FOLDING flag is off
|
|
||||||
// and we are folding the device. We still add the overlay to block touches
|
|
||||||
// while the animation is running but the overlay is transparent.
|
|
||||||
TRANSPARENT
|
|
||||||
} else {
|
|
||||||
animationProgress
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getLayoutParams(): WindowManager.LayoutParams {
|
private fun getLayoutParams(): WindowManager.LayoutParams {
|
||||||
val params: WindowManager.LayoutParams = WindowManager.LayoutParams()
|
val params: WindowManager.LayoutParams = WindowManager.LayoutParams()
|
||||||
|
|
||||||
@@ -286,7 +259,7 @@ constructor(
|
|||||||
private inner class TransitionListener : TransitionProgressListener {
|
private inner class TransitionListener : TransitionProgressListener {
|
||||||
|
|
||||||
override fun onTransitionProgress(progress: Float) {
|
override fun onTransitionProgress(progress: Float) {
|
||||||
executeInBackground { scrimView?.revealAmount = calculateRevealAmount(progress) }
|
executeInBackground { scrimView?.revealAmount = progress }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTransitionFinished() {
|
override fun onTransitionFinished() {
|
||||||
|
|||||||
Reference in New Issue
Block a user