Fixed
Status Update
Comments
vi...@google.com <vi...@google.com>
vi...@google.com <vi...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
[Deleted User] <[Deleted User]> #3
Great! Thanks a lot, I'll look for the live updates soon!
vi...@google.com <vi...@google.com> #4
We have passed this defect onto the development team and will update this issue with more information as it becomes available.
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 5c26346135ab721b111109cffe4b2ef7f2ec3ce8
Author: Ian Lake <ilake@google.com>
Date: Wed Jul 03 10:44:25 2019
Add @MainThread to Fragment lifecycle callbacks
Ensure that Lint and other tooling is aware
that Fragment lifecycle callbacks are run on
the main thread.
Test: ./gradlew checkApi
BUG: 127272564
Change-Id: I499266565229ebd68c0511c374ca6794a8ce5d97
M fragment/fragment/api/1.2.0-alpha02.txt
M fragment/fragment/api/current.txt
M fragment/fragment/src/main/java/androidx/fragment/app/DialogFragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
https://android-review.googlesource.com/1011465
https://goto.google.com/android-sha1/5c26346135ab721b111109cffe4b2ef7f2ec3ce8
Branch: androidx-master-dev
commit 5c26346135ab721b111109cffe4b2ef7f2ec3ce8
Author: Ian Lake <ilake@google.com>
Date: Wed Jul 03 10:44:25 2019
Add @MainThread to Fragment lifecycle callbacks
Ensure that Lint and other tooling is aware
that Fragment lifecycle callbacks are run on
the main thread.
Test: ./gradlew checkApi
BUG: 127272564
Change-Id: I499266565229ebd68c0511c374ca6794a8ce5d97
M fragment/fragment/api/1.2.0-alpha02.txt
M fragment/fragment/api/current.txt
M fragment/fragment/src/main/java/androidx/fragment/app/DialogFragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
il...@google.com <il...@google.com> #6
We've added annotations to the lifecycle methods and they'll be available in Fragments 1.2.0-alpha02.
Description
I'm trying to confirm some threading assumptions in a codebase. It currently boils down to the following question:
Can I assume that Fragment.onViewCreated() and Fragment.onResume() are always called on the application's main thread?
As far as I can tell there is no reason for either to be called on a worker thread, but I'm worried my assumption might cause trouble in the future. I'd like to request the addition of "@MainThread" and/or "@AnyThread" to those methods to alleviate that uncertainty.