use of android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class Registrant method messageForRegistrant.
/**
* NOTE: May return null if weak reference has been collected
*/
public Message messageForRegistrant() {
Handler h = getHandler();
if (h == null) {
clear();
return null;
} else {
Message msg = h.obtainMessage();
msg.what = what;
msg.obj = userObj;
return msg;
}
}
use of android.os.Message in project android_frameworks_base by ParanoidAndroid.
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);
}
}
use of android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class AccessibilityInteractionController method findAccessibilityNodeInfoByAccessibilityIdClientThread.
public void findAccessibilityNodeInfoByAccessibilityIdClientThread(long accessibilityNodeId, 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_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;
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 android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class AccessibilityInteractionController method findAccessibilityNodeInfosByViewIdClientThread.
public void findAccessibilityNodeInfosByViewIdClientThread(long accessibilityNodeId, String viewId, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid, MagnificationSpec spec) {
Message message = mHandler.obtainMessage();
message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFOS_BY_VIEW_ID;
message.arg1 = flags;
message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
SomeArgs args = SomeArgs.obtain();
args.argi1 = interactionId;
args.arg1 = callback;
args.arg2 = spec;
args.arg3 = viewId;
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 android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class BroadcasterTest method test4.
@MediumTest
public void test4() throws Exception {
/*
* Two handlers request different messages, with translations, sending
* only one. The other one should never get sent.
*/
HandlerTester tester = new HandlerTester() {
Handler h1;
Handler h2;
public void go() {
Broadcaster b = new Broadcaster();
h1 = new H();
h2 = new H();
b.request(MESSAGE_A, h1, MESSAGE_C);
b.request(MESSAGE_B, h2, MESSAGE_D);
Message msg = new Message();
msg.what = MESSAGE_A;
b.broadcast(msg);
}
public void handleMessage(Message msg) {
if (msg.what == MESSAGE_C && msg.getTarget() == h1) {
success();
} else {
failure();
}
}
};
tester.doTest(1000);
}
Aggregations