Andorid屏幕唤醒异常,Power按键无法点亮屏幕的分析

news/2024/11/17 0:07:59/

写在前面:

    关于这个话题我们需要了解屏幕唤醒的一些基本流程,物理按键的Keycode,CPU使用率,Low Memeory,还需要关注ANR(由于广播是按顺序发送的,ANR会导致唤醒屏幕的广播阻塞引起屏幕无法正常点亮),再结合现场其他的一些情况进行综合分析。


结合案例分析:

    案例描述:打开应用市场更新软件,操作Power键无法正常唤醒屏幕


分析过程:


    下面的这行log,当有按键产生的时候就会打印出来,可以直接以keycode= 来做为关键字搜索:
02-13 18:32:06.203: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=false keyguardActive=true policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
    请注意这个  policyFlags = #2000001 ,若这个值是包含下面两个值,则是由于底层驱动配置亮屏的,需要检查一下对应实体按键的配置文件:
    public final static int FLAG_WAKE = 0x00000001;
    public final static int FLAG_WAKE_DROPPED = 0x00000002;

    首先我们可以通过案例描述可以看到当前手机系统资源比较紧张,不过还是要进一步去确认。那么我们可以通过沟通来准确定位现场时间点,但是一般情况下用户是不能提供准确的时间点,那么此时我们通过log信息来定位现场复现的时间点,那么keycode的按键log来进行定位(Tag:WindowManager,Key:keycode=26),如下:

02-13 18:32:06.203: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=false keyguardActive=true policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false//此为唤醒按键操作①

02-13 18:32:06.207: D/PowerManagerDisplayState(707): setScreenOn: on=true//修改状态

02-13 18:32:06.297: I/WindowManager(707): Lock screen displayed!①

02-13 18:32:06.721: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=true mHomePressed=false canceled=false metaState:0
......
02-13 18:32:07.109: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=9 keyguardOn=true mHomePressed=false canceled=false metaState:0

02-13 18:32:07.123: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=true policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:44:19.788: D/PowerManagerDisplayState(707): setScreenOn: on=false修改状态

02-13 18:44:26.345: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=false keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false//此为唤醒按键操作②

02-13 18:44:26.408: D/PowerManagerDisplayState(707): setScreenOn: on=true//修改状态

02-13 18:44:26.473: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false//此为灭屏按键操作
02-13 18:44:28.619: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:44:28.924: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:44:29.034: D/PowerManagerDisplayState(707): setScreenOn: on=false//修改状态

02-13 18:44:31.418: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=false keyguardActive=true policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false//此为唤醒按键操作③

02-13 18:44:31.448: D/PowerManagerDisplayState(707): setScreenOn: on=true//修改状态

02-13 18:44:32.098: I/WindowManager(707): Lock screen displayed!②

02-13 18:44:31.763: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=true policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false//此为灭屏按键操作

02-13 18:44:33.163: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=true policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:44:33.666: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=true mHomePressed=false canceled=false metaState:0
02-13 18:44:33.715: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=2 keyguardOn=true mHomePressed=false canceled=false metaState:0

02-13 18:44:34.023: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=true policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:44:34.093: D/PowerManagerDisplayState(707): setScreenOn: on=false//修改状态

02-13 18:44:37.393: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=false keyguardActive=true policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false//此为唤醒按键操作④

02-13 18:44:37.413: D/PowerManagerDisplayState(707): setScreenOn: on=true//修改状态

02-13 18:44:37.895: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=true mHomePressed=false canceled=false metaState:0
......
02-13 18:44:38.097: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=5 keyguardOn=true mHomePressed=false canceled=false metaState:0

02-13 18:44:38.134: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=true policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:44:39.063: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=true policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:44:39.565: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=true mHomePressed=false canceled=false metaState:0

......

02-13 18:44:39.617: I/WindowManager(707): Lock screen displayed!//③

02-13 18:44:40.149: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=10 keyguardOn=true mHomePressed=false canceled=false metaState:0
02-13 18:44:40.183: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=true policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:45:10.730: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:45:11.043: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:45:11.571: D/PowerManagerDisplayState(707): setScreenOn: on=false//修改状态

02-13 18:45:12.303: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=false keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false//此为唤醒按键操作⑤

02-13 18:45:12.306: D/PowerManagerDisplayState(707): setScreenOn: on=true//修改状态

02-13 18:45:12.693: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false//此为灭屏按键操作
02-13 18:45:14.163: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:45:14.665: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=false mHomePressed=false canceled=false metaState:0
......
02-13 18:45:14.816: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=4 keyguardOn=false mHomePressed=false canceled=false metaState:0

02-13 18:45:14.823: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:45:15.633: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:45:16.135: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=true mHomePressed=false canceled=false metaState:0
......
02-13 18:45:16.488: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=8 keyguardOn=true mHomePressed=false canceled=false metaState:0

02-13 18:45:16.515: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=true policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:45:17.404: I/WindowManager(707): Lock screen displayed!④

02-13 18:46:47.593: D/PowerManagerDisplayState(707): setScreenOn: on=false//修改状态

02-13 18:48:41.257: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=false keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false//此为唤醒按键操作⑥

02-13 18:48:41.404: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false//此为灭屏按键操作

02-13 18:48:41.405: D/PowerManagerDisplayState(707): setScreenOn: on=true//修改状态

02-13 18:48:41.435: I/WindowManager(707): Lock screen displayed!⑤

02-13 18:49:44.441: D/PowerManagerDisplayState(707): setScreenOn: on=false//修改状态

02-13 18:49:46.089: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=false keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false//此为唤醒按键操作⑦

02-13 18:49:46.096: D/PowerManagerDisplayState(707): setScreenOn: on=true//修改状态

02-13 18:49:46.108: I/WindowManager(707): Lock screen displayed!⑥

02-13 18:49:46.352: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false//此为灭屏按键操作
02-13 18:51:12.283: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:51:12.533: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:51:13.041: D/PowerManagerDisplayState(707): setScreenOn: on=false//修改状态

02-13 18:51:15.380: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=false keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false //此为唤醒按键操作⑧

02-13 18:51:15.861: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=false mHomePressed=false canceled=false metaState:0//此为灭屏按键操作

02-13 18:51:15.422: D/PowerManagerDisplayState(707): setScreenOn: on=true//修改状态
02-13 18:51:15.883: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:51:16.844: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:51:17.349: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=false mHomePressed=false canceled=false metaState:0
02-13 18:51:17.373: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:51:18.790: D/PowerManagerDisplayState(707): setScreenOn: on=false//修改状态
02-13 18:51:18.236: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:51:18.733: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:51:18.789: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=false mHomePressed=false canceled=false metaState:0

02-13 18:51:15.883: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:51:16.844: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:51:17.349: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=false mHomePressed=false canceled=false metaState:0
02-13 18:51:17.373: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:51:18.236: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:51:18.733: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:51:18.789: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=false mHomePressed=false canceled=false metaState:0

02-13 18:51:19.626: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=false keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false//此为唤醒按键操作⑨

02-13 18:51:19.781: D/PowerManagerDisplayState(707): setScreenOn: on=true//修改状态

02-13 18:51:20.068: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=false mHomePressed=false canceled=false metaState:0
......
02-13 18:51:20.469: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=9 keyguardOn=false mHomePressed=false canceled=false metaState:0
02-13 18:51:20.514: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:51:21.363: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:51:22.091: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=true mHomePressed=false canceled=false metaState:0
......
02-13 18:51:22.440: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=5 keyguardOn=true mHomePressed=false canceled=false metaState:0

02-13 18:51:22.943: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=true policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false

02-13 18:51:22.972: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=6 keyguardOn=true mHomePressed=false canceled=false metaState:0

02-13 18:51:23.645: I/WindowManager(707): Lock screen displayed!⑦

02-13 18:51:26.773: I/WindowManager(707): Lock screen displayed!⑧

02-13 18:56:41.499: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:56:42.000: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=false mHomePressed=false canceled=false metaState:0
......
02-13 18:56:42.248: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=6 keyguardOn=false mHomePressed=false canceled=false metaState:0

02-13 18:56:42.303: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =false mVolumeUpKeyTriggered =false
02-13 18:56:57.267: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =true canceled = false isWakeKey=true mVolumeDownKeyTriggered =true mVolumeUpKeyTriggered =false

02-13 18:56:57.705: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=1 keyguardOn=false mHomePressed=false canceled=false metaState:0
......
02-13 18:56:58.817: D/WindowManager(707): interceptKeyTi keyCode=26 down=true repeatCount=23 keyguardOn=false mHomePressed=false canceled=false metaState:0

02-13 18:56:58.843: D/WindowManager(707): interceptKeyTq keycode=26 screenIsOn=true keyguardActive=false policyFlags = #2000001 down =false canceled = false isWakeKey=true mVolumeDownKeyTriggered =true mVolumeUpKeyTriggered =false

。。。。。。

从上面log我们看到用户进行Power按键唤醒屏幕的操作,其中包括几次长按,我们从上面的按键log中找出唤醒屏幕的操作时间点,然后来进行一一确认,这些唤醒操作是否能够成功唤醒屏幕。

那么通过对按键log的分析我们发现请求点亮的操作有9个,而实际成功唤醒的操作有8个,一个没有正常唤醒,也就是说有一次点亮屏幕失败,那么我们先重点关注此次唤醒失败的情况。在log中查找原因,首先我们查看哪一次唤醒的广播没有处理成功,然后我们发现有一次广播没有正常发出,如下:

02-13 18:51:25.360: W/BroadcastQueue(707): Failure sending broadcast Intent { act=android.intent.action.SCREEN_ON flg=0x50000010 }
02-13 18:51:25.360: W/BroadcastQueue(707): android.os.RemoteException: app thread has died
02-13 18:51:25.360: W/BroadcastQueue(707): at com.android.server.am.BroadcastQueue.performReceiveLocked(BroadcastQueue.java:441)
02-13 18:51:25.360: W/BroadcastQueue(707): at com.android.server.am.BroadcastQueue.deliverToRegisteredReceiverLocked(BroadcastQueue.java:528)
02-13 18:51:25.360: W/BroadcastQueue(707): at com.android.server.am.BroadcastQueue.processNextBroadcast(BroadcastQueue.java:745)
02-13 18:51:25.360: W/BroadcastQueue(707): at com.android.server.am.ActivityManagerService.finishReceiver(ActivityManagerService.java:14821)
02-13 18:51:25.360: W/BroadcastQueue(707): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:384)
02-13 18:51:25.360: W/BroadcastQueue(707): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2272)
02-13 18:51:25.360: W/BroadcastQueue(707): at android.os.Binder.execTransact(Binder.java:404)
02-13 18:51:25.360: W/BroadcastQueue(707): at dalvik.system.NativeStart.run(Native Method)

注:判断自动灭屏log信息如下:

02-13 18:44:19.295   707   771 I PowerManagerService: Going to sleep due to screen timeout...


http://www.ppmy.cn/news/692927.html

相关文章

音量键唤醒屏幕方法技术

方法一、 通过本教程的修改,你可以实现: 1.屏幕关闭状态下使用音量—键即可唤醒屏幕,注意是唤醒,也就是点亮屏幕。 2.音量键本身的音量调整功能不被破坏。(目前大部分通过修改QWERTY文件来 实现屏幕唤醒的教程都是以牺…

android 触摸 唤醒屏幕,Android中屏幕保持唤醒

1、锁的类型 PowerManager中各种锁的类型对CPU 、屏幕、键盘的影响: PARTIAL_WAKE_LOCK : 保持CPU 运转,屏幕和键盘灯有可能是关闭的。 SCREEN_DIM_WAKE_LOCK:保持CPU 运转,允许保持屏幕显示但有可能是灰的,允许关闭键…

Android 中保持屏幕唤醒的方法

最近在解一个 bug 时,用到了这个知识点。在这里总结一下: bug 是这样描述的: 在 Camera 切换到摄像时,摄像过程大概持续2,3分钟,就自动进锁屏了 有时也会持续很长时间进锁屏。 这是一个概率性的问题&am…

android锁屏唤醒并解锁屏幕

1、这个方法是实现锁屏状态下唤醒手机,亮屏并解锁屏幕: public static void wakeUpAndUnlock(Context context){//屏锁管理器KeyguardManager km (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);KeyguardManager.KeyguardLock k…

android唤醒屏幕/保持屏幕唤醒

1、唤醒屏幕 use PowerManager and WakeLockAndroidManifest.xml权限: <uses-permission android:name"android.permission.WAKE_LOCK" /> 程序中的代码: PowerManager pm (PowerManager) getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock …

android学习笔记 按电源键屏幕唤醒和屏幕睡眠流程(从上层到kernel)

一. 屏幕的唤醒 首先inputread在读取到有keyboard事件上报后&#xff0c;会调用到keydispatch的notifykey&#xff0c;去询问wm是否会对这次按键特殊处理,如果WM不处理&#xff0c;则此处会点亮或者熄灭屏幕。 inputReader.cpp KeyboardInputM…

杰理-watch-手表-AC701-双击屏幕唤醒

杰理-watch-手表-AC701-双击屏幕唤醒 TP不在休眠状态&#xff0c;功耗较大&#xff0c;测试熄屏功耗2-3mA &#xff08;1&#xff09;TP抬起的时候rouse_two_flag置1 判断是都开启双击唤醒&#xff0c;关闭TP则进入睡眠&#xff0c;功耗降低 开机设定初始状态 static bo…

电脑休眠唤醒后会出现屏幕闪烁问题怎么彻底解决?

电脑休眠唤醒后会出现屏幕闪烁问题怎么彻底解决&#xff1f;有的用户在电脑待机休眠之后&#xff0c;重新去唤醒电脑使用&#xff0c;这个时候电脑屏幕就会出现验证的屏幕闪烁&#xff0c;导致无法进行正常的使用。这个情况是电脑系统不兼容导致的。如果想要彻底解决问题&#…