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

Commit 65e9f7da authored by Candice Lo's avatar Candice Lo Committed by Automerger Merge Worker
Browse files

Merge "Support exiting edit mode when performing click action on the...

Merge "Support exiting edit mode when performing click action on the magnifier" into udc-qpr-dev am: dc371e00 am: 414e8544

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24188364



Change-Id: Ib27d29cc9c1b13690e6dc967a84c68c80927b575
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 8c7a0750 414e8544
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2406,6 +2406,8 @@
    <string name="magnification_open_settings_click_label">Open magnification settings</string>
    <!-- Click action label for magnification settings panel. [CHAR LIMIT=NONE] -->
    <string name="magnification_close_settings_click_label">Close magnification settings</string>
    <!-- Click action label for exiting magnifier edit mode. [CHAR LIMIT=NONE] -->
    <string name="magnification_exit_edit_mode_click_label">Exit edit mode</string>
    <!-- Label of the corner of a rectangle that you can tap and drag to resize the magnification area. [CHAR LIMIT=NONE] -->
    <string name="magnification_drag_corner_to_resize">Drag corner to resize</string>

+14 −2
Original line number Diff line number Diff line
@@ -1476,6 +1476,12 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
    private class MirrorWindowA11yDelegate extends View.AccessibilityDelegate {

        private CharSequence getClickAccessibilityActionLabel() {
            if (mEditSizeEnable) {
                // Perform click action to exit edit mode
                return mContext.getResources().getString(
                        R.string.magnification_exit_edit_mode_click_label);
            }

            return mSettingsPanelVisibility
                    ? mContext.getResources().getString(
                            R.string.magnification_close_settings_click_label)
@@ -1518,8 +1524,14 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold

        private boolean performA11yAction(int action) {
            if (action == AccessibilityAction.ACTION_CLICK.getId()) {
                if (mEditSizeEnable) {
                    // When edit mode is enabled, click the magnifier to exit edit mode.
                    setEditMagnifierSizeMode(false);
                } else {
                    // Simulate tapping the drag view so it opens the Settings.
                    handleSingleTap(mDragView);
                }

            } else if (action == R.id.accessibility_action_zoom_in) {
                performScale(mScale + A11Y_CHANGE_SCALE_DIFFERENCE);
            } else if (action == R.id.accessibility_action_zoom_out) {
+30 −0
Original line number Diff line number Diff line
@@ -720,6 +720,36 @@ public class WindowMagnificationControllerTest extends SysuiTestCase {
        verify(mWindowMagnifierCallback).onAccessibilityActionPerformed(eq(displayId));
    }

    @Test
    public void windowMagnifierEditMode_performA11yClickAction_exitEditMode() {
        mInstrumentation.runOnMainSync(() -> {
            mWindowMagnificationController.enableWindowMagnificationInternal(Float.NaN, Float.NaN,
                    Float.NaN);
            mWindowMagnificationController.setEditMagnifierSizeMode(true);
        });

        View closeButton = getInternalView(R.id.close_button);
        View bottomRightCorner = getInternalView(R.id.bottom_right_corner);
        View bottomLeftCorner = getInternalView(R.id.bottom_left_corner);
        View topRightCorner = getInternalView(R.id.top_right_corner);
        View topLeftCorner = getInternalView(R.id.top_left_corner);

        assertEquals(View.VISIBLE, closeButton.getVisibility());
        assertEquals(View.VISIBLE, bottomRightCorner.getVisibility());
        assertEquals(View.VISIBLE, bottomLeftCorner.getVisibility());
        assertEquals(View.VISIBLE, topRightCorner.getVisibility());
        assertEquals(View.VISIBLE, topLeftCorner.getVisibility());

        final View mirrorView = mWindowManager.getAttachedView();
        mirrorView.performAccessibilityAction(AccessibilityAction.ACTION_CLICK.getId(), null);

        assertEquals(View.GONE, closeButton.getVisibility());
        assertEquals(View.GONE, bottomRightCorner.getVisibility());
        assertEquals(View.GONE, bottomLeftCorner.getVisibility());
        assertEquals(View.GONE, topRightCorner.getVisibility());
        assertEquals(View.GONE, topLeftCorner.getVisibility());
    }

    @Test
    public void enableWindowMagnification_hasA11yWindowTitle() {
        mInstrumentation.runOnMainSync(() -> {