Loading packages/SystemUI/res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -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> Loading packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java +14 −2 Original line number Diff line number Diff line Loading @@ -1446,6 +1446,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) Loading Loading @@ -1488,8 +1494,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) { Loading packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationControllerTest.java +30 −0 Original line number Diff line number Diff line Loading @@ -681,6 +681,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(() -> { Loading Loading
packages/SystemUI/res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -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> Loading
packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java +14 −2 Original line number Diff line number Diff line Loading @@ -1446,6 +1446,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) Loading Loading @@ -1488,8 +1494,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) { Loading
packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationControllerTest.java +30 −0 Original line number Diff line number Diff line Loading @@ -681,6 +681,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(() -> { Loading