指定键唤醒屏幕
例如指定按键机所有键均可以唤醒屏幕,添加如下修改部分即可
frameworks/base/core/java/android/view/KeyEvent.java
/** @hide */
public static final boolean isWakeKey(int keyCode) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
case KeyEvent.KEYCODE_MENU:
case KeyEvent.KEYCODE_WAKEUP:
case KeyEvent.KEYCODE_PAIRING:
case KeyEvent.KEYCODE_STEM_1:
case KeyEvent.KEYCODE_STEM_2:
case KeyEvent.KEYCODE_STEM_3:
// 返回true则可作为唤醒屏幕按键
// Redmine150387 breeze modify the main display can be wake isWakeKeyby all keys 20181022 begin
case KeyEvent.KEYCODE_0:
case KeyEvent.KEYCODE_1:
case KeyEvent.KEYCODE_2:
case KeyEvent.KEYCODE_3:
case KeyEvent.KEYCODE_4:
case KeyEvent.KEYCODE_5:
case KeyEvent.KEYCODE_6:
case KeyEvent.KEYCODE_7:
case KeyEvent.KEYCODE_8:
case KeyEvent.KEYCODE_9:
case KeyEvent.KEYCODE_STAR:
case KeyEvent.KEYCODE_POUND:
case KEYCODE_DPAD_LEFT:
case KEYCODE_DPAD_RIGHT:
case KEYCODE_DPAD_UP:
case KEYCODE_DPAD_DOWN:
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_CALL:
// Redmine150387 breeze modify the main display can be wake by all keys 20181022 end
return true;
}
return false;
}
指定键禁止唤醒屏幕
例如禁止返回键和菜单键唤醒屏幕
frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
/**
* When the screen is off we ignore some keys that might otherwise typically
* be considered wake keys. We filter them out here.
*
* {@link KeyEvent#KEYCODE_POWER} is notably absent from this list because it
* is always considered a wake key.
*/
private boolean isWakeKeyWhenScreenOff(int keyCode) {
switch (keyCode) {
// ignore volume keys unless docked
case KeyEvent.KEYCODE_VOLUME_UP:
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_VOLUME_MUTE:
return mDockMode != Intent.EXTRA_DOCK_STATE_UNDOCKED;
// ignore media and camera keys
case KeyEvent.KEYCODE_MUTE:
case KeyEvent.KEYCODE_HEADSETHOOK:
case KeyEvent.KEYCODE_MEDIA_PLAY:
case KeyEvent.KEYCODE_MEDIA_PAUSE:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
case KeyEvent.KEYCODE_MEDIA_STOP:
case KeyEvent.KEYCODE_MEDIA_NEXT:
case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
case KeyEvent.KEYCODE_MEDIA_REWIND:
case KeyEvent.KEYCODE_MEDIA_RECORD:
case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK:
case KeyEvent.KEYCODE_CAMERA:
// 返回false则不会作为唤醒屏幕按键,即使在KeyEvent中isWakeKey方法进行了配置
// Redmine150387 breeze modify the main display can be wake by all keys 20181022 begin
case KeyEvent.KEYCODE_BACK:
case KeyEvent.KEYCODE_MENU:
// Redmine150387 breeze modify the main display can be wake by all keys 20181022 end
return false;
}
return true;
}
解决MTK手机进入休眠后按键无法点亮屏幕问题
kernel-4.4/drivers/input/keyboard/mediatek/kpd.c
#include <linux/debugfs.h>
#define KPD_NAME "mtk-kpd"
-#define MTK_KP_WAKESOURCE /* this is for auto set wake up source */
+
+
+//change by breeze
+//#define MTK_KP_WAKESOURCE /* this is for auto set wake up source */
static struct dentry *kpd_droot;
static struct dentry *kpd_dklog;