Merge "Do not announce a11y move instructions in sensor area." into udc-dev am: 3b3191edd1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21618219 Change-Id: Ie7b1bba963439f261bf7ae5789d9468945a3d20d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -62,16 +62,7 @@ public class UdfpsUtils {
|
|||||||
*/
|
*/
|
||||||
public Point getTouchInNativeCoordinates(int idx, MotionEvent event,
|
public Point getTouchInNativeCoordinates(int idx, MotionEvent event,
|
||||||
UdfpsOverlayParams udfpsOverlayParams) {
|
UdfpsOverlayParams udfpsOverlayParams) {
|
||||||
Point portraitTouch = new Point((int) event.getRawX(idx), (int) event.getRawY(idx));
|
Point portraitTouch = getPortraitTouch(idx, event, udfpsOverlayParams);
|
||||||
int rot = udfpsOverlayParams.getRotation();
|
|
||||||
if (rot == Surface.ROTATION_90 || rot == Surface.ROTATION_270) {
|
|
||||||
RotationUtils.rotatePoint(
|
|
||||||
portraitTouch,
|
|
||||||
RotationUtils.deltaRotation(rot, Surface.ROTATION_0),
|
|
||||||
udfpsOverlayParams.getLogicalDisplayWidth(),
|
|
||||||
udfpsOverlayParams.getLogicalDisplayHeight()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scale the coordinates to native resolution.
|
// Scale the coordinates to native resolution.
|
||||||
float scale = udfpsOverlayParams.getScaleFactor();
|
float scale = udfpsOverlayParams.getScaleFactor();
|
||||||
@@ -80,14 +71,26 @@ public class UdfpsUtils {
|
|||||||
return portraitTouch;
|
return portraitTouch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param idx The pointer identifier.
|
||||||
|
* @param event The MotionEvent object containing full information about the event.
|
||||||
|
* @param udfpsOverlayParams The [UdfpsOverlayParams] used.
|
||||||
|
* @return Whether the touch event is within sensor area.
|
||||||
|
*/
|
||||||
|
public boolean isWithinSensorArea(int idx, MotionEvent event,
|
||||||
|
UdfpsOverlayParams udfpsOverlayParams) {
|
||||||
|
Point portraitTouch = getPortraitTouch(idx, event, udfpsOverlayParams);
|
||||||
|
return udfpsOverlayParams.getSensorBounds().contains(portraitTouch.x, portraitTouch.y);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function computes the angle of touch relative to the sensor and maps the angle to a list
|
* This function computes the angle of touch relative to the sensor and maps the angle to a list
|
||||||
* of help messages which are announced if accessibility is enabled.
|
* of help messages which are announced if accessibility is enabled.
|
||||||
*
|
*
|
||||||
* @return Whether the announcing string is null
|
* @return Whether the announcing string is null
|
||||||
*/
|
*/
|
||||||
public String onTouchOutsideOfSensorArea(boolean touchExplorationEnabled,
|
public String onTouchOutsideOfSensorArea(boolean touchExplorationEnabled, Context context,
|
||||||
Context context, int touchX, int touchY, UdfpsOverlayParams udfpsOverlayParams) {
|
int scaledTouchX, int scaledTouchY, UdfpsOverlayParams udfpsOverlayParams) {
|
||||||
if (!touchExplorationEnabled) {
|
if (!touchExplorationEnabled) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -106,8 +109,8 @@ public class UdfpsUtils {
|
|||||||
String theStr =
|
String theStr =
|
||||||
onTouchOutsideOfSensorAreaImpl(
|
onTouchOutsideOfSensorAreaImpl(
|
||||||
touchHints,
|
touchHints,
|
||||||
touchX,
|
scaledTouchX,
|
||||||
touchY,
|
scaledTouchY,
|
||||||
scaledSensorX,
|
scaledSensorX,
|
||||||
scaledSensorY,
|
scaledSensorY,
|
||||||
udfpsOverlayParams.getRotation()
|
udfpsOverlayParams.getRotation()
|
||||||
@@ -156,4 +159,22 @@ public class UdfpsUtils {
|
|||||||
}
|
}
|
||||||
return touchHints[index];
|
return touchHints[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map the touch to portrait mode if the device is in landscape mode.
|
||||||
|
*/
|
||||||
|
private Point getPortraitTouch(int idx, MotionEvent event,
|
||||||
|
UdfpsOverlayParams udfpsOverlayParams) {
|
||||||
|
Point portraitTouch = new Point((int) event.getRawX(idx), (int) event.getRawY(idx));
|
||||||
|
int rot = udfpsOverlayParams.getRotation();
|
||||||
|
if (rot == Surface.ROTATION_90 || rot == Surface.ROTATION_270) {
|
||||||
|
RotationUtils.rotatePoint(
|
||||||
|
portraitTouch,
|
||||||
|
RotationUtils.deltaRotation(rot, Surface.ROTATION_0),
|
||||||
|
udfpsOverlayParams.getLogicalDisplayWidth(),
|
||||||
|
udfpsOverlayParams.getLogicalDisplayHeight()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return portraitTouch;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user