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

Commit 93b493a2 authored by Evan Rosky's avatar Evan Rosky
Browse files

Move insets freeze to visibleRequested change

Instead of doing freeze/unfreeze exclusively for legacy
transitions, just freeze the insets whenever an activity goes
invisible; then clear it whenever the the activity is visible.

This is compatible with shell transitions as well.

Bug: 179270750
Test: updated/added WindowContainerTests
Change-Id: Iae5025beaed7d70a4623b446a1bb73574d420663
parent 057fc812
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -4447,6 +4447,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return;
            return;
        }
        }
        mVisibleRequested = visible;
        mVisibleRequested = visible;
        setInsetsFrozen(!visible);
        if (app != null) {
        if (app != null) {
            mTaskSupervisor.onProcessActivityStateChanged(app, false /* forceBatch */);
            mTaskSupervisor.onProcessActivityStateChanged(app, false /* forceBatch */);
        }
        }
+0 −7
Original line number Original line Diff line number Diff line
@@ -4105,13 +4105,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
     */
     */
    void onWindowAnimationFinished(@NonNull WindowContainer wc, int type) {
    void onWindowAnimationFinished(@NonNull WindowContainer wc, int type) {
        if (type == ANIMATION_TYPE_APP_TRANSITION || type == ANIMATION_TYPE_RECENTS) {
        if (type == ANIMATION_TYPE_APP_TRANSITION || type == ANIMATION_TYPE_RECENTS) {
            // Unfreeze the insets state of the frozen target when the animation finished if exists.
            final Task task = wc.asTask();
            if (task != null) {
                task.forAllWindows(w -> {
                    w.clearFrozenInsetsState();
                }, true /* traverseTopToBottom */);
            }
            removeImeSurfaceImmediately();
            removeImeSurfaceImmediately();
        }
        }
    }
    }
+0 −8
Original line number Original line Diff line number Diff line
@@ -2684,14 +2684,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
            @Nullable ArrayList<WindowContainer> sources) {
            @Nullable ArrayList<WindowContainer> sources) {
        final Task task = asTask();
        final Task task = asTask();
        if (task != null && !enter && !task.isHomeOrRecentsRootTask()) {
        if (task != null && !enter && !task.isHomeOrRecentsRootTask()) {
            if (AppTransition.isClosingTransitOld(transit)) {
                // Freezes the insets state when the window is in app exiting transition, to
                // ensure the exiting window won't receive unexpected insets changes from the
                // next window.
                task.forAllWindows(w -> {
                    w.freezeInsetsState();
                }, true /* traverseTopToBottom */);
            }
            mDisplayContent.showImeScreenshot();
            mDisplayContent.showImeScreenshot();
        }
        }
        final Pair<AnimationAdapter, AnimationAdapter> adapters = getAnimationAdapter(lp,
        final Pair<AnimationAdapter, AnimationAdapter> adapters = getAnimationAdapter(lp,
+1 −1
Original line number Original line Diff line number Diff line
@@ -797,7 +797,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
     * {@link InsetsStateController#notifyInsetsChanged}.
     * {@link InsetsStateController#notifyInsetsChanged}.
     */
     */
    boolean isReadyToDispatchInsetsState() {
    boolean isReadyToDispatchInsetsState() {
        return isVisible() && mFrozenInsetsState == null;
        return isVisibleRequested() && mFrozenInsetsState == null;
    }
    }


    void seamlesslyRotateIfAllowed(Transaction transaction, @Rotation int oldRotation,
    void seamlesslyRotateIfAllowed(Transaction transaction, @Rotation int oldRotation,
+9 −0
Original line number Original line Diff line number Diff line
@@ -736,4 +736,13 @@ class WindowToken extends WindowContainer<WindowState> {
    boolean isFromClient() {
    boolean isFromClient() {
        return mFromClientToken;
        return mFromClientToken;
    }
    }

    /** @see WindowState#freezeInsetsState() */
    void setInsetsFrozen(boolean freeze) {
        if (freeze) {
            forAllWindows(WindowState::freezeInsetsState, true /* traverseTopToBottom */);
        } else {
            forAllWindows(WindowState::clearFrozenInsetsState, true /* traverseTopToBottom */);
        }
    }
}
}
Loading