History log of /frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
299f960e5e5837da44cd81692388f3cbd5d2c362 26-Jan-2015 Craig Mautner <cmautner@google.com> Add reason string for bringing stack to front

Additional debug and useful information.
Also removed am_resume_activity verbosity and refactored method to
eliminate unused parameter.

For bug 17721767.

Change-Id: Ie1c0652a38a0c6ae6db27a52a9e5da29e252e300
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b4d43538d7cbcea5ddcfd32edb4ada2c211b2a04 21-Jan-2015 louis_chang <louis_chang@htc.com> Resume home activity can skip resume and cause ANR. DO NOT MERGE

Symptom:
In some scenario, there might have two home tasks
in the home stack. If the top home task was finishing
and expected to return to home stack, no activity
will resume.

Root Cause:
Unable to perform resumeHomeStackTask() because the
resumeTopActivityLocked() has been prevented to invoke
recursively.

Solution:
Just resume the next activity if already in home stack

Change-Id: I24ecbcac6cee4ddbd90cdd27c4f4915cffb9b354
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
94ab46659bac1ffdfd7b72d15a68ea6d3b09224e 20-Jan-2015 Craig Mautner <cmautner@google.com> More debugging for bug 17721767

Narrow down why GEL is being resumed instead of the top stack.

Change-Id: I79c0be4adf0ccee30e1a5aa4308ee91148f239fa
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
48248c80e58c459d211d36164baa69354e070c07 24-Dec-2014 Sungsoo Lim <sungsoo@google.com> DO NOT MERGE Make mute/unmute work

Bug: 18844550
Change-Id: I431a223d55430aa8e1bb28f0275e11876ed0e0bb
(cherry picked from commit d1851e6e4e49b6a45d9e013de2e1384711975328)
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6b904ef4741321dcb01caee9795c2a044018706c 18-Dec-2014 Craig Mautner <cmautner@google.com> Make window mgr stack movement track activity mgr

There were situations where the activity manager ActivityStack was
moved to the front but the corresponding window manager TaskStack
was not. This caused the wrong activity to receive focus which led
to Application Not Responding errors.

One path in particular occurred in startActivityUncheckedLocked()
where curTop.task != intentActivity.task and
sourceStack.topActivity().task != sourceRecord.task. In this case
targetStack.moveTaskToFrontLocked() was never called.

This fix forces all calls to ActivityStack.moveToFront() to make
a call to WindowManagerService.moveTaskToTop() and eliminates
redundant calls to moveTaskToTop().

Fixes bug 17721767.

Change-Id: Ibf01389810dd36724eaec5a4a07560144b2f4cef
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
37f271869ed9c9e9f0e7de7339017e0bb6719780 09-Dec-2014 Wale Ogunwale <ogunwale@google.com> Always take an activity screenshot when pausing.

http://ag/261732 introduced an optimization where we only take
the activity screenshot if is is not the activity we took a
screenshot for last. This causes us to display a stale screenshot
for activities that change their display content (using fragments)
without going through the pause/resume cycle. It should be safe
to always take a screenshot when we are pausing since the code
path is only called once per pause/resume cycle.

Bug: 18682160
Change-Id: Ie5c43cfd806286808af4233c5917ae7071908ebb
(cherry picked from commit eacdf2ce04899b0a3abef55e4e7e1fe9c1649932)
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1864a509b06ab2e3e7de25d38776f03aca5e865e 01-Dec-2014 louis_chang <louis_chang@htc.com> [ActivityManager] Invalidate last screenshot when activity relaunched

Symptom:
The task thumbnail is not updated when activity relaunched.

Reproduce Steps:
1. Put device in portrait
2. Launch Calculator
3. Launch Recent App (the Calculator's screenshot is correct)
4. Rotate device to landscape
5. Click Calculator in Recent App to return to Calculator (Calculator has relaunched to landsacpe ui)
6. Launch Recent App again (the Calculator's screenshot is not updated)

Change-Id: I92e951ea2ee215c52ca6e50cf6f9e02deb787bce
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
740c3ac782675d190941b2ab1905e56f246c1b11 13-Nov-2014 Winson Chung <winsonc@google.com> Initial changes to add callback on task stack changes. (Bug 17672056, Bug 18291345)

Add a listener to listen for changes in the Task stacks to preload thumbnails from the
system. In addition, reduce the amount of synchronous work done in activity creation
and first measure/layout passes.

Change-Id: I8bd9155d7a05e89c190a20429acff69a17808208
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0a398d7bb477c57508e5a7374e91cb331b689290 21-Nov-2014 Craig Mautner <cmautner@google.com> Merge "Treat screen-on while pausing as pause timeout." into lmp-mr1-dev
9ef94019386183cb88ad090965418ef294bbb79a 21-Nov-2014 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 694c1d2b to lmp-mr1-dev

Change-Id: I9a9b724e0fd12aa161ff276540431b9d8e218e2b
f49b0a45aece9bad42d81a09eeceaf1b5b6c06df 21-Nov-2014 Craig Mautner <cmautner@google.com> Treat screen-on while pausing as pause timeout.

If an activity is started pausing when the screen turns off and
hasn't completed pausing by the time the screen turns back on then
we will end up showing the activity below it when the pause times
out.

In particular pausing the secure camera exposes the activity on
the top of the stack if you turn the screen off and back on
immediately.

Immediately forcing the existing pause to complete when the screen
comes back on allows the keyguard to obscure anything that might
otherwise be shown.

Fixes bug 17713150.

Change-Id: Ibe275991aa325a7d326bf2a24511aeb4dcbb7e1b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1f4c02bb18ef8e8cc0fecd6786209089f84de147 13-Nov-2014 Wale Ogunwale <ogunwale@google.com> Stop activity onVisibleBehindCanceled()

Once an activity is no longer visible behind and has released
its background resources, it is added to the list of activities
that can be stopped, but not actually stopped until the next
major event (like another activity starting). We now schedule
the idle processing once the background resources have been
released so the activity can be stopped as soon as possible.

Bug: 18191707
Change-Id: I472eee949c1a78b4d944454463f03c90e7d2618b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
44f60cca7bb31e2f9b4b7bf25bb2e0cfb0e3e1e1 07-Nov-2014 Jorim Jaggi <jjaggi@google.com> Fix lockscreen launch animations once and for all

In SysUI, make sure not to dismiss Keyguard multiple times when just
waiting for a deferred dismissal, so WindowManager doesn't get
multiple calls to keyguardGoingAway.

Change heuristics how notifying Keyguard about activity drawn works.
Always notify Keyguard after executing an app transition, and notify
it also when not doing a transition after a startActivity call.

For that to work, update AppWindowToken.startingDisplayed also when
the window is displayed, but force hidden because of Keyguard.

Further, handle the case correctly when a window gets added during
the Keyguard exit animation by overriding the start time for the
animation of that new window. Also don't apply a transition animation
for a window when executing keyguard exit animation, so by removing
a starting window we don't break this animation.

Last but not least, tell Keyguard to start exiting immediately if
animations for exiting are disabled, like when going to phone/camera
on lockscreen. Before, we always had a delay of 1 second because we
waited for the timeout.

Bug: 1599196
Bug: 18272544
Change-Id: I596b2489f814b934abd256e16079d3d3f326e209
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2cc8043cad4c51aeffd5650b669b15e93fb980d5 11-Nov-2014 Prabhakar Thirumoorthy <prabhakar@google.com> Merge "If task isn't found in recents, look in the stacks." into lmp-mr1-dev
e042bf2b22b391f13d8e43ddcd657183992c7197 11-Nov-2014 Craig Mautner <cmautner@google.com> If task isn't found in recents, look in the stacks.

It may take an attach to move a task into the recents list. If the
timing is right a task may not be in recents by the time we are
removing it from the stacks due to a finish. In that case we should
look in the stacks for the task as well as looking in recents.

Fixes bug 18017409.

Change-Id: Idcfe2e263c9d0fe9a063fdf22515ac4e7fe89ecb
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
85d558cd486d195aabfc4b43cff8f338126f60a5 04-Nov-2014 Dianne Hackborn <hackbod@google.com> Add Activity API to get referrer information.

This expands the use of EXTRA_REFERRER to be relevant anywhere,
allowing apps to supply referrer information if they want. However,
if they don't explicitly supply it, then the platform now keeps
track of package names that go with Intents when delivering them
to apps, which it can be returned as the default value.

The new method Activity.getReferrer() is used to retrieve this
referrer information. It knows about EXTRA_REFERRER, it can return
the default package name tracked internally, and it also can return
a new EXTRA_REFERRER_NAME if that exists. The latter is needed
because we can't use EXTRA_REFERRER in some cases since it is a Uri,
and things like #Intent; URI extras can only generate primitive type
extras. We really need to support this syntax for referrers, so we
need to have this additional extra field as an option.

When a referrer is to a native app, we are adopting the android-app
scheme. Since we are doing this, Intent's URI creation and parsing
now supports this scheme, and we improve its syntax to be able to build
intents with custom actions and stuff, instead of being all hung up
on custom schemes.

While doing this, fixed a problem when parsing both intent: and new
android-app: schemes with a selector portion, where we were not
respecting any scheme that was specified.

Change-Id: I06e55221e21a8156c1d6ac755a254fea386917a2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
42d04db459e5a510c8c815c38e17e419c3e3b404 06-Nov-2014 Craig Mautner <cmautner@google.com> More fixes for keyguard animations.

Add a state machine for calling comeOutOfSleepIfNeededLocked() so
that it is only called after the lockscreen has started dismissing
but not before resumeTopActivityLocked(). Also keep
resumeTopActivityLocked() from being called from
comeOutOfSleepIfNeededLocked() recursively.

Have starting windows count towards notifying the keyguard that a
window has been drawn.

Do not update wallpaper animations based on their not being included
in the windows being animated if there are no windows being animated.

And always improve logging.

Fixes bug 15991916.

Change-Id: I0d21c5337f0e89d9eacc8dab2cdaa52fec43ac0b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d3e2a0891b9710dc63fbc15800e7c45909301737 05-Nov-2014 Wale Ogunwale <ogunwale@google.com> Fix issue #18240452: No recents screenshot when resuming from keyguard.

WindowManager.keyguardGoingAway() isn't called early enough when you exit
the keyguard by clicking on a notification. So, the WindowState for the
preivous activity behind the keyguard is never transitioned to visible
and the activity manager then fails to take the screenshot for recents.
We will now be taking a screenshot of the activity before we go to sleep
so we are not dependent on signals from the keyguard.

Change-Id: I2acb2ad7a627d4e446ba11c9a0842d21fa6922d3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
245645ca460150b4030d84c88faa931345a90a50 01-Oct-2014 Craig Mautner <cmautner@google.com> Merge "Don't clear visible-behind activity if it is top" into lmp-dev
64ccb7086741d520c041273610519a5c2f65b440 01-Oct-2014 Craig Mautner <cmautner@google.com> Don't clear visible-behind activity if it is top

Previously if an activity requested to keep running behind
translucent activities (Activity.requestVisibleBehind()) and then
converted itself to opaque (Activity.convertFromTranslucent()), we
would clear the visible-behind activity. This change tests to see
if the top activity is the visible-behind activity and does not
clear it in that case.

This change also clears the visible-behind activity whenever it
comes back to the front. That forces the activity to call
requestVisibleBehind() each time it is resumed.

Fixes bug 17648436.

Change-Id: Id0fc4d7e2a2b907675305d98bad1b08cb610919e
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7622a0f8e4198adf0aae5d4e167ee132b34f4cdb 30-Sep-2014 Dianne Hackborn <hackbod@google.com> Maybe fix issue #17700474: manta: high occurrence of device booted...

...but dev.bootcomplete flag is not set

Rework things to address a few issues I found:

- When the activity goes idle, the way we were handling finishing the
boot there was calling finishBooting() with the lock held, but it
shouldn't. We now dispatch that and turning on the screen together
in a separate message.

- Make sure we don't try to start the home activity until we have
reached the point of the system being ready and mBooting being set.
This ensures we don't do any work prematurely.

Change-Id: If30c1f287af73bc2164e7aadbe98022ae42cc5e7
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f3eb843665d0e52729a7063442f1c229568c3118 20-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17492300: NavUtils.shouldUpRecreateTask returns different...

...value in L

Only do the new logic when the task is a document.

Change-Id: I4664b94a3fe86ea266c2feb4e889c14c06751a15
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
603537986568e6be03d167a431505739e9357ed5 17-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17507017: took ~3 seconds to move an app to the foreground" into lmp-dev
7922882189a5c1cc62de7e91b067f90d9a3e2f2b 16-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16662560: SingleTop activity is getting instantiated multiple time

Introduce a concept of a "root affinity" to a task -- this is the
affinity of the initial activity in the task. Use this instead of
the current affinity in findTaskLocked(), where we look for an
existing task to use for a NEW_TASK intent.

This changes the semantics of the new "relinquish task identity" mode
so that it doesn't relinquish the root affinity of the task. This
means when we are in the old style application-based recents matching
of findTaskLocked(), we will never count these tasks as the same as
the application's tasks only because they have relinquished their
identity to that application. This is probably okay, it is basically
putting a different line between new document-centric recents and
old application-centric recents when they are mixed together.

Change-Id: I73a22ead9bd08e98bf67ad035a017f828c6a6715
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
95465200b0f652c48d40ca1028238763dd647900 16-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17507017: took ~3 seconds to move an app to the foreground

This is because of the 5 second timeout from when the user can bring
home to the foreground until regular third party apps can launch an
activity on top of it. Activities launched from notifications look
like they are being launched by the app, so get impacted by the timeout.

Fix this be also looking at the actual caller to see if they are
allowed to pop in front regardless of the timeout.

Change-Id: I63fbc2bcabf585e6d2810a2309f0613fdf91fdf5
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
465fa3963534e41ead0dce1273b71fd50c58c973 14-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16907799: Processes containing bound services...

...are killed over eagerly.

When the current foreground activity is moving to the background,
it was briefly going through the CACHED_ACTIVITY state before the
correct LAST_ACTIVITY state, allowing its bound service processes
to be killed (because they went in to the cached list). To solve
this, as long as a process has stopping activities, it won't go
lower than LAST_ACTIVITY.

Also fixed a problem where we could put a process in CACHED_EMPTY
instead of CACHED_ACTIVITY_CLIENT. There were a number of cases
in the binding flow and also the client process state transitions
where we would not correctly updateing the bound client activity
state.

And add some sanity code so that if a process hosting a
service is killed, and a client process of that service is in the
cached state, we kill the client process. This avoids situations
where we can start thrashing around in the cached list because we
are restarting process for no reason -- since they will just
continue to be cached.

Finally, tune the process LRU list to allow twice as many cached
activity processes (from 8 to 16), so we can make better use of
the RAM we have available these days.

Change-Id: Ib0cdf78c321cbb035259fc9dd6ee27b5ba1f90c5
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
652973fca83c48d8b4622493f10e656b8d86dd17 11-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17414533: update batterystats occasionally takes a couple...

...hundred milliseconds.

Rework the locking so that no critical paths block on the cpu collection.

Change-Id: Ie615a033f7f8b523b67abee62c581d1a8fce324c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d2a38c78543c913da851d6c377c1890a20516a23 08-Sep-2014 Craig Mautner <cmautner@google.com> Merge "Ignore finishing activities when fetching the top" into lmp-dev
0175b882b5e021907c307ab0e455bff014ad8784 08-Sep-2014 Craig Mautner <cmautner@google.com> Ignore finishing activities when fetching the top

When the top activity is finishing we don't want to be comparing
it for matches to launching activities. This was keeping curTop
from matching itself when launching a lower task.

Fixes bug 17383648.

Change-Id: I837ac087ef965d99d12c98ab1c779de46716e204
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a4e102ee580282dc7abeb22f4a025813e53b9431 05-Sep-2014 Dianne Hackborn <hackbod@google.com> Work on issue #17357238: Recents is often slow if not used in a while

Add a new activity attribute, resumeWhilePausing, that allows an
activity specifying it to immediately start running without waiting
for the previous activity to pause. The recents activity is updated
to use this.

The implementation of this is ultimately fairly simple -- if we are
in the path of resuming such an activity, and find that we first need
to pause the existing activity, then within the activity manager we
do the regular pause flow but act like it has immediately finished
pausing right then so that we can immediately go on to the resume.
To make this clean, we tell the activity when asking it to pause that
it should not come back and tell us it is done, because we aren't in
any way waiting for it.

One potentially important change I needed to make here is the pause
callback no longer provides the saved persistent state, because we
now can't count on that callback happening. I don't think there was
really any utility in this anyway -- all modern apps will have their
save state flow happen as part of stopping, not pausing, so we'll
only capture that saved state when the stop is reported back anyway.
And since we do send the saved state back when stopping, it would
always blow away whatever we had gotten at the pause.

Finally, update the documentation for AppTask.startActivity(), and
fix the implementation handling that to be cleaner -- we need to
deal with inTask first before getting in to "oh noes add NEW_TASK
if this isn't coming from a calling activity" flow.

Change-Id: Ia1da0fac90d7bdbaafdda2e34850d795ce17a39f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
46edee0994354e828bd6d0bffe60b6036b8c1388 05-Sep-2014 Craig Mautner <cmautner@google.com> Merge "Prevent recursion in resumeTopActivityLocked" into lmp-dev
544efa76639b46e4177b385d498fca60c8b6ded5 05-Sep-2014 Craig Mautner <cmautner@google.com> Prevent recursion in resumeTopActivityLocked

The existing recursion in resumeTopActivityLocked() finally caused
a problem by attempting to pause the same activity twice. By
preventing the recursion with this change we no longer face that
problem.

Fixes bug 17260463.

Change-Id: I0954614fc1a7dc0eeeef9335c1b973a42a7fc345
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
925e2b335237153648ecad84d5fa280669f4cf1a 04-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17175312: Calendar crashed when tapping on the event notification

mActivities can be null.

Change-Id: I9cc1a08d19d2c38a4ebaaf0ed2168cfbeeaf3b51
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
48a10a56e98b008ac55b9d50aee1ad33b377e367 27-Aug-2014 Winson Chung <winsonc@google.com> Change API to return thumbnail size instead of individual dimensions. (Bug 17295512)

- Fixing issue where we were pulling the thumbnail dimensions too early in AMS. (Bug 17286904)
- Simplifying the Recents code between start & configuration change

Change-Id: I6d667cbf37b844939e5fc466da613bb78ca05082
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4c499be0edc24eb2e2b9705dba52a2059823e4aa 27-Aug-2014 Jorim Jaggi <jjaggi@google.com> Fix that Keyguard didn't always get onActivityDrawn call

Bug: 16481924
Change-Id: I299645c940c71820aa7dc70985e41da869f1368a
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
852975d5377bfe5f4abc9d2a28e301aa2fa99994 23-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17179314: Make recents limits consistent

The max limit is now 100 (or 50 on svelte devices), and that is
what everyone used.

Re-arranged things so we have a big expensive "fix the world!"
function for recents that we go in to at only select points:
when first initializing the system, when external storage comes
and goes, and if we detect something wrong with the recents
structure.

With that, now getRecentTasks() and addRecentTaskLocked() are
generally much simpler, doing very little work in most cases.
This will help a lot with scaling up to many more recents
entries.

Change-Id: I7b5ae89edc06568f68c8af54a4420aff7635581c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
89ad456ea49cb62615ebdcac83a2515743bbe5fa 25-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16311398: Limit number of documents a process can open

In application processes, monitor for when we start getting close
to the Dalvik heap limit, and ask the activity manager to try to
prune old activity instances in that case.

Add an explicit API for apps to ask that they have their own
activity instances cleaned up, if they want.

Fix some bugs in launching activities that were not correctly
applying the "multi task" behavior in the appropriate situations
of document-centric recents.

Clean up the activity manager's process removal code to all share
a common path.

Add a new "Spam" option to ActivityTests, which continually creates
new tasks, checking that the activity manager will now prune old
tasks rather than letting the app run out of RAM.

And while I was was doing this, I found problems with the path
for bringing an empty task to the foreground -- it could make
a new task instead of re-starting the root activity in the
existing task. This is fixed, and some code in the recents
UI for working around the bug is removed.

And as long as I am doing that, we now have nice hooks in to
the activity manager for AppTask to give some APIs for better
managing the task, so add those along with more tests for these
APIs in ActivityTests.

We should look at also having the activity manager try to prune
old tasks when it sees app processes being killed, to better balance
memory use across multiple processes when some processes may host
many documents. That however is for another CL...

Change-Id: I2bb81c3f92819350c868c7a7470b35817eb9bea9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4cce1de9fe95ffc3b968de87579a543a461f96bb 26-Aug-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #16366571: UIDs for work and normal Chrome processes are the same" into lmp-dev
885fbe5c070cf1579c96ab8e150449af00e16501 24-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16366571: UIDs for work and normal Chrome processes are the same

Use uid as main key for determining which app tasks a caller has
access to.

Change-Id: Ibbe3f0f64197671d279c3fc519edfc720d442938
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6f4d61ff2e3143bea37bbc1a7a2a0ab415b2c88a 22-Aug-2014 Dianne Hackborn <hackbod@google.com> Work on issue #17011123: Hit Back/Recents button when in Recents...

...without interacting with any of the Recents items should not bring
Home back to top

Up navigation needs to be smarter about multi-document and in the case
of being at the root of a document know to re-construct a task for
the app.

Change-Id: Ief874e46e9a9897379dda1010bcce4c5b03d82f1
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
aec68bb89fe614181a20eb97340149406218ce2f 21-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17038762: Add API to add entries to the recents list

New API Added to ActivityManager for adding an entry. See docs
there.

Repercussions:

- I hit a bug in system UI where if the thumbnail has alpha, it tries
to modify it, but thumbnails are loading immutable so crashes. Fixed
this by loading the bitmaps to be mutable.
- Improved dump output of recents; there was a lot of stuff missing.
Also split the recents dump output from the rest of the activity
output, since it can be really large.
- Added tests to the lovely ActivityTest app.

Bonus: new method on AppTask to control the exclude from recents flag.

Change-Id: I01e543db4d15320ee1701e95872fef73c116526c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
4b6c6697da5a20c08b2f9f2ca40c94008477e914 13-Aug-2014 Jose Lima <joselima@google.com> Renamed "media playing" APIs to "visible behind"

- Request from API Review: rename the media playing APIs to a more
generic name, reflecting the background visibility feature these
methods actually control.
- Made the new isActivityVisibleBehind().
- Changed convertFromTranslucent() and convertToTranslucent() to be
SystemApi.

Bug: 16959028
Change-Id: I526eac22f44273b3254dd6201f89194d13e597e2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8de4311c51229efbe2f2d0afbf298982c5cadd96 11-Aug-2014 Jorim Jaggi <jjaggi@google.com> Lockscreen launch animations

- Get rid of ActivityManager.dismissKeyguardOnNextActivity, which was
used for two different things: Dismiss keyguard from somewhere else
(not really necessary anymore), wait to actually dismiss keyguard
after the window behind is drawn. Instead, introduce
keyguardWaitingForActivityDrawn(), and change the semantics where
necessary.
- Make wallpaper_close_enter consistent with task_open_enter and the
Keyguard launch animation.
- Close the panel even on lockscreen when launching a notification.
- Block notification shade updates during the collapsing motion so
notification don't play the disappear animation immediately after
having launched a notification.

Bug: 15991916

Change-Id: I133c177b84e926c87c1a404ba93d633593fec3ab
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
fa387ad6cfa996d09050f8f6c39eaa0537893d20 05-Aug-2014 Craig Mautner <cmautner@google.com> Make next activity opaque when media stops

Call convertFromTranslucent on next activity when an activity below
it stops playing media.

Fixes bug 14469711.

Change-Id: I7e4346987cb620cb3a8c09096ff3a639cf344679
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9bcc6e83d98dc5608d15f38c12d397be650c637c 30-Jul-2014 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Avoid mistaking visibility by finishing task.

Cherry-picked from aosp into lmp-dev.

Sympton:
Next activity only adds to history but does not launch/resume then results ANR.

Root Cause:
In a rare timing, some windows are switched at the same time,
it will cause some finishing records on the top temporarily,
then set startIt to false that skip to resume the real top activty.

Solution:
If all activities in a task are finishing, do not use it to check.
The behavior/checking is the same concept as in JellyBean:
// If starting in an existing task, find where that is...
boolean startIt = true;
for (int i = NH-1; i >= 0; i--) {
ActivityRecord p = mHistory.get(i);
if (p.finishing) { // <--
continue;
}

Change-Id: I9d81a7b5182400c52e173da23eee61c74692beee

Conflicts:
services/java/com/android/server/am/ActivityStack.java
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7544c829972d5ea33ab2ac9ec1e9a4974909d8d8 29-Jul-2014 Craig Mautner <cmautner@google.com> am 09875ec7: am 0fa45d93: Merge "Remove PendingActivityLaunches based on stack." into klp-modular-dev

* commit '09875ec7292b19e07c38b6127406d6aa7490e26c':
Remove PendingActivityLaunches based on stack.
09875ec7292b19e07c38b6127406d6aa7490e26c 29-Jul-2014 Craig Mautner <cmautner@google.com> am 0fa45d93: Merge "Remove PendingActivityLaunches based on stack." into klp-modular-dev

* commit '0fa45d93f7265c130d5dc49a51130ed74db5cec9':
Remove PendingActivityLaunches based on stack.
0fa45d93f7265c130d5dc49a51130ed74db5cec9 29-Jul-2014 Craig Mautner <cmautner@google.com> Merge "Remove PendingActivityLaunches based on stack." into klp-modular-dev
7f13ed37fd2a0533fa7c5e330519decd89fdc1d5 28-Jul-2014 Craig Mautner <cmautner@google.com> Remove PendingActivityLaunches based on stack.

Was previously removing by trying to match activities, but the
activity being matched would not have been in the stack yet. Since
it doesn't get added to the stack when it goes into the list
of pending activities. By removing all pending activities associated
with the stack we clean up all such pending activities.

Fixes bug 16045752.

Change-Id: I6b5981ffcce674139837b06362e573299bbc9e52
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a9c5257a15f2efb5c017d2ecadb5a7360230bfee 25-Jul-2014 Craig Mautner <cmautner@google.com> am a0bb44ef: Merge "Finish crashed activities immediately" into klp-modular-dev

* commit 'a0bb44efe96ca70635b64dac8922b225d1a19407':
Finish crashed activities immediately
8e5b133bf63c0f29ce059bf0ef05695a2f7f99b8 24-Jul-2014 Craig Mautner <cmautner@google.com> Finish crashed activities immediately

By finishing crashed activities right away the VirtualDisplays
associated with ActivityView are removed immediately rather than
being deferred. Also there is no waiting for Pause (0.5 sec) and
Destroy (10 sec) timeouts to expire.

Fixes bug 15092354.

Change-Id: Ie4941cb19dcc6f6fc61b2475162ea2794c9558a2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6ba042b51496b9763d721b6dca8a591c323d648c 28-Jul-2014 George Mount <mount@google.com> Make returning ActivityOptions part of ActivityRecord.

Bug 16626030

Getting the timing correct for when to clear returning activity options
was difficult when Activities can be destroyed and recreated. Moving
the returning ActivityOptions to the ActivityRecord forces the
ActivityOptions to only apply to the correct Activity.

Change-Id: Ib5400b157eb741ae484aae0cc83172a3db637a3e
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
040491594d922177c892d377bfff17b272bb6611 25-Jul-2014 Craig Mautner <cmautner@google.com> am 053ce1e7: am 40185726: am a9c5257a: am a0bb44ef: Merge "Finish crashed activities immediately" into klp-modular-dev

* commit '053ce1e7a85e3ca7820a3b9e1b2c203d1a1a345b':
Finish crashed activities immediately
5ec618e3c3163928bd4c1109756764fcd9f90dae 25-Jul-2014 Craig Mautner <cmautner@google.com> am a9c5257a: am a0bb44ef: Merge "Finish crashed activities immediately" into klp-modular-dev

* commit 'a9c5257a15f2efb5c017d2ecadb5a7360230bfee':
Finish crashed activities immediately
a8f076e8c3e4750d9860cc24376838bad73ba7a1 25-Jul-2014 Nicolas Prevot <nprevot@google.com> am e7469eca: am c50bbc02: Merge "Migrate extras to ClipData for image/video capture intents." into lmp-dev

* commit 'e7469eca60b76931830e3679788865ee8582add1':
Migrate extras to ClipData for image/video capture intents.
d1c99b1fe85ed03261a77a14ae52e7fa3a6e523a 04-Jul-2014 Nicolas Prevot <nprevot@google.com> Migrate extras to ClipData for image/video capture intents.

The intents ACTION_IMAGE_CAPTURE, ACTION_IMAGE_CAPTURE_SECURE and ACTION_VIDEO_CAPTURE are now handled in a way
similar to ACTION_SEND and ACTION_SEND_MULTIPLE.
Migrate the uri in the EXTRA_OUTPUT extra to clipData, and add the flag GRANT_WRITE_URI_PERMISSION.

The userIds are now added to extra uris in the process receiving the intent, (not in the system process), because the
system process may not be able to parcel/unparcel the extras.

BUG: 15534203

Change-Id: I8f79666b726bc6d7745bf777ad3c7518945c5cc3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
25dd00a5192e064c13dc367d22230fd31c3bab48 17-Jul-2014 Craig Mautner <cmautner@google.com> am 73c69b27: am c2d339a6: Merge "resolved conflicts for merge of 0a931069 to lmp-dev" into lmp-dev

* commit '73c69b2727b311d12f1ca8ad197db7cbe83d162c':
Additional cleanup after stack deletion.
aa9b0f15753541ff8e4d62e6497c11800c737077 17-Jul-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 0a931069 to lmp-dev

Conflicts:
services/core/java/com/android/server/am/ActivityManagerService.java
services/core/java/com/android/server/am/ActivityStackSupervisor.java

Change-Id: I68e8290566b51fadb5671abdd9d05faf28502e22
0a93106964eec2462ec86e372def1b0d1526cd7d 17-Jul-2014 Justin Koh <justinkoh@google.com> am 65d7c332: Merge "Additional cleanup after stack deletion." into klp-modular-dev

* commit '65d7c332d7b613f23a26066051cc7496e0efa994':
Additional cleanup after stack deletion.
ee36c77acd3b92c64e53e19c570e2482382db870 16-Jul-2014 Craig Mautner <cmautner@google.com> Additional cleanup after stack deletion.

- Remove activity from PendingActivityLaunch list when it is removed
from stack. This prevents the delayed launch causing
IllegalArgumentException in b/16045752.
- Move PendingActivityLaunch from ActivityManagerService to
ActivityStackSupervisor.
- Immediately call onTaskListEmptyLocked() in cases where no
activities are found in stack.

Fixes bug 16045752.

Change-Id: Ia69a449e7f5e08ab6e36157d0fd793c4d2fdaca4
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f33f4d7f60eb11ef288961cd00dec0ff06373a15 16-Jul-2014 Craig Mautner <cmautner@google.com> am 15c2da7c: am 2e7b2521: Merge "[ActivityManager]: Update home process when home activity resumed"

* commit '15c2da7ce51ad1c1cbb07602644fa7291e8c7896':
[ActivityManager]: Update home process when home activity resumed
76ae2f07e04ae5288a8c485a0c37e844743e012b 16-Jul-2014 Craig Mautner <cmautner@google.com> am 07c3b195: am d543c3e1: Merge "[ActivityManager] Do not finish root activity when reset task"

* commit '07c3b19556b03a51c661b21c19c16deebab6065b':
[ActivityManager] Do not finish root activity when reset task
bb742462781a73bb25516067c8fe6311c1c8a93e 08-Jul-2014 Craig Mautner <cmautner@google.com> Launch activity behind launching task.

Use ActivityOptions.makeLaunchTaskBehindAnimation() to launch tasks
behind the current task. Includes animations for launching and
launched tasks.

Fixes bug 16157517.

Change-Id: I0a94af70b4748592e94673b958ee824cfb3d7ec0
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0b23e20be6121286567726e995cf3617c022a844 15-Jul-2014 Craig Mautner <cmautner@google.com> Merge "Add null check" into lmp-dev
3b1dac8c5aea2aaf12453aa8063630bd6bde0a92 15-Jul-2014 Craig Mautner <cmautner@google.com> Add null check

Fixes bug 15847145.

Change-Id: Ia4d223da578bc38516824dd82dd3c5b8d58328dd
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
01e9a97fe68dbba42a0edd0ad965ccfe2b8efe7d 10-Jul-2014 George Mount <mount@google.com> Don't lose ActivityOptions during orientation change.

Bug 16188506

Change-Id: I056153e6ddbaf328dd65b8b27a91ae773c33ea22
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a2ff611fd6312510f03a2556c2932f87ba3144af 15-Jul-2014 Alan Viverette <alanv@google.com> resolved conflicts for merge of dca272b8 to lmp-dev

Change-Id: Ifbd10ace66f7488f225bfae6e26bab60ab56e651
dca272b8c21f2910424496b97cd9b7a558008876 11-Jul-2014 Michael Kolb <kolby@google.com> am 0cb38d2e: Merge "Add configuration for activity thumbnails" into klp-modular-dev

* commit '0cb38d2e5ab32fd34c8129f3c2d1c158bad9abc3':
Add configuration for activity thumbnails
5f6238e4a7b2b54c4852852bd9bf045f387a5e42 10-Jul-2014 Michael Kolb <kolby@google.com> Add configuration for activity thumbnails

Bug: 15750584

Change-Id: I0b2bfb46022b46d7649f6d9ba9ba74cdfc70a6ea
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
a228ae95ea2f842c0e84f237c64bf032689410dd 09-Jul-2014 Craig Mautner <cmautner@google.com> Add task affiliation

Introduces new flag Intent.FLAG_ACTIVITY_LAUNCH_BEHIND which
causes the newly launched task to affiliate with the launching task.
(Later this flag will also launch the task behind the current task).
This shows up in a new member of the RecentTaskInfo class. This also
causes the recents list returned by getRecentsInfo to be rearranged
so that affiliated tasks are together.

Fixes bug 16157517.

Change-Id: Ia1386af50da2f01809278b62d249f05c6a0de951
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
083baf99ff1228e96ede96aac88c8200c4fdc2b2 11-Jul-2014 Winson Chung <winsonc@google.com> Fixing a few potential crashes, preparing for Task affiliations framework changes.

- Deferring widget host listening to speed up startup
- Ensuring that we animate to the right task position in the stack and not just the front-most
- Removing assumption that we can only get screenshots for the most recent task
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9d8a30d9e1c17877cd45686a8f6aa70142c33573 07-Jul-2014 Craig Mautner <cmautner@google.com> am a7f02a5c: am ef2e7667: Merge "[ActivityManager] Avoid keeping restarting home when only home activity exists."

* commit 'a7f02a5cda27147fe7076805187fb6fbc60fdcfb':
[ActivityManager] Avoid keeping restarting home when only home activity exists.
ee2e45acbff28986c2ced636b7550d0afbb0eeb7 27-Jun-2014 Craig Mautner <cmautner@google.com> Add Media Playing API

These methods permit an activity to play or continue playing media
behind a translucent activity above it. Particularly the home
activity in Android TV. Methods exist to notify the upper activity
when playing starts or stops and for notifying the playing activity
when to stop playing and release its resources.

Methods are called when either activity's state changes or new
activities are launched.

Fixes bug 14469711.

Change-Id: I7ba10c5a4683504931cffa228488f5281e5bbf86
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
468f7da79715cd7445a854ee118312cff4f2f1fd 08-Jul-2014 George Mount <mount@google.com> Merge "Introduce onNewActivityOptions for return activity"
eb8abf7207aa118065999514f9248affbdd94de1 03-Jul-2014 Craig Mautner <cmautner@google.com> Introduce onNewActivityOptions for return activity

When an activity that is already translucent returns to the
previous activity using a scene transition the receiving activity
did not receive its ActivityOptions for its side of the animation.
The new method onNewActivityOptions() delivers those options.

Fixes bug 14869070.

Change-Id: I09b136b3213aae5d3521894e17a7500ac793f3d2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6ea0d0a2592395b8980c24304733daec628e947e 03-Jul-2014 Dianne Hackborn <hackbod@google.com> Fix cleanup of voice sessions.

They would leave active voice activities lingering around.

Change-Id: I5b6716ab303636ebdf2f13c3172552a73dae3bb1
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0df9858802d80e4275326521813c580176fb24f2 07-Jul-2014 Craig Mautner <cmautner@google.com> am 9d8a30d9: am a7f02a5c: am ef2e7667: Merge "[ActivityManager] Avoid keeping restarting home when only home activity exists."

* commit '9d8a30d9e1c17877cd45686a8f6aa70142c33573':
[ActivityManager] Avoid keeping restarting home when only home activity exists.
c0ffce5ddd6446f1d46a49cdfaeda4a2ce408e1d 01-Jul-2014 Craig Mautner <cmautner@google.com> Use cached thumbnails in Recent tasks.

The thumbnail returned from ActivityManager.getTaskThumbnail() now
contains either a Bitmap or a ParcelFileDescriptor that points to
a file containing a compressed Bitmap. The Recent tasks list is
now responsible for all thumbnail Bitmap caching as the activity
manager keeps only the most recent 5. This also permits low memory
devices to have many more tasks in the Recent tasks list.

As part of this CL the concept of subtasks is removed eliminating
code supporting the TaskAccessInfo and IThumbnailRetriever classes.

Fixes bug 15828934.

Change-Id: I0fd0320a1a04e3c78d79357899b83a2fff97abf2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
70778d7d53e1ade34f9ddcdf0860540bb18d7648 02-Jul-2014 George Mount <mount@google.com> Stop temporary window from showing with activity transitions.

Bug 15424905

When creating a new process, a temporary window would show,
even when within the same task. This CL prevents the temporary
window from showing when using
ActivityOptions.makeSceneTransitionAnimation(...)

Change-Id: I93c40ba0b41ed90ebe6e9802d1236f8c81d60abe
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
76e2a765b495f15a718dc4dfd9d81e9539a7074b 24-Jun-2014 Craig Mautner <cmautner@google.com> Don't set return to recents on every resume

Checking for previous task to be the Recents activity every time
through resumeTopActivityLocked() leads to missetting the
mTaskToReturnTo to Recents for Recents. Instead check for
Recents launching a task in moveTaskToFront and startActivity.

Fixes bug 15832448.

Change-Id: Ib64fe26f3fd3fdcd878edafb041928ec02757e63
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
84984faf530e525b066e28710d0f9beb32142ec5 19-Jun-2014 Craig Mautner <cmautner@google.com> Return to recents when coming from recents

If a task is launched from recents then backing all the way
out of the task will return you to recents. Entering the task
in any other way (home, another activity, nav bar) will reset
this behavior.

Fixes bug 15703876.

Change-Id: I98dc36e4dbcb238d59e2175832076de7225bfdd9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9d4e9bcebbd97ad51daa0ef15cfba5aabb399bbb 19-Jun-2014 Craig Mautner <cmautner@google.com> Allow a root activity to relinquish task identity

If a an acitivty with attribute android:relinquishTaskIdentity true
is the root activity of a task then the intent of that task will
be that of the first activity in the stack with
android:relinquishTaskIdentity set false.

The ability to set intent also includes the ability to set the
TaskDescription of the task.

Fixes bug 15675610.
Fixes bug 10428661.

Change-Id: Ib28a9eae3b9832eeeef9106adbebe344184ee5ae
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
916cd9770ce865bad98f15a68be74f3aa607e727 14-Jun-2014 Craig Mautner <cmautner@google.com> am 6335fbcb: Revert "Revert "Close ActivityView and ActivityContainer cleanly.""

* commit '6335fbcba106147d914acae0a9d8f4fcd53af768':
Revert "Revert "Close ActivityView and ActivityContainer cleanly.""
6335fbcba106147d914acae0a9d8f4fcd53af768 14-Jun-2014 Craig Mautner <cmautner@google.com> Revert "Revert "Close ActivityView and ActivityContainer cleanly.""

This reverts commit dd5c94717077c9366dee364c88a86a78e5ee2688.
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
0f3d3dd26c7c726752c92fbf92fb1502ba4b77f0 13-Jun-2014 Justin Koh <justinkoh@google.com> am dd5c9471: Revert "Close ActivityView and ActivityContainer cleanly."

* commit 'dd5c94717077c9366dee364c88a86a78e5ee2688':
Revert "Close ActivityView and ActivityContainer cleanly."
dd5c94717077c9366dee364c88a86a78e5ee2688 13-Jun-2014 Justin Koh <justinkoh@google.com> Revert "Close ActivityView and ActivityContainer cleanly."

This reverts commit 4a9f129874785d34930f165268dbc618e4bc2618.

Conflicts:
services/core/java/com/android/server/am/ActivityStackSupervisor.java

Change-Id: Ic1f4df7f4cb644de7ddebcdc8ce632b46c5ba8f2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f5030ecbca4f8dc217204d96d3f0a3511acf49ac 12-Jun-2014 Craig Mautner <cmautner@google.com> am 4a9f1298: Close ActivityView and ActivityContainer cleanly.

* commit '4a9f129874785d34930f165268dbc618e4bc2618':
Close ActivityView and ActivityContainer cleanly.
4a9f129874785d34930f165268dbc618e4bc2618 11-Jun-2014 Craig Mautner <cmautner@google.com> Close ActivityView and ActivityContainer cleanly.

- Do not call IActivityContainer.release() from
ActivityView.finalize() if it has already been called from
ActivityView.release(). Eliminates IBinder finalized Exception.

- Call ActivityRecord.makeFinishing() before calling ActivityStack.
destroyActivityLocked(). Forces call to scheduleDestroyActivity()
and eventually removeFromHistory(). Otherwise removeFromHistory()
is never called and window manager AppWindowTokens become orphans.

- Defer call to ActivityContainer.detachLocked() until all
activities have finished or timed out. Fixes problem where Display
is removed while activities are still launching.

- Call ActivityStackSupervisor.deleteActivityContainer() when all
activities have finished or timed out. Fixes orphaned
ActivityContainers.

Fixes bug 15450798.
Fixes bug 15484154.
Fixes bug 15383479.
Fixes bug 15316558.
Fixes bug 15168560.
Fixes bug 15143914.

Change-Id: Id3c641976b6f825458690f9ee063c07818b56f23
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d163e751895930a1c8d8d6c3d7e0a37177dbbf19 14-Jun-2014 Craig Mautner <cmautner@google.com> Revert "Revert "Close ActivityView and ActivityContainer cleanly.""

This reverts commit dd5c94717077c9366dee364c88a86a78e5ee2688.

Change-Id: I7bac1aa1d96fa7922cc835949730a26204f15f2f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
220cad6d9743f134c0d44623fc56cd57467866e7 13-Jun-2014 Qiwen Zhao <zhao@google.com> Merge commit '0f3d3dd2'

Conflicts:
services/core/java/com/android/server/am/ActivityStack.java
services/core/java/com/android/server/am/ActivityStackSupervisor.java
4c07d0246fb37e6a77be2c5cdcdf55a989b90f75 12-Jun-2014 Craig Mautner <cmautner@google.com> Merge commit 'f5030ecb' into manualmerge

Conflicts:
services/core/java/com/android/server/am/ActivityStack.java
services/core/java/com/android/server/am/ActivityStackSupervisor.java

Change-Id: Ie38e3e8b82f588d36e955664904f3ab84bdfaaf5
82b3201a95063a1fe51842417c444c0dfd8cf780 07-Jun-2014 Nick Kralevich <nnk@google.com> resolved conflicts for merge of 13ed83ee to master

Change-Id: Ia3739cfa7af60e6a47bf94d403df190f3f2cd082
ffcfcaadfefec2fb56f67a0a614a54bf4599d62b 05-Jun-2014 Craig Mautner <cmautner@google.com> Implement maxRecents and fix TaskPersister bug

Activities can now set the maximum number of times that they will
appear in the recent task lists when using DocCentric mode. The
default number is 15, the min 1, and the max 100.

Also a bug in TaskPersister that deleted files because it did not
properly parse their task ids is fixed.

Fixes bug 13736052.

Change-Id: I7ccb4e6f89d6202ff31c8577bb7b9d8d1b7e5e8d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b6011c1c2a2452174c7ce973e1867b912996081d 05-Jun-2014 Craig Mautner <cmautner@google.com> Merge commit '21483b9f' into manualmerge

Change-Id: If9261cc1625f9f492697fe16c21d2b71c0cc0e11
21483b9f0b5a92aec10d858d9e3525abd190504c 05-Jun-2014 Craig Mautner <cmautner@google.com> am e34fcf8f: Merge "Add callback when ActivityView activities complete" into klp-modular-dev

* commit 'e34fcf8ff9a023641505a8decdeb1b77232d8a16':
Add callback when ActivityView activities complete
d94b47f3b671f5afbc79b061a9b8fa7aa8b22f87 03-Jun-2014 Craig Mautner <cmautner@google.com> Add callback when ActivityView activities complete

Users of ActivityViews can now be informed when there are no more
active activities in ActivityView by registering a callback.

Fixes bug 15330616.

Change-Id: I39d55bdb0db8b0a12ee751cdcb039b7fbb899c85
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6b942b8c52f7071ae6c590f3080c7e52dfef7d9e 02-Jun-2014 Nicolas Prevot <nprevot@google.com> Small fix related to cross-profile result intents.

Change-Id: Id99d6406cdd8ceddacf6fee0cf66e7e59d749a15
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
1015efb143b51a5d31f2f932528f295cfa1add1f 29-May-2014 Nicolas Prevot <nprevot@google.com> Merge "Making the content resolver work with result intents."
71ac80c46a1b094ad951e59c24791d9e9ef769bf 29-May-2014 Craig Mautner <cmautner@google.com> Merge "Revert "Modify task navigation to return to recent tasks." DO NOT MERGE" into lmp-preview-dev
b9a6c8ad99c7885dccc23223068c0a551f350cd5 29-May-2014 Craig Mautner <cmautner@google.com> Revert "Modify task navigation to return to recent tasks." DO NOT MERGE

This reverts commit 1a4e211e03f1f795d935058e27356a0e8bc5df7c.

Change-Id: Ia691b93347c7eb2395933e5a5ba385ea94e08d6f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
fdaaf91f356a1dcd960c48a5f0137869d561cb23 29-May-2014 Craig Mautner <cmautner@google.com> Merge "Revert "Modify task navigation to return to recent tasks.""
719e621186adc1ba5a365bddea01cbe73bb26b02 29-May-2014 Craig Mautner <cmautner@google.com> Revert "Modify task navigation to return to recent tasks."

This reverts commit 19174878e25ebfd8806595f83df7bdea1d239c07.

Change-Id: I98db2c9aa975495c5828b3d16b8b45f515e6a5fa
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c6cf95c0f5f7250c65e40c441fe58d8cbfd114c9 29-May-2014 Nicolas Prevot <nprevot@google.com> Making the content resolver work with result intents.

prepareToLeaveUser is called if necessary on result intents.
Adding the targetUserId to grantUriPermissionFromIntentLocked
This allows the GET_CONTENT intent to work across profiles.

Change-Id: Id81280c23247aeda7ad56e34af9b12a6f3a00a3c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e30e02f5d9a9141c9ee70c712d4f9d52c88ea969 28-May-2014 Dianne Hackborn <hackbod@google.com> Add system layer for voice interaction services.

New window layer that voice interaction service windows
go in to. Includes a new voice-specific content rectangle
that voice activities are placed in to.

Add specific animations for this layer, sliding down from
the top (though this can be customized by the voice interaction
service).

Also add the concept of activities running for voice interaction
services for purposes of adjusting the animation used for them,
again sliding from the top, but not (yet?) customizable by the
voice interaction service.

Change-Id: Ic9e0e8c843c2e2972d6abb4087dce0019326155d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2eb4f9c377c01b5644c00f4b0cca2e655e107998 22-May-2014 Winson Chung <winsonc@google.com> DO NOT MERGE

Removing unnecessary public values. (Bug 14995844)
(cherry picked from commit aa327fc2ce428f939885e1172578ff1dc975214c)

Change-Id: I98672d0ed3120c15bf31ce7a21ab604cfe66273d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
8f4f2ff5cbd9cf5733437afeb54f8a2453d9e616 27-May-2014 Winson Chung <winsonc@google.com> Merge "DO NOT MERGE " into lmp-preview-dev
e67a784eb2c914c04c62ea5dfa1e3751df5582cc 21-May-2014 Craig Mautner <cmautner@google.com> Modify task navigation to return to recent tasks. DO NOT MERGE

Tasks launched from the recent task list will now return to the list
when they are finished. Also tasks that are launched from the
notification panel and services will now return to the list,
provided that the launcher is not front and center when they are
launched.

Fixes bug 14464114.

Change-Id: Ic0d3731fc7248d1eaa80e5ee399753d80e80c979
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
df6523f2703920a1d2a84c45b862b325b8cebf40 21-May-2014 Craig Mautner <cmautner@google.com> Modify task navigation to return to recent tasks.

Tasks launched from the recent task list will now return to the list
when they are finished. Also tasks that are launched from the
notification panel and services will now return to the list,
provided that the launcher is not front and center when they are
launched.

Fixes bug 14464114.

Change-Id: Ic0d3731fc7248d1eaa80e5ee399753d80e80c979
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
21d24a21ea4aaadd78e73de54168e8a8a8973e4d 23-Apr-2014 Craig Mautner <cmautner@google.com> Add code for persisting tasks and activities to disk DO NOT MERGE

Recent tasks that have the persistable flag set are
saved to /data/system/recent_tasks/ on shutdown and in the
background. Their thumbnails are saved to
/data/system/recent_images/.

Change-Id: Ifb820a01c412fe1f8c0f6e41aa655fafd89eaa8d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
deec695253aa5856135be3ffdcd35eaafed9e526 24-May-2014 Craig Mautner <cmautner@google.com> Merge "Add code for persisting tasks and activities to disk"
376543bc5f1f8a4465f6f0f9c9b45f96f37b3d06 22-May-2014 Winson Chung <winsonc@google.com> DO NOT MERGE

Invalidating screenshots when we resume the task that they were taken in. (Bug 13587139)

- Removing multiple calls to get the same thumbnail screenshot
(cherry picked from commit d4ce870e9ad24eff444443bd19ca2061f7c3099d)

Change-Id: Id1feea856a1374173c7f0d329d6f11482794df1a
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
ef73ee1dd98acfc4a19561367cfc3e4d8bbe06ea 23-Apr-2014 Craig Mautner <cmautner@google.com> Add code for persisting tasks and activities to disk

Recent tasks that have the persistable flag set are
saved to /data/system/recent_tasks/ on shutdown and in the
background. Their thumbnails are saved to
/data/system/recent_images/.

Change-Id: Ifb820a01c412fe1f8c0f6e41aa655fafd89eaa8d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6784f1c62379f2226d895cd944d716c17f4cb195 22-May-2014 Winson Chung <winsonc@google.com> Removing unnecessary public values. (Bug 14995844)
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
cc12f28e5dc6bd027971c995c7aab63dadcc0d35 22-May-2014 Winson Chung <winsonc@google.com> Invalidating screenshots when we resume the task that they were taken in. (Bug 13587139)

- Removing multiple calls to get the same thumbnail screenshot
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9aeb60739909aa2b8100c95157835e4e3db28519 19-May-2014 Winson Chung <winsonc@google.com> Merge "Enabling alternate recents on all form factors."
7fd239cf0a1ddc0500b51d97e0e6c3539b42639f 14-May-2014 Craig Mautner <cmautner@google.com> Merge "Pass ActivityOptions back from finishing activity."
fd08622588d5a90c11216894344e58147ff6359a 14-May-2014 Winson Chung <winsonc@google.com> Enabling alternate recents on all form factors.

Change-Id: I9dec6da7646205b72f46cedf604fadfb03cab6d4
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
233ceeebab7efe6ad4783371003c4cf29b896436 10-May-2014 Craig Mautner <cmautner@google.com> Pass ActivityOptions back from finishing activity.

Adding an ActivityOptions parameter to convertToTranslucent provides
a mechanism for delivering these options to the activity that
launched the one that is returning.

Fixes bug 13032208.
Fixes bug 14469460.
Fixes bug 14597427.

Change-Id: I4115dd3c69de9d175f6df0498a6e964fca5eca29
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
5ae2afdc2aeec468436ca126a6da1e8dd90d7aff 13-May-2014 bulic <bulic@google.com> Merge "Prevent home task from being set as ontopofhome"
ccd230712d8ec4c017f8ab9b24ee53b4e5dfc19b 12-May-2014 bulic <bulic@google.com> Prevent home task from being set as ontopofhome

If the front activity of a task that is on top of home finishes, the oldest task in
other stacks will be set as ontopofhome (which in this case meant the
home task was set to ontopofhome). The solution is to ensure we
only set a task to ontopofhome if the finishing activity is in the same
stack.

Change-Id: Idd8f9af4d3d9bd2de3c519d3dcc60f479695ae0c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d9ddf2e9d04f8a53d7445a96aa3e192fa86f08d6 09-May-2014 Craig Mautner <cmautner@google.com> Merge "Introduce persistent forms of Activity lifecycle calls."
a002604af0c9b1204556610537b85685d7055996 23-Apr-2014 Craig Mautner <cmautner@google.com> Introduce persistent forms of Activity lifecycle calls.

When an Activity is created with R.attr.persistable true different
forms of activity lifecycle methods including PersistableBundle will
be used.

Fixes bug 13736007.

Change-Id: I7e92917b300b76964257cfcc26c24e76aa19bd16
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
729cb2391f8eedbab9af1d0ef62febb0b56292cc 06-May-2014 Jose Lima <joselima@google.com> Remove unecessary code from ActivityStack

- Due to a previous CL to allow activities to be visible under
the Home stack, some code un ActivityStack became unecessary.
- This CL removes the uused code and changes the interface of
ensureActivitiesVisibleLocked, since we no longer need to
special case visibility for the Home stack.

Change-Id: I5cffe903bc82041fe79bfc63107df71ddf01232c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
41db4a77fa4659d60ad055ec1819a410ce35bf28 08-May-2014 Craig Mautner <cmautner@google.com> Use new doccentric flags and attributes in Sharing

Put the new doccentric flags and attributes into use. And make their
first application the Share widget. Sharing now creates a new task
which is destroyed once the share action has completed.

Fixes bug 14463859.

Change-Id: I34c4c79775ef44d65e1967be5601997a2d46b210
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
c03c9167c2d9a1e22fb2b176b00a0524177fb037 02-May-2014 Dianne Hackborn <hackbod@google.com> Further work on voice interaction services.

This makes VoiceInteractionSession a more first-class
concept. Now the flow is that a VoiceInteractionService
calls startSession() when it wants to begin a session.
This will result in a new VoiceInteractionSession via the
VoiceInteractionSessionService containing it, and the
session at that point an decide what to do. It can now
show UI, and it is what has access to the startVoiceActivity
API.

Change-Id: Ie2b85b3020ef1206d3f44b335b128d064e8f9935
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
be2ba85c4f84463e6ff1747132f021769811f14b 03-May-2014 Jose Lima <joselima@google.com> Merge "Allow activities to be visible behind the Home Stack"
09233289624a85093b1d99e4a6a149bf09059d8d 30-Apr-2014 Dianne Hackborn <hackbod@google.com> Make GET_TASKS signature|system.

Normal apps can't hold it now. If they try to use
getRecentTasks() or getRunningTasks() without the permission,
they will only see their own tasks and home in the list.

Also took this opportunity to eradicate all of the old pending
thumbnail stuff.

Change-Id: I6dc52a06221c78097162e4a8b482027b798bf3ee
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
7ba7125af1962b322d48ac5a49f698565da2b84c 30-Apr-2014 Jose Lima <joselima@google.com> Allow activities to be visible behind the Home Stack

- Only hide/stop activities behind the Home stack if the Home
stack contains a full-screen/opaque activity.

Change-Id: I69f951b91753f48d0344a9d534569cfb8de1d57f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
648c83b4ee5fe825aa4032e0bb32c1d6269b02ad 29-Apr-2014 Winson Chung <winsonc@google.com> Fixing NPE. (Bug 14385152)

Change-Id: Ie6d1e7c3e5dcf721e945c4933c077fa6abb10067
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
91097de49b0f683b00e26a75dbc0ac6082344137 05-Apr-2014 Dianne Hackborn <hackbod@google.com> Initial implementation of new voice interaction API.

This gives a basic working implementation of a persist
running service that can start a voice interaction when
it wants, with the target activity(s) able to go through
the protocol to interact with it. It may even work when
the screen is off by putting the activity manager in the
correct state to act like the screen is on.

Includes a sample app that is a voice interation service
and also has an activity it can launch.

Now that I have this initial implementation, I think I
want to rework some aspects of the API.

Change-Id: I7646d0af8fb4ac768c63a18fe3de43f8091f60e9
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
67b082e02cbfb7bafe046a619e686e9a5c1abc05 25-Apr-2014 Winson Chung <winsonc@google.com> Merge "Enabling doc centric recents on phones."
f6ead5d62e62ff9a466bd4cbbea77390ce00605b 24-Apr-2014 Craig Mautner <cmautner@google.com> Take screenshots of pausing activity

Previous CL to optimize out excessive screenshots (ag/379669) was too
effective and didn't take screenshots when going into an activity
that had attribute Window_windowNoDisplay. Adding in the test for
ActivityRecord.noDisplay allows screenshots for this situation.

Fixes bug 13410507.

Change-Id: Ieafebf44b7d1a3ba18115e762fba113f8d1c0252
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
6c83b77b87a1f8b247874c9544d4975d13da7d23 22-Apr-2014 Craig Mautner <cmautner@google.com> am 43c6a98f: am 6985badc: Fix black ActivityView

* commit '43c6a98f0ffe079429735a485acaa81841740fac':
Fix black ActivityView
7ad27288f1b66733a4fcb2bdcb17dd5db6c6423d 22-Apr-2014 Craig Mautner <cmautner@google.com> am c00c89b1: am f4c909bc: Fix ActivityView lifecycle

* commit 'c00c89b1add5bcbf6a76287c9a3384877449c746':
Fix ActivityView lifecycle
43c6a98f0ffe079429735a485acaa81841740fac 22-Apr-2014 Craig Mautner <cmautner@google.com> am 6985badc: Fix black ActivityView

* commit '6985badc632f2ff8425aa86423577a96eafc49e9':
Fix black ActivityView
c00c89b1add5bcbf6a76287c9a3384877449c746 22-Apr-2014 Craig Mautner <cmautner@google.com> am f4c909bc: Fix ActivityView lifecycle

* commit 'f4c909bcb87d6f103c9f9e8255fa61bd86f4de67':
Fix ActivityView lifecycle
6985badc632f2ff8425aa86423577a96eafc49e9 22-Apr-2014 Craig Mautner <cmautner@google.com> Fix black ActivityView

Don't add the surface to the VirtualDisplay until the activity
has drawn. That will keep the TextureView from turning black.

Fixes bug 12821632.

Change-Id: Ia06e9f91be3e14ad724f735ae4e201ac798863a2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f4c909bcb87d6f103c9f9e8255fa61bd86f4de67 18-Apr-2014 Craig Mautner <cmautner@google.com> Fix ActivityView lifecycle

Major changes to maintain the VirtualDisplay across repeated
attach/detach cycles of an ActivityView. This keeps the activities
and VirtualDisplays in the ActivityView from getting into bad states.

Fixes bug 14107002.

Change-Id: Idc2aaf85ac496eab0eeb436736cb10a2020040e8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f9f2314aa444e32b93caecd06cb4f10a71a2df39 21-Apr-2014 Winson Chung <winsonc@google.com> Enabling doc centric recents on phones.

Change-Id: If853cdcbf3fc75001060e522bce2e0d49d2ddea3
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
934ef05799532b75d349338c4300671cec1ab162 16-Apr-2014 Craig Mautner <cmautner@google.com> am 4b81e89d: am 2fd3cb95: Merge "Fix ActivityContainer callback parcelling." into klp-modular-dev

* commit '4b81e89d9b7a2cf3ed5aacd9c647aed47f4c4675':
Fix ActivityContainer callback parcelling.
4b81e89d9b7a2cf3ed5aacd9c647aed47f4c4675 16-Apr-2014 Craig Mautner <cmautner@google.com> am 2fd3cb95: Merge "Fix ActivityContainer callback parcelling." into klp-modular-dev

* commit '2fd3cb9544df1e09caa725a8d542cf2fe1df0c75':
Fix ActivityContainer callback parcelling.
e3a00d745fad479f560e96cec23e957f37d1c043 16-Apr-2014 Craig Mautner <cmautner@google.com> Fix ActivityContainer callback parcelling.

The Binder interface for passing a callback was not implemented
properly. Also the callback for ActivityContainer now has a new
API.

Change-Id: I6b719be0cb57542f022a3cc14e8f4efde60b1a50
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
f4824a06884e096beef921646cba4be29d7f36fc 02-Apr-2014 Kenny Guy <kennyguy@google.com> Fix issue with not allowing activities for current user.

Change-Id: Ic2e30c3f4990a03aac9801ee9bf5f270a5e90ef8
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
2a764949c943681a4d25a17a0b203a0127a4a486 02-Apr-2014 Kenny Guy <kennyguy@google.com> Rename related users to profiles.

Rename the related user concept as profiles.
When returning profiles of a user include the
user as a profile of itself.

Change-Id: Id5d4f29017b7ca6844632ce643f10331ad733e1d
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
71888f54cb256f0d5527e2dd66f95e83992d795f 29-Mar-2014 Craig Mautner <cmautner@google.com> am 1872ce3e: am 155e3133: am d511bc17: Merge "[ActivityManager] Fix a bug: unable to start activity after starting activities during screen off."

* commit '1872ce3e7af0e2130a9e8f9f52983cd234f6ead0':
[ActivityManager] Fix a bug: unable to start activity after starting activities during screen off.
1872ce3e7af0e2130a9e8f9f52983cd234f6ead0 29-Mar-2014 Craig Mautner <cmautner@google.com> am 155e3133: am d511bc17: Merge "[ActivityManager] Fix a bug: unable to start activity after starting activities during screen off."

* commit '155e3133407e590f18e7e16eddc6fc743f35b0fd':
[ActivityManager] Fix a bug: unable to start activity after starting activities during screen off.
9410f5983b2fab4bac220dab0fab7cde10e6d34a 27-Mar-2014 Craig Mautner <cmautner@google.com> am 723f7bbc: am 7f7ce0f7: am a2824410: Merge "Do not show Home behind full screen activity"

* commit '723f7bbcf34168b216421eee4b7d86199f90de1f':
Do not show Home behind full screen activity
723f7bbcf34168b216421eee4b7d86199f90de1f 27-Mar-2014 Craig Mautner <cmautner@google.com> am 7f7ce0f7: am a2824410: Merge "Do not show Home behind full screen activity"

* commit '7f7ce0f71b5f1b5274b0cda190401823508cda1f':
Do not show Home behind full screen activity
2c92c9700c7b06f3c7dd5ab15d8343dfce68c833 20-Mar-2014 George Mount <mount@google.com> Fix null ActivityOptions when starting an Activity in a new Process.

Bug 13563265

Change-Id: Ie56cd6d55f13dbf68bafb82ab4bd6b27fde60df6
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
d00f47402cb886a43a3448128bdcd9dd2f348a2a 12-Mar-2014 Craig Mautner <cmautner@google.com> Launch new tasks with Doc Centric flag.

Introduction of new Intent flag FLAG_ACTIVITY_NEW_DOCUMENT. When
this flag is set the target activity will be launched in its own
task. This is the start of the new Doc Centric mode of working.

Change-Id: I719168532134ab2c5ea3300df676c2b2a0e81795
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
aea74a5977ca9f1054926eb24f247562c3a4a6ba 08-Mar-2014 Craig Mautner <cmautner@google.com> Add Lock Task Mode.

When in lock task mode only the specified task may run. All
attempts to switch to another task are ignored until the task
finishes or a call to stopLockTaskMode() is made.

Change-Id: I6cfe92fe1bcf22cd47b5398c08e23c52a4092dda
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
303e1ff1fec8b240b587bb18b981247a99833aa8 08-Mar-2014 Winson Chung <winsonc@google.com> Initial changes for recents.

Change-Id: Ide2c202b4a5b25410f0f32bd0a81ccf817ede38f
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
734983fff35d9ed2b7a9848bdfbca401887d0dd8 05-Mar-2014 Amith Yamasani <yamasani@google.com> Allow related users to show activities on primary user

Make ActivityManager and WindowManager understand related users.

Task stack will now contain interleaved tasks for related users,
but still group regular users separately from groups of related users.

InputMethodManagerService permits related users to invoke IME and receive
key events.

Change-Id: I3bd87b32aec69c3f8d470c8b29b144f4e849c808
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e1abfdf711ce9ff3b15ff1b4d86531f5a8dd3dec 21-Feb-2014 Craig Mautner <cmautner@google.com> am 6222a8ef: am 1648f042: am fd8a8ccb: Merge "Set the new SurfaceControl opaque flag." into klp-modular-dev

* commit '6222a8ef853609ea9c0f725c2412a2d25968d9da':
Set the new SurfaceControl opaque flag.
71dd1b63436e9cdd5cbd2d42cd5841d497da8238 19-Feb-2014 Craig Mautner <cmautner@google.com> Set the new SurfaceControl opaque flag.

Converts surfaces from transparent to opaque and opaque to transparent
without creating a new surface. Uses the new SurfaceControl.setOpaque
method.

Fixes bug 12387406.

Change-Id: I669c064e622e211b00b1585183a488d5b3f4b778
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
33fa09b1ffe8d14d146de4b2632103d831ff8988 11-Feb-2014 Craig Mautner <cmautner@google.com> am 2d6b55aa: am 312ba86b: Change task removal sequence

* commit '2d6b55aaa9dd03f7d934f7a192989513b1087357':
Change task removal sequence
312ba86b476fa1d83864a7d465135cc9a4e94ad8 11-Feb-2014 Craig Mautner <cmautner@google.com> Change task removal sequence

- Remove task after removing activity. Removing the task before
removing the activity led to problems when the task was still needed.

- In WindowManager wait for activity manager to remove the task.
Previously was automatically removing the task when the last activity
was removed.

Fixes bug 12957434.

Change-Id: I7f6b1f09a2e2a845f177f337769075c9376f8bdb
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
9e4adfb358ca3680288c07201efc8811472a579d 05-Feb-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 32360147 to master

Change-Id: I97cc95f66df50006469f8debd286966cc21edb60
df88d73092c62a1a3cd2b2056ca63ae2e70cc238 27-Jan-2014 Craig Mautner <cmautner@google.com> Add IIntentSender to ActivityContainer.startActivity

PendingIntents and IntentSenders can now be launched. Still does not
work once the host activity has been paused and resumed.

Window manager TaskStacks now exist independently of Displays and app
windows persist after Displays are removed below them. Attaching the
stack to a new Display does not yet restore the windows to it.

Fixes bug 12747909.

Change-Id: I509007ee23fda400b353f483cf6ecce08177763b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
e0d1e295f15a5c70ca030732fd9309f0dc50b2cc 28-Jan-2014 Craig Mautner <cmautner@google.com> am af17925f: am 45b68ac3: am 09325627: am 245b58d6: am baf2c7a4: Merge "[ActivityManager]: Fix the activity visibility state not sync between ActivityManager and WindowManager"

* commit 'af17925f94c3a293022a4c41fc284a0a9312dcb6':
[ActivityManager]: Fix the activity visibility state not sync between ActivityManager and WindowManager
af17925f94c3a293022a4c41fc284a0a9312dcb6 28-Jan-2014 Craig Mautner <cmautner@google.com> am 45b68ac3: am 09325627: am 245b58d6: am baf2c7a4: Merge "[ActivityManager]: Fix the activity visibility state not sync between ActivityManager and WindowManager"

* commit '45b68ac3a7acb7af95fdfc5c0e31560b3c28c9f8':
[ActivityManager]: Fix the activity visibility state not sync between ActivityManager and WindowManager
441b57bce9dcd507a3e36b911b5adeacb066c9be 16-Jan-2014 Craig Mautner <cmautner@google.com> am 593a4e6f: Fix NPE when destroyActivity occurs after detach.

* commit '593a4e6f982cecddc3f2f6107044b5e12fab3e20':
Fix NPE when destroyActivity occurs after detach.
fc8fa54f80b419966b3893a0992354a17c270333 16-Jan-2014 Craig Mautner <cmautner@google.com> am e9ddaa0b: Merge "Cleanup after ActivityView" into klp-modular-dev

* commit 'e9ddaa0b183d979be782a63970929cebd861b7c9':
Cleanup after ActivityView
593a4e6f982cecddc3f2f6107044b5e12fab3e20 16-Jan-2014 Craig Mautner <cmautner@google.com> Fix NPE when destroyActivity occurs after detach.

*** FATAL EXCEPTION IN SYSTEM PROCESS: ActivityManager
java.lang.NullPointerException
at com.android.server.am.ActivityStack.removeTask(ActivityStack.java:3627)
at com.android.server.am.ActivityStack.removeActivityFromHistoryLocked(ActivityStack.java:2693)
at com.android.server.am.ActivityStack.activityDestroyedLocked(ActivityStack.java:2878)
at com.android.server.am.ActivityStack$ActivityStackHandler.handleMessage(ActivityStack.java:296)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at com.android.server.am.ActivityManagerService$AThread.run(ActivityManagerService.java:1868)

Change-Id: Ifaf0fe6c62d1f63897d57dc96b4d86d8111b45db
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
34b73dfaa3a92e5a85abf62317183fb114f2ffff 13-Jan-2014 Craig Mautner <cmautner@google.com> Cleanup after ActivityView

- Release Surface and VirtualDisplay when shutting down ActivityView.
- Shut down child stacks when relaunching parent activity.

Change-Id: I60314b2b43bd2da5406cf6ec871293b5baca157c
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
3a43aa9cef79324dd149a47c5a73ce1fa8ed95b3 15-Jan-2014 Craig Mautner <cmautner@google.com> am 9cfb2e5f: Merge "Retain stacks even if they are empty." into klp-modular-dev

* commit '9cfb2e5f4c95c16d8ca531808f60486f214f9039':
Retain stacks even if they are empty.
9cfb2e5f4c95c16d8ca531808f60486f214f9039 15-Jan-2014 Craig Mautner <cmautner@google.com> Merge "Retain stacks even if they are empty." into klp-modular-dev
04a0ea60ac7e20369e63edc4f3f8cedf8425a439 13-Jan-2014 Craig Mautner <cmautner@google.com> Retain stacks even if they are empty.

Previously stacks would be removed when the last ActivityRecord was
removed. This causes problems for ActivityContainers which persist and
permit activities to be launched into an empty stack.

Change-Id: Ia79ac65d17c42eff3a7b1321980c21b29996001b
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
663fb7a09e48c77a7fff4f7a8488b08175170d6f 11-Jan-2014 Craig Mautner <cmautner@google.com> am da9b87a7: am 5d8936b4: am 27581792: am 54f99137: am 3747768b: Merge "Fix visibility of multiple non-fullscreen activities."

* commit 'da9b87a70994ed00868dd4405243932fe7e267f2':
Fix visibility of multiple non-fullscreen activities.
da9b87a70994ed00868dd4405243932fe7e267f2 11-Jan-2014 Craig Mautner <cmautner@google.com> am 5d8936b4: am 27581792: am 54f99137: am 3747768b: Merge "Fix visibility of multiple non-fullscreen activities."

* commit '5d8936b4cfdb14941536e533c2cc376e99b9f7d5':
Fix visibility of multiple non-fullscreen activities.
88a00abe0803327bb55171082e18fe2901c35d49 10-Jan-2014 Craig Mautner <cmautner@google.com> am 0bb2a4de: Merge "Call moveHomeStack before moving any stack." into klp-modular-dev

* commit '0bb2a4deee6451a2f3075254761e9bfb38429fa4':
Call moveHomeStack before moving any stack.
fefeef8249e898d2d450da21d0edda49b88be7ce 10-Jan-2014 Craig Mautner <cmautner@google.com> Call moveHomeStack before moving any stack.

Order matters, otherwise mFocusedStack and mLastStack aren't updated
correctly.

Fixes bug 12478856.

Change-Id: I12e4334678bb3af49d1ff26c4003def3e8d987c2
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
b859449b717b24ac6e678c303d7706d55fd184f7 08-Jan-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 88bfc6dd to master

Change-Id: Ib656ac0591b21ad14f2df51021729552e9373515
e0a3884cb627efc650e19fbe76b1b3343468cf57 17-Dec-2013 Craig Mautner <cmautner@google.com> Extend stack management to other displays.

- Abandon ActivityContainer.startActivity() in favor of
IActivityManager.startActivityAsUserInContainer().
- Modify Am to test starting an activity on a container.
- Create a DisplayContext as the base context if the activity token
is on a different display.
- Test for home display in more cases when manipulating home stack.
- Rename mDisplayInfos => mActivityDisplays.
- Create new method for moving task to front of stack regardless of
which display it is on.

Change-Id: I4fcb83ae844c5839ee3e2722229623d1a80ed921
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java
49782e46c0eb85a25ae2abcf80880c48dbab5aea 20-Dec-2013 Amith Yamasani <yamasani@google.com> am 9158825f: Move some system services to separate directories

* commit '9158825f9c41869689d6b1786d7c7aa8bdd524ce':
Move some system services to separate directories
9158825f9c41869689d6b1786d7c7aa8bdd524ce 22-Nov-2013 Amith Yamasani <yamasani@google.com> Move some system services to separate directories

Refactored the directory structure so that services can be optionally
excluded. This is step 1. Will be followed by another change that makes
it possible to remove services from the build.

Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
/frameworks/base/services/core/java/com/android/server/am/ActivityStack.java