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

Commit 848544b4 authored by wilsonshih's avatar wilsonshih
Browse files

Allow WindowState to assign layer during transition.

But don't build the layer info into finish transaction.
So when an Activity contains multiple WindowState, the layers can be
update according to the hierarchy order. Keeps the layers as zero can
confuse surface flinger. Also this shouldn't affect transition since
window state won't participat transition directly.

Bug: 270906945
Bug: 275459505
Test: manual, launch app and monitor the z order of windows can change
during transition animation.

Change-Id: I10daa1c4d9403dc29e5c740670d43a7590f647c0
parent b0658303
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -503,8 +503,14 @@ class TransitionController {
     * playing, but can be "opened-up" for certain transition operations like calculating layers
     * for finishTransaction.
     */
    boolean canAssignLayers() {
        return mBuildingFinishLayers || !isPlaying();
    boolean canAssignLayers(@NonNull WindowContainer wc) {
        // Don't build window state into finish transaction in case another window is added or
        // removed during transition playing.
        if (mBuildingFinishLayers) {
            return wc.asWindowState() == null;
        }
        // Always allow WindowState to assign layers since it won't affect transition.
        return wc.asWindowState() != null || !isPlaying();
    }

    @WindowConfiguration.WindowingMode
+1 −1
Original line number Diff line number Diff line
@@ -2596,7 +2596,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    void assignLayer(Transaction t, int layer) {
        // Don't assign layers while a transition animation is playing
        // TODO(b/173528115): establish robust best-practices around z-order fighting.
        if (!mTransitionController.canAssignLayers()) return;
        if (!mTransitionController.canAssignLayers(this)) return;
        final boolean changed = layer != mLastLayer || mLastRelativeToLayer != null;
        if (mSurfaceControl != null && changed) {
            setLayer(t, layer);