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

Commit 061238ca authored by ryanlwlin's avatar ryanlwlin
Browse files

Fix incomplete magnification mode transition

The magnification mode transition is interrupted by
the interaction client state changed. This accidental
invocation leads to consecutive transition mode requests.

To fix it, we check if the display is valid before ensuring
the windows on the display is tracking.

Besides, we also drop the new request when receving same
consecutive requests during the tranistion.

Bug: 194350828
Test: manual test
      atest MagnificationControllerTest
Change-Id: I9ef4314349b033971620a52dffbdf8df3085f351
parent 3b7391c2
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1704,6 +1704,10 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
     * @param displayId The logical display id.
     */
    private void ensureWindowsAvailableTimedLocked(int displayId) {
        if (displayId == Display.INVALID_DISPLAY) {
            return;
        }

        if (mA11yWindowManager.getWindowListLocked(displayId) != null) {
            return;
        }
+5 −3
Original line number Diff line number Diff line
@@ -189,10 +189,10 @@ public class MagnificationController implements WindowMagnificationManager.Callb
            if (animationCallback.mCurrentMode == targetMode) {
                animationCallback.restoreToCurrentMagnificationMode();
                return;
            } else {
                Slog.w(TAG, "discard duplicate request");
                return;
            }
            Slog.w(TAG, "request during transition, abandon current:"
                    + animationCallback.mTargetMode);
            animationCallback.setExpiredAndRemoveFromListLocked();
        }

        if (magnificationCenter == null) {
@@ -464,7 +464,9 @@ public class MagnificationController implements WindowMagnificationManager.Callb
        private final TransitionCallBack mTransitionCallBack;
        private boolean mExpired = false;
        private final int mDisplayId;
        // The mode the in-progress animation is going to.
        private final int mTargetMode;
        // The mode the in-progress animation is going from.
        private final int mCurrentMode;
        private final float mCurrentScale;
        private final PointF mCurrentCenter = new PointF();