use of com.android.internal.os.SomeArgs in project android_frameworks_base by ParanoidAndroid.
the class AccessibilityInteractionController method findAccessibilityNodeInfosByTextClientThread.
public void findAccessibilityNodeInfosByTextClientThread(long accessibilityNodeId, String text, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid, MagnificationSpec spec) {
Message message = mHandler.obtainMessage();
message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_TEXT;
message.arg1 = flags;
SomeArgs args = SomeArgs.obtain();
args.arg1 = text;
args.arg2 = callback;
args.arg3 = spec;
args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
args.argi3 = interactionId;
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);
}
}
use of com.android.internal.os.SomeArgs in project android_frameworks_base by ParanoidAndroid.
the class AccessibilityInteractionController method findFocusUiThread.
private void findFocusUiThread(Message message) {
final int flags = message.arg1;
final int focusType = message.arg2;
SomeArgs args = (SomeArgs) message.obj;
final int interactionId = args.argi1;
final int accessibilityViewId = args.argi2;
final int virtualDescendantId = args.argi3;
final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1;
final MagnificationSpec spec = (MagnificationSpec) args.arg2;
args.recycle();
AccessibilityNodeInfo focused = 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)) {
switch(focusType) {
case AccessibilityNodeInfo.FOCUS_ACCESSIBILITY:
{
View host = mViewRootImpl.mAccessibilityFocusedHost;
// of the root from which to start the search, then the search failed.
if (host == null || !ViewRootImpl.isViewDescendantOf(host, root)) {
break;
}
// If the host has a provider ask this provider to search for the
// focus instead fetching all provider nodes to do the search here.
AccessibilityNodeProvider provider = host.getAccessibilityNodeProvider();
if (provider != null) {
if (mViewRootImpl.mAccessibilityFocusedVirtualView != null) {
focused = AccessibilityNodeInfo.obtain(mViewRootImpl.mAccessibilityFocusedVirtualView);
}
} else if (virtualDescendantId == View.NO_ID) {
focused = host.createAccessibilityNodeInfo();
}
}
break;
case AccessibilityNodeInfo.FOCUS_INPUT:
{
// Input focus cannot go to virtual views.
View target = root.findFocus();
if (target != null && isShown(target)) {
focused = target.createAccessibilityNodeInfo();
}
}
break;
default:
throw new IllegalArgumentException("Unknown focus type: " + focusType);
}
}
} finally {
try {
mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
applyAppScaleAndMagnificationSpecIfNeeded(focused, spec);
if (spec != null) {
spec.recycle();
}
callback.setFindAccessibilityNodeInfoResult(focused, interactionId);
} catch (RemoteException re) {
/* ignore - the other side will time out */
}
}
}
use of com.android.internal.os.SomeArgs in project android_frameworks_base by ParanoidAndroid.
the class AccessibilityInjectorFallback method traverseGivenAxis.
/**
* Traverse the document along the given navigation axis.
*
* @param direction The direction of traversal.
* @param axis The axis along which to traverse.
* @param sendEvent Whether to send an accessibility event to
* announce the change.
* @param contentDescription A description of the performed action.
*/
private boolean traverseGivenAxis(int direction, int axis, boolean sendEvent, String contentDescription, boolean sychronous) {
final WebViewCore webViewCore = mWebView.getWebViewCore();
if (webViewCore == null) {
return false;
}
if (sendEvent) {
final AccessibilityEvent event = getPartialyPopulatedAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY);
// The text will be set upon receiving the selection string.
event.setContentDescription(contentDescription);
mScheduledEvent = event;
mScheduledToken++;
}
// result in cursor ring movement and selection of its content
if (axis == NAVIGATION_AXIS_DEFAULT_WEB_VIEW_BEHAVIOR) {
return false;
}
final SomeArgs args = SomeArgs.obtain();
args.argi1 = direction;
args.argi2 = axis;
args.argi3 = mScheduledToken;
// If we don't need synchronous results, just return true.
if (!sychronous) {
webViewCore.sendMessage(EventHub.MODIFY_SELECTION, args);
return true;
}
final boolean callbackResult;
synchronized (mCallbackLock) {
mCallbackReceived = false;
// Asynchronously changes the selection in WebView, which responds by
// calling onSelectionStringChanged().
webViewCore.sendMessage(EventHub.MODIFY_SELECTION, args);
try {
mCallbackLock.wait(MODIFY_SELECTION_TIMEOUT);
} catch (InterruptedException e) {
// Do nothing.
}
callbackResult = mCallbackResult;
}
return (mCallbackReceived && callbackResult);
}
use of com.android.internal.os.SomeArgs in project android_frameworks_base by ParanoidAndroid.
the class ViewRootImpl method dispatchResized.
public void dispatchResized(Rect frame, Rect overscanInsets, Rect contentInsets, Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
if (DEBUG_LAYOUT)
Log.v(TAG, "Resizing " + this + ": frame=" + frame.toShortString() + " contentInsets=" + contentInsets.toShortString() + " visibleInsets=" + visibleInsets.toShortString() + " reportDraw=" + reportDraw);
Message msg = mHandler.obtainMessage(reportDraw ? MSG_RESIZED_REPORT : MSG_RESIZED);
if (mTranslator != null) {
mTranslator.translateRectInScreenToAppWindow(frame);
mTranslator.translateRectInScreenToAppWindow(overscanInsets);
mTranslator.translateRectInScreenToAppWindow(contentInsets);
mTranslator.translateRectInScreenToAppWindow(visibleInsets);
}
SomeArgs args = SomeArgs.obtain();
final boolean sameProcessCall = (Binder.getCallingPid() == android.os.Process.myPid());
args.arg1 = sameProcessCall ? new Rect(frame) : frame;
args.arg2 = sameProcessCall ? new Rect(contentInsets) : contentInsets;
args.arg3 = sameProcessCall ? new Rect(visibleInsets) : visibleInsets;
args.arg4 = sameProcessCall && newConfig != null ? new Configuration(newConfig) : newConfig;
args.arg5 = sameProcessCall ? new Rect(overscanInsets) : overscanInsets;
msg.obj = args;
mHandler.sendMessage(msg);
}
use of com.android.internal.os.SomeArgs in project android_frameworks_base by ParanoidAndroid.
the class InputMethodManagerService method handleMessage.
@Override
public boolean handleMessage(Message msg) {
SomeArgs args;
switch(msg.what) {
case MSG_SHOW_IM_PICKER:
showInputMethodMenu();
return true;
case MSG_SHOW_IM_SUBTYPE_PICKER:
showInputMethodSubtypeMenu();
return true;
case MSG_SHOW_IM_SUBTYPE_ENABLER:
args = (SomeArgs) msg.obj;
showInputMethodAndSubtypeEnabler((String) args.arg1);
args.recycle();
return true;
case MSG_SHOW_IM_CONFIG:
showConfigureInputMethods();
return true;
case MSG_UNBIND_INPUT:
try {
((IInputMethod) msg.obj).unbindInput();
} catch (RemoteException e) {
// There is nothing interesting about the method dying.
}
return true;
case MSG_BIND_INPUT:
args = (SomeArgs) msg.obj;
try {
((IInputMethod) args.arg1).bindInput((InputBinding) args.arg2);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_SHOW_SOFT_INPUT:
args = (SomeArgs) msg.obj;
try {
if (DEBUG)
Slog.v(TAG, "Calling " + args.arg1 + ".showSoftInput(" + msg.arg1 + ", " + args.arg2 + ")");
((IInputMethod) args.arg1).showSoftInput(msg.arg1, (ResultReceiver) args.arg2);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_HIDE_SOFT_INPUT:
args = (SomeArgs) msg.obj;
try {
if (DEBUG)
Slog.v(TAG, "Calling " + args.arg1 + ".hideSoftInput(0, " + args.arg2 + ")");
((IInputMethod) args.arg1).hideSoftInput(0, (ResultReceiver) args.arg2);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_ATTACH_TOKEN:
args = (SomeArgs) msg.obj;
try {
if (DEBUG)
Slog.v(TAG, "Sending attach of token: " + args.arg2);
((IInputMethod) args.arg1).attachToken((IBinder) args.arg2);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_CREATE_SESSION:
{
args = (SomeArgs) msg.obj;
IInputMethod method = (IInputMethod) args.arg1;
InputChannel channel = (InputChannel) args.arg2;
try {
method.createSession(channel, (IInputSessionCallback) args.arg3);
} catch (RemoteException e) {
} finally {
// because the remote proxy will get its own copy when unparceled.
if (channel != null && Binder.isProxy(method)) {
channel.dispose();
}
}
args.recycle();
return true;
}
case MSG_START_INPUT:
args = (SomeArgs) msg.obj;
try {
SessionState session = (SessionState) args.arg1;
setEnabledSessionInMainThread(session);
session.method.startInput((IInputContext) args.arg2, (EditorInfo) args.arg3);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_RESTART_INPUT:
args = (SomeArgs) msg.obj;
try {
SessionState session = (SessionState) args.arg1;
setEnabledSessionInMainThread(session);
session.method.restartInput((IInputContext) args.arg2, (EditorInfo) args.arg3);
} catch (RemoteException e) {
}
args.recycle();
return true;
case MSG_UNBIND_METHOD:
try {
((IInputMethodClient) msg.obj).onUnbindMethod(msg.arg1);
} catch (RemoteException e) {
// There is nothing interesting about the last client dying.
}
return true;
case MSG_BIND_METHOD:
{
args = (SomeArgs) msg.obj;
IInputMethodClient client = (IInputMethodClient) args.arg1;
InputBindResult res = (InputBindResult) args.arg2;
try {
client.onBindMethod(res);
} catch (RemoteException e) {
Slog.w(TAG, "Client died receiving input method " + args.arg2);
} finally {
// because the remote proxy will get its own copy when unparceled.
if (res.channel != null && Binder.isProxy(client)) {
res.channel.dispose();
}
}
args.recycle();
return true;
}
case MSG_SET_ACTIVE:
try {
((ClientState) msg.obj).client.setActive(msg.arg1 != 0);
} catch (RemoteException e) {
Slog.w(TAG, "Got RemoteException sending setActive(false) notification to pid " + ((ClientState) msg.obj).pid + " uid " + ((ClientState) msg.obj).uid);
}
return true;
// --------------------------------------------------------------
case MSG_HARD_KEYBOARD_SWITCH_CHANGED:
mHardKeyboardListener.handleHardKeyboardStatusChange(msg.arg1 == 1, msg.arg2 == 1);
return true;
}
return false;
}
Aggregations