Java Code Examples for android.os.Looper#getQueue()

The following examples show how to use android.os.Looper#getQueue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FrameMetricsObserver.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a FrameMetricsObserver
 *
 * @param looper the looper to use when invoking callbacks
 */
FrameMetricsObserver(@NonNull Window window, @NonNull Looper looper,
        @NonNull Window.OnFrameMetricsAvailableListener listener) {
    if (looper == null) {
        throw new NullPointerException("looper cannot be null");
    }

    mMessageQueue = looper.getQueue();
    if (mMessageQueue == null) {
        throw new IllegalStateException("invalid looper, null message queue\n");
    }

    mFrameMetrics = new FrameMetrics();
    mWindow = new WeakReference<>(window);
    mListener = listener;
}
 
Example 2
Source File: InputEventSender.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Creates an input event sender bound to the specified input channel.
 *
 * @param inputChannel The input channel.
 * @param looper The looper to use when invoking callbacks.
 */
public InputEventSender(InputChannel inputChannel, Looper looper) {
    if (inputChannel == null) {
        throw new IllegalArgumentException("inputChannel must not be null");
    }
    if (looper == null) {
        throw new IllegalArgumentException("looper must not be null");
    }

    mInputChannel = inputChannel;
    mMessageQueue = looper.getQueue();
    mSenderPtr = nativeInit(new WeakReference<InputEventSender>(this),
            inputChannel, mMessageQueue);

    mCloseGuard.open("dispose");
}
 
Example 3
Source File: InputEventReceiver.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Creates an input event receiver bound to the specified input channel.
 *
 * @param inputChannel The input channel.
 * @param looper The looper to use when invoking callbacks.
 */
public InputEventReceiver(InputChannel inputChannel, Looper looper) {
    if (inputChannel == null) {
        throw new IllegalArgumentException("inputChannel must not be null");
    }
    if (looper == null) {
        throw new IllegalArgumentException("looper must not be null");
    }

    mInputChannel = inputChannel;
    mMessageQueue = looper.getQueue();
    mReceiverPtr = nativeInit(new WeakReference<InputEventReceiver>(this),
            inputChannel, mMessageQueue);

    mCloseGuard.open("dispose");
}
 
Example 4
Source File: DisplayEventReceiver.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a display event receiver.
 *
 * @param looper The looper to use when invoking callbacks.
 * @param vsyncSource The source of the vsync tick. Must be on of the VSYNC_SOURCE_* values.
 */
public DisplayEventReceiver(Looper looper, int vsyncSource) {
    if (looper == null) {
        throw new IllegalArgumentException("looper must not be null");
    }

    mMessageQueue = looper.getQueue();
    mReceiverPtr = nativeInit(new WeakReference<DisplayEventReceiver>(this), mMessageQueue,
            vsyncSource);

    mCloseGuard.open("dispose");
}
 
Example 5
Source File: Loopers.java    From deagle with Apache License 2.0 4 votes vote down vote up
@SuppressLint("NewApi")	// Looper.getQueue is hidden before Android M.
private static MessageQueue getQueue(final Looper looper) {
	return looper.getQueue();
}