Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b25b4a4c authored by Biswarup Pal's avatar Biswarup Pal
Browse files

Improve logs in InputController

Test: presubmit
Flag: EXEMPT log improvement
Bug: N/A
Change-Id: I1e100b33f5fd5400cf586911b4732c8a4bdb3f27
parent 45ebc209
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -691,11 +691,13 @@ class InputController {
    /** A helper class used to wait for an input device to be registered. */
    private class WaitForDevice implements AutoCloseable {
        private final CountDownLatch mDeviceAddedLatch = new CountDownLatch(1);
        private final String mDeviceName;
        private final InputManager.InputDeviceListener mListener;

        private int mInputDeviceId = IInputConstants.INVALID_INPUT_DEVICE_ID;

        WaitForDevice(String deviceName, int vendorId, int productId, int associatedDisplayId) {
            mDeviceName = deviceName;
            mListener = new InputManager.InputDeviceListener() {
                @Override
                public void onInputDeviceAdded(int deviceId) {
@@ -741,15 +743,17 @@ class InputController {
            try {
                if (!mDeviceAddedLatch.await(1, TimeUnit.MINUTES)) {
                    throw new DeviceCreationException(
                            "Timed out waiting for virtual device to be created.");
                            "Timed out waiting for virtual input device " + mDeviceName
                                    + " to be created.");
                }
            } catch (InterruptedException e) {
                throw new DeviceCreationException(
                        "Interrupted while waiting for virtual device to be created.", e);
                        "Interrupted while waiting for virtual input device " + mDeviceName
                                + " to be created.", e);
            }
            if (mInputDeviceId == IInputConstants.INVALID_INPUT_DEVICE_ID) {
                throw new IllegalStateException(
                        "Virtual input device was created with an invalid "
                        "Virtual input device " + mDeviceName + " was created with an invalid "
                                + "id=" + mInputDeviceId);
            }
            return mInputDeviceId;