一 . 亮屏主要关键log
驱动按键时间
??-?? ??:??:??.??? <3>[14082.058160] (0)[70:pmic_thread]kpd: Power Key generate, pressed=1
上层按键时间
09-25 15:13:07.196667 929 1117 D PhoneWindowManager-interceptKeyBeforeQueueing: --->keyCode:26 down:true
上层开始唤醒
09-25 15:13:07.197996 929 1117 D PowerManagerNotifier: onWakeLockAcquired: flags=1, tag="PhoneWindowManager.mPowerKeyWakeLock", packageName=android, ownerUid=1000, ownerPid=929, workSource=null
09-25 15:13:07.202103 929 1117 D PowerManagerService: |----com.android.server.power.PowerManagerService.wakeUpNoUpdateLocked(PowerManagerService.java:1536)
09-25 15:13:07.202144 929 1117 D PowerManagerService: |----com.android.server.power.PowerManagerService.wakeUpInternal(PowerManagerService.java:1527)
09-25 15:13:07.202176 929 1117 D PowerManagerService: |----com.android.server.power.PowerManagerService.-wrap39(PowerManagerService.java)
09-25 15:13:07.202207 929 1117 D PowerManagerService: |----com.android.server.power.PowerManagerService$BinderService.wakeUp(PowerManagerService.java:4008)
09-25 15:13:07.202234 929 1117 D PowerManagerService: |----android.os.PowerManager.wakeUp(PowerManager.java:769)
09-25 15:13:07.202263 929 1117 D PowerManagerService: |----com.android.server.policy.PhoneWindowManager.wakeUp(PhoneWindowManager.java:7613)
09-25 15:13:07.202297 929 1117 D PowerManagerService: |----com.android.server.policy.PhoneWindowManager.wakeUpFromPowerKey(PhoneWindowManager.java:7599)
09-25 15:13:07.202326 929 1117 D PowerManagerService: |----com.android.server.policy.PhoneWindowManager.interceptPowerKeyDown(PhoneWindowManager.java:1246)
09-25 15:13:07.202356 929 1117 D PowerManagerService: |----com.android.server.policy.PhoneWindowManager.interceptKeyBeforeQueueing(PhoneWindowManager.java:6922)
09-25 15:13:07.202384 929 1117 D PowerManagerService: |----com.android.server.wm.InputMonitor.interceptKeyBeforeQueueing(InputMonitor.java:465)
09-25 15:13:07.202418 929 1117 D PowerManagerService: |----com.android.server.input.InputManagerService.interceptKeyBeforeQueueing(InputManagerService.java:1897)
09-25 15:13:07.202448 929 1117 I PowerManagerService: Waking up from sleep (uid 1000)...
开始unlock screen
09-25 15:13:07.221393 929 963 I DisplayPowerController: Blocking screen on until initial contents have been drawn.
开始设置auto-suspend的时间
09-25 15:13:07.362247 929 1396 D PowerManagerService: Setting HAL auto-suspend mode to false
09-25 15:13:07.362454 929 1396 D PowerManagerService: Setting HAL interactive mode to true
解锁时间
09-25 15:13:07.372362 929 963 I DisplayPowerController: Unblocked screen on after 151 ms
设置背光灯点亮
??-?? ??:??:??.??? <7>[14082.423208] (1)[1396:PhotonicModulat][name:leds&][LED]Set Backlight directly 44 at time 4296345559, mapping level is 44
??-?? ??:??:??.??? <7>[14082.424847] (1)[1396:PhotonicModulat][name:ddp_aal&]disp_aal_notify_backlight_changed: 177/1023
??-?? ??:??:??.??? <4>[14082.430442] (0)[508:AALServiceMain][PWM] disp_pwm_set_backlight_cmdq(id = 0x1, level_1024 = 149), old = 0
亮屏完成
09-25 15:13:07.380214 929 963 D DisplayPowerController: Finished business..
遇到的问题分析过程
按power按键后,13秒以后才会亮起
//上层唤醒
03-10 10:27:36.810765 1007 1060 I PowerManagerService: Waking up from sleep (uid 1000)...
//设置auto-suspend的动作
03-10 10:27:37.039599 1007 1140 D PowerManagerService: Setting HAL auto-suspend mode to false
03-10 10:27:49.775024 1007 1140 D PowerManagerService: Setting HAL interactive mode to true
//上层解锁
03-10 10:27:50.844962 1007 1060 I DisplayPowerController: Blocking screen on until initial contents have been drawn.
//设置背光点亮
03-10 10:27:50.109 <7>[64212.010491] (5)[1140:PhotonicModulat][name:leds&][LED][BL] Set Backlight directly T:64212.10,L:255 map:255
03-10 10:27:50.109 <7>[64212.010510] (5)[1140:PhotonicModulat][name:ddp_aal&]disp_aal_notify_backlight_changed: 1023/1023
//完成点亮屏幕
03-10 10:27:51.880013 1007 1060 D DisplayPowerController: Finished business...
初步分析如下,发现异常点,Setting HAL auto-suspend发现消耗了13s,这时候会打印出关键log
PowerManagerService-JNI: Excessive delay in autosuspend_disable() while turning screen on: 12735ms
继续分析:
发现这段时间内有14秒左右
<6>[64197.519864] (0)[1061:system_server]PM: suspend entry 2017-03-10 02:27:35.602021092 UTC
<3>[64198.293043] (1)[1061:system_server]battery resume NOT by pcm timer!!
<3>[64211.675581] (0)[1061:system_server]@bs=0@
<6>[64211.675625] (0)[1061:system_server]PM: suspend exit 2017-03-10 02:27:49.773928539 UTC
综上分析,问题点就在charger这块可能持锁时间太长.
http://192.168.10.10/#/c/153969/
二. 灭屏的主要关键log
上层按键的时间(自动灭屏无此log)
09-25 15:13:04.405504 929 1117 D PhoneWindowManager-interceptKeyBeforeQueueing: --->keyCode:26 down:true
上层开始执行灭屏
09-25 15:13:04.656024 929 1117 D PowerManagerService:
|----com.android.server.power.PowerManagerService.goToSleepNoUpdateLocked(PowerManagerService.java:1610)
09-25 15:13:04.656052 929 1117 D PowerManagerService:
|----com.android.server.power.PowerManagerService.goToSleepInternal(PowerManagerService.java:1599)
09-25 15:13:04.656075 929 1117 D PowerManagerService:
|----com.android.server.power.PowerManagerService.-wrap13(PowerManagerService.java)
09-25 15:13:04.656113 929 1117 D PowerManagerService:
|----com.android.server.power.PowerManagerService$BinderService.goToSleep(PowerManagerService.java:4042)
09-25 15:13:04.656136 929 1117 D PowerManagerService:
|----android.os.PowerManager.goToSleep(PowerManager.java:731)
09-25 15:13:04.656158 929 1117 D PowerManagerService:
|----com.android.server.policy.PhoneWindowManager.powerPress(PhoneWindowManager.java:1357)
09-25 15:13:04.656181 929 1117 D PowerManagerService:
|----com.android.server.policy.PhoneWindowManager.interceptPowerKeyUp(PhoneWindowManager.java:1292)
09-25 15:13:04.656204 929 1117 D PowerManagerService:
|----com.android.server.policy.PhoneWindowManager.interceptKeyBeforeQueueing(PhoneWindowManager.java:6933)
09-25 15:13:04.656226 929 1117 D PowerManagerService:
|----com.android.server.wm.InputMonitor.interceptKeyBeforeQueueing(InputMonitor.java:465)
09-25 15:13:04.656248 929 1117 D PowerManagerService:
|----com.android.server.input.InputManagerService.interceptKeyBeforeQueueing(InputManagerService.java:1897)
09-25 15:13:04.656270 929 1117 I PowerManagerService: Going to sleep due to power button (uid 1000)...
设置auto-suspend的状态
09-25 15:13:05.553522 929 1396 D PowerManagerService: Setting HAL interactive mode to false
09-25 15:13:05.553586 929 1396 D PowerManagerService: Setting HAL auto-suspend mode to true
更新当前屏幕的状态
09-25 15:13:04.656918 929 1117 D DisplayPowerController: requestPowerState: policy=OFF, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=true, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, useTwilight=false, waitForNegativeProximity=false, changed=true
09-25 15:13:04.661324 929 963 D DisplayPowerController: updatePowerState: policy=OFF, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=true, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, useTwilight=false, mWaitingForNegativeProximity=false, autoBrightnessAdjustmentChanged=false, mustNotify=true
09-25 15:13:05.200432 929 963 D DisplayPowerController: updatePowerState: policy=OFF, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=true, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, useTwilight=false, mWaitingForNegativeProximity=false, autoBrightnessAdjustmentChanged=false, mustNotify=true
09-25 15:13:05.554135 929 963 D DisplayPowerController: updatePowerState: policy=OFF, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=true, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, useTwilight=false, mWaitingForNegativeProximity=false, autoBrightnessAdjustmentChanged=false, mustNotify=true
驱动设置背光亮度
??-?? ??:??:??.??? <7>[14080.065349] (0)[1396:PhotonicModulat][name:leds&][LED]Set Backlight directly 0 at time 4296345323, mapping level is 0
灭屏完成
09-25 15:13:05.554253 929 963 D DisplayPowerController: Display ready!
09-25 15:13:05.554306 929 963 D DisplayPowerController: Finished business...
拨打电话的时候,马上出现灭屏
初步分析
拨打电话的时间
12-08 20:27:12.377449 885 921 I AT : AT< +ECPI: 1,133,0,0,1,0,"18317062682",161,"",16 (RIL_URC_READER, tid:0)
执行灭屏的时间
12-08 20:27:19.195634 993 1018 D PowerManagerService:
|----com.android.server.power.PowerManagerService.goToSleepNoUpdateLocked(PowerManagerService.java:1565)
12-08 20:27:19.195767 993 1018 D PowerManagerService:
|----com.android.server.power.PowerManagerService.updateWakefulnessLocked(PowerManagerService.java:2266)
12-08 20:27:19.195873 993 1018 D PowerManagerService:
|----com.android.server.power.PowerManagerService.updatePowerStateLocked(PowerManagerService.java:1845)
12-08 20:27:19.195965 993 1018 D PowerManagerService:
|----com.android.server.power.PowerManagerService.handleUserActivityTimeout(PowerManagerService.java:2205)
12-08 20:27:19.196052 993 1018 D PowerManagerService:
|----com.android.server.power.PowerManagerService.-wrap18(PowerManagerService.java)
12-08 20:27:19.196141 993 1018 D PowerManagerService:
|----com.android.server.power.PowerManagerService$PowerManagerHandler.handleMessage(PowerManagerService.java:3547)
12-08 20:27:19.196232 993 1018 D PowerManagerService:
|----android.os.Handler.dispatchMessage(Handler.java:110)
12-08 20:27:19.196502 993 1018 D PowerManagerService:
|----android.os.Looper.loop(Looper.java:203)
12-08 20:27:19.196621 993 1018 D PowerManagerService:
|----android.os.HandlerThread.run(HandlerThread.java:61)
12-08 20:27:19.196707 993 1018 D PowerManagerService:
|----com.android.server.ServiceThread.run(ServiceThread.java:46)
12-08 20:27:19.196788 993 1018 I PowerManagerService: Going to sleep due to screen timeout (uid 1000)...
设置auto-suspend的时间
12-08 20:27:20.206320 993 1278 D PowerManagerService: Setting HAL interactive mode to false
12-08 20:27:20.206363 993 1278 D PowerManagerService: Setting HAL auto-suspend mode to true
驱动设置灭屏
12-08 20:27:19.758 <7>[ 8556.395647] (0)[1278:PhotonicModulat][name:leds&][LED]Set Backlight directly 0 at time 4295792934, mapping level is 0
灭屏完成,以上log可以知道从接受开始灭屏的时间到完成灭屏,是没有问题
12-08 20:27:20.206830 993 1018 D DisplayPowerController: Display ready!
12-08 20:27:20.206856 993 1018 D DisplayPowerController: Finished business...
深入分析什么条件触发他灭屏的?
查看当前打电话开始整个屏幕显示的过程,可以发现一个奇怪的问题,为什么useProximitySensor一直为false.对比正常打电话,这里是一直ture状态
12-08 20:27:08.477400 993 1018 D DisplayPowerController: updatePowerState: policy=BRIGHT, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=false, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, useTwilight=false, mWaitingForNegativeProximity=false, autoBrightnessAdjustmentChanged=false, mustNotify=true
12-08 20:27:08.947930 993 1018 D DisplayPowerController: updatePowerState: policy=BRIGHT, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=false, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, useTwilight=false, mWaitingForNegativeProximity=false, autoBrightnessAdjustmentChanged=false, mustNotify=true
12-08 20:27:09.022917 993 1018 D DisplayPowerController: updatePowerState: policy=BRIGHT, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=false, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, useTwilight=false, mWaitingForNegativeProximity=false, autoBrightnessAdjustmentChanged=false, mustNotify=true
12-08 20:27:09.023881 993 1018 D DisplayPowerController: updatePowerState: policy=BRIGHT, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=false, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, useTwilight=false, mWaitingForNegativeProximity=false, autoBrightnessAdjustmentChanged=false, mustNotify=true
12-08 20:27:17.193356 993 1018 D DisplayPowerController: updatePowerState: policy=DIM, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=false, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, useTwilight=false, mWaitingForNegativeProximity=false, autoBrightnessAdjustmentChanged=false, mustNotify=true
12-08 20:27:17.657676 993 1018 D DisplayPowerController: updatePowerState: policy=DIM, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=false, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, useTwilight=false, mWaitingForNegativeProximity=false, autoBrightnessAdjustmentChanged=false, mustNotify=false
12-08 20:27:19.200712 993 1018 D DisplayPowerController: updatePowerState: policy=OFF, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=false, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, useTwilight=false, mWaitingForNegativeProximity=false, autoBrightnessAdjustmentChanged=false, mustNotify=true
12-08 20:27:19.755524 993 1018 D DisplayPowerController: updatePowerState: policy=OFF, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=false, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, useTwilight=false, mWaitingForNegativeProximity=false, autoBrightnessAdjustmentChanged=false, mustNotify=true
12-08 20:27:20.206754 993 1018 D DisplayPowerController: updatePowerState: policy=OFF, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, brightnessSetByUser=true, useAutoBrightness=false, blockScreenOn=false, lowPowerMode=false, boostScreenBrightness=false, dozeScreenBrightness=-1, dozeScreenState=UNKNOWN, useTwilight=false, mWaitingForNegativeProximity=false, autoBrightnessAdjustmentChanged=false, mustNotify=true
查看知道返回是0参数,0代表靠近。ALS是Lightsensor PS是Psensor
12-08 20:27:14.133 <4>[ 8550.770608] (0)[2026:Binder:993_9]
ps_delay 20000000 ns
12-08 20:27:19.822 <4>[ 8556.459917] (3)[1245:Binder:993_3] ps_delay 200000000 ns
12-08 20:27:19.879 <7>[ 8556.517378] (3)[466:AALServiceMain][name:ltr559&][ALS/PS] ltr559_obj als enable value = 0
和驱动沟通确认发现只报了靠近,未报远离,导致灭屏后,无法重新亮起了,驱动回复,校准下就行