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) {
&& (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: {