我正在调试一个错误,在该错误中,从挂起恢复后(按结束键后)不会显示 android 主屏幕。有时它可以恢复,但当它不恢复时,它会保持屏幕昏暗和黑色,但外壳仍在工作。
我可以转储错误报告并使用 chkbugreport 应用程序...对不起,我是一名初学者 android 开发人员,感谢任何帮助指出我从错误报告中调查的位置:
它实际上会在离开手机几分钟后触发 ANR。
恢复后有趣的logcat没有android屏幕(powermanager屏幕超时):
01-09 03:14:29.550 1565 1620 I PowerManagerService: Waking up from sleep...
01-09 03:14:29.560 1347 1424 D SurfaceFlinger: Screen acquired, type=0 flinger=0x4178c408
01-09 03:14:29.610 1565 1620 I WindowManager: Lock screen displayed!
01-09 03:14:29.690 1350 1704 D audio_hw: ENTERING adev_set_parameters() screen_state=on
01-09 03:14:29.690 1350 1704 V audio_hw: setFMParameters: screen_state=on
01-09 03:14:29.690 1350 1704 V audio_hw: LEAVING adev_set_parameters()
01-09 03:14:29.710 1565 1712 I qtaguid : Failed write_ctrl(s 1 10022) res=-1 errno=
01-09 03:14:29.810 1865 2388 I NfcService: applyRouting(), screenState = 2
01-09 03:14:33.320 1565 1694 I PowerManagerService: Going to sleep by user request...
01-09 03:14:33.750 1347 1424 D SurfaceFlinger: Screen released, type=0 flinger=0x4178c408
01-09 03:14:33.800 1565 1712 I qtaguid : Failed write_ctrl(s 0 10022) res=-1 errno=1
01-09 03:14:39.470 1565 1620 D EmergencyButton: Is Sim 1 Locked = false, Is Sim 2 locked = false
01-09 03:14:39.500 1565 1620 D EmergencyButton: enalbe emergency call button = false
01-09 03:14:39.590 1565 1620 I Choreographer: Skipped 176 frames! The application may be doing too much work on its main thread.
01-09 03:14:39.640 1565 1568 D dalvikvm: GC_CONCURRENT freed 698K, 21% free 6985K/8792K, paused 5ms+13ms, total 102ms
01-09 03:14:39.650 1565 1620 I PowerManagerService: Waking up from sleep...
01-09 03:14:39.660 1347 1424 D SurfaceFlinger: Screen acquired, type=0 flinger=0x4178c408
01-09 03:14:39.730 1565 1620 I WindowManager: Lock screen displayed!
01-09 03:14:39.800 1565 1712 I qtaguid : Failed write_ctrl(s 1 10022) res=-1 errno=1
01-09 03:14:49.660 1565 1688 I PowerManagerService: Going to sleep due to screen timeout...
01-09 03:14:50.100 1347 1424 D SurfaceFlinger: Screen released, type=0 flinger=0x4178c408
从 bugreport chkbugreport 中,我可以看到有一些繁忙的线程:
system_server(1565)/PowerManagerService
•system_server(1565)/ActivityManager
•system_server(1565)/UI
•system_server(1565)/PowerManagerService
•system_server(1565)/ActivityManager
•system_server(1565)/UI
PowerManagerService (tid=22 pid=1688 prio=5 state=NATIVE)
android.view.Surface.nativeCreate
android.view.Surface. (Surface.java)
com.android.server.power.ElectronBeam.createSurface (ElectronBeam.java)
com.android.server.power.ElectronBeam.tryPrepare (ElectronBeam.java)
com.android.server.power.ElectronBeam.prepare (ElectronBeam.java)
com.android.server.power.DisplayPowerState.prepareElectronBeam (DisplayPowerState.java)
com.android.server.power.DisplayPowerController.updatePowerState (DisplayPowerController.java)
com.android.server.power.DisplayPowerController.access$300 (DisplayPowerController.java)
com.android.server.power.DisplayPowerController$DisplayControllerHandler.handleMessage (DisplayPowerController.java)
android.os.Handler.dispatchMessage (Handler.java)
android.os.Looper.loop (Looper.java)
android.os.HandlerThread.run (HandlerThread.java)
ActivityManager (tid=15 pid=1628 prio=5 state=NATIVE)
android.view.Surface.nativeCreate
android.view.Surface. (Surface.java)
com.android.server.wm.WindowStateAnimator.createSurfaceLocked (WindowStateAnimator.java)
com.android.server.wm.WindowManagerService.relayoutWindow (WindowManagerService.java)
com.android.server.wm.Session.relayout (Session.java)
android.view.ViewRootImpl.relayoutWindow (ViewRootImpl.java)
android.view.ViewRootImpl.performTraversals (ViewRootImpl.java)
android.view.ViewRootImpl.doTraversal (ViewRootImpl.java)
android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java)
android.view.Choreographer$CallbackRecord.run (Choreographer.java)
android.view.Choreographer.doCallbacks (Choreographer.java)
android.view.Choreographer.doFrame (Choreographer.java)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java)
android.os.Handler.handleCallback (Handler.java)
android.os.Handler.dispatchMessage (Handler.java)
android.os.Looper.loop (Looper.java)
com.android.server.am.ActivityManagerService$AThread.run (ActivityManagerService.java)
UI (tid=13 pid=1620 prio=5 state=NATIVE)
com.google.android.gles_jni.EGLImpl.eglSwapBuffers
android.view.HardwareRenderer$GlRenderer.draw (HardwareRenderer.java)
android.view.ViewRootImpl.draw (ViewRootImpl.java)
android.view.ViewRootImpl.performDraw (ViewRootImpl.java)
android.view.ViewRootImpl.performTraversals (ViewRootImpl.java)
android.view.ViewRootImpl.doTraversal (ViewRootImpl.java)
android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java)
android.view.Choreographer$CallbackRecord.run (Choreographer.java)
android.view.Choreographer.doCallbacks (Choreographer.java)
android.view.Choreographer.doFrame (Choreographer.java)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java)
android.os.Handler.handleCallback (Handler.java)
android.os.Handler.dispatchMessage (Handler.java)
android.os.Looper.loop (Looper.java)
android.os.HandlerThread.run (HandlerThread.java)
01-09 03:21:02.820 1565 1628 E ActivityManager: ANR in com.android.launcher
01-09 03:21:02.820 1565 1628 E ActivityManager: Reason: Broadcast of Intent { act=android.intent.action.TIME_TICK flg=0x40000014 (has extras) }
01-09 03:21:02.820 1565 1628 E ActivityManager: Load: 0.04 / 0.39 / 0.26
01-09 03:21:02.820 1565 1628 E ActivityManager: CPU usage from 55055ms to 0ms ago:
01-09 03:21:02.820 1565 1628 E ActivityManager: 0.1% 1565/system_server: 0% user + 0.1% kernel / faults: 10 minor
01-09 03:21:02.820 1565 1628 E ActivityManager: 0% 1736/com.android.systemui: 0% user + 0% kernel / faults: 18 minor
01-09 03:21:02.820 1565 1628 E ActivityManager: 0% 482/kworker/0:2: 0% user + 0% kernel
01-09 03:21:02.820 1565 1628 E ActivityManager: 0% 412/kworker/3:1: 0% user + 0% kernel
1-09 03:21:02.820 1565 1628 E ActivityManager: 0% 1347/surfaceflinger: 0% user + 0% kernel
01-09 03:21:02.820 1565 1628 E ActivityManager: 0% 1361/gpslogd: 0% user + 0% kernel
01-09 03:21:02.820 1565 1628 E ActivityManager: 0% TOTAL: 0% user + 0% kernel
01-09 03:21:02.820 1565 1628 E ActivityManager: CPU usage from 1987ms to 2629ms later:
01-09 03:21:02.820 1565 1628 E ActivityManager: 21% 1565/system_server: 0% user + 21% kernel / faults: 1 minor
01-09 03:21:02.820 1565 1628 E ActivityManager: 21% 1628/ActivityManager: 1.5% user + 20% kernel
01-09 03:21:02.820 1565 1628 E ActivityManager: 4.6% TOTAL: 0.5% user + 4.1% kernel
从这里开始,由于我对 android 的了解有限,我可以猜测它在 powermanager 等待创建电子束动画以显示主屏幕时卡住了。它正在等待一些本机(或内核代码)完成?因此,它可能是较低层的问题......?
谢谢你的帮助。