Disables tracking focus on move a11y actions.
After a user perform a11y action, namely moving up/down/left/right, we
have to disable tracking focus functionality.
We refactor #onDrag to a more general term #onMove to cover any move
action which has to disable tracking focus functionality.
Bug: 218935435
Test: atest WindowMagnificationTest
atest WindowMagnificationControllerTest
atest WindowMagnificationManagerTest
Change-Id: I578b301645a08c71e874fe2f4fcf2557202abefd
This commit is contained in:
@@ -68,12 +68,10 @@ import android.graphics.Rect;
|
||||
void onAccessibilityActionPerformed(int displayId);
|
||||
|
||||
/**
|
||||
* Called when the user is performing dragging gesture. It is started after the offset
|
||||
* between the down location and the move event location exceed
|
||||
* {@link ViewConfiguration#getScaledTouchSlop()}.
|
||||
* Called when the user is performing move action.
|
||||
*
|
||||
* @param displayId The logical display id.
|
||||
*/
|
||||
void onDrag(int displayId);
|
||||
void onMove(int displayId);
|
||||
|
||||
}
|
||||
|
||||
@@ -221,9 +221,9 @@ public class WindowMagnification extends CoreStartable implements WindowMagnifie
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrag(int displayId) {
|
||||
public void onMove(int displayId) {
|
||||
if (mWindowMagnificationConnectionImpl != null) {
|
||||
mWindowMagnificationConnectionImpl.onDrag(displayId);
|
||||
mWindowMagnificationConnectionImpl.onMove(displayId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,10 +150,10 @@ class WindowMagnificationConnectionImpl extends IWindowMagnificationConnection.S
|
||||
}
|
||||
}
|
||||
|
||||
void onDrag(int displayId) {
|
||||
void onMove(int displayId) {
|
||||
if (mConnectionCallback != null) {
|
||||
try {
|
||||
mConnectionCallback.onDrag(displayId);
|
||||
mConnectionCallback.onMove(displayId);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Failed to inform taking control by a user", e);
|
||||
}
|
||||
|
||||
@@ -852,6 +852,7 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
|
||||
@Override
|
||||
public void move(int xOffset, int yOffset) {
|
||||
moveWindowMagnifier(xOffset, yOffset);
|
||||
mWindowMagnifierCallback.onMove(mDisplayId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1045,8 +1046,7 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
|
||||
|
||||
@Override
|
||||
public boolean onDrag(float offsetX, float offsetY) {
|
||||
moveWindowMagnifier(offsetX, offsetY);
|
||||
mWindowMagnifierCallback.onDrag(mDisplayId);
|
||||
move((int) offsetX, (int) offsetY);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.android.systemui.accessibility;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.ViewConfiguration;
|
||||
|
||||
/**
|
||||
* A callback to inform {@link com.android.server.accessibility.AccessibilityManagerService} about
|
||||
@@ -56,11 +55,9 @@ interface WindowMagnifierCallback {
|
||||
void onAccessibilityActionPerformed(int displayId);
|
||||
|
||||
/**
|
||||
* Called when the user is performing dragging gesture. It is started after the offset
|
||||
* between the down location and the move event location exceed
|
||||
* {@link ViewConfiguration#getScaledTouchSlop()}.
|
||||
* Called when the user is performing a move action.
|
||||
*
|
||||
* @param displayId The logical display id.
|
||||
*/
|
||||
void onDrag(int displayId);
|
||||
void onMove(int displayId);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import static org.mockito.Mockito.atLeastOnce;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.timeout;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -566,6 +567,7 @@ public class WindowMagnificationControllerTest extends SysuiTestCase {
|
||||
mirrorView.performAccessibilityAction(R.id.accessibility_action_move_right, null));
|
||||
assertTrue(
|
||||
mirrorView.performAccessibilityAction(R.id.accessibility_action_move_left, null));
|
||||
verify(mWindowMagnifierCallback, times(4)).onMove(eq(displayId));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -148,13 +148,13 @@ public class WindowMagnificationTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDrag_enabled_notifyCallback() throws RemoteException {
|
||||
public void onMove_enabled_notifyCallback() throws RemoteException {
|
||||
mCommandQueue.requestWindowMagnificationConnection(true);
|
||||
waitForIdleSync();
|
||||
|
||||
mWindowMagnification.onDrag(TEST_DISPLAY);
|
||||
mWindowMagnification.onMove(TEST_DISPLAY);
|
||||
|
||||
verify(mConnectionCallback).onDrag(TEST_DISPLAY);
|
||||
verify(mConnectionCallback).onMove(TEST_DISPLAY);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -834,10 +834,10 @@ public class WindowMagnificationManager implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrag(int displayId) {
|
||||
public void onMove(int displayId) {
|
||||
if (mTrace.isA11yTracingEnabledForTypes(
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK)) {
|
||||
mTrace.logTrace(TAG + "ConnectionCallback.onDrag",
|
||||
mTrace.logTrace(TAG + "ConnectionCallback.onMove",
|
||||
FLAGS_WINDOW_MAGNIFICATION_CONNECTION_CALLBACK,
|
||||
"displayId=" + displayId);
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ public class WindowMagnificationManagerTest {
|
||||
mWindowMagnificationManager.getMagnificationSourceBounds(TEST_DISPLAY, outRegion);
|
||||
final Rect requestedRect = outRegion.getBounds();
|
||||
requestedRect.offsetTo(requestedRect.right + 10, requestedRect.bottom + 10);
|
||||
mMockConnection.getConnectionCallback().onDrag(TEST_DISPLAY);
|
||||
mMockConnection.getConnectionCallback().onMove(TEST_DISPLAY);
|
||||
|
||||
mWindowMagnificationManager.onRectangleOnScreenRequested(TEST_DISPLAY,
|
||||
requestedRect.left, requestedRect.top, requestedRect.right, requestedRect.bottom);
|
||||
@@ -355,7 +355,7 @@ public class WindowMagnificationManagerTest {
|
||||
throws RemoteException {
|
||||
mWindowMagnificationManager.setConnection(mMockConnection.getConnection());
|
||||
mWindowMagnificationManager.enableWindowMagnification(TEST_DISPLAY, 3.0f, 50f, 50f);
|
||||
mMockConnection.getConnectionCallback().onDrag(TEST_DISPLAY);
|
||||
mMockConnection.getConnectionCallback().onMove(TEST_DISPLAY);
|
||||
mWindowMagnificationManager.onImeWindowVisibilityChanged(true);
|
||||
final Region outRegion = new Region();
|
||||
mWindowMagnificationManager.getMagnificationSourceBounds(TEST_DISPLAY, outRegion);
|
||||
|
||||
Reference in New Issue
Block a user