Android 5.1截获HOME键
2015-06-09 21:20
381 查看
修改framework android policy
在PhoneWindowmanager.java中做如下修改即可
if (keyCode == KeyEvent.KEYCODE_HOME) {
// If we have released the home key, and didn't do anything else
// while it was pressed, then it is time to go home!
+/* Thu, 29 Jan 2015 17:24:38 +0800
+ *
+ */
+ WindowManager.LayoutParams attrs = win != null ? win.getAttrs() : null;
+ if (attrs != null
+ && "com.android.xxxx/com.android.xxxx.xxxxx".equals(attrs.getTitle())) {
+ return 0;
+ }
+// End
if (!down) {
cancelPreloadRecentApps();
@@ -2406,7 +2415,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// If a system window has focus, then it doesn't make sense
// right now to interact with applications.
+/* Thu, 29 Jan 2015 17:23:40 +0800
+ *
WindowManager.LayoutParams attrs = win != null ? win.getAttrs() : null;
+ */
+// End
if (attrs != null) {
final int type = attrs.type;
if (type == WindowManager.LayoutParams.TYPE_KEYGUARD_SCRIM
在PhoneWindowmanager.java中做如下修改即可
if (keyCode == KeyEvent.KEYCODE_HOME) {
// If we have released the home key, and didn't do anything else
// while it was pressed, then it is time to go home!
+/* Thu, 29 Jan 2015 17:24:38 +0800
+ *
+ */
+ WindowManager.LayoutParams attrs = win != null ? win.getAttrs() : null;
+ if (attrs != null
+ && "com.android.xxxx/com.android.xxxx.xxxxx".equals(attrs.getTitle())) {
+ return 0;
+ }
+// End
if (!down) {
cancelPreloadRecentApps();
@@ -2406,7 +2415,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// If a system window has focus, then it doesn't make sense
// right now to interact with applications.
+/* Thu, 29 Jan 2015 17:23:40 +0800
+ *
WindowManager.LayoutParams attrs = win != null ? win.getAttrs() : null;
+ */
+// End
if (attrs != null) {
final int type = attrs.type;
if (type == WindowManager.LayoutParams.TYPE_KEYGUARD_SCRIM
相关文章推荐
- Android5.1 屏蔽下拉框以及屏蔽HOME键功能
- Android 截获home键的处理方式以及back键
- Android 5.1 如何监听用户按了home键
- Android 4.4、5.1、6.0 屏蔽Home键
- Android使用代码模拟HOME键的功能
- android 屏蔽home键操作
- Android的全局键(home键/长按耳机键)详解【android源码解析八】
- android 截获网络数据包的方法
- android 平板去掉home键实现全屏方法
- android的Home键的监听封装工具类(一)
- Android中屏蔽 电源键长按、Home键、Home长按
- Android 按下Home键
- Android HOME键屏蔽
- Android 5.1长按电源键添加重启功能
- 【Android】短信应用——短信截获
- Android 5.1双卡打电话发短信的实际应用
- Android -- TouchEvent的分发和截获方式
- Android 5.1系统源码Wifi模块中wifiConfigController源码分析
- android 5.1 系统音频的切换