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

Commit 1e0ff8cc authored by Katie's avatar Katie
Browse files

[A11y] Allow magnifier to zoom to 20x by default

This increases the max magnifier scale available
without changing the default value or current user-set
value.

Bug: b/301565981
Test: Manual, new FullscreenMagnificationGestureHandlerTest
Flag: EXEMPT configured in system property
Change-Id: I60a69f9b87424ec864a45635fbeaebf20abe6f12
parent c9a43de0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ public final class MagnificationConstants {
    /** Minimum supported value for magnification scale. */
    public static final float SCALE_MIN_VALUE = 1.0f;

    /** Maximum supported value for magnification scale. Default of 8.0. */
    /** Maximum supported value for magnification scale. Default of 20.0. */
    public static final float SCALE_MAX_VALUE =
            Float.parseFloat(SystemProperties.get("ro.config.max_magnification_scale", "8.0"));
            Float.parseFloat(SystemProperties.get("ro.config.max_magnification_scale", "20.0"));
}
+22 −0
Original line number Diff line number Diff line
@@ -1319,6 +1319,16 @@ public class FullScreenMagnificationGestureHandlerTest {
        verify(mWindowMagnificationPromptController).showNotificationIfNeeded();
    }

    @Test
    public void testSetScaleTo2() {
        testSetScaleAndZoom(2.0f);
    }

    @Test
    public void testSetScaleTo20() {
        testSetScaleAndZoom(20.0f);
    }

    @Test
    public void testTransitToPanningState_scaleDifferenceOverThreshold_startDetecting() {
        final float scale = 2.0f;
@@ -1698,6 +1708,18 @@ public class FullScreenMagnificationGestureHandlerTest {
        assertActionsInOrder(eventCaptor.mEvents, expectedActions);
    }

    private void testSetScaleAndZoom(float scale) {
        Settings.Secure.putFloatForUser(mContext.getContentResolver(),
                Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, scale,
                UserHandle.USER_SYSTEM);

        goFromStateIdleTo(STATE_ACTIVATED_2TAPS);

        check(mMgh.mCurrentState == mMgh.mDetectingState, STATE_IDLE);
        assertThat(mMgh.mFullScreenMagnificationController.getScale(DISPLAY_0))
                .isEqualTo(scale);
    }

    private void enableOneFingerPanning(boolean enable) {
        mMockOneFingerPanningEnabled = enable;
        when(mMockOneFingerPanningSettingsProvider.isOneFingerPanningEnabled()).thenReturn(enable);
+1 −1
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ public class MagnificationConnectionManagerTest {
        mMagnificationConnectionManager.setConnection(mMockConnection.getConnection());
        mMagnificationConnectionManager.enableWindowMagnification(TEST_DISPLAY, 2.5f, NaN, NaN);

        mMagnificationConnectionManager.setScale(TEST_DISPLAY, 10.0f);
        mMagnificationConnectionManager.setScale(TEST_DISPLAY, 22.0f);

        assertEquals(mMagnificationConnectionManager.getScale(TEST_DISPLAY),
                MagnificationScaleProvider.MAX_SCALE);