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)

2019040701_android-recover-from-sleep-1.patch (2.4 KB ) - added by mspieth 7 years ago.
20190415-android-suspend-fix.patch (1.9 KB ) - added by mspieth 7 years ago.
20190417-android-suspend-pause-bookmark.patch (2.8 KB ) - added by gigem 7 years ago.
20190418-android-suspend-pause-bookmark.patch (2.9 KB ) - added by gigem 7 years ago.

Download all attachments as: .zip

Change History (19)

by mspieth, 7 years ago

comment:1 by mspieth, 7 years ago

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

We will see.

comment:2 by mspieth, 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 mspieth, 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 mspieth, 7 years ago

comment:4 by mspieth, 7 years ago

Added new patch for main repo.

Disregard previous patch.

Not yet tested but builds.

No change to manifest required.

Last edited 7 years ago by mspieth (previous) (diff)

comment:5 by Mark Spieth <mspieth@…>, 7 years ago

In 9de7b0f21d/mythtv:

Error: Processor CommitTicketReference failed
GIT backend not available

comment:6 by Mark Spieth <mspieth@…>, 7 years ago

In 9de7b0f21d/mythtv:

Error: Processor CommitTicketReference failed
GIT backend not available

by gigem, 7 years ago

comment:7 by gigem, 7 years ago

Added a new patch to automatically pause and set a bookmark when suspending and undo them when resuming.

in reply to:  7 ; comment:8 by mspieth, 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.

in reply to:  8 comment:9 by gigem, 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 gigem, 7 years ago

comment:10 by gigem, 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 mspieth, 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 gigem, 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:13 by David Engel <dengel@…>, 7 years ago

In 94bffc30a5/mythtv:

Error: Processor CommitTicketReference failed
GIT backend not available

comment:14 by mspieth, 7 years ago

Resolution: Fixed
Status: newclosed

comment:15 by Stuart Auchterlonie, 7 years ago

Milestone: needs_triage31.0
Note: See TracTickets for help on using tickets.