Can you send patches on the mailing list for comment?
Michael

This is my first ugly attempt. It brings up menu when pressing AUX for
more then 1 second.

Radek
diff --git a/services/java/com/android/server/KeyInputQueue.java b/services/java/com/android/server/KeyInputQueue.java
index c67754b..34b19e7 100644
--- a/services/java/com/android/server/KeyInputQueue.java
+++ b/services/java/com/android/server/KeyInputQueue.java
@@ -263,19 +263,40 @@ public abstract class KeyInputQueue {
                                 (scancode < RawInputEvent.BTN_FIRST ||
                                         scancode > RawInputEvent.BTN_LAST)) {
                             boolean down;
+                            long delta = 0;
                             if (ev.value != 0) {
                                 down = true;
                                 di.mDownTime = curTime;
                             } else {
                                 down = false;
+                                delta = curTime - di.mDownTime;
                             }
                             int keycode = rotateKeyCodeLocked(ev.keycode);
+                            Log.i(TAG, "delta=" + delta + ", keycode=" + keycode);
+                            if(delta > 1000 && keycode == KeyEvent.KEYCODE_BACK) {
+                           		Log.i(TAG, "1");
+                               	keycode = KeyEvent.KEYCODE_MENU;
+                               	addLocked(di, curTime, ev.flags,
+                                    RawInputEvent.CLASS_KEYBOARD,
+                                    newKeyEvent(di, di.mDownTime, curTime, true,
+                                            keycode, 0, scancode,
+                                            ((ev.flags & WindowManagerPolicy.FLAG_WOKE_HERE) != 0)
+                                             ? KeyEvent.FLAG_WOKE_HERE : 0));
+                               
+                               	addLocked(di, curTime, ev.flags,
+                                    RawInputEvent.CLASS_KEYBOARD,
+                                    newKeyEvent(di, di.mDownTime, curTime, false,
+                                            keycode, 0, scancode,
+                                            ((ev.flags & WindowManagerPolicy.FLAG_WOKE_HERE) != 0)
+                                             ? KeyEvent.FLAG_WOKE_HERE : 0));
+                            } else {
                             addLocked(di, curTime, ev.flags,
                                     RawInputEvent.CLASS_KEYBOARD,
                                     newKeyEvent(di, di.mDownTime, curTime, down,
                                             keycode, 0, scancode,
                                             ((ev.flags & WindowManagerPolicy.FLAG_WOKE_HERE) != 0)
                                              ? KeyEvent.FLAG_WOKE_HERE : 0));
+                            }
                         } else if (ev.type == RawInputEvent.EV_KEY) {
                             if (ev.scancode == RawInputEvent.BTN_TOUCH &&
                                     (classes&RawInputEvent.CLASS_TOUCHSCREEN) != 0) {
_______________________________________________
android-freerunner mailing list
[email protected]
http://android.koolu.org/listinfo.cgi/android-freerunner-koolu.org

Reply via email to