Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c172495 authored by buwenjing's avatar buwenjing Committed by Riddle Hsu
Browse files

Restore content surface to transition root when animation finishes



In case the finish transaction won't apply immediately if there are
subsequent transitions to run, e.g. DefaultMixedHandler. Otherwise
before the finish transaction applies, the screen may be black
because the parent of content surface is removed.

The transition surface hierarchy when performing rotation animation
with visible wallpaper (back effect only creates for the case):
 Transition root
  > Back effect (background color for windowing layer)
   > Windowing layer (the content, i.e. mSurfaceControl)

Bug: 411163941
Flag: EXEMPT  bugfix
Test: While holding device in landscape, enter split screen
      from portrait home. There won't flash a black screen.

Change-Id: I93f95ac05e2233e4492f0461cdfff7f84b94bde8
Signed-off-by: default avatarbuwenjing <buwenjing@xiaomi.com>
parent eb737b68
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ class ScreenRotationAnimation {
    private final float[] mTmpFloats = new float[9];
    /** The leash of the changing window container. */
    private final SurfaceControl mSurfaceControl;
    private final SurfaceControl mRootLeash;

    private final int mAnimHint;
    private final int mStartWidth;
@@ -123,6 +124,7 @@ class ScreenRotationAnimation {
        mAnimHint = animHint;

        mSurfaceControl = change.getLeash();
        mRootLeash = rootLeash;
        mStartWidth = change.getStartAbsBounds().width();
        mStartHeight = change.getStartAbsBounds().height();
        mEndWidth = change.getEndAbsBounds().width();
@@ -390,6 +392,10 @@ class ScreenRotationAnimation {
            t.remove(mBackColorSurface);
        }
        if (mBackEffectSurface != null && mBackEffectSurface.isValid()) {
            // Restore the content surface to transition root because it was moved to BackEffect.
            if (mSurfaceControl.isValid() && mRootLeash.isValid()) {
                t.reparent(mSurfaceControl, mRootLeash);
            }
            t.remove(mBackEffectSurface);
        }
        t.apply();