之前在没有遇到过这样的问题,网络上搜索也没有相关的解决方法。偶然的机会发现 framework 中的 PhoneWindowManager.java 会拦截相关的按键事件,研究之后,发现就是在这个文件中做按键的压感反馈。
解决方案如下:
- 平台 rk3368, Android5.1
- 解决方案:
diff --git a/frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index d25051e..295ad5c 100755 (executable) --- a/frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -5160,7 +5160,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mKeyguardDelegate.isShowing())); //ADD BY LJH START - if (down && ((keyCode == KeyEvent.KEYCODE_HOME)||(keyCode == KeyEvent.KEYCODE_MENU)||(keyCode == KeyEvent.KEYCODE_BACK))) + if (down && ((keyCode == KeyEvent.KEYCODE_HOME)||(keyCode == KeyEvent.KEYCODE_MENU)||(keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_APP_SWITCH))) { performHapticFeedbackLw(null, HapticFeedbackConstants.VIRTUAL_KEY, false); }