Use sync transaction for dim layer and scale
Otherwise when performing shell rotation animation, the buffer
layers are waiting for start transaction but their parent
container layers have applied the change in new rotation. Then
before the rotation animation starts, those window may be placed
at strange position.
Also
1. Skip window animation if display is in transition, because
it is usually hard to observe while the whole content of
display is changing. Sync transaction cannot help this case
because it may be like to delay the leash creation and jump
to the end of animation if the sync transaction is applied
later. The window level animation in this case may happen on
an activity with declaring window exit/enter animation and it
doesn't handle config change. So the relaunch adds/removes
the window that triggers exit/enter.
2. Fix a missing condition of async rotation that screen decorations
draw in new rotation before the rotation animation starts.
Bug: 225324120
Test: adb shell setprop persist.wm.debug.shell_transit 1; reboot
Start a dialog style activity with FLAG_SHOW_WALLPAPER,
screenOrientation="fullSensor", and without configChanges
(to trigger relaunch). Rotate the device and check no
obvious flickering.
Change-Id: Ic4239ca7c7e3cd9e6ecae6f4ec7e823104b638de
This commit is contained in:
@@ -144,7 +144,8 @@ class AsyncRotationController extends FadeAnimationController implements Consume
|
||||
// Legacy animation doesn't need to wait for the start transaction.
|
||||
if (mTransitionOp == OP_LEGACY) {
|
||||
mIsStartTransactionCommitted = true;
|
||||
} else if (displayContent.mTransitionController.useShellTransitionsRotation()) {
|
||||
} else if (displayContent.mTransitionController.useShellTransitionsRotation()
|
||||
|| displayContent.mTransitionController.isCollecting(displayContent)) {
|
||||
keepAppearanceInPreviousRotation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -662,7 +662,7 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {
|
||||
mDimmer.resetDimStates();
|
||||
}
|
||||
|
||||
if (mDimmer.updateDims(getPendingTransaction(), mTmpDimBoundsRect)) {
|
||||
if (mDimmer.updateDims(getSyncTransaction(), mTmpDimBoundsRect)) {
|
||||
scheduleAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3297,9 +3297,10 @@ class Task extends TaskFragment {
|
||||
mTmpDimBoundsRect.offsetTo(0, 0);
|
||||
}
|
||||
|
||||
updateShadowsRadius(isFocused(), getSyncTransaction());
|
||||
final SurfaceControl.Transaction t = getSyncTransaction();
|
||||
updateShadowsRadius(isFocused(), t);
|
||||
|
||||
if (mDimmer.updateDims(getPendingTransaction(), mTmpDimBoundsRect)) {
|
||||
if (mDimmer.updateDims(t, mTmpDimBoundsRect)) {
|
||||
scheduleAnimation();
|
||||
}
|
||||
|
||||
@@ -3309,7 +3310,7 @@ class Task extends TaskFragment {
|
||||
final boolean show = isVisible() || isAnimating(TRANSITION | PARENTS | CHILDREN);
|
||||
if (mSurfaceControl != null) {
|
||||
if (show != mLastSurfaceShowing) {
|
||||
getSyncTransaction().setVisibility(mSurfaceControl, show);
|
||||
t.setVisibility(mSurfaceControl, show);
|
||||
}
|
||||
}
|
||||
mLastSurfaceShowing = show;
|
||||
|
||||
@@ -2424,7 +2424,7 @@ class TaskFragment extends WindowContainer<WindowContainer> {
|
||||
// Bounds need to be relative, as the dim layer is a child.
|
||||
final Rect dimBounds = getBounds();
|
||||
dimBounds.offsetTo(0 /* newLeft */, 0 /* newTop */);
|
||||
if (mDimmer.updateDims(getPendingTransaction(), dimBounds)) {
|
||||
if (mDimmer.updateDims(getSyncTransaction(), dimBounds)) {
|
||||
scheduleAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5256,6 +5256,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
if (mControllableInsetProvider != null) {
|
||||
return;
|
||||
}
|
||||
if (mDisplayContent.inTransition()) {
|
||||
// Skip because the animation is usually unnoticeable (e.g. covered by rotation
|
||||
// animation) and the animation bounds could be inconsistent, such as depending
|
||||
// on when the window applies its draw transaction with new rotation.
|
||||
return;
|
||||
}
|
||||
|
||||
final DisplayInfo displayInfo = getDisplayInfo();
|
||||
anim.initialize(mWindowFrames.mFrame.width(), mWindowFrames.mFrame.height(),
|
||||
@@ -5500,10 +5506,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
}
|
||||
float newHScale = mHScale * mGlobalScale * mWallpaperScale;
|
||||
float newVScale = mVScale * mGlobalScale * mWallpaperScale;
|
||||
if (mLastHScale != newHScale ||
|
||||
mLastVScale != newVScale ) {
|
||||
getPendingTransaction().setMatrix(getSurfaceControl(),
|
||||
newHScale, 0, 0, newVScale);
|
||||
if (mLastHScale != newHScale || mLastVScale != newVScale) {
|
||||
getSyncTransaction().setMatrix(mSurfaceControl, newHScale, 0, 0, newVScale);
|
||||
mLastHScale = newHScale;
|
||||
mLastVScale = newVScale;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user