OSDN Git Service

DeviceKeyHandler: Fix suspend gesture not working
authorKeith Mok <kmok@cyngn.com>
Mon, 16 Nov 2015 21:48:36 +0000 (13:48 -0800)
committerSteve Kondik <shade@chemlab.org>
Tue, 13 Sep 2016 16:48:50 +0000 (09:48 -0700)
A function for handling DeviceKey is mis-placed in
PhoneWindowManager.java when merging from cm-12.1

Change-Id: I5a5421c88216b70defaac69b732d99d506e1a2a6

services/core/java/com/android/server/policy/PhoneWindowManager.java

index ff30459..b505e38 100644 (file)
@@ -3963,18 +3963,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
             final boolean initialDown = event.getAction() == KeyEvent.ACTION_DOWN
                     && event.getRepeatCount() == 0;
 
-        // Specific device key handling
-        if (mDeviceKeyHandler != null) {
-            try {
-                // The device only should consume known keys.
-                if (mDeviceKeyHandler.handleKeyEvent(event)) {
-                    return null;
-                }
-            } catch (Exception e) {
-                Slog.w(TAG, "Could not dispatch event to device key handler", e);
-            }
-        }
-
             // Check for fallback actions specified by the key character map.
             final FallbackAction fallbackAction;
             if (initialDown) {
@@ -6057,6 +6045,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                 && (policyFlags & WindowManagerPolicy.FLAG_VIRTUAL) != 0
                 && event.getRepeatCount() == 0;
 
+        // Specific device key handling
+        if (mDeviceKeyHandler != null) {
+            try {
+                // The device only should consume known keys.
+                if (mDeviceKeyHandler.handleKeyEvent(event)) {
+                    return 0;
+                }
+            } catch (Exception e) {
+                Slog.w(TAG, "Could not dispatch event to device key handler", e);
+            }
+        }
+
         // Handle special keys.
         switch (keyCode) {
             case KeyEvent.KEYCODE_BACK: {