问题描述
测试同学在测试过程中,打开了xx应用,然后点击home键,发生黑屏现象。
解决方案
从视频现象来看,桌面是处于黑屏的,但是statusBar以及dock栏是可以正常现实的,其实这种问题一般都是属于应用问题了。
下面我们继续从log解读:
启动com.xx.xx时间17:54:32,从log看,com.xx.xx这个应用一直处于前台,也就是说按home键之后,xx应用并没有回退到后台(以下log关于此应用信息全部用xx代替):
- 12-21 17:54:32.975 1539 2049 I ActivityTaskManager: START u10 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.xx.xx cmp=com.xx.xx/.xx(has extras)} from uid 1010018
-
- 12-21 17:54:32.979 1539 2049 I wm_set_resumed_activity: [10,com.xx.xx/.xx,bringingFoundTaskToFront]
-
- 12-21 17:54:32.979 1539 2049 I WindowManager: onActivityStackWindowModeChange toFont=true,launchedFromPackage=com.xx.xx,packageName=com.xx.xx
-
- 12-21 17:54:32.979 1539 2049 I wm_new_intent: [10,141496873,1001707,com.xx.xx/.xx,android.intent.action.MAIN,NULL,NULL,270548992]
-
- 12-21 17:54:32.985 1539 2077 I wm_resume_activity: [10,141496873,1001707,com.xx.xx/.xx]
-
- 12-21 17:54:32.986 4838 4838 I wm_on_restart_called: [141496873,com.xx.xx,performRestartActivity]
-
- 12-21 17:54:32.986 4838 4838 I wm_on_start_called: [141496873,com.xx.xx,handleStartActivity]
-
- 12-21 17:54:32.988 4838 4838 I wm_on_resume_called: [141496873,com.xx.xx,RESUME_ACTIVITY]
-
- 12-21 17:54:33.024 4838 4838 I wm_on_top_resumed_gained_called: [141496873,com.xx.xx,topStateChangedWhenResumed]
-
- 12-21 17:54:33.024 4838 4838 I wm_on_top_resumed_lost_called: [141496873,com.xx.xx,topStateChangedWhenResumed]
黑屏原因应该是surface未同步更新导致,图形渲染出现问题,这一步的流程是处于ViewRootImpl.java跟
SurfaceSyncer之间,如果流程正常在提交给wms处理,surface未同步更新也就导致对应的图形没有绘制出来。并且从下面log可以看出刚好问题发生的进程就是com.xx.xx,而且黑屏现象是statusBar以及dock栏可见。
- 12-21 17:54:33.006 4838 22487 E OpenGLRenderer: Unable to match the desired swap behavior.
- 12-21 17:54:33.007 2101 19425 I xx : onForegroundActivitiesChanged uid 1010048 pid 4838 fg true
- 12-21 17:54:33.008 4838 4838 E SurfaceSyncer: Failed to find sync for id=0
- 12-21 17:54:33.008 4838 4838 E SurfaceSyncer: Failed to find sync for id=1
- 12-21 17:54:33.008 4838 4838 E SurfaceSyncer: Failed to find sync for id=2
- 12-21 17:54:33.008 4838 4838 E SurfaceSyncer: Failed to find sync for id=3
SurfaceSyncer这个类属于Android T新增。
而Suarfece同步更新都没完成,那也就属于应用问题,因为正常有了Surface之后会把当前的window的mDrawState置为DRAW_PENDING,这个问题还可以dump surfaceflinger、dump window来进一步确认。
评论记录:
回复评论: