bug系列------为何kl的wake失效了
来源:互联网 发布:微博淘客软件 编辑:程序博客网 时间:2024/04/28 08:32
之前说了kl文件里的wake是唤醒系统的关键,但是最近遇到的bug是哪怕把kl里的wake拿掉还是会唤醒系统,也就是wake还在
这就很奇怪了。于是追代码:
有个两个因素会影响wake,一个是kl文件中的wake的flag,还有就是
PhoneWindowManager.java里的interceptKeyBeforeQueueing这个函数。在interceptKeyBeforeQueueing这个函数最好调用了wakeUp(event.getEventTime(),
mAllowTheaterModeWakeFromKey, "android.policy:KEY");唤醒了系统。经过实验,目前的M里,不论kl的flag是否存在,都会导致wakeup的发生。所以是在
interceptKeyBeforeQueueing里
boolean isWakeKey = (policyFlags & WindowManagerPolicy.FLAG_WAKE) != 0
|| event.isWakeKey();
这个event.isWakeKey()就在KeyEvent.java里
then
if (isWakeKey) {
Log.d(TAG,"matt- if (isWakeKey) ");
wakeUp(event.getEventTime(), mAllowTheaterModeWakeFromKey, "android.policy:KEY"); //wake up system
}
public static final boolean isWakeKey(int keyCode) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
case KeyEvent.KEYCODE_MENU:
case KeyEvent.KEYCODE_HOME:
case KeyEvent.KEYCODE_WAKEUP:
case KeyEvent.KEYCODE_PAIRING:
return true;
}
return false;
}
这里把三个key都设成wake
$ git blame ./KeyEvent.java
337d9d2e (Michael Wright 2014-04-22 15:03:48 -0700 1903) public static final boolean isWakeKey(int keyCode) {
337d9d2e (Michael Wright 2014-04-22 15:03:48 -0700 1904) switch (keyCode) {
337d9d2e (Michael Wright 2014-04-22 15:03:48 -0700 1905) case KeyEvent.KEYCODE_BACK:
337d9d2e (Michael Wright 2014-04-22 15:03:48 -0700 1906) case KeyEvent.KEYCODE_MENU:
00000000 (Not Committed Yet 2016-07-25 16:02:49 +0800 1907) //case KeyEvent.KEYCODE_HOME:
337d9d2e (Michael Wright 2014-04-22 15:03:48 -0700 1908) case KeyEvent.KEYCODE_WAKEUP:
8ac485a3 (Michael Wright 2014-06-04 12:38:18 -0700 1909) case KeyEvent.KEYCODE_PAIRING:
337d9d2e (Michael Wright 2014-04-22 15:03:48 -0700 1910) return true;
337d9d2e (Michael Wright 2014-04-22 15:03:48 -0700 1911) }
git show 337d9d2e
google提交的原因如下
commit 337d9d2edc262141f9b8f684e53aae5e47f0ae13
Author: Michael Wright <michaelwr@google.com>
Date: Tue Apr 22 15:03:48 2014 -0700
Move key attribute information into KeyEvent.
This consolidates all of the information that was in the native
KeyEvent and the KeyLayout files into the managed KeyEvent class.
It also moves the definition for all of the key names to the native
side, rather than having them in both places.
- bug系列------为何kl的wake失效了
- android 按键映射***.kl文件中的WAKE和WAKE_DROPPED的定义
- android 按键映射qwerty.kl文件中的WAKE和WAKE_DROPPED的定义
- android 按键映射qwerty.kl文件中的WAKE和WAKE_DROPPED的定义
- 奇怪的bug,win8里的ctrl-backspace失效了
- 为何此处的getchar()失效
- 为何Eclipse的调试快捷键F8失效?
- Wake
- setBackgroundResource后Padding失效的bug
- setBackgroundResource后Padding失效的bug
- couchbase 设置ttl失效的bug
- Log4j配置为何失效
- Linux和android下测试键盘和触摸屏 && .kl文件中的WAKE和WAKE_DROPPED
- 汽车电子的KL
- SQL Server 2008 R2 CU7已经发布, 修复了在VS 2010 sp1后SSMS智能提示失效的bug
- deeplearning的wake-sleep算法
- KL Divergence between two multivariate normal distributions(使用了trace 和Expection的性质)
- 为何我的杀毒软件启动不了了?
- Stoer-Wagner算法训练题目合集 hdu 3691 hdu3002 poj 2914
- java设计模式——简单工厂模式(Simple Factory Pattern)
- 设计模式-职责链模式
- CURL模拟登录
- 1. 写程序求两个数的平均值(多种方法)
- bug系列------为何kl的wake失效了
- 从技术角度上来说Android 防杀方法(应用进程守护)
- HDU - 1702 ACboy needs your help again!
- ring buffer api(可循环读写)
- UML类图实例讲解
- poj1322Chocolate(724训练题)解析
- 一个字符串有多个img如何取出来 ?
- 基于Redis的分布式锁实现方式
- Develop>API Guides>Introduction>Device Compatibility 中文翻译