History log of /frameworks/base/core/java/android/app/FragmentManager.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f53968061cff4bb897748efe7c09bd7a203e1d8f 27-Aug-2016 Andrew Solovay <asolovay@google.com> docs: Fixing links to moved Fragments guide, + redirect

The Fragments API guide was moved, but apparently a redirect was
never set up. Also, there are a few links to the old location in
the Javadocs.

Staged the revised Javadocs (see first comment for stage location).
Not going to stage the redirects file since it would trash another,
bigger CL that deals with the redirects file, but it's pretty
straightforward.

bug: 30559011
Change-Id: Ibd65f85c1ebb9789c1d40614fe11fe4ffda97e58
/frameworks/base/core/java/android/app/FragmentManager.java
e30299f99018f6d1094df53bb48efa712e7a9221 13-May-2016 Adam Powell <adamp@google.com> Add Fragment#onAttachFragment for parent fragments

Framework edition

Add a matching onAttachFragment method to Fragment to match the
fragment host version.

Bug 28760393

Change-Id: I5f50b3446449cae7110da6b4e468ee80f413e1e5
/frameworks/base/core/java/android/app/FragmentManager.java
467cc6f0e1703a961e76f763aef70185c6019405 11-May-2016 Adam Powell <adamp@google.com> Less lazy child FragmentManager creation

Framework edition

Fix a bug where child FragmentManagers moving too lazily into the
CREATED state and beyond caused child fragments to not be
attached/created when expected.

Bug 25019275

Change-Id: I04ff0d3bcb693178a6ee3057da591392defdbcf8
/frameworks/base/core/java/android/app/FragmentManager.java
a9bab98d7014aefc81adf3fcb689242b651d46f1 21-Apr-2016 Adam Powell <adamp@google.com> Move child FragmentManager shutdown for retained fragments

Some apps out there do some creative things in terms of calling their
own onDetach methods from elsewhere. Perform the child FragmentManager
shutdown for retained fragments in a package-level perform method
instead of in onDetach itself.

Also mark all existing fragment methods with @CallSuper.

Bug 28293847

Change-Id: I343b610f8d427fe5cabd523a78fbf0e6f3b34c57
/frameworks/base/core/java/android/app/FragmentManager.java
cbade7f4d3ed06636cdf0f2e2317a9e49b46852a 15-Apr-2016 Adam Powell <adamp@google.com> Retain loaders through stopped config changes

Framework edition

Previously we would throw away any stopped LoaderManagers when we went
to retain instances to pass along as nonConfigurationInstances during
config changes or similar activity restarts. This causes loaders to do
more work than they need to when a calling activity starts a new
activity on top, a config change happens (e.g. screen rotation) and
then the top activity is finished, restarting the caller in a new
configuration. The loaders would go through onReset unnecessarily,
potentially throwing away data to be reloaded again after the config
change completes.

Instead of throwing away stopped LoaderManagers in this case, restart
them and retain them across the config change so they can resume where
they left off.

Bug 27176186

Change-Id: Ia52c6448d2ad41dcb25d493770d9ffae20a19d2a
/frameworks/base/core/java/android/app/FragmentManager.java
933076d80561751618f462b26309ce9e4c3ff3bf 30-Mar-2016 Andrii Kulian <akulian@google.com> Refactor usages of Picture In Picture and Multi Window (1/4)

Bug: 27365860
Change-Id: I1590e430a12ceb84cb83da295e0bf7e4378fea96
/frameworks/base/core/java/android/app/FragmentManager.java
eacacb5989a9ad178694dce8f59767fc9b71ea89 23-Mar-2016 Adam Powell <adamp@google.com> Fix bugs around restoring nested retained instance fragments

Framework edition

In a few configurations the child fragment state of a
retained-instance fragment would not be preserved correctly, leading
to child fragments not being restored. Clean this up along with live
state management issues that were leading to logged warnings during
normal fragment operation.

Bug 27371492
Bug 27477824

Change-Id: I847ac05b1757392580e008dc20c50c3ef365ca68
/frameworks/base/core/java/android/app/FragmentManager.java
b67d34f10e8accd1c205e4db0679fdd32df28a6a 01-Mar-2016 George Mount <mount@google.com> Merge "Ensure that fragments are created in added order." into nyc-dev
3518feda213f32c3ab0fd11a4bb97f6225f4bbdd 01-Mar-2016 Adam Powell <adamp@google.com> Correct state loss tracking for FragmentTransaction.commitNow

Booleans are hard.

Bug 27419920

Change-Id: I91a746aa14cad36bf77ec6224ffc13b00dc39ae7
/frameworks/base/core/java/android/app/FragmentManager.java
e01f5957fbbea04138073af423c1c9ae0b510038 24-Feb-2016 Adam Powell <adamp@google.com> Protect FragmentManager against View.NO_ID container ids

Not all code paths for FragmentManager were checking that the
container view had a valid view id. As we can't correctly restore a
fragment with a container without one, throw a more descriptive
exception earlier.

Bug 27290033

Change-Id: I86e41d2f9b5197e058a7ce154c682cbcc2f9c6eb
/frameworks/base/core/java/android/app/FragmentManager.java
a7245b42536bb9e71229651ef7135b039c7df70c 11-Feb-2016 George Mount <mount@google.com> Ensure that fragments are created in added order.

Bug 26894030

Change-Id: I522cc56ee1902eb01b21301dc32e6807217d6906
/frameworks/base/core/java/android/app/FragmentManager.java
44ba79e47d6db54e5501f994880fa09eb880c185 05-Feb-2016 Adam Powell <adamp@google.com> Permit setRetainInstance(true) on nested fragments, framework edition

Save arbitrarily nested fragments across config changes as
nonconfiguration objects. This permits the use of retain-instance
child fragments as arbitrary opaque dependencies within other
fragments.

Change-Id: Ia6640b76cfcf7ec28ba252628957a0c14863e957
(cherry picked from commit 7466be66263d5ebffb786ea402d9ed6e36c254f0)
/frameworks/base/core/java/android/app/FragmentManager.java
8585ed66b947ef30d6a43f0bb91885ed0c5ebfb4 05-Feb-2016 Adam Powell <adamp@google.com> FragmentTransaction.commitNow, framework edition

Offer commitNow and commitNowAllowingStateLoss methods on Fragment for
use by encapsulated components using fragments as implementation
details. This can help prevent unexpected ordering side effects at the
app level when a call to a library method wants to commit and
immediately initialize a fragment as an implementation detail.

Note that this change still does not permit reentrant FragmentManager
operations. It is still an error to add/remove/change fragments in the
same FragmentManager while a fragment transaction is being executed.

Have the commonly used ViewPager adapters use commitNow instead of
executePendingTransactions.

Change-Id: Ia37a871234a287423063f0c2c3e4c93d69116cad
(cherry picked from commit f6b30662f87f7339d0d3946dcf71e930c2fead9b)
/frameworks/base/core/java/android/app/FragmentManager.java
7c796811c040a3b9c189d49f138028c5e44466a4 30-Jan-2016 Wale Ogunwale <ogunwale@google.com> Added onMultiWindowChanged and onPictureInPictureChanged methods to Fragement class

Bug: 26688489
Change-Id: I611444b29199b4686c9f78dbdd33c9b71820aec4
/frameworks/base/core/java/android/app/FragmentManager.java
d1d4d9cb3a2f40aa1a476b9e55c7a4981da21c0f 12-Jan-2016 Adam Powell <adamp@google.com> Eagerly update fragment state when moving between states

As seen in frameworks/support!

Previously we would not set a fragment's new state until the move to a
new target state was fully complete. This causes problems when other
parts of the fragment manager infrastructure (such as lazily
initializing a child fragment manager) read that state while we're
dispatching a state change call to a fragment.

In this situation, adding a child fragment and then calling
executePendingTransactions on the child FragmentManager would not have
the intended effect, as the child FragmentManager would still be in
state INITIALIZING. The expected lifecycle callbacks to the child
fragment would then occur later.

Fix this by updating the fragment state as we go through each phase of
moveToState before we dispatch to the associated onState method,
matching our usual pattern of invoking onFoo methods after foo has
occurred. Delete the redundant resumed field as we now can use the
state directly.

Bug 25019275

Change-Id: I97fe45578d59ab643c9779eaeb475a331e446335
/frameworks/base/core/java/android/app/FragmentManager.java
ad968cf4e55afdd897ea84a44b7450442aea1e1d 20-Oct-2015 Todd Kennedy <toddke@google.com> Merge "Retain fragment loaders" into mnc-dr-dev
2ee19c7f46ab488f19380f4c70904a1ac00fee9a 20-Oct-2015 Todd Kennedy <toddke@google.com> Retain fragment loaders

Remove the partial fix [it did not work for child fragment managers]
and replace with a more general fix that works with all fragments.

Bug: 23838271
Change-Id: I88b465f6a06a6ad627b9651b9e2eea41fae08972
/frameworks/base/core/java/android/app/FragmentManager.java
ac0e6ca0d20446d34d9855b898611e6960866853 19-Oct-2015 Todd Kennedy <toddke@google.com> Set host when restoring a fragment

When we restore a fragment [i.e. on configuration change], we need to
make sure the host is set prior to calling into lifecycle methods
such as onInflate(). These use data contained within the host.

Bug: 22512520
Change-Id: I709365a858cfc555ec5b7fc200629fa8d022faad
/frameworks/base/core/java/android/app/FragmentManager.java
e16fb554dd49db118327ece0d9aac8eb788c7c54 10-Sep-2015 Todd Kennedy <toddke@google.com> save "retain loader" state

We cannot pull the "retain loader" state from the Activity; an Activity may
not always be hosting a Fragment. Instead, save the "retain loader" state
inside the individual fragments.

Bug: 23838271
Change-Id: I8358183a7689b5a571ea7be03d769186b2812600
/frameworks/base/core/java/android/app/FragmentManager.java
0aa69b7dc5706d0950d1d000de71437822e11bd9 31-Aug-2015 Todd Kennedy <toddke@google.com> Ensure host is set before onInflate()

Bug: 22512520
Change-Id: I70f3b3c3234d7015880e0b83ae13f6fbe218f19a
/frameworks/base/core/java/android/app/FragmentManager.java
de9284de88e06c9b4e022fa982ab580f16f42650 23-May-2015 Doris Liu <tianliu@google.com> Set a HW layer for Fragment alpha animation

Bug: 8554227
Change-Id: I58035001fe8f37a02dfe84e7ecd5074ab033129a
/frameworks/base/core/java/android/app/FragmentManager.java
46d168fb6b50f0bb093f5c0428c8287f2e8d2d08 13-May-2015 Todd Kennedy <toddke@google.com> Don't negate saving state

In the original implementation, we would only save the state if the
activity was "!isFinishing()". That was abstracted into a method
that returned whether we should save state. However, the "!" wasn't
removed. D'oh.

Bug: 20860094
Change-Id: I8827cb265f2e7fb911f5d110c56e464aa092bfe7
/frameworks/base/core/java/android/app/FragmentManager.java
434bd65ca61ff5cec46fce9fbe866d8ee40579da 04-May-2015 Todd Kennedy <toddke@google.com> Call Activity#onAttachFragment()

This was accidentally removed during the changes to abstract a Fragment host.
Also ensure Fragment#onInflate(Activity) gets invoked

Bug: 20825263
Change-Id: I981266ae1e8817db5c82ec4609bbcf4a5e676fee
/frameworks/base/core/java/android/app/FragmentManager.java
a5fc6f006f67867417b7a427de6e7394c4312dec 15-Apr-2015 Todd Kennedy <toddke@google.com> Remove dependency upon FragmentActivity

The FragmentManagerImpl is intimately tied with a FragmentActivity. In
many cases, we want to be able to create / manage Fragments outside of
a FragmentManager. This defines a FragmentController interface that can
be used by any class to host Fragments.

Bug: 19569654
Change-Id: I6816a5c1815122d206062b9f4584ad460b3d41dd
/frameworks/base/core/java/android/app/FragmentManager.java
7b9c912f536925ac6ec43935d6e97506851b33d6 31-May-2013 Tor Norbye <tnorbye@google.com> Add @ResourceInt annotations on APIs

Change-Id: I119cc059c2f8bd98fd585fc84ac2b1b7d5892a08
/frameworks/base/core/java/android/app/FragmentManager.java
c051955392840cb94bd6f0b2a8107a48d2ffc8b0 12-Feb-2015 Scott Kennedy <skennedy@google.com> Mark findViewById(int) @Nullable

Change-Id: I9bf7c08a896bd9c28400ff832179abc579fd502f
/frameworks/base/core/java/android/app/FragmentManager.java
1a780826c2f24b5414c6e0e5b3d9fbc55c0be887 19-Sep-2014 George Mount <mount@google.com> am fbb670d9: am 5a988492: am 00877d68: am f187823e: Merge "Fix exception when fragment container has no View." into lmp-dev

* commit 'fbb670d9ddd16c174369cdd4575860dee6ffe8c4':
Fix exception when fragment container has no View.
0b26e4d58ab1a60340dd7ab35ca6e3bddff9f760 18-Sep-2014 George Mount <mount@google.com> Fix exception when fragment container has no View.

Bug 17535259

Change-Id: I29c9ef53dd693cbb4043ebfb4750753870c9e99a
/frameworks/base/core/java/android/app/FragmentManager.java
4656e69bf36d42a35c9290ab79eeb33b4cca1d5c 08-Sep-2014 Elliott Hughes <enh@google.com> resolved conflicts for merge of 2008cff7 to lmp-dev-plus-aosp

Change-Id: I5148eda624e8504f12dbc1288cd4a7a5b7c10850
d0646dca40ff740bd49755ad60751678b0ccca52 28-Aug-2014 Mark Doliner <mark@kingant.net> Small documentation fixes across many files.

Change-Id: I3e8787ce4bc6018ea1dc9aef2a2cd4e0a8dde663
/frameworks/base/core/java/android/app/FragmentManager.java
c03da0e7a9ef721709d51cf8a2d539a5bd8a320e 23-Aug-2014 George Mount <mount@google.com> Make Fragment Transitions match Acitivty Transitions API

Bug 17188255

Change-Id: I506a097be4010d7156caf465c95295c58612c16e
/frameworks/base/core/java/android/app/FragmentManager.java
33acfbed073fdda5bcd2c97213a0361bc5958702 28-Jun-2014 Craig Mautner <cmautner@google.com> Restore saved fragment state

DialogFragment was saving the state of the dialog in
onSavedInstanceState() but this was being lost because it was
only being saved in the FragmentState but not being restored
into the Fragment when the Fragment was being reinstantiated.
This left us in a state after a rotation where the
DialogFragment was in the state "showing" but had never been
relaunched. Restoring the saved Bundle to the Fragment causes
the DialogFragment to be relaunched after the rotation.

Fixes bug 15559669.

Change-Id: I953a6c4bfdaed1ebcad1d99f47ceac5e017797db
/frameworks/base/core/java/android/app/FragmentManager.java
371a809179c843d7ae661a10bc9b4b8cfcaff566 20-Jun-2014 Adam Powell <adamp@google.com> Inflate fragments from layout into child FragmentManagers

Previously, if an app inflated a layout in a Fragment's onCreateView
that itself had fragments included, those fragments would be added to
the Activity-level FragmentManager and would not share the same
lifecycle with the fragment it was inflated for. This led to some
nasty management headaches.

If an app targets L or above, add the fragment to the child
FragmentManager of the current fragment when inflated using the
LayoutInflater passed to the parent fragment.

Bug 12763389

Change-Id: Iad4ed7d5df602aea9579bf1503e206fa894630c1
/frameworks/base/core/java/android/app/FragmentManager.java
d4c3c91dd0757eec9703ef90ea4c5a7ee99f18ca 09-Jun-2014 George Mount <mount@google.com> Allow antroid.transition Transitions in fragments.

Bug 15274281
Bug 15189829

Change-Id: I8e2974430b84a611866fe20afe1f5745e803683f
/frameworks/base/core/java/android/app/FragmentManager.java
7071786e0074bea42b01236f817383cab69c1b63 28-Feb-2014 Tim Kilbourn <tkilbourn@google.com> Clear child FragmentManagers when destroying Fragments.

If Fragment has instantiated a child FragmentManager and is later
detached, it retains its reference to the child FragmentManager which
has been destroyed. This causes an IllegalStateException in the
child FragmentManager if the original Fragment is reattached.

Fixes Issue 42601.

Change-Id: I8db2b1a110a341dc259939723f4c5ec131ca5f1e
/frameworks/base/core/java/android/app/FragmentManager.java
bb1d4d3896b781905bbf3ccbd5d5617da61cc3eb 01-Oct-2013 Romain Guy <romainguy@android.com> am d6c1870d: am 5fceada3: Merge "Fragement, or Fragment: that is the question"

* commit 'd6c1870d434562a10e015915dd9da9f8a956661c':
Fragement, or Fragment: that is the question
2de5082f437b90f08ba10210a5b9e25d1173bb9c 30-Sep-2013 Cyril Mottier <cyrilmottier@gmail.com> Fragement, or Fragment: that is the question

Change-Id: Iac3a14b9d2d7b4bd1e452db987b3c5c95dbefd3b
/frameworks/base/core/java/android/app/FragmentManager.java
1487466dc2ce14cccf0ff2bd2f824238aaa0044e 19-Jul-2013 Adam Powell <adamp@google.com> Add View#cancelPendingInputEvents API

This API allows an application to cancel deferred high-level input
events already in flight. It forms one tool of several to help apps
debounce input events and prevent things like multiple startActivity
calls, FragmentTransactions, etc. from executing when only one was
desired since it's otherwise not desirable for things like click
events to fire synchronously.

Change-Id: I60b12cd5350898065f0019d616e24d779eb8cff9
/frameworks/base/core/java/android/app/FragmentManager.java
95a4609b90abe02474c815c216780a1383f13cb2 14-Aug-2013 Alan Viverette <alanv@google.com> Throw exception in FragmentManager when queuing to a destroyed activity

Change-Id: I0522cf27fd423070f7578c1c43c1f05a335810bf
/frameworks/base/core/java/android/app/FragmentManager.java
8c84109b9fbbf473b225707a38261ff5f99d95fb 24-Jun-2013 Dianne Hackborn <hackbod@google.com> Use FastPrintWriter... everywhere.

One problem this turned up is, because FastPrintWriter does
its own buffering, a lot of code that used to use PrintWriter
would fail -- if it pointed to a StringWriter, there was no
buffering, so it could just immediately get the result. Now
you need to first flush the FastPrintWriter.

Also added some new constructors to specify the size of buffer
that FastPrintWriter should use.

Change-Id: If48cd28d7be0b6b3278bbb69a8357e6ce88cf54a
/frameworks/base/core/java/android/app/FragmentManager.java
2756293910032a2e7dfe007182b6b22a0fb9459e 07-Jun-2013 Adam Powell <adamp@google.com> Fix incorrect fragment animation used for hiding fragments

Mirror of support lib patch
https://android-review.googlesource.com/#/c/60032/ into
frameworks/base.

Change-Id: I8d1cb2e217721336674b8e3e2ef8722a8d9baefd
/frameworks/base/core/java/android/app/FragmentManager.java
6d9dcbccec126d9b87ab6587e686e28b87e5a04d 03-Oct-2012 Dianne Hackborn <hackbod@google.com> Fix issue #7273573: Need API to find out if activity is destroyed

Also update 17.txt with all of the recent API additions.

Change-Id: I21fc669267935261a741c19e22b0bf35c3a76b81
/frameworks/base/core/java/android/app/FragmentManager.java
f43a33c5ea5adb8d100ab0c3da965bac33155cb8 27-Sep-2012 Dianne Hackborn <hackbod@google.com> Work on issue #7232641: ISE crash when rotating phone in label list mode

This doesn't fix the problem; I think it is an app problem. It does
improve a bunch of the debugging to help better identify what is going
on, and introduces some checks when adding a fragment to fail
immediately if we are getting into a state when a fragment is going to
be in the added list multiple times (which is pretty much guaranteed
to lead to a failure at some point in the future).

Change-Id: If3a8700763facd61c4505c6ff872ae66875afc8d
/frameworks/base/core/java/android/app/FragmentManager.java
e181bd9b5e6a3e5382a1ff3c40b9ce2cb43c7971 25-Sep-2012 Dianne Hackborn <hackbod@google.com> Fix AbsListView to correctly retain its state if not layed out.

This covers a hole where if the list view restores its state and
then is asked to save its state before its layout happens, the
original state is lost. Instead we just store that original state.

Also tweak FragmentManager to make sure an inactive fragment can
not have its state moved up out of CREATED.

Bug #7232088: ListView saved state being lost in some cases

Change-Id: I5b40f37c259c7bcbe17dd1330016f9531f1b5534
/frameworks/base/core/java/android/app/FragmentManager.java
1b8ecc5031051b4bba620fac27552e84ca666496 09-Sep-2012 Dianne Hackborn <hackbod@google.com> A little cleanup.

Change-Id: Ie33fd1b02011606e67ce08df3cce887c07680c60
/frameworks/base/core/java/android/app/FragmentManager.java
62bea2f1710be0d1a42c07109fd4307ded660d3b 05-Sep-2012 Dianne Hackborn <hackbod@google.com> Nested fragments.

Change-Id: I79acc19b391352c16b06afee2ca543223c38e364
/frameworks/base/core/java/android/app/FragmentManager.java
4702a856973a553deb82f71b1d3b6c3db5dbf4ba 18-Aug-2012 Dianne Hackborn <hackbod@google.com> More view hierarchy, fragment debugging.

Add a View.toString() method.

Rename all of the View private flags to have a PFLAG prefix to
avoid going insane trying to figure out which constant goes with
which flag.

Activity.dump() now includes a summary of the activity's view
hierarchy, using the View.toString() method.

All exceptions thrown by FragmentManager now perform a dump of
the owning activity state, where appropriate.

Change-Id: I6482e397e10cb5a0612ab02ce6ed5131823437a6
/frameworks/base/core/java/android/app/FragmentManager.java
5bf6e1a1dbfffa0732d2cc5dd1d02cf1d2f3b9b4 15-Aug-2012 Dianne Hackborn <hackbod@google.com> Add more debug info when a container view ID can't be found.

Change-Id: Ibb2afc49747bd2d0ac24605cb3ec390334f8abf8
/frameworks/base/core/java/android/app/FragmentManager.java
1c43719c4709702fe3187e9c42ba9f4d22921034 01-Aug-2012 Craig Mautner <cmautner@google.com> Remove debugging for b6829431.

Change-Id: If7da858722d5d0a5e7db2bc249d454bdee1ec94e
/frameworks/base/core/java/android/app/FragmentManager.java
6d8f30f043516d2d5d103e7b2cb2cb6e78f33d85 20-Jul-2012 Craig Mautner <cmautner@google.com> Add debug to help with b6829431.

Change-Id: Id65f5c7c187072f5a5c1418c83e06c4a6767c658
/frameworks/base/core/java/android/app/FragmentManager.java
ae5bd3a998fb0b811f2575899514e73243041a5d 20-Jun-2012 Dianne Hackborn <hackbod@google.com> am cb1c45ed: am b6ce1f31: Merge "Fix issue #6675499: java.lang.RuntimeException: Unable to start..." into jb-dev

* commit 'cb1c45ed80df368051368a478fa931d3333c99f6':
Fix issue #6675499: java.lang.RuntimeException: Unable to start...
acdfbcca6f91bdf3f77ed7b2e699c97ce98c1fb8 20-Jun-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6675499: java.lang.RuntimeException: Unable to start...

...activity ComponentInfo{com.google.android.gm/
com.google.android.gm.ui.MailActivityGmail}: java.lang.NullPointerException

There were a number of places in FragmentManagerImpl where we were
not dealing with mAdded being null. In the original implementation,
mAdded would almost always be null if mActive is null. As we have
added features, this has become a less strong guarantee (and it actually
was never completely guaranteed), but there are a lot of places where
we would check for mActive being non-null and assume this meant
mAdded is non-null.

Fix these to correctly check for mAdded.

Bug: 6675499
Change-Id: I2a6a801d8bc89550fc73e12c9c3f8bb0ad6c7fa4
/frameworks/base/core/java/android/app/FragmentManager.java
33644b9ba7d092d5686b4d85c0006066b78fcf2d 05-Jun-2012 Dianne Hackborn <hackbod@google.com> am 4a683a34: am 1ad66b2f: Merge "Fix issue #6584942 IllegalStateException: Failure saving state..." into jb-dev

* commit '4a683a343083ec2b8aed1ee63669dbade6c0379f':
Fix issue #6584942 IllegalStateException: Failure saving state...
ee76efb74b5886f98cdfebfbefe9b69224e016fb 05-Jun-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6584942 IllegalStateException: Failure saving state...

...active SuggestFragment{419494f0} has cleared index: -1

There were issues when the same fragment was removed and then
added again before completely finishing the remove (such as due
to a running animation).

Two fixes:

- Now when you call FragmentTransaction.replace() and are replacing
a fragment with the same fragment, this becomes a no-op, to avoid
visual artifacts in the transition and bad states.
- When we are moving the fragment state up and it is currently
animating away to the INITIALIZED state, we could end up making
the fragment inactive as part of the cleanup. In this case it
shouldn't be made inactive; we just need to initialize it but
keep it active since we are going to continue to use it.

Bug: 6584942
Change-Id: I8bfd73f2d8ef8f67b541b3e2525dfa5db6c3bfa5
/frameworks/base/core/java/android/app/FragmentManager.java
e075d5099bac96d1fd5028012f8a22dea60c7211 31-May-2012 Dianne Hackborn <hackbod@google.com> am 11855f31: am 388d4801: Merge "Working on issue #6561352: java.lang.RuntimeException: Unable to start..." into jb-dev

* commit '11855f31a3f7074d9fbccd1ee460b99fc47162c6':
Working on issue #6561352: java.lang.RuntimeException: Unable to start...
61af8a8ef77fd0e1a760d01a5c7784ae1d0efc37 31-May-2012 Dianne Hackborn <hackbod@google.com> Working on issue #6561352: java.lang.RuntimeException: Unable to start...

...activity ComponentInfo{com.google.android.googlequicksearchbox
/com.google.android.googlequicksearchbox.SearchActivity}

Add check for a situation where we are saving the state of a
fragment with a -1 index, and fail early in that case with more
debug information.

Change-Id: I03a928dde521fa06664d0036dd9f90eef3247afc
/frameworks/base/core/java/android/app/FragmentManager.java
b4131ccba37169df236cebd7e5dca8c0984888cd 15-May-2012 Dianne Hackborn <hackbod@google.com> am b4652172: am bea7afc5: Merge "Fix issue #6284404: ArrayIndexOutOfBoundsException in..." into jb-dev

* commit 'b4652172404643d0a8fffbcc315cddcc733ec5ba':
Fix issue #6284404: ArrayIndexOutOfBoundsException in...
03fcc333cf0fbbc4df1215649746d6360801efd8 15-May-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6284404: ArrayIndexOutOfBoundsException in...

...FragmentManagerImpl.restoreAllState

This was a bug related to the difference between the pre- and post-HC
behavior of onSaveInstanceState(). Prior to HC, state was saved
before calling onPause(). Starting with HC, it is saved between
onPause() and onStop(). To maintain compatibility with existing
applications, there is a check in ActivityThread for pre-HC to in
that case emulate the behavior of old applications, still calling
onSaveInstanceState() before onPause() but using the state later.

One of the special cases we had to deal with in the old model of
saving state before pausing was restarting an activity that is
already paused.

Consider, for example: you have two activities on screen, the one on
top not fullscreen so you can see the one behind. The top activity
is resumed, the behind activity is paused. In the pre-HC world, the
behind activity would have already had its state saved.

Now you rotate the screen, and we need to restart the activities.
We need to destroy the behind activity and create a new instance,
but the new instance has to end up in the paused state. To
accompish this, we restart it with a flag saying that it should
end up paused. For the pre-HC world, since it ends up paused,
we need to make sure we still have its instance state kept around
in case we need it because we can't regenerate it (since it is
already paused).

So that is what the changed code here is doing. It goes through
the normal create/start/resume steps, but holds on to the current
saved state so that it isn't lost when resume clears it, and then
puts the activity back to paused and stuffs that old saved state
back in to it.

The problem is that this code was doing it for every application,
even HC apps. So we end up in a bad state, when a HC app has its
saved state sitting there as if it had been saved, even though it
is only paused. Now if we go to restart the activity again, instead
of asking it for a new saved state (as we should for a HC app as
part of stopping it), we just re-use the existing saved state again.

Now this wouldn't generally be a huge problem. Worst case, when we
restart the activity yet again we are just instantiating it from
the same saved state as we used last time, dropping whatever changes
may have happened in-between. Who cares? All it has been doing is
sitting there in the background, visible to the user, but not something
they can interact with. If the activity made changes to its
fragments, those changes will be lost, and we will restore it from
the older state.

However... if one of those fragements is a retained fragment, this
will *not* appear in the saved state, but actually be retained across
each activity instance. And now we have a problem: if the retained
fragments are changed during this time, the next activity instance
will be created from the most recent state for the retained fragments,
but the older state for everyting else. If these are inconsistent...
wham, dead app.

To fix this, just don't keep the saved state for HC apps.

Also includes a small optimization to ActivityStack to not push
the home screen to the front redundantly.

Change-Id: Ic3900b12940de25cdd7c5fb9a2a28fb1f4c6cd1a
/frameworks/base/core/java/android/app/FragmentManager.java
c0581aff1d201208c42273b825d573d6cba52900 24-Apr-2012 Jake Wharton <jakewharton@gmail.com> DO NOT MERGE. Do not dispatch context selection events to non-visible fragments.

When used in a `ViewPager`, fragments that are present on the adjacent,
cached pages will receive context selection dispatches which, depending
on your fragment contents, can be difficult to determine whether or not
the event truly originated from your view.

By using the visible hint we restrict dispatching to only those fragments
which are marked as being visible. Since the fragment pager adapter
updates this setting properly most implementations will be afforded this
fix without any change required. If the user is implementing their own
adapter they likely already understand the implications of these cached
fragments and the reponsibility for updating the boolean falls to them.

Mirrors support library change Ie6a72c1c82c2784774373670007b6f5948fe16da

Integrated from AOSP.

Change-Id: I19bbbe4c8d910fb38c14d6ae5d462eb7dd44fd26
/frameworks/base/core/java/android/app/FragmentManager.java
258029eeaaace45fab6244cd09cc389aa57fedac 22-Apr-2012 Jake Wharton <jakewharton@gmail.com> Fix potential NPE when saving fragment state.

If a fragment's saved view state is null and the user
visible hint is true then the `result` bundle will have
never been initialized to a value resulting in a
`NullPointerException`.

Mirrors support library change I8ba585bc6b9298841490d64bc22a8219cd261adb.

Change-Id: Iabd5ac293d2ece3771da9ef257479eca0dcd523c
/frameworks/base/core/java/android/app/FragmentManager.java
7871badd5d4d29d80207e9cc09a0681f26a151d0 13-Dec-2011 Dianne Hackborn <hackbod@google.com> SDK only: now that support lib is in SDK, we can link to it.

Update some of the platform documentation to directly link to
relevent support lib docs. Yay!

Also improve BroadcastReceiver documentation to more clearly
discussion security around receivers, and how the support
lib's LocalBroadcastManager can help.

Change-Id: I563c7516d5fbf91ab884c86bc411aff726249e42
/frameworks/base/core/java/android/app/FragmentManager.java
78fed9b78f8b3b92979b94dda2640cdeaffb2573 07-Nov-2011 Adam Powell <adamp@google.com> Change the "start deferred" fragment API to "user visible hint"

Allow a fragment to set a hint of whether or not it is currently user
visible. This will be used implicitly to defer the start of fragments
that are not user visible until the loaders for visible fragments have
run. This hint defaults to true.

Change-Id: Id1349d319886a277ef07301f64f7b9e12c8729bf
/frameworks/base/core/java/android/app/FragmentManager.java
2db4e4bd1b5a2b11b07b870660b7f4b3e1f07061 02-Nov-2011 Adam Powell <adamp@google.com> Fix bug 5557267 - [ViewPager] non-primary fragments unnecessary
stopped if "defer start" is enabled

Only revise the target state in moveToState if it would cross the
stopped/started boundary.

Change-Id: I8f6e400331157eac9343261117cf633611fc1e4d
/frameworks/base/core/java/android/app/FragmentManager.java
37510908a7b570accb2c4829842790b3d9d3a102 31-Oct-2011 Adam Powell <adamp@google.com> Bug 5535639 - Monkeys mad at FragmentManager

Also check for starting deferred start fragments when a loader is
destroyed.

Change-Id: Ia17a902c579c09d7ac01079c7c1da137635aa08b
/frameworks/base/core/java/android/app/FragmentManager.java
635c60af623c73d2409f5729c0953638b5d6c497 26-Oct-2011 Adam Powell <adamp@google.com> Add API for deferring fragment start.

Fragments now have the setDeferStart method to signal that a fragment
has lower priority than others. Deferred start fragments will not
always be started immediately; they will be started once any loaders
have finished servicing any outstanding requests. This is useful if
any attached fragments are not immediately visible and can wait to
start until later.

Disabling deferStart on a fragment that is waiting for a deferred
start will start it immediately. Start.

Change-Id: Ia1f004877ca5e88d4f10147d21c7e2e97f141c34
/frameworks/base/core/java/android/app/FragmentManager.java
b54e7a3d9f60ac605f404f9eb3c5e92ca51bbd23 04-Oct-2011 Joe Fernandez <joefernandez@google.com> docs: add developer guide cross-references, Project ACRE

Change-Id: I5df1c4e13af67ff4c4a5b22f3cb1247bf0103b09
/frameworks/base/core/java/android/app/FragmentManager.java
6c285977a0dc9605348bd9530282c7d006cbf8bd 30-Aug-2011 Dianne Hackborn <hackbod@google.com> Fix issues 5158104 and 4981556 (fragment problems)

5158104: com.android.contacts: java.lang.IllegalStateException:
Can not perform this action after onSaveInstanceState at
android.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1201)

The ViewPager can just commit without worrying about a state loss,
since it can correctly reconstruct its state later.

4981556: Fragment.mImmediateActivity doesn't get restored on orientation change

I am giving up on this thing; I just don't see how it can actually
be correct. So now instead of getting an exception about a dup
add/remove at point of the add/remove call, this will happen later when
processing the transaction.

Also add an API for controlling the visibility of menus, which ViewPager
can use to have the correct menus shows. And add a method to get the
name of a back stack entry.

Change-Id: Idcba14cfa2a172545a7a2a2c466cb49ceb789619
/frameworks/base/core/java/android/app/FragmentManager.java
9520251003cc3a321028bb80693749e5047eb3f8 08-Aug-2011 Adam Powell <adamp@google.com> Fix bug 5116342 - don't keep fragment state around once resumed

Clear out saved fragment/view state when a fragment is resumed in case
we didn't need to restore it. This keeps it from hanging around and
preventing proper save/restore behavior later.

Change-Id: Ie3fce5534ee4f8fdb4116281f9ac6a9cfa392561
/frameworks/base/core/java/android/app/FragmentManager.java
f0f5fffc6f578f531df7b208cfbfb53f884c0380 01-Aug-2011 Adam Powell <adamp@google.com> Fix bug 5090996 - Crash on tapping Menu on dial pad

Let the FragmentManager handle deferring menu invalidation when
not currently resumed.

Change-Id: I6e5de9c8ab5288c7c90a59ce8e0c7bb9133b6eb5
/frameworks/base/core/java/android/app/FragmentManager.java
c68c913d357e2955d4bd7ca52829071e531c7825 29-Jul-2011 Dianne Hackborn <hackbod@google.com> Various work on out of memory managment.

- Improve how we handle processes that have shown UI, to take care
of more cases where we want to push them into the background LRU
list.
- New trim memory level for when an application that has done UI
is no longer visible to the user.
- Add APIs to get new trim memory callback.
- Add a host of new bind flags to tweak how the system will adjust
the OOM level of the target process.

Change-Id: I23ba354112f411a9f8773a67426b4dff85fa2439
/frameworks/base/core/java/android/app/FragmentManager.java
89b09da7b3b1e69264d9ec710c66eb2f891b313e 27-Jul-2011 Adam Powell <adamp@google.com> Bug 5076788 - Optimize the building and invalidation of menus

Fix cases that weren't batching menu presenter changes correctly.

Have FragmentManager invalidate the options menu less often.

Change-Id: Ia66fcd09ada8b0a084ad6b08d4340a8fa0c8fc5d
/frameworks/base/core/java/android/app/FragmentManager.java
c693823fd4cb927160c3f423670587be5e09ac20 22-Jul-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5054723: java.lang.NullPointerException at...

...android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1284)

Make sure to commit all pending actions before completing the destroy.

Change-Id: I85643e5f7b1221048523bd186b48fb88fc70ca23
/frameworks/base/core/java/android/app/FragmentManager.java
0d32528be3b708e8a7ebb4e8d7fd2a2c94d6638e 13-Jul-2011 Jeff Sharkey <jsharkey@android.com> Release strong Fragment references after exec.

When finished with a Runnable transaction in execPendingActions(),
release the strong reference so that Fragment can be GC'ed.

Bug: 3117761
Change-Id: Ica2f50e363be1bd047bf0474b293efeb814b1264
/frameworks/base/core/java/android/app/FragmentManager.java
f930232fd1c8d301d91853c8fe5dca43979ac807 15-Jun-2011 Dianne Hackborn <hackbod@google.com> Fix a major problem in fragment lifecycle.

When animating away a fragment, we were not putting it through
the last part of its lifecycle (onDestroy() etc).

Also, retained fragments that have a target were broken. Oops.

Change-Id: I5a669b77a2f24b581cde2a0959acf62edb65e326
/frameworks/base/core/java/android/app/FragmentManager.java
afc4b283fdaedec9bf32492a019b43cc33edc9b6 11-Jun-2011 Dianne Hackborn <hackbod@google.com> Fix some problems with moving in and out of detached state.

Loaders were not being re-initialized correctly when coming back
(this would also impact the back stack). The ListView also wasn't
working correctly, and there were also problems with simply
re-using a Fragment instance after it had been removed.

Change-Id: I534b091ae09c0ef7ffffe9d68049e6840e8926b3
/frameworks/base/core/java/android/app/FragmentManager.java
1333276c7af53bca06ad166f129d39fc756930df 04-Jun-2011 Dianne Hackborn <hackbod@google.com> Fix to not lose state when saving a deactivated fragment.

Also deactivating a fragment shouldn't put it in the exiting state.

Change-Id: I514f3589ee7bbbee131cd7b4a48803e99b212bd0
/frameworks/base/core/java/android/app/FragmentManager.java
b46ed7636be9341b6ce0b158b3d86f34a437e6da 03-Jun-2011 Dianne Hackborn <hackbod@google.com> Add new Fragment API for explicitly saving/restoring state.

Also fix issue #4519821:
Blank screen displayed on tapping "Battery Use" option in the settings

We weren't correctly doing the full Activity resume code when coming
back from delivering a new Intent or result.

And fix a fragment problem where we still weren't correctly restoring
the state of list views. (I think this was from a bad manual-merge
from master.)

Change-Id: If79dc7e998155c39ab8c04781f6c73a82238a9ef
/frameworks/base/core/java/android/app/FragmentManager.java
16f6e89c2a4bbf73fe15cb2e81c8fec98c7ac831 16-Apr-2011 Dianne Hackborn <hackbod@google.com> DO NOT MERGE. Integrate fragment work from master

Back-port new fragment detach APIs from support lib.

This allow a much cleaner implementation of things like the
fragment pager class.

Integrate from support lib: fix restore of list state.

The FragmentManager/ListFragment impl was restoring the list
state before setting its adapter. This caused the list view to
lose the state, since it gets cleared as part of setting the
adapter. Now the fragment manager waits on restoring the view
hierarchy state until after it has done onActivityCreated(),
at which point we have set the adapter.

It would be nice to make list view less fragile in this regard,
but that is for a different change.

Change-Id: I38606ef7d0b06478995f3fb7726aead67420e172
/frameworks/base/core/java/android/app/FragmentManager.java
e3a7f628c6d9fef42be24999b3137ebe5c6f3525 04-Mar-2011 Dianne Hackborn <hackbod@google.com> Fix Fragment.onInflate() to actually work correctly.

Like, um, it needs to be given the Activity since this is called before
the activity is attached.

And it was called after the entire fragment and its *view* was created
when being restored from saved state.

And the documentation was whacked.

Also fix the IME selector to dismiss when you tap outside of it.

Change-Id: Icbcafe7558965a570bdef9cda3441b1f0f7a317c
/frameworks/base/core/java/android/app/FragmentManager.java
87ffa20a2fd4dff11262b87607a9aca992bdd05d 28-Feb-2011 Ben Komalo <benkomalo@google.com> Remove a stale line in a JavaDoc.

Change-Id: I2d98bf5aaa2d47adef2b31903761db3d9f7e1ac1
/frameworks/base/core/java/android/app/FragmentManager.java
7187ccb93ee8adbb745fcbb901cfacfeed397a23 25-Jan-2011 Dianne Hackborn <hackbod@google.com> Fix issue #3385839: Fragment.onCreateView is passing in activity...

...context for a DialogFragment

Change-Id: I434ebca64d2738da4c27321db8dbbded2cbe167d
/frameworks/base/core/java/android/app/FragmentManager.java
5d9d03a0234faa3cffd11502f973057045cafe82 24-Jan-2011 Dianne Hackborn <hackbod@google.com> Maybe fix issue #3093599: java.lang.IndexOutOfBoundsException...

...Invalid index 0, size is 0 at
android.app.ActivityThread.performPauseActivity(ActivityThread.java:2326)

It looks like if an arrow key is dispatched between the time the
list view is told its data set has changed and it does the resulting
layout pass, we could try to move the position to a now invalid
index. This may prevent that from happening.

Also put in a better error message if saving state of a fragment
whose target is no longer in the fragment manager.

And fix a bug in PackageManager where we could return a null from
queryIntentActivities().

And add a new API to find out whether a fragment is being removed,
to help fix issue #3306021: NPE at
android.app.AlertDialog.getDefaultDialogTheme(AlertDialog.java)

Next, for new HC apps we can delay committing data to
storage until the activity is stopped.

Finally, use the new multi-threaded AyncTask executor in a few
places, so we don't have worked blocked by long-running tasks from
the application.

Change-Id: I27b2aafedf2e1bf3a2316309889613fa539760f3
/frameworks/base/core/java/android/app/FragmentManager.java
ec541e1787b39605200584042fa1e144923eeb4f 22-Jan-2011 Dianne Hackborn <hackbod@google.com> Fix some error messages, turn off logging.

Change-Id: Ifcd2c0f0ad137485896144d2248361aeb0a05600
/frameworks/base/core/java/android/app/FragmentManager.java
17b9b81418c9166e181a992f27598e4de18d7203 18-Jan-2011 Dianne Hackborn <hackbod@google.com> Remove old APIs.

Change-Id: If676e4e7886ad71c4959d4253db99639b49218b8
/frameworks/base/core/java/android/app/FragmentManager.java
327fbd2c8fa294b919475feb4c74a74ee1981e02 17-Jan-2011 Dianne Hackborn <hackbod@google.com> Fix a bunch of API review bugs.

3362464 API REVIEW: android.content potpourri
3362445 API REVIEW: Fragment transaction stuff
3362428 API REVIEW: Fragment stuff
3362418 API REVIEW: Loader stuff
3362414 API REVIEW: android.content.pm.ActivityInfo

Change-Id: I6475421a4735759b458acb67df4380cc6234f147
/frameworks/base/core/java/android/app/FragmentManager.java
48e7b458694acdf3a4fc58e62437f1dbc4f29d83 17-Jan-2011 Dianne Hackborn <hackbod@google.com> Start renaming FragmentTransaction.openTransaction() to beginTransaction().

Change-Id: Ib4a6d824b33cca699b7b25159c491fb610d5f5da
/frameworks/base/core/java/android/app/FragmentManager.java
b29407faf39a1421ac61958a34431286c8397929 11-Jan-2011 Chet Haase <chet@google.com> Fix null crash when fragments go away during animations

Change-Id: I239cabce3ce322fcc3f1246486b4bf05f0dd322b
/frameworks/base/core/java/android/app/FragmentManager.java
352cc98b4621b76959af8f8a698fd75c6d6132e8 04-Jan-2011 Dianne Hackborn <hackbod@google.com> Few little fragment, wm tweaks.

Deal with fragments being restored when their containing view is
gone.

Try to put in a black background during rotation. Currently commented
out because it appears to cause surface flinger to hang.

Change-Id: I150d061e64488356d17513f4e2d124d7c3d04f6b
/frameworks/base/core/java/android/app/FragmentManager.java
e646b28cb3bdd10e46c209e367b8ee055ff5a4ba 28-Dec-2010 Chet Haase <chet@google.com> Minor fix to previous fragment change: non-animating case

The previous change only hid the fragment when the transition animation
ended. But if there is no animation, the fragment would never be hidden.
This change adds an else clause that handles the non-animating case.

Change-Id: Ie35b2ae98cb5c21193dadefbef71b8542fcf5f7d
/frameworks/base/core/java/android/app/FragmentManager.java
61eb40d276d7fe5c4bead019b7565b99ead07731 28-Dec-2010 Chet Haase <chet@google.com> Delay hiding fragments until transition finishes

Change-Id: I616de20e7e161fe1a53cd5e72912cec48f078df5
/frameworks/base/core/java/android/app/FragmentManager.java
1b39e221e2d2db98f8aea7dd7b7ded3eca6f3d55 28-Dec-2010 Dianne Hackborn <hackbod@google.com> Fix NPE pointed out by Chet.

Change-Id: Id421476aa6f6ff281054b435ecd09f932966305c
/frameworks/base/core/java/android/app/FragmentManager.java
d173fa3b1cb8e4294aba7564c0171894be6c3c24 23-Dec-2010 Dianne Hackborn <hackbod@google.com> Possible fix to issue #3213749: NPE at...

...android.app.Fragment.startActivityForResult(Fragment.java)

Make sure to remove all pending messages when AbsListView is detached
from its window.

But... that's not enough.

It turns out that when a fragment's views are animating away, they of
course don't get detached until after the animation is done. However
the fragment itself is immediately destroyed, leaving its live views
still going after that.

Here's a possible solution: when fragment manager initiates an animation
on a fragment whose views are being removed, it makes note of that so
it can hold off on destroying the fragment until the animation is over.

There are a lot of interesting race conditions here, if further operations
happen on the fragment while it is being animated. I think the code here
does something sensible, and it does seem to work for the situations I
have tested, but it is hard to know all of the edge cases that may happen.

Change-Id: I4490ce8862a9bb714c7ea54baca3072c62126388
/frameworks/base/core/java/android/app/FragmentManager.java
a2ea747faaf5fcd437afbaaf4085cfc29e7c16b8 20-Dec-2010 Dianne Hackborn <hackbod@google.com> More cleanup of Loader APIs.

- Remove old method names.
- Introduce onXxx() hooks to Loader.
- Improve debugging.

Change-Id: I3fba072a05c7023aa7d2c3eb4e126feb514ab6d8
/frameworks/base/core/java/android/app/FragmentManager.java
d2835935d2df8be70d1b37d3ef3b2fe0155b3422 14-Dec-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3258849: Grab thumbnail when exiting an app via back

Also issue #3281400: Rotating a retained instance fragment leaks the fragment manager

And turn off fragment debug logging.

Change-Id: Ibdd7db82bb35618021bcba421ba92ced7cd691c2
/frameworks/base/core/java/android/app/FragmentManager.java
30d7189067524000c738c188c4ff91f84f474d25 11-Dec-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3274841: Orientation change problem with a paused activity

Plus a bunch of debug output improvements.

And some new Intent helpers for dealing with restarting an app.

Change-Id: I50ec56bca6a86c562156b13fe8a6fdf68038a12e
/frameworks/base/core/java/android/app/FragmentManager.java
9d0718042f7c0a50d825c621f82ce9a92071f07a 08-Dec-2010 Dianne Hackborn <hackbod@google.com> Fix issues #3257701 and #3267312

3257701 Preference headers have duplicated "title" and "summary" if
title is not loaded from a resource
3267312 Fragment.onConfigurationChanged doesn't get called

Change-Id: I76e346ba88aa632ebb9aa413a2ce2645ebf357cd
/frameworks/base/core/java/android/app/FragmentManager.java
d9b3b7e8e1d8c919c3e5f5851daa80a2651ea7d1 17-Nov-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3202866: system server crash

Change-Id: Ied92164bea70f6cb8afe2c1c6ff4fc3836a209ab
/frameworks/base/core/java/android/app/FragmentManager.java
3a57fb9e9c4f205ca6bd4f036b3080f92588d16d 16-Nov-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3191573: PreferenceFragment.onActivityResult cannot
launch a new fragment on the same call.

There were some problems with the API design where you could do
things in such a way that a back stack entry that was not at the
top would get popped. Ouch. Hopefully this change prevents that
from being able to happen.

Change-Id: I8cbc952e12ddd231ff6c84b6e9bbf5125f449f04
/frameworks/base/core/java/android/app/FragmentManager.java
6908cd154c5a2ed2e3b21d40f51952d45be69184 09-Nov-2010 Dianne Hackborn <hackbod@google.com> Fix animations to use correct interpolator.

Also some fragment fixes.

Change-Id: I3906199e541a86379d07c8a4e4d5f9e99830c44a
/frameworks/base/core/java/android/app/FragmentManager.java
ab36acb39941ce981dddda9f9cf4d2d23a56fd26 05-Nov-2010 Dianne Hackborn <hackbod@google.com> Fixe some stuff.

Addresses these bugs:

3061847 - With no headers, PreferenceActivity crashes
2888426 - minor typo in DevicePolicyManagerService.ActiveAdmin.writeToXml()
3159155 - IllegalStateException:"Can not perform this action after
onSaveInstanceState" while dismissing a DialogFragment
3155995 - PopupWindow.showAtLocation does not respect LayoutParams

Also tweak the new fragment APIs to use abstract classes instead of
interfaces as base classes.

Change-Id: I9c0b4337fe0e304b737b5f7c2762762372bb3020
/frameworks/base/core/java/android/app/FragmentManager.java
8eb2e244f9b14d946ee587d0b673b866865026c0 01-Nov-2010 Dianne Hackborn <hackbod@google.com> Various PreferenceActivity and related improvement.

This is all about making the preferences implementation better.

Well, mostly all about that.

Change-Id: I8efa98cb5680f3ccfa3ed694a1586de3fb3a9e11
/frameworks/base/core/java/android/app/FragmentManager.java
5164246d7e47b9c995ca1e1587f3056eb777f60b 28-Oct-2010 Dianne Hackborn <hackbod@google.com> Fix setting of class loader.

Also add Bundle API to retrieve its class loader because... well,
why not.

Change-Id: Ie939f6a2ae13974e5a05eb5bd3b28f350d8a8565
/frameworks/base/core/java/android/app/FragmentManager.java
fb3cffeb35368da22f99b85d45039c4e6e471c06 26-Oct-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3130426: Finsky crash in switching from window carousel

Need to note that we no longer have saved state before delivering
results or new intents to an activity.

Also do some work on loaders to prevent apps from making fragment
changes as a result of receiving loader data. This makes apps
consistent crash in a case that they would previously sometimes
crash (if they got the loader data after onPause).

Change-Id: I46e9e46d0aa05d9d7d6a275a2a488a18a20a5747
/frameworks/base/core/java/android/app/FragmentManager.java
9ff82bf2b33513052500473d0d6d025a80dcecbf 05-Oct-2010 Chet Haase <chet@google.com> Adding next/prev to fragment animations and to PreferenceActivity

Adding a new concept of "next" and "previous" to fragment.s Previously, fragments would
either be placed onto or taken off of the stack, or would just replace the current
fragment. The new next/prev capability gives the ability to run a transition that is
specific to next/previous operations, such as navigating forward and backward in a list.
New next/prev animations may be associated with a fragment replace operation to get the
next/prev animations built into the system (next animates things up, prev animates them
down).

Change-Id: Ia9f3663bac009376420d845b396ac51b8e4d1647
/frameworks/base/core/java/android/app/FragmentManager.java
625ac271f80777668f832a344486a6fcdc06d0ae 18-Sep-2010 Dianne Hackborn <hackbod@google.com> Work on fragments in layouts.

- Change semantics if IDs associated with these fragments, to
work correctly when placed in a container. If the container
has an ID or you have supplied a tag, the fragment's ID is
optional.

- To do this, there is a new LayoutInflater API that allows code
creating views to access the parent container that view will
be in.

- Fix issues with state management around these fragments. Now
correctly retains state when switching to a layout that doesn't
include the fragment.

Also:

- Add new simple list layouts for items that want to show an
activated state.
- Add new Activity.dump() that can be invoked with adb shell
dumpsys; the default implementation dumps fragment state.

Change-Id: I192f35e3ea8c53fbd26cf909095f2a994abfc1b6
/frameworks/base/core/java/android/app/FragmentManager.java
c6669ca63299219d815464129dac051ab2404286 16-Sep-2010 Dianne Hackborn <hackbod@google.com> Add API for showing breadcrumbs of fragment back stack.

This adds a simple API to have your back stack automatically
shown as bread crumbs in the action bar. Introduces some APIs
to retrieve the current back stack.

Also fix a little bug in the "activated" state where it was
being propagated down the hierarchy as "selected". :p And from
that, fix the standard colors to be reasonable when in the
activated state.

Finally PreferenceActivity is updated to take advantage of
bread crumbs to show your place in the preferences.

Change-Id: I9d633bedf8d7c6e4ed9b25cb9698faa66c7dd9a4
/frameworks/base/core/java/android/app/FragmentManager.java
3e449ce00ed2d3b271e50bc7a52798f630973bf1 12-Sep-2010 Dianne Hackborn <hackbod@google.com> Some fragment stuff:

Fix issue #2975886: Make getTargetFragment() survive rotation events with
retained fragments. We now fix up the fragment pointer when restoring state.

Fix issue #2919928: In PreferenceFragment, addPreferencesFromResources() is
not effective when called after onActivityCreated(). Note to self: do not use
a what code of 0. Maybe that should be documented (I'll do it in gingerbread).

Hopefully implement #2992753: DialogFragment.dismiss will NPE if called too soon
(before attached to activity). We now keep track of the FragmentManager
separately from the activity, and set that as soon as the fragment is part of a
transaction.

Investigate issue #2988876: NPE when device orientation is changed. The NPE is
because of the app trying to do a fragment transaction in onPause(). This is
fundamentally not viable, since (a) the activity will be gone before we ever
have a chance to process the message to commit the transaction, and (b) even if
we did try to commit the transaction earlier, this would be done after
onSaveInstanceState() and thus not work in cases where the activity gets killed
in the background. So instead, we'll just throw an immediate exception if you
try to do this.

Change-Id: Iea62b50eb79f066af2471fce86836d073398f4f7
/frameworks/base/core/java/android/app/FragmentManager.java
b20db3ec34e846010f389880b2cfab4d7bf79820 10-Sep-2010 Chet Haase <chet@google.com> Make fragment animations work when fragments go away

Change-Id: I136de6ef910cc02b8181fcfa065bdb0770841396
/frameworks/base/core/java/android/app/FragmentManager.java
a18a86b43e40e3c15dcca0ae0148d641be9b25fe 07-Sep-2010 Chet Haase <chet@google.com> Rename several animation classes

Change-Id: I6a4544875090db485163c8d56de8718f56d267c7
/frameworks/base/core/java/android/app/FragmentManager.java
5f36c96f6d3623a826466db68cc1586f078ac307 27-Aug-2010 Dianne Hackborn <hackbod@google.com> Fix issue #2950374: Fragment#setHasOptionsMenu() doesn't work...

...when it is called before the parent Activity becomes ready.

Change-Id: Id021564ebb3419353234e459b7358b9a72660715
/frameworks/base/core/java/android/app/FragmentManager.java
d51d368f2d512ab657b8ae45780c82c0dbea94c3 12-Aug-2010 Chet Haase <chet@google.com> Change animator xml importing to use new inflater class

Change-Id: I97225ee9868f4dcce5e4c1ba55e16414eb6c0464
/frameworks/base/core/java/android/app/FragmentManager.java
def1537e9e8d0dd190cde5310ddae8b921088c9b 15-Aug-2010 Dianne Hackborn <hackbod@google.com> More fragment work:

- Introduce FragmentManager as a public API, deprecating the fragment
APIs on Activity. (They will be removed soon.)
- Add APIs to write a fragment reference to a bundle and later retrieve
it.
- Add Fragment API to set another fragment as its target, for delivering
results.
- Change when onInflate() is called and formalize its meaning in relation
to the fragment arguments that were previously introduced.
- Change onDestroyView() to always be called, regardless of when
onCreateView() returns. It now also is called slightly differently,
after the view hierarchy's state is saved.
- Fix some issues with DialogFragment's lifecycle with its associated
Dialog and state save/restore.
- Preference can now have a Bundle associated with it to provide
arguments to a fragment. The data for this Bundle call be supplied
via <extra> tags under a PreferenceScreen.
- PreferenceActivity's header XML tags are now <preference-headers>
and <header>, and you can supply <extra> tags under a <header> to set
arguments for the header's fragment.

Change-Id: I22c212c9fa862d50840201ca16e51f9de5ef0031
/frameworks/base/core/java/android/app/FragmentManager.java
b7a2e4772220c4b41df1260cedaf8912f4b07547 13-Aug-2010 Dianne Hackborn <hackbod@google.com> Fragment and PreferenceFragment and FragmentManager, oh my!

- Introduce FragmentManager public API, for all Fragment management
needs. Will in the future allow the removal of the (growing number
of) fragment APIs on Activity.

- Fragment now has a concept of arguments. This can be supplied
immediately after creation, and are retained across instances.

- PreferenceActivity now has an API to have it update its headers (note
not tested). Headers now have arguments. Keys for controlling
when PreferenceActivity shows at launch have been added to the SDK.

- Fixes to back stack handling and state saving/restoring.

Change-Id: Ib9d07ae2beb296c4eb3a4d9e1b3b59544675e819
/frameworks/base/core/java/android/app/FragmentManager.java
811ed1065f39469cf2cf6adba22cab397ed88d5e 06-Aug-2010 Chet Haase <chet@google.com> Make Fragments use the new animation APIs

Change-Id: I3e3c271234c737491b6ae37821f16434f4563b1d
/frameworks/base/core/java/android/app/FragmentManager.java
5e0d59547c4042037e23a42ba4e2521721e9c7d3 05-Aug-2010 Dianne Hackborn <hackbod@google.com> Fix some Loader bugs.

- Weren't re-attaching to the current loader manager after retaining
instance state.
- Ensure loaders are being destroyed.
- Fix a bug if you call restartLoader() inside of onLoadFinished().

Change-Id: I89df53db49d8e09047bf55216ebeb0f133c059e7
/frameworks/base/core/java/android/app/FragmentManager.java
b3cf10ffa8ff9cac0da8b23a0d84076b3f501400 03-Aug-2010 Dianne Hackborn <hackbod@google.com> Add facility to switch to new fragments from preferences.

Change-Id: I009315b59cf81b4962e9c5a4490f0f82743ed64a
/frameworks/base/core/java/android/app/FragmentManager.java
dd913a50cd72d6dd23c4ea437f0ebe2be05ca2e8 22-Jul-2010 Dianne Hackborn <hackbod@google.com> Add new DialogFragment class.

For all your Dialog needs.

Change-Id: I36c602ca253488d34a55c8f0be610b9752c33264
/frameworks/base/core/java/android/app/FragmentManager.java
9e14e9f33a66b864b98c6ff9517988bafbca3301 14-Jul-2010 Dianne Hackborn <hackbod@google.com> Fix fragment index expunging.

Change-Id: If37e58dfa998575530305584d3aa756bb5a61d7b
/frameworks/base/core/java/android/app/FragmentManager.java
ef69fb82db8ca5cb588767da7a3d261ada8a4227 14-Jul-2010 Dianne Hackborn <hackbod@google.com> Fix bug where LoaderManager instances were not being removed.

Change-Id: Ic8385ff60623ecd3e9fe8ff4360aef2c3b11f24f
/frameworks/base/core/java/android/app/FragmentManager.java
2707d6026240bcca6f0e35e2e1138958882e90ce 10-Jul-2010 Dianne Hackborn <hackbod@google.com> Implement instance passing in LoaderManager.

Activity now propagates loaders across instances when retaining
state. Adjusted APIs to make it better for apps to deal with this.

Change-Id: I8a6448cff1132e66207f9223eb29ccfc0decf2ca
/frameworks/base/core/java/android/app/FragmentManager.java
c801768e4d29667a2608695449ebc2833ba0f200 06-Jul-2010 Dianne Hackborn <hackbod@google.com> Integrate Loader support in to Activity/Fragment.

Introduces a new LoaderManager class that takes care of
most of what LoaderManagingFragment does. Every Fragment
and Activity can have one instance of this class. In the
future, the instance will be retained across config changes.

Also various other cleanups and improvement.

Change-Id: I3dfb406dca46bda7f5acb3c722efcbfb8d0aa9ba
/frameworks/base/core/java/android/app/FragmentManager.java
445646c52128a763b56ed7bb3bd009e2f33e3e4f 26-Jun-2010 Dianne Hackborn <hackbod@google.com> Improvements to ListFragment.

Now deals correctly with a content view containing just a list,
and adds a lot more built-in functionality: ability to show
custom text for an empty list, and indeterminant progress while
populating the list.

In addition, reworks transaction committing to be more aggressive
about committing the transactions as the containing activity
moves between its states (rather than waiting for the activity's
handler to process the transaction message whenever that may
finally happen). And fixed a bug with saving/restoring state of
transaction replace operations.

Change-Id: I9617a0c4f248b50a61b319910323639b6de24f73
/frameworks/base/core/java/android/app/FragmentManager.java
5ddd127d5a38d80c0d8087d1770f41f61f84f048 12-Jun-2010 Dianne Hackborn <hackbod@google.com> Implement ListFragment and Fragment context menus.

Also fix the docs build.

Change-Id: I96f24cc03e6debd897171e503957284b140a9f27
/frameworks/base/core/java/android/app/FragmentManager.java
b31e84bc4513e46bac4be8f8d0513f78e360fb11 09-Jun-2010 Dianne Hackborn <hackbod@google.com> Add Fragment option menu APIs.

Also fix up how transactions are handled so that a series of transactions
can correctly be created and committed.

Change-Id: I948ba47d49e9b2246a1958bd9eac9dd36dc5a855
/frameworks/base/core/java/android/app/FragmentManager.java
5ae74d6e89a30e79ea85c487b32223ef55314985 20-May-2010 Dianne Hackborn <hackbod@google.com> More fragment work.

Clean up FragmentTransaction API, add more animation control, add new
Fragment APIs for hiding and showing.

Change-Id: Iffe31351024a7a63d164270b8a955a499076600e
/frameworks/base/core/java/android/app/FragmentManager.java
6e8304e57ec533e257a2496183125f257be1ff60 14-May-2010 Dianne Hackborn <hackbod@google.com> More fragment stuff:

- New startActivityForResult() API.
- Fragments now should have the correct lifecycle while hanging around
in the back stack (not being destroyed and re-created).
- Rework of state save/restore to make it simpler and better. In theory
now any fragment (including layout and others in the hierarchy) can
now be retained across config changes, though this hasn't been tested.

Change-Id: I2a7fe560e14e567f5675a2f172a23fca67b3e97f
/frameworks/base/core/java/android/app/FragmentManager.java
b4bc78b16a05554c57508b488e21dd8eca4e13e6 13-May-2010 Dianne Hackborn <hackbod@google.com> Further work on fragments:

- Implement all of the state saving and restoring machinery. This
caused some flux in the API.
- Add ability to have fragments that are retained across activity
instances.
- Fix some bugs.

Change-Id: Ib6b5b0752d7f8d667cfdcd3e76d127cc9b6d901b
/frameworks/base/core/java/android/app/FragmentManager.java
f121be737c59390d97e21a92be8e166001534c7d 06-May-2010 Dianne Hackborn <hackbod@google.com> Improvements to fragment API:

- Remove names associated with fragments (we'll use ids). They may
come back for other uses.
- Add method to replace a fragment, to help in doing back stacks.
- Add names to back stack states, to allow for jumping back to
known states.
- Add ability to set animations associated with fragments being
added or removed.

Change-Id: Ic2799f06947b1511fb1df5965ca32568b860b3c3
/frameworks/base/core/java/android/app/FragmentManager.java
ba51c3d02d08709e933de6f6c76dee3fd2f4bfa1 06-May-2010 Dianne Hackborn <hackbod@google.com> New fragment stuff: back stack, and layout integration.

You can now have fragment transactions pushed on to a local back
stack, which will automatically be popped when the user pressed
back in the activity.

Fragments can also now be inserted into layouts.

Change-Id: Id1c9ae3fbc54f696cd8bb5ca5957bec4d3eabf18
/frameworks/base/core/java/android/app/FragmentManager.java
2dedce6e84679ead961a485c7fe4b0f77c713b6a 15-Apr-2010 Dianne Hackborn <hackbod@google.com> Introducing Fragment.

Basic implementation of an API for organizing a single activity into separate,
discrete pieces. Currently supports adding and removing fragments, and
performing basic lifecycle callbacks on them.

Change-Id: I6ea8e6bdb04d93f8105c2e983fe9b6532422de34
/frameworks/base/core/java/android/app/FragmentManager.java