Search in sources :

Example 66 with SomeArgs

use of com.android.internal.os.SomeArgs in project android_frameworks_base by crdroidandroid.

the class AccessibilityInteractionController method findAccessibilityNodeInfoByAccessibilityIdClientThread.

public void findAccessibilityNodeInfoByAccessibilityIdClientThread(long accessibilityNodeId, Region interactiveRegion, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid, MagnificationSpec spec) {
    Message message = mHandler.obtainMessage();
    message.what = PrivateHandler.MSG_FIND_ACCESSIBILITY_NODE_INFO_BY_ACCESSIBILITY_ID;
    message.arg1 = flags;
    SomeArgs args = SomeArgs.obtain();
    args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
    args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
    args.argi3 = interactionId;
    args.arg1 = callback;
    args.arg2 = spec;
    args.arg3 = interactiveRegion;
    message.obj = args;
    // client can handle the message to generate the result.
    if (interrogatingPid == mMyProcessId && interrogatingTid == mMyLooperThreadId) {
        AccessibilityInteractionClient.getInstanceForThread(interrogatingTid).setSameThreadMessage(message);
    } else {
        mHandler.sendMessage(message);
    }
}
Also used : Message(android.os.Message) SomeArgs(com.android.internal.os.SomeArgs)

Example 67 with SomeArgs

use of com.android.internal.os.SomeArgs in project android_frameworks_base by crdroidandroid.

the class AccessibilityInteractionController method performAccessibilityActionClientThread.

public void performAccessibilityActionClientThread(long accessibilityNodeId, int action, Bundle arguments, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid, long interrogatingTid) {
    Message message = mHandler.obtainMessage();
    message.what = PrivateHandler.MSG_PERFORM_ACCESSIBILITY_ACTION;
    message.arg1 = flags;
    message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
    SomeArgs args = SomeArgs.obtain();
    args.argi1 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
    args.argi2 = action;
    args.argi3 = interactionId;
    args.arg1 = callback;
    args.arg2 = arguments;
    message.obj = args;
    // client can handle the message to generate the result.
    if (interogatingPid == mMyProcessId && interrogatingTid == mMyLooperThreadId) {
        AccessibilityInteractionClient.getInstanceForThread(interrogatingTid).setSameThreadMessage(message);
    } else {
        mHandler.sendMessage(message);
    }
}
Also used : Message(android.os.Message) SomeArgs(com.android.internal.os.SomeArgs)

Example 68 with SomeArgs

use of com.android.internal.os.SomeArgs in project android_frameworks_base by crdroidandroid.

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;
    final Region interactiveRegion = (Region) args.arg4;
    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_ITEM_ID) {
            root = findViewByAccessibilityId(accessibilityViewId);
        } else {
            root = mViewRootImpl.mView;
        }
        if (root != null && isShown(root)) {
            AccessibilityNodeProvider provider = root.getAccessibilityNodeProvider();
            if (provider != null) {
                if (virtualDescendantId != AccessibilityNodeInfo.UNDEFINED_ITEM_ID) {
                    infos = provider.findAccessibilityNodeInfosByText(text, virtualDescendantId);
                } else {
                    infos = provider.findAccessibilityNodeInfosByText(text, AccessibilityNodeProvider.HOST_VIEW_ID);
                }
            } else if (virtualDescendantId == AccessibilityNodeInfo.UNDEFINED_ITEM_ID) {
                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, AccessibilityNodeProvider.HOST_VIEW_ID);
                                if (infosFromProvider != null) {
                                    infos.addAll(infosFromProvider);
                                }
                            } else {
                                infos.add(foundView.createAccessibilityNodeInfo());
                            }
                        }
                    }
                }
            }
        }
    } 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);
        } 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 : AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) ArrayList(java.util.ArrayList) AccessibilityNodeProvider(android.view.accessibility.AccessibilityNodeProvider) Point(android.graphics.Point) IAccessibilityInteractionConnectionCallback(android.view.accessibility.IAccessibilityInteractionConnectionCallback) SomeArgs(com.android.internal.os.SomeArgs) Region(android.graphics.Region) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) RemoteException(android.os.RemoteException)

Example 69 with SomeArgs

use of com.android.internal.os.SomeArgs 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 70 with SomeArgs

use of com.android.internal.os.SomeArgs in project android_frameworks_base by crdroidandroid.

the class RecentsImplProxy method dockTopTask.

@Override
public void dockTopTask(int topTaskId, int dragMode, int stackCreateMode, Rect initialBounds) throws RemoteException {
    SomeArgs args = SomeArgs.obtain();
    args.argi1 = topTaskId;
    args.argi2 = dragMode;
    args.argi3 = stackCreateMode;
    args.arg1 = initialBounds;
    mHandler.sendMessage(mHandler.obtainMessage(MSG_DOCK_TOP_TASK, args));
}
Also used : SomeArgs(com.android.internal.os.SomeArgs)

Aggregations

SomeArgs (com.android.internal.os.SomeArgs)187 Message (android.os.Message)67 Point (android.graphics.Point)46 RemoteException (android.os.RemoteException)42 IAccessibilityInteractionConnectionCallback (android.view.accessibility.IAccessibilityInteractionConnectionCallback)36 AccessibilityNodeInfo (android.view.accessibility.AccessibilityNodeInfo)30 Region (android.graphics.Region)25 AccessibilityNodeProvider (android.view.accessibility.AccessibilityNodeProvider)18 IInputMethod (com.android.internal.view.IInputMethod)12 InputChannel (android.view.InputChannel)11 EditorInfo (android.view.inputmethod.EditorInfo)11 IInputContext (com.android.internal.view.IInputContext)11 Rect (android.graphics.Rect)7 Configuration (android.content.res.Configuration)6 Bundle (android.os.Bundle)6 IBinder (android.os.IBinder)6 InputBinding (android.view.inputmethod.InputBinding)6 InputConnection (android.view.inputmethod.InputConnection)6 InputMethod (android.view.inputmethod.InputMethod)6 IInputMethodClient (com.android.internal.view.IInputMethodClient)6