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

Commit 02040422 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "a11y: add zoomInFullScreenMagnification method in MagnificationController" into main

parents 65312c8f baaac5fa
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -478,6 +478,24 @@ public class MagnificationController implements MagnificationConnectionManager.C
                || getMagnificationConnectionManager().isWindowMagnifierEnabled(displayId);
    }

    /**
     * Perform the action to activate the fullscreen magnification and zoom in with persisted scale.
     *
     * @param displayId The logical display id
     */
    public void zoomInFullScreenMagnification(int displayId) {
        final float scale = mFullScreenMagnificationController.getPersistedScale(displayId);
        mFullScreenMagnificationController.setScaleAndCenter(
                displayId,
                scale,
                Float.NaN,
                Float.NaN,
                /* animate= */ true,
                AccessibilityManagerService.MAGNIFICATION_GESTURE_HANDLER_ID);

        // TODO: b/440359677 - Rename the method and add zoom in for window magnification.
    }

    private void maybeContinuePan() {
        if (mActivePanDisplay == Display.INVALID_DISPLAY) {
            return;
+19 −1
Original line number Diff line number Diff line
@@ -36,8 +36,8 @@ import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyFloat;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.floatThat;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.floatThat;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doAnswer;
@@ -2472,6 +2472,24 @@ public class MagnificationControllerTest {
                .onFullscreenMagnificationActivationChanged(TEST_DISPLAY, /* activated= */ true);
    }

    @Test
    public void zoomInFullScreenMagnification_setsPersistedScale() throws RemoteException {
        final float persistedScale = mScreenMagnificationController.getPersistedScale(TEST_DISPLAY);

        // Perform the zoom-in action
        mMagnificationController.zoomInFullScreenMagnification(TEST_DISPLAY);

        // Verify that the scale is set to the persisted value
        verify(mScreenMagnificationController)
                .setScaleAndCenter(
                        eq(TEST_DISPLAY),
                        eq(persistedScale),
                        eq(Float.NaN),
                        eq(Float.NaN),
                        /* animate= */ eq(true),
                        eq(AccessibilityManagerService.MAGNIFICATION_GESTURE_HANDLER_ID));
    }

    private void setMagnificationEnabled(int mode) throws RemoteException {
        setMagnificationEnabled(mode, MAGNIFIED_CENTER_X, MAGNIFIED_CENTER_Y);
    }