Search in sources :

Example 96 with Message

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;
    }
}
Also used : Message(android.os.Message) Handler(android.os.Handler)

Example 97 with Message

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);
    }
}
Also used : Message(android.os.Message) SomeArgs(com.android.internal.os.SomeArgs)

Example 98 with 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);
    }
}
Also used : Message(android.os.Message) SomeArgs(com.android.internal.os.SomeArgs)

Example 99 with 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);
    }
}
Also used : Message(android.os.Message) SomeArgs(com.android.internal.os.SomeArgs)

Example 100 with 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);
}
Also used : Message(android.os.Message) Handler(android.os.Handler) Broadcaster(android.os.Broadcaster) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

Message (android.os.Message)3198 Handler (android.os.Handler)347 RemoteException (android.os.RemoteException)263 Bundle (android.os.Bundle)210 Test (org.junit.Test)144 Intent (android.content.Intent)130 IOException (java.io.IOException)124 Point (android.graphics.Point)86 HashMap (java.util.HashMap)77 SomeArgs (com.android.internal.os.SomeArgs)67 SmallTest (android.test.suitebuilder.annotation.SmallTest)64 Messenger (android.os.Messenger)63 ArrayList (java.util.ArrayList)59 View (android.view.View)52 File (java.io.File)50 MediumTest (android.test.suitebuilder.annotation.MediumTest)43 TextView (android.widget.TextView)41 IBinder (android.os.IBinder)38 Map (java.util.Map)37 PendingIntent (android.app.PendingIntent)33