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

Commit 68aa1083 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Update surface position on removing leash for a closing window

An animating WindowState will set surface position on animation
leash and its surface will be set to (0,0), when the animation
is finished, the animation leash will be removed and the actual
surface position needs to restore to WindowState.

Because isGoneForLayout returns true if the activity is invisible
requested, then the window may miss to restore surface position.

Bug: 381968939
Flag: EXEMPT bugfix
Test: Open AppInfo. Either click Disable/Uninstall/ForceStop.
      And then click the list item immediately (e.g. Wi-Fi data).
      The dialog window should not flash on top (zero position).
Change-Id: I1a580a0d37c56fc30b3995cbbe6bd4b4d3ca6735
parent 78ed9b43
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -5300,6 +5300,18 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        }
    }

    @Override
    public void onAnimationLeashLost(Transaction t) {
        if (!mSurfacePlacementNeeded && mActivityRecord != null
                && !mActivityRecord.isVisibleRequested() && mActivityRecord.isVisible()
                && !mLastSurfacePosition.equals(mSurfacePosition)) {
            // The activity is closing but still visible. Make sure updateSurfacePosition() is not
            // skipped due to isGoneForLayout().
            mSurfacePlacementNeeded = true;
        }
        super.onAnimationLeashLost(t);
    }

    // TODO(b/70040778): We should aim to eliminate the last user of TYPE_APPLICATION_MEDIA
    // then we can drop all negative layering on the windowing side and simply inherit
    // the default implementation here.