Search in sources :

Example 16 with IAccessibilityInteractionConnectionCallback

use of android.view.accessibility.IAccessibilityInteractionConnectionCallback in project android_frameworks_base by crdroidandroid.

the class AccessibilityInteractionController method findAccessibilityNodeInfoByAccessibilityIdUiThread.

private void findAccessibilityNodeInfoByAccessibilityIdUiThread(Message message) {
    final int flags = message.arg1;
    SomeArgs args = (SomeArgs) message.obj;
    final int accessibilityViewId = args.argi1;
    final int virtualDescendantId = args.argi2;
    final int interactionId = args.argi3;
    final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1;
    final MagnificationSpec spec = (MagnificationSpec) args.arg2;
    final Region interactiveRegion = (Region) args.arg3;
    args.recycle();
    List<AccessibilityNodeInfo> infos = mTempAccessibilityNodeInfoList;
    infos.clear();
    try {
        if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) {
            return;
        }
        mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = flags;
        View root = null;
        if (accessibilityViewId == AccessibilityNodeInfo.UNDEFINED_ITEM_ID) {
            root = mViewRootImpl.mView;
        } else {
            root = findViewByAccessibilityId(accessibilityViewId);
        }
        if (root != null && isShown(root)) {
            mPrefetcher.prefetchAccessibilityNodeInfos(root, virtualDescendantId, flags, infos);
        }
    } finally {
        try {
            mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
            applyAppScaleAndMagnificationSpecIfNeeded(infos, spec);
            // system process and obtained from a pool when read from parcel.
            if (spec != null && android.os.Process.myPid() != Binder.getCallingPid()) {
                spec.recycle();
            }
            adjustIsVisibleToUserIfNeeded(infos, interactiveRegion);
            callback.setFindAccessibilityNodeInfosResult(infos, interactionId);
            infos.clear();
        } catch (RemoteException re) {
        /* ignore - the other side will time out */
        }
        // the system process and instantiated  when read from parcel.
        if (interactiveRegion != null && android.os.Process.myPid() == Binder.getCallingPid()) {
            interactiveRegion.recycle();
        }
    }
}
Also used : IAccessibilityInteractionConnectionCallback(android.view.accessibility.IAccessibilityInteractionConnectionCallback) SomeArgs(com.android.internal.os.SomeArgs) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) Region(android.graphics.Region) RemoteException(android.os.RemoteException) Point(android.graphics.Point)

Example 17 with IAccessibilityInteractionConnectionCallback

use of android.view.accessibility.IAccessibilityInteractionConnectionCallback in project android_frameworks_base by ParanoidAndroid.

the class AccessibilityInteractionController method findAccessibilityNodeInfoByAccessibilityIdUiThread.

private void findAccessibilityNodeInfoByAccessibilityIdUiThread(Message message) {
    final int flags = message.arg1;
    SomeArgs args = (SomeArgs) message.obj;
    final int accessibilityViewId = args.argi1;
    final int virtualDescendantId = args.argi2;
    final int interactionId = args.argi3;
    final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1;
    final MagnificationSpec spec = (MagnificationSpec) args.arg2;
    args.recycle();
    List<AccessibilityNodeInfo> infos = mTempAccessibilityNodeInfoList;
    infos.clear();
    try {
        if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) {
            return;
        }
        mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = flags;
        View root = null;
        if (accessibilityViewId == AccessibilityNodeInfo.UNDEFINED) {
            root = mViewRootImpl.mView;
        } else {
            root = findViewByAccessibilityId(accessibilityViewId);
        }
        if (root != null && isShown(root)) {
            mPrefetcher.prefetchAccessibilityNodeInfos(root, virtualDescendantId, flags, infos);
        }
    } finally {
        try {
            mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
            applyAppScaleAndMagnificationSpecIfNeeded(infos, spec);
            if (spec != null) {
                spec.recycle();
            }
            callback.setFindAccessibilityNodeInfosResult(infos, interactionId);
            infos.clear();
        } catch (RemoteException re) {
        /* ignore - the other side will time out */
        }
    }
}
Also used : IAccessibilityInteractionConnectionCallback(android.view.accessibility.IAccessibilityInteractionConnectionCallback) SomeArgs(com.android.internal.os.SomeArgs) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) RemoteException(android.os.RemoteException) Point(android.graphics.Point)

Example 18 with IAccessibilityInteractionConnectionCallback

use of android.view.accessibility.IAccessibilityInteractionConnectionCallback in project android_frameworks_base by ParanoidAndroid.

the class AccessibilityInteractionController method focusSearchUiThread.

private void focusSearchUiThread(Message message) {
    final int flags = message.arg1;
    final int accessibilityViewId = message.arg2;
    SomeArgs args = (SomeArgs) message.obj;
    final int direction = args.argi2;
    final int interactionId = args.argi3;
    final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1;
    final MagnificationSpec spec = (MagnificationSpec) args.arg2;
    args.recycle();
    AccessibilityNodeInfo next = null;
    try {
        if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) {
            return;
        }
        mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = flags;
        View root = null;
        if (accessibilityViewId != AccessibilityNodeInfo.UNDEFINED) {
            root = findViewByAccessibilityId(accessibilityViewId);
        } else {
            root = mViewRootImpl.mView;
        }
        if (root != null && isShown(root)) {
            View nextView = root.focusSearch(direction);
            if (nextView != null) {
                next = nextView.createAccessibilityNodeInfo();
            }
        }
    } finally {
        try {
            mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
            applyAppScaleAndMagnificationSpecIfNeeded(next, spec);
            if (spec != null) {
                spec.recycle();
            }
            callback.setFindAccessibilityNodeInfoResult(next, interactionId);
        } catch (RemoteException re) {
        /* ignore - the other side will time out */
        }
    }
}
Also used : IAccessibilityInteractionConnectionCallback(android.view.accessibility.IAccessibilityInteractionConnectionCallback) SomeArgs(com.android.internal.os.SomeArgs) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) RemoteException(android.os.RemoteException) Point(android.graphics.Point)

Example 19 with IAccessibilityInteractionConnectionCallback

use of android.view.accessibility.IAccessibilityInteractionConnectionCallback in project android_frameworks_base by ParanoidAndroid.

the class AccessibilityInteractionController method perfromAccessibilityActionUiThread.

private void perfromAccessibilityActionUiThread(Message message) {
    final int flags = message.arg1;
    final int accessibilityViewId = message.arg2;
    SomeArgs args = (SomeArgs) message.obj;
    final int virtualDescendantId = args.argi1;
    final int action = args.argi2;
    final int interactionId = args.argi3;
    final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1;
    Bundle arguments = (Bundle) args.arg2;
    args.recycle();
    boolean succeeded = false;
    try {
        if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) {
            return;
        }
        mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = flags;
        View target = null;
        if (accessibilityViewId != AccessibilityNodeInfo.UNDEFINED) {
            target = findViewByAccessibilityId(accessibilityViewId);
        } else {
            target = mViewRootImpl.mView;
        }
        if (target != null && isShown(target)) {
            AccessibilityNodeProvider provider = target.getAccessibilityNodeProvider();
            if (provider != null) {
                succeeded = provider.performAction(virtualDescendantId, action, arguments);
            } else if (virtualDescendantId == View.NO_ID) {
                succeeded = target.performAccessibilityAction(action, arguments);
            }
        }
    } finally {
        try {
            mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
            callback.setPerformAccessibilityActionResult(succeeded, interactionId);
        } catch (RemoteException re) {
        /* ignore - the other side will time out */
        }
    }
}
Also used : IAccessibilityInteractionConnectionCallback(android.view.accessibility.IAccessibilityInteractionConnectionCallback) SomeArgs(com.android.internal.os.SomeArgs) Bundle(android.os.Bundle) RemoteException(android.os.RemoteException) AccessibilityNodeProvider(android.view.accessibility.AccessibilityNodeProvider) Point(android.graphics.Point)

Example 20 with IAccessibilityInteractionConnectionCallback

use of android.view.accessibility.IAccessibilityInteractionConnectionCallback in project android_frameworks_base by ParanoidAndroid.

the class AccessibilityInteractionController method findAccessibilityNodeInfosByTextUiThread.

private void findAccessibilityNodeInfosByTextUiThread(Message message) {
    final int flags = message.arg1;
    SomeArgs args = (SomeArgs) message.obj;
    final String text = (String) args.arg1;
    final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg2;
    final MagnificationSpec spec = (MagnificationSpec) args.arg3;
    final int accessibilityViewId = args.argi1;
    final int virtualDescendantId = args.argi2;
    final int interactionId = args.argi3;
    args.recycle();
    List<AccessibilityNodeInfo> infos = null;
    try {
        if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) {
            return;
        }
        mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = flags;
        View root = null;
        if (accessibilityViewId != AccessibilityNodeInfo.UNDEFINED) {
            root = findViewByAccessibilityId(accessibilityViewId);
        } else {
            root = mViewRootImpl.mView;
        }
        if (root != null && isShown(root)) {
            AccessibilityNodeProvider provider = root.getAccessibilityNodeProvider();
            if (provider != null) {
                infos = provider.findAccessibilityNodeInfosByText(text, virtualDescendantId);
            } else if (virtualDescendantId == AccessibilityNodeInfo.UNDEFINED) {
                ArrayList<View> foundViews = mTempArrayList;
                foundViews.clear();
                root.findViewsWithText(foundViews, text, View.FIND_VIEWS_WITH_TEXT | View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION | View.FIND_VIEWS_WITH_ACCESSIBILITY_NODE_PROVIDERS);
                if (!foundViews.isEmpty()) {
                    infos = mTempAccessibilityNodeInfoList;
                    infos.clear();
                    final int viewCount = foundViews.size();
                    for (int i = 0; i < viewCount; i++) {
                        View foundView = foundViews.get(i);
                        if (isShown(foundView)) {
                            provider = foundView.getAccessibilityNodeProvider();
                            if (provider != null) {
                                List<AccessibilityNodeInfo> infosFromProvider = provider.findAccessibilityNodeInfosByText(text, AccessibilityNodeInfo.UNDEFINED);
                                if (infosFromProvider != null) {
                                    infos.addAll(infosFromProvider);
                                }
                            } else {
                                infos.add(foundView.createAccessibilityNodeInfo());
                            }
                        }
                    }
                }
            }
        }
    } finally {
        try {
            mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
            applyAppScaleAndMagnificationSpecIfNeeded(infos, spec);
            if (spec != null) {
                spec.recycle();
            }
            callback.setFindAccessibilityNodeInfosResult(infos, interactionId);
        } catch (RemoteException re) {
        /* ignore - the other side will time out */
        }
    }
}
Also used : IAccessibilityInteractionConnectionCallback(android.view.accessibility.IAccessibilityInteractionConnectionCallback) SomeArgs(com.android.internal.os.SomeArgs) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) RemoteException(android.os.RemoteException) AccessibilityNodeProvider(android.view.accessibility.AccessibilityNodeProvider) Point(android.graphics.Point)

Aggregations

Point (android.graphics.Point)36 RemoteException (android.os.RemoteException)36 IAccessibilityInteractionConnectionCallback (android.view.accessibility.IAccessibilityInteractionConnectionCallback)36 SomeArgs (com.android.internal.os.SomeArgs)36 AccessibilityNodeInfo (android.view.accessibility.AccessibilityNodeInfo)30 Region (android.graphics.Region)25 AccessibilityNodeProvider (android.view.accessibility.AccessibilityNodeProvider)18 Bundle (android.os.Bundle)6 ArrayList (java.util.ArrayList)6 List (java.util.List)6 LinkedList (java.util.LinkedList)5