Merge "Fix black frame when unfold animation starts" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9e41a090cd
@@ -40,6 +40,8 @@ import com.android.systemui.dagger.qualifiers.UiBackground
|
|||||||
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
|
||||||
|
import com.android.systemui.unfold.UnfoldLightRevealOverlayAnimation.AddOverlayReason.FOLD
|
||||||
|
import com.android.systemui.unfold.UnfoldLightRevealOverlayAnimation.AddOverlayReason.UNFOLD
|
||||||
import com.android.systemui.unfold.UnfoldTransitionProgressProvider.TransitionProgressListener
|
import com.android.systemui.unfold.UnfoldTransitionProgressProvider.TransitionProgressListener
|
||||||
import com.android.systemui.unfold.updates.RotationChangeProvider
|
import com.android.systemui.unfold.updates.RotationChangeProvider
|
||||||
import com.android.systemui.unfold.util.ScaleAwareTransitionProgressProvider.Companion.areAnimationsEnabled
|
import com.android.systemui.unfold.util.ScaleAwareTransitionProgressProvider.Companion.areAnimationsEnabled
|
||||||
@@ -125,7 +127,7 @@ constructor(
|
|||||||
try {
|
try {
|
||||||
// Add the view only if we are unfolding and this is the first screen on
|
// Add the view only if we are unfolding and this is the first screen on
|
||||||
if (!isFolded && !isUnfoldHandled && contentResolver.areAnimationsEnabled()) {
|
if (!isFolded && !isUnfoldHandled && contentResolver.areAnimationsEnabled()) {
|
||||||
executeInBackground { addView(onOverlayReady) }
|
executeInBackground { addOverlay(onOverlayReady, reason = UNFOLD) }
|
||||||
isUnfoldHandled = true
|
isUnfoldHandled = true
|
||||||
} else {
|
} else {
|
||||||
// No unfold transition, immediately report that overlay is ready
|
// No unfold transition, immediately report that overlay is ready
|
||||||
@@ -137,7 +139,7 @@ constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addView(onOverlayReady: Runnable? = null) {
|
private fun addOverlay(onOverlayReady: Runnable? = null, reason: AddOverlayReason) {
|
||||||
if (!::wwm.isInitialized) {
|
if (!::wwm.isInitialized) {
|
||||||
// Surface overlay is not created yet on the first SysUI launch
|
// Surface overlay is not created yet on the first SysUI launch
|
||||||
onOverlayReady?.run()
|
onOverlayReady?.run()
|
||||||
@@ -152,7 +154,10 @@ constructor(
|
|||||||
LightRevealScrim(context, null).apply {
|
LightRevealScrim(context, null).apply {
|
||||||
revealEffect = createLightRevealEffect()
|
revealEffect = createLightRevealEffect()
|
||||||
isScrimOpaqueChangedListener = Consumer {}
|
isScrimOpaqueChangedListener = Consumer {}
|
||||||
revealAmount = 0f
|
revealAmount = when (reason) {
|
||||||
|
FOLD -> TRANSPARENT
|
||||||
|
UNFOLD -> BLACK
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val params = getLayoutParams()
|
val params = getLayoutParams()
|
||||||
@@ -247,7 +252,7 @@ constructor(
|
|||||||
override fun onTransitionStarted() {
|
override fun onTransitionStarted() {
|
||||||
// Add view for folding case (when unfolding the view is added earlier)
|
// Add view for folding case (when unfolding the view is added earlier)
|
||||||
if (scrimView == null) {
|
if (scrimView == null) {
|
||||||
executeInBackground { addView() }
|
executeInBackground { addOverlay(reason = FOLD) }
|
||||||
}
|
}
|
||||||
// Disable input dispatching during transition.
|
// Disable input dispatching during transition.
|
||||||
InputManager.getInstance().cancelCurrentTouch()
|
InputManager.getInstance().cancelCurrentTouch()
|
||||||
@@ -294,11 +299,17 @@ constructor(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private enum class AddOverlayReason { FOLD, UNFOLD }
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
private const val ROTATION_ANIMATION_OVERLAY_Z_INDEX = Integer.MAX_VALUE
|
const val ROTATION_ANIMATION_OVERLAY_Z_INDEX = Integer.MAX_VALUE
|
||||||
|
|
||||||
// Put the unfold overlay below the rotation animation screenshot to hide the moment
|
// Put the unfold overlay below the rotation animation screenshot to hide the moment
|
||||||
// when it is rotated but the rotation of the other windows hasn't happen yet
|
// when it is rotated but the rotation of the other windows hasn't happen yet
|
||||||
private const val UNFOLD_OVERLAY_LAYER_Z_INDEX = ROTATION_ANIMATION_OVERLAY_Z_INDEX - 1
|
const val UNFOLD_OVERLAY_LAYER_Z_INDEX = ROTATION_ANIMATION_OVERLAY_Z_INDEX - 1
|
||||||
|
|
||||||
|
// constants for revealAmount.
|
||||||
|
const val TRANSPARENT = 1f
|
||||||
|
const val BLACK = 0f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user