History log of /frameworks/base/core/java/android/app/FragmentManager.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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