OSDN Git Service

Be bug-compatible with Fragment#setUserVisibleHint < N
authorAdam Powell <adamp@google.com>
Mon, 18 Apr 2016 18:01:55 +0000 (11:01 -0700)
committerAdam Powell <adamp@google.com>
Mon, 18 Apr 2016 23:39:22 +0000 (16:39 -0700)
commitef4d99f016077ba193fa00ba1b05dce8686f130c
treef5aab298dc309189c26a631ae0f820ff9aec2742
parent739da49dbb5f1132da62fe55768602f36b08575c
Be bug-compatible with Fragment#setUserVisibleHint < N

Prior to Android N we were simply checking if a fragment had a
FragmentManager set before we would trigger a deferred
start. Unfortunately this also gets set before a fragment transaction
is committed, so if setUserVisibleHint was called before a transaction
commit, we would start the fragment way too
early. FragmentPagerAdapter triggers this situation.

Unfortunately some apps relied on this timing in overrides of
setUserVisibleHint on their own fragments, and expected, however
erroneously, that after a call to super.setUserVisibleHint their
onStart methods had been run.

Bug 28184671

Change-Id: Ie40d5f6963d312c2fad4a48fb4f992d33e65c83b
core/java/android/app/Fragment.java