Fixing bugs due to the new custom accessibility action APIs.
1. AccessibiltiyAction was incorectly throwing an exception when a custom action was constructed. 2. AccessibilityManagerService should no longer enforce only standard actions as we allow custom ones too. bug:15110963 Change-Id: Iea57e0a6449b87bd8d103c55ca255e80705f2565
This commit is contained in:
committed by
The Android Automerger
parent
d23d0b8ea4
commit
89ea3cd049
@@ -318,11 +318,6 @@ public class AccessibilityNodeInfo implements Parcelable {
|
||||
*/
|
||||
private static final int ACTION_TYPE_MASK = 0xFF000000;
|
||||
|
||||
/**
|
||||
* Mask to define standard not legacy actions.
|
||||
*/
|
||||
private static final int STANDARD_NON_LEGACY_ACTION_MASK = 0x01000000;
|
||||
|
||||
// Action arguments
|
||||
|
||||
/**
|
||||
@@ -3262,14 +3257,10 @@ public class AccessibilityNodeInfo implements Parcelable {
|
||||
* @param label The label for the new AccessibilityAction.
|
||||
*/
|
||||
public AccessibilityAction(int actionId, @Nullable CharSequence label) {
|
||||
if ((actionId & ACTION_TYPE_MASK) == 0 && Integer.bitCount(actionId) > 1) {
|
||||
if ((actionId & ACTION_TYPE_MASK) == 0 && Integer.bitCount(actionId) != 1) {
|
||||
throw new IllegalArgumentException("Invalid standard action id");
|
||||
}
|
||||
|
||||
if ((actionId & STANDARD_NON_LEGACY_ACTION_MASK) != 0) {
|
||||
throw new IllegalArgumentException("action id not a resource id");
|
||||
}
|
||||
|
||||
mActionId = actionId;
|
||||
mLabel = label;
|
||||
}
|
||||
|
||||
@@ -2376,8 +2376,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
|
||||
return false;
|
||||
}
|
||||
resolvedWindowId = resolveAccessibilityWindowIdLocked(accessibilityWindowId);
|
||||
final boolean permissionGranted = mSecurityPolicy.canPerformActionLocked(this,
|
||||
resolvedWindowId, action, arguments);
|
||||
final boolean permissionGranted = mSecurityPolicy.canGetAccessibilityNodeInfoLocked(
|
||||
this, resolvedWindowId);
|
||||
if (!permissionGranted) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -3177,30 +3177,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
|
||||
final class SecurityPolicy {
|
||||
public static final int INVALID_WINDOW_ID = -1;
|
||||
|
||||
private static final int VALID_ACTIONS =
|
||||
AccessibilityNodeInfo.ACTION_CLICK
|
||||
| AccessibilityNodeInfo.ACTION_LONG_CLICK
|
||||
| AccessibilityNodeInfo.ACTION_FOCUS
|
||||
| AccessibilityNodeInfo.ACTION_CLEAR_FOCUS
|
||||
| AccessibilityNodeInfo.ACTION_SELECT
|
||||
| AccessibilityNodeInfo.ACTION_CLEAR_SELECTION
|
||||
| AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS
|
||||
| AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS
|
||||
| AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY
|
||||
| AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
|
||||
| AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT
|
||||
| AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT
|
||||
| AccessibilityNodeInfo.ACTION_SCROLL_FORWARD
|
||||
| AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD
|
||||
| AccessibilityNodeInfo.ACTION_COPY
|
||||
| AccessibilityNodeInfo.ACTION_PASTE
|
||||
| AccessibilityNodeInfo.ACTION_CUT
|
||||
| AccessibilityNodeInfo.ACTION_SET_SELECTION
|
||||
| AccessibilityNodeInfo.ACTION_EXPAND
|
||||
| AccessibilityNodeInfo.ACTION_COLLAPSE
|
||||
| AccessibilityNodeInfo.ACTION_DISMISS
|
||||
| AccessibilityNodeInfo.ACTION_SET_TEXT;
|
||||
|
||||
private static final int RETRIEVAL_ALLOWING_EVENT_TYPES =
|
||||
AccessibilityEvent.TYPE_VIEW_CLICKED
|
||||
| AccessibilityEvent.TYPE_VIEW_FOCUSED
|
||||
@@ -3452,13 +3428,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
|
||||
return canRetrieveWindowContentLocked(service) && isRetrievalAllowingWindow(windowId);
|
||||
}
|
||||
|
||||
public boolean canPerformActionLocked(Service service, int windowId, int action,
|
||||
Bundle arguments) {
|
||||
return canRetrieveWindowContentLocked(service)
|
||||
&& isRetrievalAllowingWindow(windowId)
|
||||
&& isActionPermitted(action);
|
||||
}
|
||||
|
||||
public boolean canRetrieveWindowsLocked(Service service) {
|
||||
return canRetrieveWindowContentLocked(service) && service.mRetrieveInteractiveWindows;
|
||||
}
|
||||
@@ -3538,10 +3507,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isActionPermitted(int action) {
|
||||
return (VALID_ACTIONS & action) != 0;
|
||||
}
|
||||
|
||||
private void enforceCallingPermission(String permission, String function) {
|
||||
if (OWN_PROCESS_ID == Binder.getCallingPid()) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user