Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e01ee57 authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "Removing action arguments checks." into jb-dev

parents f1790eb5 afe8cf26
Loading
Loading
Loading
Loading
+1 −25
Original line number Diff line number Diff line
@@ -1765,8 +1765,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                Bundle arguments) {
            return canRetrieveWindowContent(service)
                && isRetrievalAllowingWindow(windowId)
                && isActionPermitted(action)
                && isActionArgumentsValid(action, arguments);
                && isActionPermitted(action);
        }

        public boolean canRetrieveWindowContent(Service service) {
@@ -1790,29 +1789,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
             return (VALID_ACTIONS & action) != 0;
        }

        private boolean isActionArgumentsValid(int action, Bundle arguments) {
            switch (action) {
                case AccessibilityNodeInfo.ACTION_NEXT_AT_GRANULARITY:
                case AccessibilityNodeInfo.ACTION_PREVIOUS_AT_GRANULARITY: {
                    if (arguments.size() == 1) {
                        final int granularity = arguments.getInt(
                                AccessibilityNodeInfo.ACTION_ARGUMENT_GRANULARITY_INT);
                        return (granularity & VALID_GRANULARITIES) != 0
                                && Integer.bitCount(granularity) == 1;
                    }
                } break;
                case AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT:
                case AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT: {
                    if (arguments.size() == 1) {
                        String element = arguments.getString(
                                AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING);
                        return !TextUtils.isEmpty(element);
                    }
                } break;
            }
            return false;
        }

        private void enforceCallingPermission(String permission, String function) {
            if (OWN_PROCESS_ID == Binder.getCallingPid()) {
                return;