Opened 7 years ago
Closed 7 years ago
Last modified 7 years ago
#13444 closed Bug Report - General (Fixed)
Android recover from long sleep
| Reported by: | mspieth | Owned by: | Mark Spieth |
|---|---|---|---|
| Priority: | minor | Milestone: | 31.0 |
| Component: | Ports - Android | Version: | Master Head |
| Severity: | medium | Keywords: | |
| Cc: | Ticket locked: | no |
Description
When sleeping for a while on android (shield in particular) when the shield wakes up, the screen is black and wont redraw.
Attachments (4)
Change History (19)
by , 7 years ago
| Attachment: | 2019040701_android-recover-from-sleep-1.patch added |
|---|
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Doesnt work
root cause is probably related to this
https://groups.google.com/forum/#!topic/android-ndk/jwVMF6zINus
investigating
comment:3 by , 7 years ago
More info
https://conf.qtcon.org/system/attachments/132/original/QtCon16.pdf%3F1473147092 for android.app.splash_screen_sticky
also https://stackoverflow.com/questions/31523403/qt-5-android-change-background-running-value-to-true to fix the timer not working correctly when the app is in the background. Will need to track the state of the app and not do any UI stuff during background state.
Yet to be tested.
by , 7 years ago
| Attachment: | 20190415-android-suspend-fix.patch added |
|---|
comment:4 by , 7 years ago
Added new patch for main repo.
Disregard previous patch.
Not yet tested but builds.
No change to manifest required.
by , 7 years ago
| Attachment: | 20190417-android-suspend-pause-bookmark.patch added |
|---|
follow-up: 8 comment:7 by , 7 years ago
Added a new patch to automatically pause and set a bookmark when suspending and undo them when resuming.
follow-up: 9 comment:8 by , 7 years ago
Replying to gigem:
Added a new patch to automatically pause and set a bookmark when suspending and undo them when resuming.
Do you have to set background_running in the manifest too?
Otherwise LGTM with the above true.
The other way to do it would be to add a listener for ApplicationStateChanged in the tv class. While sendEvent QAPP_SUSPEND is synchronous, it does go through the dispatcher on the main QT thread. If this is already stopped in no background_running mode, then this may break the handling of QAPP_SUSPEND until the app goes back into foreground.
comment:9 by , 7 years ago
Replying to mspieth:
Do you have to set background_running in the manifest too?
Yes, the way it currently works using MythEvents.
Background running is also currently needed for other reasons. Any screens that use events to update their state need it. They would all have to be changed to support a "refresh everything" operation after being resumed. Some would likely be easy to do that while others less so. It's something we can continue to work towards if we want to. Background music playing would definitely need to keep background running.
Otherwise LGTM with the above true.
The other way to do it would be to add a listener for ApplicationStateChanged in the tv class. While sendEvent QAPP_SUSPEND is synchronous, it does go through the dispatcher on the main QT thread. If this is already stopped in no background_running mode, then this may break the handling of QAPP_SUSPEND until the app goes back into foreground.
I wasn't sure if multiple listeners for ApplicationStateChanged would work. I can try it. Can any Q_Object listen for it? I went with what I was more familiar with (MythEVents) and what I was confident would work.
by , 7 years ago
| Attachment: | 20190418-android-suspend-pause-bookmark.patch added |
|---|
comment:10 by , 7 years ago
Added revised patch using signals and slots instead of MythEventMessages. Also added member variable denoting when we are suspended. This might be needed to avoid a race condition if suspension occurs during TV startup. If would help if someone familiar with TV startup could take a look at that.
comment:11 by , 7 years ago
This one looks fine to me too.
If you think the MythEvents version is better and we can guarantee background running then that version is fine too.
Commit either as you see fit but don't forget the Manifest change too with the first one.
Sorry for not mentioning this sooner to eliminate waste/churn.
comment:12 by , 7 years ago
I'll likely go with the latest patch since it's slightly more direct. I still would like Mark Kendall to review it before committing. He might have a better idea and might also comment on the race condition part I mentioned.
The manifest part is already committed. I did that two days ago. As mentioned, it's still needed unless and until multiple screens are updated to perform full refreshes after being suspended for potentially long periods of time.
comment:14 by , 7 years ago
| Resolution: | → Fixed |
|---|---|
| Status: | new → closed |
comment:15 by , 7 years ago
| Milestone: | needs_triage → 31.0 |
|---|

Added patch which seems to have worked when I paused playback overnight.
We will see.