Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cards unable to be redrawn after screen off #4938

Closed
timrae opened this issue Sep 10, 2018 · 11 comments
Closed

Cards unable to be redrawn after screen off #4938

timrae opened this issue Sep 10, 2018 · 11 comments

Comments

@timrae
Copy link
Member

timrae commented Sep 10, 2018

Uh.oh.

@timrae
Copy link
Member Author

timrae commented Sep 10, 2018

Android 8.0.0, alpha 30
I believe it's gonna be easy to reproduce

@mikehardy
Copy link
Member

Sure - I'm just now rebasing and branching out after you merged the last PR, I'll see what I can see

@mikehardy
Copy link
Member

if you publish those to any distribution channels you should stop it though! no need to get a flood of reports for even one bug when we know a big chunk landed...

@timrae
Copy link
Member Author

timrae commented Sep 10, 2018 via email

@mikehardy
Copy link
Member

got it. just firing up the environment on that code right now and if I/we can't find it in the next couple hours we can revert

@timrae
Copy link
Member Author

timrae commented Sep 10, 2018 via email

@timrae
Copy link
Member Author

timrae commented Sep 10, 2018 via email

@mikehardy
Copy link
Member

mikehardy commented Sep 10, 2018

Ok - it's triggered between library versions 27.0.2 and 27.1.0. I'll find it for real but this will be an easy hotfix without losing otherwise-forward progress from the material-dialogs upgrade and cleanup work

mikehardy added a commit to mikehardy/Anki-Android that referenced this issue Sep 10, 2018
@timrae timrae closed this as completed in 2e98bb0 Sep 10, 2018
@timrae
Copy link
Member Author

timrae commented Sep 10, 2018

Thanks for the quick response, confirmed that the problem is resolved in the new alpha.

@mikehardy
Copy link
Member

Developer comments on the 27.0->27.1 changes: https://medium.com/androiddevelopers/loaders-in-support-library-27-1-0-b1a1f0fee638

I think this issue should remain open and have a "Support Library 27.1.x - " prefix (those issue summaries are how I'm looking at forward-porting issues, or maybe we need an issue tag for "forward-porting" or similar)

@mikehardy
Copy link
Member

mikehardy commented Sep 11, 2018

I found the exact library hook at this point.

The 27.0.2 and 27.1.1 sequence for initial card load is:

  1. UI thread deck picker -> select deck
  2. UI thread deck is loaded and picks first card
  3. UI thread Reviewer.onResume() (plus whole object hierarchy) is called and finishes
  4. Async thread CollectionLoader.deliverResult() is called
  5. UI thread AnkiActivity.onLoadFinished() / LoaderCallback called
  6. UI thread Reviewer.onCollectionLoaded() called the super() chain goes up
  7. UI thread AbstractFlashcardViewer.onCollectionLoaded() does lots of stuff
  8. UI thread Reviewer.onCollectionLoaded() does lots of stuff

For 27.0.2 screen power cycle it looks like:

  1. All the onPause() stuff happens as screen goes down
  2. Step 3 from the initial card load above happens as screen comes up
  3. Step 4 above happens, but Step 5 on the UI thread never happens. No LoaderCallback.onLoadFinished()/CollectionLoader.onCollectionLoaded() thread hand-off call.
  4. The WebView shows up

For 27.1.1 screen power cycle:

  1. same as 27.0.2
  2. same as 27.0.2
  3. Steps 5-8 from the initial card load happen! UI thread .onCollectionLoaded is called
  4. The WebView is blanked out :-(

What I don't understand is why the WebView doesn't just show up again. It seems to me that the 27.0.2 flow was actually wrong - the 27.1.1 flow should be fine as it is idempotent really, but for some reason the work done by item 5-8 of the initial load works once, but not a second time on the same screen. Maybe during onPause() we need to do some more WebView teardown for 27.1.1 to make it ready for all the re-init it does?

I'm still investigating, but that's where my current understanding is.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants