gluonhq / substrate

Create native Java(FX) apps for desktop, mobile and embedded
GNU General Public License v2.0
394 stars 52 forks source link

Android: Black screen after app comes from background #350

Open jperedadnr opened 4 years ago

jperedadnr commented 4 years ago

Open app, works move app to background (opening other app) go back to the app: a black screen shows up.

ADB shows:

swapBuffers failed

repeatedly:

[mar. feb. 18 19:09:48 CET 2020][INFO] [SUB] D/GraalCompiled(23456): ES2ResourceFactory: Prism - createStockShader: FillPgram_Color.frag
[mar. feb. 18 19:09:48 CET 2020][INFO] [SUB] D/GraalCompiled(23456): traceEvent
[mar. feb. 18 19:09:48 CET 2020][INFO] [SUB] D/GraalCompiled(23456): : 
[mar. feb. 18 19:09:48 CET 2020][INFO] [SUB] D/GraalCompiled(23456): Set 
[mar. feb. 18 19:09:48 CET 2020][INFO] [SUB] D/GraalCompiled(23456): MouseState[x=205,y=329,wheel=0,buttonsPressed=IntSet[]]
[mar. feb. 18 19:09:48 CET 2020][INFO] [SUB] D/GraalCompiled(23456): 
[mar. feb. 18 19:09:48 CET 2020][INFO] [SUB] D/GraalCompiled(23456): ES2ResourceFactory: Prism - createStockShader: Solid_TextureRGB.frag
[mar. feb. 18 19:09:48 CET 2020][INFO] [SUB] D/GraalCompiled(23456): 
[mar. feb. 18 19:09:48 CET 2020][INFO] [SUB] D/GraalCompiled(23456): ES2ResourceFactory: Prism - createStockShader: Texture_Color.frag
[mar. feb. 18 19:09:48 CET 2020][INFO] [SUB] D/GraalCompiled(23456): 
[mar. feb. 18 19:09:55 CET 2020][INFO] [SUB] E/GraalGluon(23456): appDataDir: /data/user/0/hello.hellofx
[mar. feb. 18 19:09:55 CET 2020][INFO] [SUB] E/GraalGluon(23456): nativeSetSurface called, env at 0x7b1f1a56c0 and size 8, surface at 0x7ffc56b248
[mar. feb. 18 19:09:55 CET 2020][INFO] [SUB] E/GraalGluon(23456): native setSurface Ready, native window at 0x7a89dbf010
[mar. feb. 18 19:09:55 CET 2020][INFO] [SUB] E/GraalGluon(23456): SurfaceReady, surface at 0x7ffc56b218
[mar. feb. 18 19:09:55 CET 2020][INFO] [SUB] E/GraalGluon(23456): SurfaceReady, native window at 0x7a89dbf010
[mar. feb. 18 19:09:55 CET 2020][INFO] [SUB] E/GraalGluon(23456): nativeSetSurface called, env at 0x7b1f1a56c0 and size 8, surface at 0x7ffc56b228
[mar. feb. 18 19:09:55 CET 2020][INFO] [SUB] E/GraalGluon(23456): native setSurface Ready, native window at 0x7a89dbf010
[mar. feb. 18 19:09:55 CET 2020][INFO] [SUB] E/GraalGluon(23456): launcher, nativeSurfaceRedrawNeeded called. Invoke method on glass_monocle
[mar. feb. 18 19:09:55 CET 2020][INFO] [SUB] D/GraalCompiled(23456): traceEvent: Set MouseState[x=205,y=329,wheel=0,buttonsPressed=IntSet[]]
[mar. feb. 18 19:09:55 CET 2020][INFO] [SUB] D/GraalCompiled(23456): swapBuffers failed
[mar. feb. 18 19:09:55 CET 2020][INFO] [SUB] D/GraalCompiled(23456): swapBuffers failed
[mar. feb. 18 19:09:55 CET 2020][INFO] [SUB] D/GraalCompiled(23456): 
[mar. feb. 18 19:09:55 CET 2020][INFO] [SUB] D/GraalCompiled(23456): swapBuffers failed
jperedadnr commented 2 years ago

Update:

Black screen when moving app to background. Log shows:

11-22 19:02:06.026 18851 18851 V GraalActivity: SurfaceRedraw needed start
11-22 19:02:06.026 18851 18851 V GraalActivity: ask native graallayer to redraw surface
--------- Java_com_gluonhq_helloandroid_MainActivity_nativeSurfaceRedrawNeeded ------->
11-22 19:02:06.026 18851 18851 E GraalGluon: launcher, nativeSurfaceRedrawNeeded called. Invoke method on glass_monocle
----- androidJfx_requestGlassToRedraw() ------>
11-22 19:02:06.026 18851 18851 I GLASS   : Native code is notified that surface needs to be redrawn (repaintall)
11-22 19:02:06.384   506   506 E Layer   : [Surface(name=AppWindowToken{df2f9f9 token=Token{bbcd8c0 ActivityRecord{bb16a43 u0 com.gluonhq.samples.notes/com.gluonhq.helloandroid.MainActivity t21}}})/@0xb6f13b4 - animation-leash#0] No local sync point found
11-22 19:02:06.384   506   506 E Layer   : [Surface(name=AppWindowToken{369deed token=Token{4252904 ActivityRecord{7ab8117 u0 com.google.android.apps.nexuslauncher/.NexusLauncherActivity t2}}})/@0xc8575e5 - animation-leash#0] No local sync point found
<---- androidJfx_requestGlassToRedraw() ------
<--------- Java_com_gluonhq_helloandroid_MainActivity_nativeSurfaceRedrawNeeded -------

11-22 19:02:06.526 18851 18851 V GraalActivity: surfaceredraw needed part 1 done
11-22 19:02:06.526 18851 18851 E GraalGluon: launcher, nativeSurfaceRedrawNeeded called. Invoke method on glass_monocle
11-22 19:02:06.527 18851 18851 I GLASS   : Native code is notified that surface needs to be redrawn (repaintall)
11-22 19:02:06.527 18851 18851 V GraalActivity: surfaceredraw needed (and wait) done

Error happens in the first call to nativeSurfaceRedrawNeeded() in MainActivity::surfaceRedrawNeeded, which in turn calls androidJfx_requestGlassToRedraw, which mainly calls jMonocleWindowManagerClass::monocle_repaintAll.