android / media-samples

Multiple samples showing the best practices in media APIs on Android (audio, video, etc.).
Apache License 2.0
1.27k stars 740 forks source link

Failed to start presentation mode. #2

Open BernardJiang opened 5 years ago

BernardJiang commented 5 years ago

The app works usually for the very first time. It fails easily with the following steps:

1) run the app successfully for the first time, presentation display on the second display, HDMI TV; 2) from Android system bar, select square to see all app in memory, then click "CLEAR ALL" to kill all; 3) run the app again, presentation fails. TV mirrors the LCD screen of android.

4) Press square button on system bar again, then click the app again. It can recover.

The log shows massive errors repeatedly for 180 times per second.

On Android API 25. It doesn't happen every time but often enough.

07-09 22:54:49.013 1414 1533 E WindowManager: Unhandled exception in Window Manager 07-09 22:54:49.013 1414 1533 E WindowManager: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.DisplayInfo com.android.server.wm.DisplayContent.getDisplayInfo()' on a null object reference 07-09 22:54:49.013 1414 1533 E WindowManager: at com.android.server.wm.Task.getDisplayInfo(Task.java:766) 07-09 22:54:49.013 1414 1533 E WindowManager: at com.android.server.wm.DimLayer.getBoundsForFullscreen(DimLayer.java:209) 07-09 22:54:49.013 1414 1533 E WindowManager: at com.android.server.wm.DimLayer.setBoundsForFullscreen(DimLayer.java:221) 07-09 22:54:49.013 1414 1533 E WindowManager: at com.android.server.wm.DimLayerController.updateDimLayer(DimLayerController.java:60) 07-09 22:54:49.013 1414 1533 E WindowManager: at com.android.server.wm.WindowSurfacePlacer.performLayoutLockedInner(WindowSurfacePlacer.java:1003) 07-09 22:54:49.013 1414 1533 E WindowManager: at com.android.server.wm.WindowSurfacePlacer.applySurfaceChangesTransaction(WindowSurfacePlacer.java:656) 07-09 22:54:49.013 1414 1533 E WindowManager: at com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementInner(WindowSurfacePlacer.java:321) 07-09 22:54:49.013 1414 1533 E WindowManager: at com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementLoop(WindowSurfacePlacer.java:236) 07-09 22:54:49.013 1414 1533 E WindowManager: at com.android.server.wm.WindowSurfacePlacer.performSurfacePlacement(WindowSurfacePlacer.java:184) 07-09 22:54:49.013 1414 1533 E WindowManager: at com.android.server.wm.WindowManagerService$H.handleMessage(WindowManagerService.java:8393) 07-09 22:54:49.013 1414 1533 E WindowManager: at android.os.Handler.dispatchMessage(Handler.java:102) 07-09 22:54:49.013 1414 1533 E WindowManager: at android.os.Looper.loop(Looper.java:154) 07-09 22:54:49.013 1414 1533 E WindowManager: at android.os.HandlerThread.run(HandlerThread.java:61) 07-09 22:54:49.013 1414 1533 E WindowManager: at com.android.server.ServiceThread.run(ServiceThread.java:46) 07-09 22:54:49.016 1414 1533 E WindowManager: Unhandled exception in Window Manager