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

Commit b64c2ba0 authored by Dongil Seo's avatar Dongil Seo
Browse files

Fix a bug that the HdmiCecLocalDeviceTv sends <User Control Released> message for unsupported keys

Bug: 17170954

Change-Id: I0ad624eb3a1301b24865228164d8dd5a97452329
parent b79a70ab
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -394,4 +394,12 @@ final class HdmiCecKeycode {
        }
        return false;
    }

    /**
     * Returns {@code true} if given Android keycode is supported, otherwise {@code false}.
     */
    static boolean isSupportedKeycode(int androidKeycode) {
        return HdmiCecKeycode.androidKeyToCecKey(androidKeycode)
                != HdmiCecKeycode.UNSUPPORTED_KEYCODE;
  }
}
+4 −0
Original line number Diff line number Diff line
@@ -343,6 +343,10 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
    @ServiceThreadOnly
    protected void sendKeyEvent(int keyCode, boolean isPressed) {
        assertRunOnServiceThread();
        if (!HdmiCecKeycode.isSupportedKeycode(keyCode)) {
            Slog.w(TAG, "Unsupported key: " + keyCode);
            return;
        }
        List<SendKeyAction> action = getActions(SendKeyAction.class);
        if (!action.isEmpty()) {
            action.get(0).processKeyEvent(keyCode, isPressed);