Loading core/java/android/view/accessibility/IWindowMagnificationConnectionCallback.aidl +10 −0 Original line number Diff line number Diff line Loading @@ -50,4 +50,14 @@ import android.graphics.Rect; * @param sourceBounds The magnified bounds in screen coordinates. */ void onSourceBoundsChanged(int displayId, in Rect sourceBounds); /** * Called when the accessibility action of scale requests to be performed. * It is invoked from System UI. And the action is provided by the mirror window. * * @param displayId The logical display id. * @param scale the target scale, or {@link Float#NaN} to leave unchanged */ void onPerformScaleAction(int displayId, float scale); } packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnification.java +17 −0 Original line number Diff line number Diff line Loading @@ -145,6 +145,13 @@ public class WindowMagnification extends SystemUI implements WindowMagnifierCall } } @Override public void onPerformScaleAction(int displayId, float scale) { if (mWindowMagnificationConnectionImpl != null) { mWindowMagnificationConnectionImpl.onPerformScaleAction(displayId, scale); } } @Override public void requestWindowMagnificationConnection(boolean connect) { if (connect) { Loading Loading @@ -247,5 +254,15 @@ public class WindowMagnification extends SystemUI implements WindowMagnifierCall } } } void onPerformScaleAction(int displayId, float scale) { if (mConnectionCallback != null) { try { mConnectionCallback.onPerformScaleAction(displayId, scale); } catch (RemoteException e) { Log.e(TAG, "Failed to inform performing scale action", e); } } } } } packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java +4 −2 Original line number Diff line number Diff line Loading @@ -719,12 +719,14 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold private boolean performA11yAction(int action) { if (action == R.id.accessibility_action_zoom_in) { final float scale = mScale + A11Y_CHANGE_SCALE_DIFFERENCE; setScale(A11Y_ACTION_SCALE_RANGE.clamp(scale)); mWindowMagnifierCallback.onPerformScaleAction(mDisplayId, A11Y_ACTION_SCALE_RANGE.clamp(scale)); return true; } if (action == R.id.accessibility_action_zoom_out) { final float scale = mScale - A11Y_CHANGE_SCALE_DIFFERENCE; setScale(A11Y_ACTION_SCALE_RANGE.clamp(scale)); mWindowMagnifierCallback.onPerformScaleAction(mDisplayId, A11Y_ACTION_SCALE_RANGE.clamp(scale)); return true; } if (action == R.id.accessibility_action_move_up) { Loading packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnifierCallback.java +9 −0 Original line number Diff line number Diff line Loading @@ -37,4 +37,13 @@ interface WindowMagnifierCallback { * @param sourceBounds The magnified bounds in screen coordinates. */ void onSourceBoundsChanged(int displayId, Rect sourceBounds); /** * Called when the accessibility action of scale requests to be performed. * It is invoked from System UI. And the action is provided by the mirror window. * * @param displayId The logical display id. * @param scale the target scale, or {@link Float#NaN} to leave unchanged */ void onPerformScaleAction(int displayId, float scale); } packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationControllerTest.java +3 −2 Original line number Diff line number Diff line Loading @@ -275,6 +275,7 @@ public class WindowMagnificationControllerTest extends SysuiTestCase { @Test public void performA11yActions_visible_expectedResults() { final int displayId = mContext.getDisplayId(); mInstrumentation.runOnMainSync(() -> { mWindowMagnificationController.enableWindowMagnification(2.5f, Float.NaN, Float.NaN); Loading @@ -284,10 +285,10 @@ public class WindowMagnificationControllerTest extends SysuiTestCase { assertTrue( mMirrorView.performAccessibilityAction(R.id.accessibility_action_zoom_out, null)); // Minimum scale is 2.0. assertEquals(2.0f, mWindowMagnificationController.getScale(), 0f); verify(mWindowMagnifierCallback).onPerformScaleAction(eq(displayId), eq(2.0f)); assertTrue(mMirrorView.performAccessibilityAction(R.id.accessibility_action_zoom_in, null)); assertEquals(3.0f, mWindowMagnificationController.getScale(), 0f); verify(mWindowMagnifierCallback).onPerformScaleAction(eq(displayId), eq(3.5f)); // TODO: Verify the final state when the mirror surface is visible. assertTrue(mMirrorView.performAccessibilityAction(R.id.accessibility_action_move_up, null)); Loading Loading
core/java/android/view/accessibility/IWindowMagnificationConnectionCallback.aidl +10 −0 Original line number Diff line number Diff line Loading @@ -50,4 +50,14 @@ import android.graphics.Rect; * @param sourceBounds The magnified bounds in screen coordinates. */ void onSourceBoundsChanged(int displayId, in Rect sourceBounds); /** * Called when the accessibility action of scale requests to be performed. * It is invoked from System UI. And the action is provided by the mirror window. * * @param displayId The logical display id. * @param scale the target scale, or {@link Float#NaN} to leave unchanged */ void onPerformScaleAction(int displayId, float scale); }
packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnification.java +17 −0 Original line number Diff line number Diff line Loading @@ -145,6 +145,13 @@ public class WindowMagnification extends SystemUI implements WindowMagnifierCall } } @Override public void onPerformScaleAction(int displayId, float scale) { if (mWindowMagnificationConnectionImpl != null) { mWindowMagnificationConnectionImpl.onPerformScaleAction(displayId, scale); } } @Override public void requestWindowMagnificationConnection(boolean connect) { if (connect) { Loading Loading @@ -247,5 +254,15 @@ public class WindowMagnification extends SystemUI implements WindowMagnifierCall } } } void onPerformScaleAction(int displayId, float scale) { if (mConnectionCallback != null) { try { mConnectionCallback.onPerformScaleAction(displayId, scale); } catch (RemoteException e) { Log.e(TAG, "Failed to inform performing scale action", e); } } } } }
packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java +4 −2 Original line number Diff line number Diff line Loading @@ -719,12 +719,14 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold private boolean performA11yAction(int action) { if (action == R.id.accessibility_action_zoom_in) { final float scale = mScale + A11Y_CHANGE_SCALE_DIFFERENCE; setScale(A11Y_ACTION_SCALE_RANGE.clamp(scale)); mWindowMagnifierCallback.onPerformScaleAction(mDisplayId, A11Y_ACTION_SCALE_RANGE.clamp(scale)); return true; } if (action == R.id.accessibility_action_zoom_out) { final float scale = mScale - A11Y_CHANGE_SCALE_DIFFERENCE; setScale(A11Y_ACTION_SCALE_RANGE.clamp(scale)); mWindowMagnifierCallback.onPerformScaleAction(mDisplayId, A11Y_ACTION_SCALE_RANGE.clamp(scale)); return true; } if (action == R.id.accessibility_action_move_up) { Loading
packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnifierCallback.java +9 −0 Original line number Diff line number Diff line Loading @@ -37,4 +37,13 @@ interface WindowMagnifierCallback { * @param sourceBounds The magnified bounds in screen coordinates. */ void onSourceBoundsChanged(int displayId, Rect sourceBounds); /** * Called when the accessibility action of scale requests to be performed. * It is invoked from System UI. And the action is provided by the mirror window. * * @param displayId The logical display id. * @param scale the target scale, or {@link Float#NaN} to leave unchanged */ void onPerformScaleAction(int displayId, float scale); }
packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationControllerTest.java +3 −2 Original line number Diff line number Diff line Loading @@ -275,6 +275,7 @@ public class WindowMagnificationControllerTest extends SysuiTestCase { @Test public void performA11yActions_visible_expectedResults() { final int displayId = mContext.getDisplayId(); mInstrumentation.runOnMainSync(() -> { mWindowMagnificationController.enableWindowMagnification(2.5f, Float.NaN, Float.NaN); Loading @@ -284,10 +285,10 @@ public class WindowMagnificationControllerTest extends SysuiTestCase { assertTrue( mMirrorView.performAccessibilityAction(R.id.accessibility_action_zoom_out, null)); // Minimum scale is 2.0. assertEquals(2.0f, mWindowMagnificationController.getScale(), 0f); verify(mWindowMagnifierCallback).onPerformScaleAction(eq(displayId), eq(2.0f)); assertTrue(mMirrorView.performAccessibilityAction(R.id.accessibility_action_zoom_in, null)); assertEquals(3.0f, mWindowMagnificationController.getScale(), 0f); verify(mWindowMagnifierCallback).onPerformScaleAction(eq(displayId), eq(3.5f)); // TODO: Verify the final state when the mirror surface is visible. assertTrue(mMirrorView.performAccessibilityAction(R.id.accessibility_action_move_up, null)); Loading