Add new APIs for initial accessibility focus setting
Bug: 255189088 Test: ran cts tests Change-Id: Iaf5f863f22c4263be2cb2687ede566939e630d2b
This commit is contained in:
@@ -52369,6 +52369,7 @@ package android.view.accessibility {
|
||||
method public String getViewIdResourceName();
|
||||
method public android.view.accessibility.AccessibilityWindowInfo getWindow();
|
||||
method public int getWindowId();
|
||||
method public boolean hasRequestInitialAccessibilityFocus();
|
||||
method public boolean isAccessibilityFocused();
|
||||
method public boolean isCheckable();
|
||||
method public boolean isChecked();
|
||||
@@ -52448,6 +52449,7 @@ package android.view.accessibility {
|
||||
method public void setPassword(boolean);
|
||||
method public void setQueryFromAppProcessEnabled(@NonNull android.view.View, boolean);
|
||||
method public void setRangeInfo(android.view.accessibility.AccessibilityNodeInfo.RangeInfo);
|
||||
method public void setRequestInitialAccessibilityFocus(boolean);
|
||||
method public void setScreenReaderFocusable(boolean);
|
||||
method public void setScrollable(boolean);
|
||||
method public void setSelected(boolean);
|
||||
|
||||
@@ -820,6 +820,8 @@ public class AccessibilityNodeInfo implements Parcelable {
|
||||
|
||||
private static final int BOOLEAN_PROPERTY_IS_TEXT_SELECTABLE = 0x0800000;
|
||||
|
||||
private static final int BOOLEAN_PROPERTY_REQUEST_INITIAL_ACCESSIBILITY_FOCUS = 1 << 24;
|
||||
|
||||
/**
|
||||
* Bits that provide the id of a virtual descendant of a view.
|
||||
*/
|
||||
@@ -2490,6 +2492,38 @@ public class AccessibilityNodeInfo implements Parcelable {
|
||||
setBooleanProperty(BOOLEAN_PROPERTY_IS_TEXT_SELECTABLE, selectableText);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the node has {@link #setRequestInitialAccessibilityFocus}.
|
||||
*
|
||||
* @return True if the node has requested initial accessibility focus.
|
||||
*/
|
||||
public boolean hasRequestInitialAccessibilityFocus() {
|
||||
return getBooleanProperty(BOOLEAN_PROPERTY_REQUEST_INITIAL_ACCESSIBILITY_FOCUS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the node has requested initial accessibility focus.
|
||||
*
|
||||
* <p>
|
||||
* If the node {@link #hasRequestInitialAccessibilityFocus}, this node would be one of
|
||||
* candidates to be accessibility focused when the window appears.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <strong>Note:</strong> Cannot be called from an
|
||||
* {@link android.accessibilityservice.AccessibilityService}.
|
||||
* This class is made immutable before being delivered to an AccessibilityService.
|
||||
* </p>
|
||||
*
|
||||
* @param requestInitialAccessibilityFocus True if the node requests to receive initial
|
||||
* accessibility focus.
|
||||
* @throws IllegalStateException If called from an AccessibilityService.
|
||||
*/
|
||||
public void setRequestInitialAccessibilityFocus(boolean requestInitialAccessibilityFocus) {
|
||||
setBooleanProperty(BOOLEAN_PROPERTY_REQUEST_INITIAL_ACCESSIBILITY_FOCUS,
|
||||
requestInitialAccessibilityFocus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if the node is editable.
|
||||
*
|
||||
|
||||
@@ -58,7 +58,7 @@ public class AccessibilityNodeInfoTest {
|
||||
|
||||
// The number of flags held in boolean properties. Their values should also be double-checked
|
||||
// in the methods above.
|
||||
private static final int NUM_BOOLEAN_PROPERTIES = 24;
|
||||
private static final int NUM_BOOLEAN_PROPERTIES = 25;
|
||||
|
||||
@Test
|
||||
public void testStandardActions_serializationFlagIsValid() {
|
||||
|
||||
Reference in New Issue
Block a user