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

Commit b5600f5f authored by Chris Li's avatar Chris Li
Browse files

Fix lastDispatchedState sources change

Before, in InsetsController#updateState, it directly used the same
source reference to update mSourceConsumers and mState, which will then
get the local override. This can cause issue when the activeControl is
revoked, because it will only trigger notifyInsetsChanged if the local
and last dispatched are different.

Bug: 339380439
Test: WindowInsetsControllerTests#testImeForceShowingNavigationBar
Flag: com.android.window.flags.insets_control_seq
Change-Id: Ibadeca3b6bbfa46f1e2fd0adfaf3e63b6abe8b3f
parent ab0182ca
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static android.view.WindowInsets.Type.captionBar;
import static android.view.WindowInsets.Type.ime;

import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE;
import static com.android.window.flags.Flags.insetsControlSeq;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -890,7 +891,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
        @InsetsType int visibleTypes = 0;
        @InsetsType int[] cancelledUserAnimationTypes = {0};
        for (int i = 0, size = newState.sourceSize(); i < size; i++) {
            final InsetsSource source = newState.sourceAt(i);
            final InsetsSource source = insetsControlSeq()
                    ? new InsetsSource(newState.sourceAt(i))
                    : newState.sourceAt(i);
            @InsetsType int type = source.getType();
            @AnimationType int animationType = getAnimationType(type);
            final InsetsSourceConsumer consumer = mSourceConsumers.get(source.getId());
+4 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static android.view.InsetsSourceConsumerProto.SOURCE_CONTROL;
import static android.view.InsetsSourceConsumerProto.TYPE_NUMBER;

import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE;
import static com.android.window.flags.Flags.insetsControlSeq;

import android.annotation.IntDef;
import android.annotation.Nullable;
@@ -410,7 +411,9 @@ public class InsetsSourceConsumer {

        // Frame is changing while animating. Keep note of the new frame but keep existing frame
        // until animation is finished.
        if (!insetsControlSeq()) {
            newSource = new InsetsSource(newSource);
        }
        mPendingFrame = new Rect(newSource.getFrame());
        mPendingVisibleFrame = newSource.getVisibleFrame() != null
                ? new Rect(newSource.getVisibleFrame())