Fix Onyx Boox black screen on wake by not using SurfaceView#579
Conversation
On some Onyx Boox devices (confirmed on Palma 2), the SurfaceView surface is not recreated after the rapid RESUME/PAUSE/STOP activity cycling that the Boox system performs on wake. This leaves android.app.window permanently nil, causing a black screen. The SurfaceView with setZOrderOnTop(true) and PixelFormat.TRANSPARENT was introduced for NGL4/Tolino devices. The Onyx Qualcomm EPD API (View.refreshScreen) does not require a SurfaceView — when needsView is false, einkUpdate() already falls back to the DecorView content view. Setting needsView()=false makes Onyx devices use NativeActivity's default DecorView surface, which follows the standard activity lifecycle and correctly survives the Boox wake sequence.
|
Last time I tested, my device also worked with needsView = false, and if I remember correctly, I don’t recall any Onyx device that required this feature. I think you can go ahead with that and if someone complains we can create a specific driver just for that device. |
|
Congratulations, @msk !! This one's been bugging me for a LONG time. |
…/android-luajit-launcher#579) On some Onyx Boox devices (confirmed on Palma 2), the SurfaceView surface is not recreated after the rapid RESUME/PAUSE/STOP activity cycling that the Boox system performs on wake. This leaves android.app.window permanently nil, causing a black screen. The SurfaceView with setZOrderOnTop(true) and PixelFormat.TRANSPARENT was introduced for NGL4/Tolino devices. The Onyx Qualcomm EPD API (View.refreshScreen) does not require a SurfaceView — when needsView is false, einkUpdate() already falls back to the DecorView content view. Setting needsView()=false makes Onyx devices use NativeActivity's default DecorView surface, which follows the standard activity lifecycle and correctly survives the Boox wake sequence.
|
So with this fix, we can revert this PR then #562 In app/src/main/java/org/koreader/launcher/device/EPDFactory.kt |
|
Are you able to try it yourself? I realize setting up the whole environment including Android can be slightly challenging. |
|
@Frenzie I will try to build it and test on the boox directly |
|
@Frenzie I can't manage to build the android version on a Mac M4 :/ |
|
I managed to build the APK. |
On some Onyx Boox devices (confirmed on Palma 2), the SurfaceView surface is not recreated after the rapid RESUME/PAUSE/STOP activity cycling that the Boox system performs on wake. This leaves
android.app.windowpermanently nil, causing a black screen. The app is still running and responding to touch; it just can't render becauseANativeWindow_lockhas no window to lock.The SurfaceView with
setZOrderOnTop(true)andPixelFormat.TRANSPARENTwas introduced for NGL4/Tolino devices. The Onyx Qualcomm EPD API (View.refreshScreen) does not require a SurfaceView; whenneedsViewis false,einkUpdate()already falls back to the DecorView content view. SettingneedsView()=falsemakes Onyx devices use NativeActivity's default DecorView surface, which follows the standard activity lifecycle and correctly survives the Boox wake sequence.This fixes koreader/koreader#12445.
Diagnostics that led to this fix
Lifecycle event logging on the Boox Palma 2 revealed that after sleep/wake,
INIT_WINDOWnever fires when using a SurfaceView:With
needsView()=false(DecorView surface),INIT_WINDOWfires correctly:Test on Boox Palma 2
See koreader/koreader#12445 (comment) for the reproduction steps.
This change is