• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/base


Commit MetaInfo

修訂c58caeec155bc307894d175124b8b6e0868d8b74 (tree)
時間2014-08-27 19:18:42
作者Chih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

skip non Android VT events

The patch is modified for KitKat from

http://git.alwaysinnovating.com/cgit.cgi/ai.android/tree/preprocess/froyo/patches/noinput.patch

Change Summary

差異

--- a/services/input/EventHub.cpp
+++ b/services/input/EventHub.cpp
@@ -50,6 +50,8 @@
5050 #include <sys/limits.h>
5151 #include <sys/sha1.h>
5252
53+#include <linux/vt.h>
54+
5355 /* this macro is used to tell if "bit" is set in "array"
5456 * it selects a byte from the array, and does a boolean AND
5557 * operation with a byte that only has the relevant bit set.
@@ -66,6 +68,8 @@
6668
6769 namespace android {
6870
71+int android_vt = 7;
72+
6973 static const char *WAKE_LOCK_ID = "KeyEvents";
7074 static const char *DEVICE_PATH = "/dev/input";
7175
@@ -716,6 +720,14 @@ size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSiz
716720 }
717721 }
718722
723+#ifdef __i386__
724+ struct vt_stat vs;
725+ int fd_vt = open("/dev/tty0", O_RDWR | O_SYNC);
726+ if (fd_vt >= 0) {
727+ ioctl(fd_vt, VT_GETSTATE, &vs);
728+ close(fd_vt);
729+ }
730+#endif
719731 // Grab the next input event.
720732 bool deviceChanged = false;
721733 while (mPendingEventIndex < mPendingEventCount) {
@@ -770,6 +782,12 @@ size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSiz
770782 } else if ((readSize % sizeof(struct input_event)) != 0) {
771783 ALOGE("could not get event (wrong size: %d)", readSize);
772784 } else {
785+#ifdef __i386__
786+ if (vs.v_active != android_vt) {
787+ ALOGV("Skip a non Android VT event");
788+ continue;
789+ }
790+#endif
773791 int32_t deviceId = device->id == mBuiltInKeyboardId ? 0 : device->id;
774792
775793 size_t count = size_t(readSize) / sizeof(struct input_event);