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

Commit cb41738a authored by Christine Franks's avatar Christine Franks Committed by Android (Google) Code Review
Browse files

Merge "Address API feedback and CTS on cloud devices"

parents b0385bd9 3b79889d
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -265,8 +265,8 @@ public final class VirtualDeviceManager {
         *
         * @param display the display that the events inputted through this device should target
         * @param inputDeviceName the name to call this input device
         * @param vendorId the vendor id
         * @param productId the product id
         * @param vendorId the vendor id, as defined by uinput's uinput_setup struct (PCI vendor id)
         * @param productId the product id, as defined by uinput's uinput_setup struct
         */
        @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE)
        @NonNull
@@ -291,8 +291,8 @@ public final class VirtualDeviceManager {
         *
         * @param display the display that the events inputted through this device should target
         * @param inputDeviceName the name to call this input device
         * @param vendorId the vendor id
         * @param productId the product id
         * @param vendorId the vendor id, as defined by uinput's uinput_setup struct (PCI vendor id)
         * @param productId the product id, as defined by uinput's uinput_setup struct
         */
        @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE)
        @NonNull
@@ -317,8 +317,8 @@ public final class VirtualDeviceManager {
         *
         * @param display the display that the events inputted through this device should target
         * @param inputDeviceName the name to call this input device
         * @param vendorId the vendor id
         * @param productId the product id
         * @param vendorId the vendor id, as defined by uinput's uinput_setup struct (PCI vendor id)
         * @param productId the product id, as defined by uinput's uinput_setup struct
         */
        @RequiresPermission(android.Manifest.permission.CREATE_VIRTUAL_DEVICE)
        @NonNull
+50 −3
Original line number Diff line number Diff line
@@ -114,9 +114,56 @@ public final class VirtualKeyEvent implements Parcelable {
        }

        /**
         * Sets the Android key code of the event. The set of allowed characters include digits 0-9,
         * characters A-Z, and standard punctuation, as well as numpad keys, function keys F1-F12,
         * and meta keys (caps lock, shift, etc.).
         * Sets the Android key code of the event. The set of allowed keys include digits
         *              {@link android.view.KeyEvent#KEYCODE_0} through
         *              {@link android.view.KeyEvent#KEYCODE_9}, characters
         *              {@link android.view.KeyEvent#KEYCODE_A} through
         *              {@link android.view.KeyEvent#KEYCODE_Z}, function keys
         *              {@link android.view.KeyEvent#KEYCODE_F1} through
         *              {@link android.view.KeyEvent#KEYCODE_F12}, numpad keys
         *              {@link android.view.KeyEvent#KEYCODE_NUMPAD_0} through
         *              {@link android.view.KeyEvent#KEYCODE_NUMPAD_RIGHT_PAREN},
         *              and these additional keys:
         *              {@link android.view.KeyEvent#KEYCODE_GRAVE}
         *              {@link android.view.KeyEvent#KEYCODE_MINUS}
         *              {@link android.view.KeyEvent#KEYCODE_EQUALS}
         *              {@link android.view.KeyEvent#KEYCODE_LEFT_BRACKET}
         *              {@link android.view.KeyEvent#KEYCODE_RIGHT_BRACKET}
         *              {@link android.view.KeyEvent#KEYCODE_BACKSLASH}
         *              {@link android.view.KeyEvent#KEYCODE_SEMICOLON}
         *              {@link android.view.KeyEvent#KEYCODE_APOSTROPHE}
         *              {@link android.view.KeyEvent#KEYCODE_COMMA}
         *              {@link android.view.KeyEvent#KEYCODE_PERIOD}
         *              {@link android.view.KeyEvent#KEYCODE_SLASH}
         *              {@link android.view.KeyEvent#KEYCODE_ALT_LEFT}
         *              {@link android.view.KeyEvent#KEYCODE_ALT_RIGHT}
         *              {@link android.view.KeyEvent#KEYCODE_CTRL_LEFT}
         *              {@link android.view.KeyEvent#KEYCODE_CTRL_RIGHT}
         *              {@link android.view.KeyEvent#KEYCODE_SHIFT_LEFT}
         *              {@link android.view.KeyEvent#KEYCODE_SHIFT_RIGHT}
         *              {@link android.view.KeyEvent#KEYCODE_META_LEFT}
         *              {@link android.view.KeyEvent#KEYCODE_META_RIGHT}
         *              {@link android.view.KeyEvent#KEYCODE_CAPS_LOCK}
         *              {@link android.view.KeyEvent#KEYCODE_SCROLL_LOCK}
         *              {@link android.view.KeyEvent#KEYCODE_NUM_LOCK}
         *              {@link android.view.KeyEvent#KEYCODE_ENTER}
         *              {@link android.view.KeyEvent#KEYCODE_TAB}
         *              {@link android.view.KeyEvent#KEYCODE_SPACE}
         *              {@link android.view.KeyEvent#KEYCODE_DPAD_DOWN}
         *              {@link android.view.KeyEvent#KEYCODE_DPAD_UP}
         *              {@link android.view.KeyEvent#KEYCODE_DPAD_LEFT}
         *              {@link android.view.KeyEvent#KEYCODE_DPAD_RIGHT}
         *              {@link android.view.KeyEvent#KEYCODE_MOVE_END}
         *              {@link android.view.KeyEvent#KEYCODE_MOVE_HOME}
         *              {@link android.view.KeyEvent#KEYCODE_PAGE_DOWN}
         *              {@link android.view.KeyEvent#KEYCODE_PAGE_UP}
         *              {@link android.view.KeyEvent#KEYCODE_DEL}
         *              {@link android.view.KeyEvent#KEYCODE_FORWARD_DEL}
         *              {@link android.view.KeyEvent#KEYCODE_INSERT}
         *              {@link android.view.KeyEvent#KEYCODE_ESCAPE}
         *              {@link android.view.KeyEvent#KEYCODE_BREAK}
         *              {@link android.view.KeyEvent#KEYCODE_BACK}
         *              {@link android.view.KeyEvent#KEYCODE_FORWARD}
         *
         * @return this builder, to allow for chaining of calls
         */
+17 −4
Original line number Diff line number Diff line
@@ -243,22 +243,34 @@ static int openUinput(const char* readableName, jint vendorId, jint productId, c
            xAbsSetup.code = ABS_MT_POSITION_X;
            xAbsSetup.absinfo.maximum = screenWidth - 1;
            xAbsSetup.absinfo.minimum = 0;
            ioctl(fd, UI_ABS_SETUP, xAbsSetup);
            if (ioctl(fd, UI_ABS_SETUP, &xAbsSetup) != 0) {
                ALOGE("Error creating touchscreen uinput x axis: %s", strerror(errno));
                return -errno;
            }
            uinput_abs_setup yAbsSetup;
            yAbsSetup.code = ABS_MT_POSITION_Y;
            yAbsSetup.absinfo.maximum = screenHeight - 1;
            yAbsSetup.absinfo.minimum = 0;
            ioctl(fd, UI_ABS_SETUP, yAbsSetup);
            if (ioctl(fd, UI_ABS_SETUP, &yAbsSetup) != 0) {
                ALOGE("Error creating touchscreen uinput y axis: %s", strerror(errno));
                return -errno;
            }
            uinput_abs_setup majorAbsSetup;
            majorAbsSetup.code = ABS_MT_TOUCH_MAJOR;
            majorAbsSetup.absinfo.maximum = screenWidth - 1;
            majorAbsSetup.absinfo.minimum = 0;
            ioctl(fd, UI_ABS_SETUP, majorAbsSetup);
            if (ioctl(fd, UI_ABS_SETUP, &majorAbsSetup) != 0) {
                ALOGE("Error creating touchscreen uinput major axis: %s", strerror(errno));
                return -errno;
            }
            uinput_abs_setup pressureAbsSetup;
            pressureAbsSetup.code = ABS_MT_PRESSURE;
            pressureAbsSetup.absinfo.maximum = 255;
            pressureAbsSetup.absinfo.minimum = 0;
            ioctl(fd, UI_ABS_SETUP, pressureAbsSetup);
            if (ioctl(fd, UI_ABS_SETUP, &pressureAbsSetup) != 0) {
                ALOGE("Error creating touchscreen uinput pressure axis: %s", strerror(errno));
                return -errno;
            }
        }
        if (ioctl(fd, UI_DEV_SETUP, &setup) != 0) {
            ALOGE("Error creating uinput device: %s", strerror(errno));
@@ -266,6 +278,7 @@ static int openUinput(const char* readableName, jint vendorId, jint productId, c
        }
    } else {
        // UI_DEV_SETUP was not introduced until version 5. Try setting up manually.
        ALOGI("Falling back to version %d manual setup", version);
        uinput_user_dev fallback;
        memset(&fallback, 0, sizeof(fallback));
        strlcpy(fallback.name, readableName, UINPUT_MAX_NAME_SIZE);