[solved] Black screen or frozen on android after resuming from sleep or switching apps

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Message
Author
User avatar
ComputerArt.Club
Veteran
Posts: 427
Joined: Mon May 22, 2017 8:12 am
Completed: Famous Fables, BoPoMoFo: Learn Chinese, Santa's workshop, Cat's Bath, Computer Art Club
Location: Taiwan
Contact:

[solved] Black screen or frozen on android after resuming from sleep or switching apps

#1 Post by ComputerArt.Club »

Has anyone else had an issue with a black screen or frozen screen after turning off the display for a few minutes on android? Doesn't seem to be an issue if the screen is off for a short period if time. It is also occurring when I switch apps. Maybe it is something to do with ATL. My games have a lot of ATL.

Any ideas on circumventing this or preventing it?


Update for newcomers
:
The error has been replicated with several games including the demo game that comes bundled with Renpy
(The Question).

It has also been replicated on the following android versions:
4.1.2, 5, 6 and 7.1.1.

And multiple phones:
Le 2 Pro 4GB RAM
Xiaomi Redmi Note 3 3GB RAM
Samsung Galaxy note 2 2GB RAM
LG G4
LG G2
other unspecified phones

Here is a playlist of videos demonstrating the issue:
https://www.youtube.com/playlist?list=P ... X1BwfXJo6k

So far the following seem unaffected:
Android 4.4.3

The source is as of yet unidenified but appears to be general to apply to many apps (extent to be confirmed) and versions of android. It is also not 100% relicable. It occurs frequently but not every time that you switch between apps or turn the screen off.

Possible causes: Android power saving measures? Something else to do with Android OS? Custom screens? ATL(unlikely)? RAM?

Update: Pytom found the problem and addressed it in a nightly build.
Last edited by ComputerArt.Club on Thu Dec 07, 2017 11:08 am, edited 8 times in total.

Apa
Regular
Posts: 103
Joined: Fri Dec 23, 2016 2:26 am
Location: NYC
Contact:

Re: Black screen or frozen on android after resuming from sleep

#2 Post by Apa »

Does it happen sometimes or every time?
Does it happen on all Android devices/versions you have?
If you can post a simple “one screen” app with “lots of ATL”, we can try to reproduce it on our Androids.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Black screen or frozen on android after resuming from sleep

#3 Post by Imperf3kt »

Can you share the game at all?
I have never experienced this.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
ComputerArt.Club
Veteran
Posts: 427
Joined: Mon May 22, 2017 8:12 am
Completed: Famous Fables, BoPoMoFo: Learn Chinese, Santa's workshop, Cat's Bath, Computer Art Club
Location: Taiwan
Contact:

Re: Black screen or frozen on android after resuming from sleep

#4 Post by ComputerArt.Club »

Thanks for your responses :). Here are two videos of the error occurring in two different Renpy apps:
Cat's Bath: https://youtu.be/0YNhwSz6utQ?t=1m34s
Here is the APK for Cat's Bath: https://drive.google.com/open?id=1P1Ecp ... M5kdSJoOn6.
Haunted School: https://youtu.be/X_hXau82Cig

It could be that the crashes are happening for very different reasons. The error is common but not always 100% replicable (as you can see, during the first half of the cat's bath video I could not replicate the error). I have experienced the error on the two devices that I have tried it on and with both my apps. Cat's Bath is a relatively simple app but it has a lot of ATL, Haunted school also has a lot of ATL but it is more complex (it has RPG and dungeon crawler elements). This time I was surprised that the error even occurred during normal dialog for haunted school. It more likely to take place during dungeon crawler sections or during fights.

Any suggestions or ideas?

Thanks for your time.

Apa
Regular
Posts: 103
Joined: Fri Dec 23, 2016 2:26 am
Location: NYC
Contact:

Re: Black screen or frozen on android after resuming from sleep

#5 Post by Apa »

ComputerArt.Club wrote: Sun Nov 19, 2017 10:17 amHere is the APK for Cat's Bath
We’ll need a simple project with source code, not APK:
Apa wrote: Sun Nov 19, 2017 3:12 amIf you can post a simple “one screen” app with “lots of ATL”, we can try to reproduce it on our Androids.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1460
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Black screen or frozen on android after resuming from sleep

#6 Post by xavimat »

I'm having the same problem. When selecting another app and going back to my app, sometimes it's a black screen, and I can only close the app.
Also Android (6.0.1), last version of Renpy.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
ComputerArt.Club
Veteran
Posts: 427
Joined: Mon May 22, 2017 8:12 am
Completed: Famous Fables, BoPoMoFo: Learn Chinese, Santa's workshop, Cat's Bath, Computer Art Club
Location: Taiwan
Contact:

Re: Black screen or frozen on android after resuming from sleep

#7 Post by ComputerArt.Club »

Apa wrote: Sun Nov 19, 2017 3:36 pm We’ll need a simple project with source code, not APK:
Thanks for the reply Apa. I will try to make a few new short demos with as little code as possible and test it out and then post the simplest app with the problem. It might not even be the ATL. I wouldn't be surprised if I could replicate it with any game. Time will tell. I will give it a go tonight (in about 13 hours).

Those phones were both running Android version 6.0
Cat's Bath was made with Renpy 6.99.13
Haunted School was made with Renpy 6.99.12.4
xavimat wrote: Sun Nov 19, 2017 4:55 pm I'm having the same problem.
Thanks for posting! Anything special about your games that might be causing the issue, or do you think it is something more basic/general?

User avatar
ComputerArt.Club
Veteran
Posts: 427
Joined: Mon May 22, 2017 8:12 am
Completed: Famous Fables, BoPoMoFo: Learn Chinese, Santa's workshop, Cat's Bath, Computer Art Club
Location: Taiwan
Contact:

Re: Black screen or frozen on android after resuming from sleep

#8 Post by ComputerArt.Club »

Apa wrote: Sun Nov 19, 2017 3:36 pm We’ll need a simple project with source code
I built an apk of The Question (the version bundled with Ren'Py 6.99.13.2919) and had the same issues with it.
The screen often goes black or freezes after switching app or turning the screen off (especially after long periods of time).
Here is a video of the error with The Question:
https://youtu.be/oxmUBmdTwtg
At this point I don't think it is a piece of code that is unique to one game, but rather something more general.

It's worth noting that while some of the failed attempts at pressing the buttons at could have been caused by the lack of mobility due to filming with my other hand, I continued testing it after putting the camera down and the game was definitely frozen. I also ran the game again after closing and was able to press the buttons. The error doesn't always occur, but it is very frequent. Sometimes it seems more difficult to generate the error, other times very easy, but there doesn't seem to be a clear reason why. For the question it seems to be most likely to occur on the main menu rather than in-game. This was not the case for the other games.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1460
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Black screen or frozen on android after resuming from sleep

#9 Post by xavimat »

ComputerArt.Club wrote: Sun Nov 19, 2017 9:12 pm
xavimat wrote: Sun Nov 19, 2017 4:55 pm I'm having the same problem.
Thanks for posting! Anything special about your games that might be causing the issue, or do you think it is something more basic/general?
My game relies heavily in custom screens, but, as you have checked with "the question" it may be a general problem.
I've filed an issue in github with a link to this thread: https://github.com/renpy/renpy/issues/1301
(Maybe this thread should go in the "Development of Ren'Py" subforum, tell the mods if you think so).
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
ComputerArt.Club
Veteran
Posts: 427
Joined: Mon May 22, 2017 8:12 am
Completed: Famous Fables, BoPoMoFo: Learn Chinese, Santa's workshop, Cat's Bath, Computer Art Club
Location: Taiwan
Contact:

Re: Black screen or frozen on android after resuming from sleep

#10 Post by ComputerArt.Club »

xavimat wrote: Mon Nov 20, 2017 10:40 am My game relies heavily in custom screens, but, as you have checked with "the question" it may be a general problem.
I've filed an issue in github with a link to this thread
Cool! Thanks!

Yeah, it would be great if this issue could be solved.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Black screen or frozen on android after resuming from sleep or switching apps

#11 Post by Imperf3kt »

Sounds more like an issue with Android 6.xx
I have a device which runs Android 6.0.1, I installed it a month ago and haven't even turned it on yet. I'll see if I get the same behaviour, sometime later this week.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Apa
Regular
Posts: 103
Joined: Fri Dec 23, 2016 2:26 am
Location: NYC
Contact:

Re: Black screen or frozen on android after resuming from sleep or switching apps

#12 Post by Apa »

I won’t hold my breath for it.
Last time I've asked to for a changes in Android build process, I got impression Android platform is not the 1st priority exactly. (No offence intended, just IMO!)
I.e. if you want to get it fixed ASAP, you better find solution yourself, test it and suggest fix to PyTom.
Few more questions/tests:
Is “The Question” app broken after turning off the display on few previous RenPy versions too (6.99.12, 6.99.11)?
Is it same for all Android versions (4,5,6,7)?

Also, quite many apps are somewhat broken on Android 6 (due to extra power-saving measures?), IMO.
It might depend on device of course.
On my LG G4, right after screen turns off:
Skype drops call, stock dialer drops Bluetooth connection and numerous other annoying things happen.
None of them were present on Android 5 on same device...

Apa
Regular
Posts: 103
Joined: Fri Dec 23, 2016 2:26 am
Location: NYC
Contact:

Re: Black screen or frozen on android after resuming from sleep or switching apps

#13 Post by Apa »

Run “The Question” complied with 6.99.13 on LG G4 (A6) and G2 (A5)
A6 shows black screen after switch to another app and back and same after sleep.
A5 works fine after switch to another app and back and killed/started app after sleep.
A6 didn’t kill/start app after sleep - I guess, it just have more memory?

To PyTom - let me know if you want me know to capture logcat log or anything else, please?

User avatar
ComputerArt.Club
Veteran
Posts: 427
Joined: Mon May 22, 2017 8:12 am
Completed: Famous Fables, BoPoMoFo: Learn Chinese, Santa's workshop, Cat's Bath, Computer Art Club
Location: Taiwan
Contact:

Re: Black screen or frozen on android after resuming from sleep or switching apps

#14 Post by ComputerArt.Club »

I ran The Question compiled by 6.99.13 on a Galaxy Note 2 (2GB RAM) running Android 4.1.2 and I replicated the problem on both the main menu and in-game.

The devices that I did the other tests on were:
A Le 2 Pro, Ram: 5GB RAM, OS: Android 6.0. CPU: Helio X20 10-core 2.3
and I think the other one was a Xiamo Redmi Note 3 (can double check tomorrow), also running android 6.0.

Apa
Regular
Posts: 103
Joined: Fri Dec 23, 2016 2:26 am
Location: NYC
Contact:

Re: Black screen or frozen on android after resuming from sleep or switching apps

#15 Post by Apa »

ComputerArt.Club wrote: Tue Nov 21, 2017 11:04 am the other one was a Xiamo Redmi Note 3
That one is well known for killing most of background apps when screen turns off. Tho, if app is killed, it should re-start without problem, not show black screen. :(

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]