Example usage for android.os Process THREAD_PRIORITY_URGENT_DISPLAY

List of usage examples for android.os Process THREAD_PRIORITY_URGENT_DISPLAY

Introduction

In this page you can find the example usage for android.os Process THREAD_PRIORITY_URGENT_DISPLAY.

Prototype

int THREAD_PRIORITY_URGENT_DISPLAY

To view the source code for android.os Process THREAD_PRIORITY_URGENT_DISPLAY.

Click Source Link

Document

Standard priority of the most important display threads, for compositing the screen and retrieving input events.

Usage

From source file:io.github.msc42.masterthemaze.GameActivity.java

private void startGameThreads() {
    mGameThreadMessageHandler = new Handler(Looper.getMainLooper()) {
        @Override//from   w  w  w.j  ava 2  s .  co  m
        public void handleMessage(Message message) {
            super.handleMessage(message);

            switch (message.what) {
            case Constants.INVALID_LEVEL_MESSAGE:
                String errorMessage = (String) message.obj;
                showInvalidLevelDialog(errorMessage);
                break;
            case Constants.IO_ERROR_MESSAGE:
                showIoErrorDialog();
                break;
            case Constants.BT_ESTABLISHED_CONNECTION_MESSAGE:
                showBluetoothEstablishedConnectionScreen();
                break;
            case Constants.BT_CANNOT_ESTABLISH_CONNECTION_MESSAGE:
                showBluetoothCannotEstablishConnectionDialog();
                break;
            case Constants.FAILED_HANDSHAKE_MESSAGE:
                showFailedHandshakeDialog();
                break;
            case Constants.BT_BEGIN_IO_ERROR_MESSAGE:
                showBtBeginIoErrorDialog();
                break;
            case Constants.BT_END_IO_ERROR_MESSAGE:
                if (mBluetoothIoErrorDialog != null) {
                    mBluetoothIoErrorDialog.cancel();
                }
                break;
            case Constants.BT_IO_ERROR_MESSAGE:
                showBtSendIoErrorDialog();
                break;
            case Constants.DISABLED_BLUETOOTH_MESSAGE:
                showDoNotDisableBluetoothDialog();
                break;
            case Constants.RFCOMM_SOCKET_NOT_SUPPORTED_MESSAGE:
                showRfcommSocketNotSupportedDialog();
                break;
            default:
                // all possible messages should get a case
                break;
            }
        }
    };

    mGameThread = new GameThread(mGame, mMotionQueue, mBluetoothDevice, mGameThreadMessageHandler);
    mGameThread.start();

    if (mMotion) {
        mSensorHandlerThread = new HandlerThread("SensorHandlerThread", Process.THREAD_PRIORITY_URGENT_DISPLAY);
        mSensorHandlerThread.start();
        mSensorHandler = new Handler(mSensorHandlerThread.getLooper());
        mAccelerometerEventListener = new AccelerometerEventListener(mRotation, mSensitivity,
                mCurrentMoveDirection, mMotionQueue);
    }
}