History log of /frameworks/base/services/java/com/android/server/am/ActivityStack.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
477897ad7b0725fa68d32a94bf8c24264068fd5c 14-Mar-2014 Craig Mautner <cmautner@google.com> Merge "Fix incorrect setting of TaskRecord.frontOfTask. DO NOT MERGE." into klp-dev
fdf28cc4be5acab6e4a050b27742435dfe7ae0de 17-Dec-2013 Craig Mautner <cmautner@google.com> Fix incorrect setting of TaskRecord.frontOfTask. DO NOT MERGE.

When Intent.FLAG_ACTIVITY_REORDER_TO_FRONT was set the TaskRecord
member frontOfTask was being set true incorrectly for the top
activity. It should only be true for the bottom activity. This fix
ensures that frontOfTask is always set correctly for all activities by
consoldating it into one method.

Fixes bug 12171535.

Change-Id: If982dad3c81b2b816adc5d89e7e0496923098a70
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
e0663591a563483d06de14ead3eebfe194fb2d10 14-Mar-2014 Craig Mautner <cmautner@google.com> Fix activities appearing behind launcher icons

cherry picked from d5c91ece7bfea74ee7ab2bc86f3cb3f5c531f866

Change-Id: I76d20398e71c1be4accfaed6b0791674197b4fb0
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
1f0f9fa94913198cd79b8d350cf9e8df8001daeb 14-Nov-2013 Craig Mautner <cmautner@google.com> Merge "Add null pointer check." into klp-dev
ada62fca51d314cefe2c5da4e007df5b9abf320d 14-Nov-2013 Craig Mautner <cmautner@google.com> Add null pointer check.

Fixes bug 11673948.

Change-Id: I60b590b9793ae1b8d5c3d343f4bb6cb40ba4a092
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
5d9f547720e07a2715d34320a9e11004654cede6 12-Nov-2013 Craig Mautner <cmautner@google.com> Relayout windows that handle their own config change.

If a window claims to handle its own configuration change then we
won't destroy and recreate its window on a configuration change.
Normally that recreation triggers the first layout following
orientation change because mHaveFrame is false. Windows that handle
their own configuration changes never got a relayout pass following a
change in orientation.

This change passes the configuration changes that an application
handles into the AppWindowToken. If the app says it handles
orientation or screen size changes then a relayout will occur when the
configuration has changed.

Fixes bug 11647107.

Change-Id: Ie8d49fd050442ebbdcf0b805087894e3a2fc4be9
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
c9ffd74659fac6f30f3f4653586af2069b903899 07-Nov-2013 Craig Mautner <cmautner@google.com> Merge "Don't call setTask twice." into klp-dev
2040967478790f67e286b203d5397159ac34006e 07-Nov-2013 Craig Mautner <cmautner@google.com> Merge "If home activity is not fullscreen keep drilling." into klp-dev
f41bcd47eac4c40fd51fac43c66fb2b5f754a9da 07-Nov-2013 Craig Mautner <cmautner@google.com> If home activity is not fullscreen keep drilling.

When the home activity launches a non-fullscreen activity as part of
its own task then ensureActivitiesVisibleLocked() must continue past
the launched activity when determining activities to show and hide.
Stopping at the non-fullscreen activity leaves the fullscreen home
activity hidden.

Fixes bug 11555762.

Change-Id: I9058d8cde3a41cb7f9b1f97e5c0cb32e9b0f5af7
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
329f4129a5114af353477b999453ffdcedcbbc25 07-Nov-2013 Craig Mautner <cmautner@google.com> Don't call setTask twice.

The method ActivityRecord.setTask() removes the ActivityRecord from
its old task's mActivities ArrayList. In jb-mr2 it did not have this
side effect (there was no mActivities) so calling it twice was not a
problem. This fix causes setTask to only be called once for the target
activity.

Fixes bug 11557835.

Change-Id: If2b6d4b297e86130009713efe6891a24fad3dd15
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
db5c4fb8641061735b6b2971e74362761aeca970 06-Nov-2013 Craig Mautner <cmautner@google.com> Fix incorrect looping limits.

One cannot iterate across an entire list if one both removes an entry
and increments the index into the list. Do one or the other or you
will end up with bugs like 11556768 which is now fixed.

Change-Id: I57f1ad13075a005cae3c1cbfae10e230d9af143a
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
76be9d2595d651cdeacdbce557f6e8d927138e6a 05-Nov-2013 Craig Mautner <cmautner@google.com> Remove harmful visibility test.

Previously inserted requirment that an activity be visible in order to
block visibility of the home screen is removed.

Fixes bug 11515761.

Change-Id: Ia47cfb4a0b6d90bbbca2b42e12a6048b1644d7cb
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
fbefe9bf741250f0ec2a538dbd11ab9f38a2c8f8 01-Nov-2013 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #11168649: LRU logic for Chrome renderers seems..." into klp-dev
db92608de9b4acccee1e3232264c9830ad300c4f 01-Nov-2013 Dianne Hackborn <hackbod@google.com> Fix issue #11168649: LRU logic for Chrome renderers seems...

...not to work on KitKat (was: Janky exit animation)

Reworking the LRU list (splitting it into an activity vs. empty
section) accidentally broken the old behavior of "client activity"
processes being prioritized with activity processes. In fact, we
were no longer marking "client activity" processes at all.

In this change, we rework how we manage "client activity" processes
by putting them on the main activity LRU section. This is generally
simple -- ActiveServices now keeps track of whether a process is
a "client activity" process based on its bindings, and updateLruProcess
treats these as regular activity processes. However, we don't want
to allow processes doing this to spam our LRU list so that we lose
everything else, so there is some additional complexity in managing
that list where we spread client activity processes across is so
that the intermingle with other activity processes.

The rest of the change is fairly simple -- the old client activity
process management is gone, but that doesn't matter because it wasn't
actually running any more. There is a new argument to updateLruProcess
to indicate a client process it comes from (since we now need to update
this based on bindings) which is just used to limit how high in the
LRU list we can move things. The ProcessRecord.hasActivities field is
simply removied, because ProcessRecord.activities.size() > 0 means the
same thing, and that is actually what all of the key mechanisms are using
at this point.

Finally, note there is some commented out code of a new way to manage
the LRU movement. This isn't in use, but something I would like to
move to in the next release so it is staying there for now for further
development.

Change-Id: Id8a21b4e32bb5aa9c8e7d443de4b658487cfbe18
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
5cbaaa3cb51ca807e9f0d19442bf830f5d3508de 29-Oct-2013 Craig Mautner <cmautner@google.com> Do not fetch tasks that don't have activities.

Fixes NullPointerException bug 11432611.

Change-Id: I62e765750e2613ecfb79e13021631ed2cd4e79f3
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
6f6d56fd4d626b38fd10d6ed69e308f07531ba14 25-Oct-2013 Craig Mautner <cmautner@google.com> Do not take screenshots when launching activities...

Unless they are in another task.

Fixes bug 11374158.

Change-Id: I961d4ce9520bc84a182806db2ccb072501c8357a
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
39e1c5a75ed850a78f3848628bcc336dd5776c4e 24-Oct-2013 Craig Mautner <cmautner@google.com> Search further than one task for fullscreen.

When a non-fullscreen task over home launches another non-fullscreen
task then the home task might not be displayed. Looking all the way
down the task stacks until reaching a visible, fullscreen activity or
home provides the right information.

Fixes bug 11273803.

Change-Id: I8dab0956c1cda06ddb7850ea3ffac7f6a223c6ad
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
04f0b70c13c0b89b11493ff3f26ab2d0d961bd3a 22-Oct-2013 Craig Mautner <cmautner@google.com> Check for home activity when switching focus.

When finishing or stopping an activity the code was automatically
refocusing to the next activity on the same stack independent of the
task's onTopOfHome flag. When the activity eventually finished or
stopped it would then honor the onTopOfHome flag.

This fix examines the onTopOfHome flag and arranges the focus
correctly if home is the next activity to run.

Fixes bug 11318263.

Change-Id: I73a8f5e82de04b01acaffe366b085f9e475e1451
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
2a272d42a38035e60a8fd53d74c1c56a363b635e 16-Oct-2013 Dianne Hackborn <hackbod@google.com> Fix issue #11217255: Setup Wizard ANR when adding new user profile from settings.

Two problems addressed here:

- If a call to startActivity() comes in on an activity that is finishing, we can
end up putting the new activity in a stack that isn't actually in use any more
(if the finishing activity is the last one on that stack). This is a bad case,
anyway, so if this happen the treat it as not being called on an existing
activity and switch to NEW_TASK to find a task for it.

- There was a bug in handling PACKAGE_CHANGE broadcasts that would result in the
app's processes being killed, even though the cleanup through the activities
was done. This could leave the activity stack in a bad state. Fix this to
correctly provide an app id for the changing package so that its processes are
killed.

Change-Id: Iece04e0cf95025c3d30353d68bf3d14fd39d44c3
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
4270ebc7db8fcc42b64286c38ad84189e6a5b9e4 16-Oct-2013 Craig Mautner <cmautner@google.com> Merge "Remove debug logging." into klp-dev
a7f2bd4da736b48a2f23335d90475db4fee4ffbb 16-Oct-2013 Craig Mautner <cmautner@google.com> Remove debug logging.

Change-Id: I5d7c11e8b8525bfc8eb87bb0fff4f71337b4a39d
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
4f1df4faed1300699bdda4ac9435532c0743ecf8 16-Oct-2013 Craig Mautner <cmautner@google.com> Restore window manager stack order on user switch.

Only the activity stacks were being restored. Also add needed debug
logs.

Fixes bug 11223831.

Change-Id: Ief42688721c49e8cea14277619c797bf7c25b859
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
cf8a6ca9aa31b4e8930b0f6e6cbc3108fda4a9bf 15-Oct-2013 Craig Mautner <cmautner@google.com> Merge "Clear displayStartTime whenever starting activity." into klp-dev
1e8b872edcc0e5c09daffef7ecfe2859ce0f41cb 15-Oct-2013 Craig Mautner <cmautner@google.com> Clear displayStartTime whenever starting activity.

setLaunchTime() was only being called from resumeTopActivityLaunched()
but also needed to be called from minimalResumeActivityLocked().

Fixes bug 11104901.

Change-Id: I35c994562dffaf75de014021c775e398224eb3a3
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
ea7c1e24a213863cd204f4ff097bf622144e417c 14-Oct-2013 Craig Mautner <cmautner@google.com> Merge "Add null check when determining mOnTopOfHome" into klp-dev
d99384d06739b7894ccac5ca4ad49648b93927dc 14-Oct-2013 Craig Mautner <cmautner@google.com> Add null check when determining mOnTopOfHome

Fixes bug 11198896.

Change-Id: I7b35c8a7156f03f8dab0598b55ef327e593f6427
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
e1db0dd089456d80a2872fe1a12a179f39240aec 14-Oct-2013 Craig Mautner <cmautner@google.com> Test for task in front must include stack in front.

The CL that ensured that a dying task must be in front of the user
(ag/374996) only checked that the task was at the top of /a/ stack,
not on top of the frontmost stack. This checks the stack for being
frontmost before switching to home.

Fixes bug 11208762.

Change-Id: I43f6d380e7a880ec19db03711ada6c7437e15f73
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
2219b751b6d1976ee9c8fa9a662b7eaaf9dd654c 12-Oct-2013 Craig Mautner <cmautner@google.com> Only return to home if the foreground task is removed.

The previous fix that returned to home when a task on top of home was
removed was too broad. If that task was not the foreground task it was
not a good idea to bring the home screen to the front.

Fixes bug 11198552.

Change-Id: I14e5fdc167011f25e0e8490c3e52c5c1dcbffbff
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
8e5695778f736e5fd8a82d7485967f3f21a94ccc 12-Oct-2013 Craig Mautner <cmautner@google.com> When removing a task that was on home, put home on top.

Killing an app that was launched from home was not relaunching home.
Previous situations relaunched the next app (i.e. home) based on the
task flag. However, when an app dies the relaunch is deferred until
the TaskRecord has long been forgotten. This fix rearranges the stacks
immediately upon the TaskRecord being removed from the stack. Then the
next resumeTopActivities() call will start the home task.

Fixes bug 11189555.

Change-Id: I0e09350a7db55ea8b38cce7bf4b69923a6b99494
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
3474040486ac6c2c351ea7dc7d34a5ce7f2c9c04 11-Oct-2013 Craig Mautner <cmautner@google.com> Make an exception for screenshot optimization.

Screenshots were not being made for tasks with the flag
FLAG_EXCLUDE_FROM_RECENTS set. But if the task is in the foreground
the shot should be taken even with the flag set. This fix adds a test
for tasks being in the foreground.

Fixes bug 11170567.

Change-Id: If42db7f43ed1dd8d2b16b68824adc813b31c94f0
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
e7dd3469ffe9f0e631c41fd8fa22fe0270d44523 06-Oct-2013 Craig Mautner <cmautner@google.com> Merge "Relax conditions for including windows behind dialogs" into klp-dev
ade5f387fa3e1c7d0de16a3d80fb8e3d5105a39b 06-Oct-2013 Craig Mautner <cmautner@google.com> Merge "Revert to jb-mr2 handling of app died." into klp-dev
f46bb1d99bc168f1812fdd5aca4282eb37984016 06-Oct-2013 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #11086275: Thumbnail only created once for top activity" into klp-dev
ff174d52bdac8893893f64c772e570842214f663 06-Oct-2013 Craig Mautner <cmautner@google.com> Relax conditions for including windows behind dialogs

When a dialog has been minimized to recents the windows behind it
won't be visible. Yet we were requiring them to be visible in order to
be included in the ones being restored. This left the background
windows invisible on resume and showed home behind floating dialogs
instead of the activity that launched the dialogs.

Fixes bug 11067724.

Change-Id: Icadd7ec8fe7c73b52982b6ff5b5d98b8fb8476b0
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
dd88879ce19332a5905699bc008504fd43d983d7 06-Oct-2013 Craig Mautner <cmautner@google.com> Merge "Evaluate task on top of home when task is brought to front." into klp-dev
1909125ebab026fff1836a93b9b14ea62f404d22 05-Oct-2013 Craig Mautner <cmautner@google.com> Revert to jb-mr2 handling of app died.

Trying to span all potential stacks looking for apps was too complex
and error-prone. Extending the jb-mr2 method across multiple stacks.

Fixes bug 11080696.

Change-Id: I6391ceae4ad6a0955a409c3fb27472219fd5bf6b
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
4d03fe64205e4c2a3d6101b4818ded5b8fa56a0e 05-Oct-2013 Dianne Hackborn <hackbod@google.com> Fix issue #11086275: Thumbnail only created once for top activity

If the last screenshot activity is resumed, we need to always capture
a new screenshot, because it can change at any time.

On the other hand, never create a thumbnail for tasks that have set
themselves to not show on the recent tasks lists, since we have no
use for them.

Change-Id: I38523afc966c125da93339e0100da950119cdf99
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
93529a475e4935aa78599556a5c1a18d9425d8c2 05-Oct-2013 Craig Mautner <cmautner@google.com> Resume user where they left off.

Remember which stack was in front when the user changes. Restore that
stack when the user changes back. Remove user state when user is
deleted.

Fixes bug 11068986.

Change-Id: I18dfbc35a0c2e21e7a4024227cbfc5ba1208b3a3
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
9c85c201a2a2d9743f50ca70c5f55a8471616d3f 05-Oct-2013 Craig Mautner <cmautner@google.com> Evaluate task on top of home when task is brought to front.

Localize the point where it is determined whether a task should sit on
top of home or return to the task below it.

Fixes bug 11080913.

Change-Id: I79d1ea9722c867d6b550ddfcd1db35517a79cd90
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
172e87ce5113d75afbf894aef83bd30b43c98f5e 03-Oct-2013 John Reck <jreck@google.com> Reduce max recents on lowram

Bug: 10918599
Reduce the number of recent tasks to 10 on lowram devices
Use RGB_565 on low ram devices for thumbnails instead of ARGB_8888
Combined this saves ~9MB across system_process and systemui

Change-Id: Ieddcb512c7341a90097bc7cbc72d7355a775b416
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
323f78001d86e626fe2a62e404f893b6cd847b1f 02-Oct-2013 Craig Mautner <cmautner@google.com> Add debuggging for 10858941.

Change-Id: I0517ccd9a83ef19a9002d61dbebf36d0120e1f63
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
51277a85216b2ebbd2df858b1ba190976a4b917b 01-Oct-2013 Craig Mautner <cmautner@google.com> Fixes to handleAppDiedLocked.

- Call in all circumstances but only set launchHomeTaskNext for
focused stack. Previous version didn't call handleAppDiedLocked for
non-focused stack.

- Rearrange logic to run down the top task and make sure that all
remaining activities belong to the dying app. Previous version just
looked at the top non-finishing activity and based its behavior on
that.

Fixes bug 11029560.

Change-Id: Ic3a7c873c4c975577d6b390a8955ff41729bdfde
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
19d112d83643c6595d435d41df6b7ff63ded590f 30-Sep-2013 Craig Mautner <cmautner@google.com> Don't display hidden activities over home screen.

Fixes jank exposed in 10881705. Specifically background activity
animating up along with translucent activity. Repro steps on manta:

1. From home start Settings.
2. Press home.
3. From home start Downloads (translucent activity that takes 85% of
screen).
4. Observe that as Downloads zooms up the 15% boundary that should be
dimly transparent are showing Settings.

The cause was that there is a finishing activity in the Downloads task
that was used to launch the DownloadsActivity. The existence of that
activity kept the logic from recognizing that the home activity was
behind the DownloadsActivity, not the Settings activity.

This fix descends through all of the activities in a task sitting on
home and makes sure that they only keep home from showing if such
activities are not finishing and visible.

Change-Id: I607afce6b0000b4db634f2ce40a6c37fcee369d7
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
16e6e203c0c86a1cbc1a7c1cf20cb5447f705a32 28-Sep-2013 Craig Mautner <cmautner@google.com> Merge "Centralize handleAppDied and fix return to home." into klp-dev
6b74cb5df5810b670155611cfad88ed3e3fac820 28-Sep-2013 Craig Mautner <cmautner@google.com> Centralize handleAppDied and fix return to home.

The home activity was being returned to when any activity in a task
that was launched from home crashed. If there were still activities
left in the task then the crash should have brought up those
activities next, not home.

This may be a partial fix for crashes where the back stack was showing
up under launcher icons. Bug 10858941.

Change-Id: I840a25bd8395bfce46f4e21b112d78b12884706d
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
0756632aa056cc873943f7f19c7501ce79608394 27-Sep-2013 Craig Mautner <cmautner@google.com> Dismiss keyguard when resuming visible activities

If an activity is visible behind the keyguard when it is launched
by another activity then there would be no call to dismissKeyguard.
Because the other activity is pausing the call to dismissKeyguard
is skipped in startActivityLocked(). And because it is already
visible the call to ActivityRecord.windowsVisible() is never made and
the call to reportActivityVisibleLocked() which calls
dismissKeyguard() is also never made.

This change recognizes when an activity is resumed and visible and
calls dismissKeyguard() in that case.

Fixes bug 10732489.

Change-Id: I3de1350a55231aaa14dadc8709fd0fcf4960742c
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
5314a40b96c7c3ecc0dafeda387efe49a5c434e4 26-Sep-2013 Craig Mautner <cmautner@google.com> Revert behavior to perform onResume.

Back out changes from CLs ag/363992 and ag/363859. These introduced
the bugs found in bug 10917435 which is now fixed. Note that backing
out these changes reintroduces bug 10732489.

Change-Id: Ic5105dd4cfc8bf79c6f06188283d1ee3680c370c
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
6ff6d010d117c623d5c2558602dc9dc7493a8ebf 25-Sep-2013 Craig Mautner <cmautner@google.com> Be less aggressive when not resuming top activity

The previous fix for keeping activities from running on startup,
ag/363992, was keeping the home task from launching when the
keyguard should have allowed it.

This fix permits the home activity to launch in such situations.

Fixes bug 10916877.

Change-Id: I429f0d5a13e06a247b9b6b7241f9a3514044c371
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
2acc389d6197f8b099e7d72ea944ccbf14065761 23-Sep-2013 Craig Mautner <cmautner@google.com> Pause activities behind keyguard after boot.

Following boot the initial activity was automatically resumed even if
a lockscreen is obscuring it. Refer to CL 363859 for why this breaks
things.

This fix pauses all activities the first time a lockscreen appears.

Completes the fix for bug 10732489.

Change-Id: I6fcac14b574c495aa0e16d798cddc1263c6b4c25
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
12946530cfba2024fa45c06b0060fe5c91252aab 20-Sep-2013 Craig Mautner <cmautner@google.com> Merge "Only show launcher for the bottom activity in a task" into klp-dev
f51b5588d795ae6add9f625482d7d3f3ab34fb94 20-Sep-2013 Craig Mautner <cmautner@google.com> Only show launcher for the bottom activity in a task

When transitioning from activity-over-launcher to task-over-launcher
ensureActivitiesVisibleLocked() was too aggressive in showing the
launcher. If there were any non-fullscreen activities in a task that
sits over the launcher then the launcher would be shown.

This fix adds a test to make sure the launcher will only be shown if
the bottommost activity in such a task is non-fullscreen.

Fixes bug 10840919.

Change-Id: I5dcd63be3fa2865ae38cbb921332937dfa4b5d47
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
3bc8f78d7a3d23a67c06221cc41292d04a2fd439 19-Sep-2013 Dianne Hackborn <hackbod@google.com> Implement issue #10691475: Kill cached processes if about to...

...be uncached and too large

When the device is in a low RAM state, when we go to pull a cached
process out to use for some background operation, we can now kill
the current process if we consider its size to be too large.

Note that the current implementation for killing processes is to
just use the same killUnneededProcessLocked() method that we already
have for other things like too many cached processes. This is a
little wrong here, though, because in this case we are at the
point where the caller is actually looking for a process to use.
This current code is not actually removing or cleaning up the
process, so we still need to return the now killed ProcessRecord
and let things fall out from there, which typically means the caller
trying to make an IPC on it and failing and falling into its "oh
no the process died unexpectedly" path. All code using this
*should* be able to handle this correctly, anyway, since processes
really can be killed at any time.

At some point we may to make this implementation cleaner, where it
actually tears down the process right in the call and returns a
null ProcessRecord. That is very dangerous however (we'd need to
go through all paths into this to make sure they are going to be
okay with process state changing on them like that), and I'm not
sure it is really worthwhile. This intention is that killing
processes like this is unusual, due to processes being too large,
and anyway as I wrote all of our incoming code paths must already
be able to handle the process being killed at this point and one
could argue this is just another way to excercise those code paths.
Really, the main negative to this is that we will often have spam
in the log with exceptions about processes dying unexpectedly.
If that is the only issue, we could just add some conditions to
quiet that up at in this case.

We don't want to compute the size of the process each time we try
to evaluate it here (it takes 10s or ms to do so), so there is now
a new field associated with the process to give us the last pss
size we computed for it while it was in the cached state.

To be able to have better cached pss data when we now need it, the
timing for computing process pss has been tuned to use a much
shorter delay for the situations when the process has first switch
into a new state. This may result in us having a fair amount more
pss data overall, which is good, as long as it doesn't cause us to
be computing pss excessively and burning cpu.

Procstats now also has new state to keep track of the number of
times each process has been killed by this new system, along with
the min, avg, max pss of all the times it has happened. This has
slightly changed the checkin format to include this additional data
at the end of pkgkills/prockills lines.

Other changes here:

- Fixed a problem where GPU RAM was not being seen when dumping
the full RAM details of a process. This was because in that
case the system would ask the process to compute its own MemInfo,
which it returned, but the process doesn't have permission to
access the files containing the GPU RAM data. So now the system
always computes the MemInfo and hands it to the app.

- Improved broadcast delays to not apply the delay if the next receiver
of the broadcast is going to run in the same process as the last
one. A situation I was seeing was an application that had two
receivers, one of which started a service; we are better off letting
the second receiver run while the service is running.

- Changed the alarm manager's TIME_TICK broadcast to be a foreground
broadcast. This really should have been anyway (it is supposed to
go out even minute, on the minute, very accurately, for UI elements
to update), and is even more important now that we are doing more
things to delay background broadcasts.

- Reworked how we maintain the LRU process list. It is now divided
into the two parts, the top always containing the processes holding
activities. This better matches the semantics we want (always try
to keep those around modulated by the LRU order we interleave with
other cached processes), and we now know whether a process is being
moved on the LRU list because of an activity operation so we can
only change the order of these activity processes when user operations
happen. Further, this just makes that common code path a lot simpler
and gets rid of all the old complexity that doesn't make sense any
more.

Change-Id: I04933ec3931b96db70b2b6ac109c071698e124eb
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
e8a9422495d6af9fc68cf4e838a4a5f19177034b 19-Sep-2013 Craig Mautner <cmautner@google.com> Merge "Return tasks in correct order." into klp-dev
c0fd8052349976fe0e9422f702e30e5030a0adde 19-Sep-2013 Craig Mautner <cmautner@google.com> Return tasks in correct order.

Fixed ActivityManager.getRunningTasks().

Fixes bug 10705790.

Change-Id: Ia3f66e592e08a87896a1ab59f980618ec5310dfe
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
4ef2693a243b308fad775a8a1691963c51ac925e 19-Sep-2013 Craig Mautner <cmautner@google.com> Revert back to a single home app in mHomeProcess

The idea of multiple processes serving as home was unfeasible.

- Revert "Allow for more than one home app." commit
e428a7f662f109a5f2015008e3161df23932483e.
- Assign ActivityManagerService.mHomeProcess to the process of the
root activity of the home task.

Addresses bug 10342471.

Change-Id: Ifb494626107d24de1306e320a18206d5b176a7c0
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
ae7ecab400374f083718995454ec03e5e57b7203 18-Sep-2013 Craig Mautner <cmautner@google.com> Move flag for home launching from activity to task.

The variable ActivityRecord.mLaunchHomeTaskNext was used to indicate
that the home task should be launched when the activity completed.
This only mattered when it was at the end of a task. As the activity
launched other activities within the same task it needed to be
migrated from activity to activity and task to task. This became
too complicated and was at the wrong level to begin with.

By moving the flag to TaskRecord.mOnTopOfHome the logic is simpler
and the results more predictable.

Fixes bug 10602256.

Change-Id: If0b752522b77be9918f1dba221d0ff670fc01af8
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
dccb770b8486520503f47cf8dacc9b0c5f836d2b 18-Sep-2013 Craig Mautner <cmautner@google.com> Add bounds checks before accessing ArrayList.

Add a test for emptiness before accessing either mTaskHistory[0] or
TaskRecord.mActivities[0]. This will keep us from hitting
IndexOutOfBoundsException.

Fixes bug 10789624.

Change-Id: If726df888a2c8b393788793b6220a6bffe2df883
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
a82aa09ba3b8cada49f0b20777e7502e86bb0248 14-Sep-2013 Craig Mautner <cmautner@google.com> When launching home activity, make sure it is top.

Because recents sits on the same stack as launcher it can sometimes be
above launcher. When we were launching home activity because the flag
told us to we would sometimes launch recents instead. This fix makes
sure that the home activity is on the top when it is supposed to be
launched next.

Previously this was fixed by having recents move itself to the back
of the stack after it launched an activity (b/9750207 and ag/336019).
But that solution caused the AppTransition to be set to
TRANSIT_TASK_TO_BACK which left the SOFT_INPUT_IS_FORWARD_NAVIGATION
flag unset. This in turn caused IMEs to remain unlaunched when
returning from recents (b/10240567).

Fixes bug 10240567.

Change-Id: I35c6619af0e68d0e6d9ab87cad06ea7c27e11e27
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
cdd82540f2f98e7b4374fdd81e771eb217a27573 11-Sep-2013 Craig Mautner <cmautner@google.com> Merge "When waiting for activity to finish don't reset" into klp-dev
5c494547af1e4558aea5994b60afaadefef971e1 06-Sep-2013 Craig Mautner <cmautner@google.com> When waiting for activity to finish don't reset

In cases where the client is waiting for an activity to launch
(startActivityMayWait()) it is a bad idea to clear
ActivityRecord.displayStartTime when going into the pause state. If
displayStartTime is cleared before the activity is displayed,
the client will never be released.

This fix keeps pause from clearing displayStartTime if any client
is waiting for the activity to be displayed.

Fixes bug 10095558. But not a permanent fix, startActivityMayWait()
should not be called by any production code.

Change-Id: I7cbdcb04256f4a26233867c52aedd3bc4151adc3
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
e5273b422e5d8deb22990992f4c72130e6e88ccf 09-Sep-2013 Craig Mautner <cmautner@google.com> Do not enter resumeTopActivity recursively.

Changes for translucent activity were causing activities to be
launched twice due to a recursive call into resumeTopActivity.
Putting the translucent action onto a handler removes the recursivity
and fixes the multiple launch problem.

Fixes bug 10556969.

Change-Id: I2bb53cd555b0aaf093ab35db2859acb10b58211e
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
c8143c623d268989be7fcb9589a73277c0e7cc1f 03-Sep-2013 Craig Mautner <cmautner@google.com> Insert home task into history when sending to back.

- There is an assumption that moving a task to the back moves it
behind the home activity. This fix ensures that the home activity
will be launched by some activity before the task that has been
moved to the back.

- Convert "private final" declarations to private only.

- Convert container tests for size()==0 to isEmpty().

- Remove unused variable.

Fixes bug 10228536.

Change-Id: I51741ee7a09652e27afffcc50c14953bf0aa27ea
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
e428a7f662f109a5f2015008e3161df23932483e 18-Aug-2013 Craig Mautner <cmautner@google.com> Allow for more than one home app.

Having a single mHomeProcess in ActivityManagerService ignores the
possibility of multiple processes serving as home. Particularly when
we have a home activity that only serves to launch the true home
activity.

Fixes bug b10296766

Change-Id: I9e5c9c955c64f4b3df856b6bc66d6a0d93f85aab
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
614b4c4cd42699161b0c801117416ec517b2afe2 06-Aug-2013 Dianne Hackborn <hackbod@google.com> Merge "Refactor ProcessStats, ProcessTracker."
d2932243e3313b59e7538641731aa98852bc5ac7 06-Aug-2013 Dianne Hackborn <hackbod@google.com> Refactor ProcessStats, ProcessTracker.

ProcessStats is now called ProcessCpuTracker.

ProcessTracker is now ProcessStatsService, and its inner State
class is broken out into a separate top-level ProcessStats class.
This ProcessStats is moved to the framework, so we will be able
to use it elsewhere.

Change-Id: I6a127bcb835b6b474b72647c0b99b82c2137e5c5
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
0f922749f45ba0717c317a765286f880bb9a1cce 06-Aug-2013 Craig Mautner <cmautner@google.com> Extend clearing of mLastPausedActivity.

Add more locations where mLastPausedActivity must be set null before
calling resumeTopActivityLocked().

Also separate the "No History" activity from mLastPausedActivity by
adding mLastNoHistoryActivity. This is necessary because now
mLastPausedActivity will be null when mLastNoHistoryActivity
is checked.

Continues to fix bug 10022212.

Change-Id: Ida543b0638c865127691dc51a6e0635062539659
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
f140fd9cef0ad2a522ad0edd852f763003933338 06-Aug-2013 Craig Mautner <cmautner@google.com> Clear last paused activity.

Moving an activity to the back used to move it behind the launcher.
This meant that the test in resumeTopActivityLocked() for
mLastPausedActivity being equal to the top activity would fail after
moveTaskToBack(). In the new activity stack model the launcher is
on a different stack so if there is only one task then the test
now passes. Clearing mLastPausedActivity when moving an activity
forward now passes the test.

Fixes bug 10022212.

Change-Id: I17932d5c87d2483f13c29ae85a7067202a08f34e
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
88176107476644765cc59b84976598d581e1fc3f 22-Jul-2013 Craig Mautner <cmautner@google.com> Remove stopping activity from activities to stop

When stopping an activity remove it from the list of activities to
be stopped when idle. Otherwise the activity gets stopped twice, at
the point of the fix here and later when idle.

Fixes bug 9755054.

Change-Id: If8d2249b75aeb9f8b6cea2d883046f3ad4c2e067
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
ac6f843c917b68ea8805711965b149a9338e3a0e 17-Jul-2013 Craig Mautner <cmautner@google.com> Fix home activity and user switch interactions.

- Make sure Home activity goes in the correct task and on the correct
stack.
- Do not allow different users to be in the same task.
- Do not set stacks aside for each user.

Fixes bug 9775492.

Change-Id: I0e7954e917aac8482a1015a36923e02914e2b692
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
a413dc06b2193442a2d956571b829aeb5fb97862 12-Jul-2013 Dianne Hackborn <hackbod@google.com> Add new proc state constants and delivery.

The activity manager now keeps a new "process state" for
each process, indicating the general execution and memory
state of the process. This closely follows the out-of-memory
adjustment and scheduling class that it currently tracks,
but roles these together (plus a little more info) into one
more semantically meaningful number.

This value is reported to each process as it changes, so they
can do things like tune the Dalvik garbage collector to match
the current process state.

I think I should also switch to this for process states. It
will give is more meaningful divisions of time for each process.

Also fix a problem in the activity stack where the previous
process was not being set correctly when moving between
activity stacks.

Change-Id: I598b1667dc46547f8fadae304e210c352cc9d41f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
5eda9b330120f75964cd78b29f6101cc273c2a7e 02-Jul-2013 Craig Mautner <cmautner@google.com> Add convertToTranslucent to API.

Rename convertToOpaque to convertFromTranslucent. Add the
counterpart to Activity.convertFromTranslucent() for returning from
opaque to a translucent Activity. The caller should wait until
TranslucentConversionListener.onTranslucentConversionComplete() is
called before actually changing the background to translucent.

Change-Id: Id04b026bcc4dd8bad9a33a7af126e1bb28fb9c03
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
785a22188fcaf1c0fb4c3884e52da8ce22467339 08-Jul-2013 Craig Mautner <cmautner@google.com> Merge "Move mLaunchingActivity from stack to supervisor."
7ea5bd497f842c8181f6455da6c8013e06578d45 06-Jul-2013 Craig Mautner <cmautner@google.com> Move mLaunchingActivity from stack to supervisor.

There did not need to be one launching wakelock for each stack.
Moving it to the stack supervisor makes the logic much simpler
and fixes bug 9693439.

Change-Id: I5c9ae856540170a4d66fedb74becb6959c44dd8f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
cee04b57394e35457f5d217731fba24631581259 04-Jul-2013 Dianne Hackborn <hackbod@google.com> Add traces for app launch / fully drawn times.

Note that we don't know the fully drawn time unless the app
tells it has finished drawing, so for apps that don't do this
we will end up just continuing to consider it to be drawing until
the next app is launched.

Change-Id: I766b71cf61b8d7324ccf239b7a44bef2518e2454
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
2286cdc0cab77e61b75e6fe9a45b91f6e57cd46d 02-Jul-2013 Dianne Hackborn <hackbod@google.com> Misc memory stuff.

- New Activity.reportFullyDrawn() method that applicatins can call
when they know they are fully drawn, allowing us to have better
app launch time info. This data is also included in usage stats.
- Added total and free memory data "dumpsys meminfo".
- Tuned the moderate memory levels to be more aggressive about
considering the device getting low on RAM, and thus starting
to prune RAM from processes.
- Fixed issues in processstats when reading old data as well as
resetting and other various fixes.

Change-Id: I20efe7451afb4edfa1aeec448328ba601c24d869
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
5729b81ab56379e3b8736a2c716421e185756460 27-Jun-2013 Craig Mautner <cmautner@google.com> Merge "Add API to convert translucent Activity to opaque."
053f61d6a6e23825e680dc49982e55c5b4299d61 27-Jun-2013 Dianne Hackborn <hackbod@google.com> Work on issue #9586838: Crash after waking up Hammerhead device

I made the power manager more rigid, not allowing different uids
to use the same wake lock. This never should happen. I would
guess there is somewhere that the activity manager is acquiring
the wake lock without clearing the calling identity... but it is
hard to follow all the paths this may happen in. So here we add
some checks when acquiring/releasing the wake lock to make sure
it is being done as the system uid.

Also:

- Protect the new activity stack calls with a permission, and
make sure to clear the calling uid once past that.
- Collect uid data from process stats so we can correctly
associate CPU use with a uid even if we don't know about the
pid for some reason.
- Fix battery stats dump commands to clear calling uid before
executing so they aren't broken.

Change-Id: I0030d4f7b614e3270d794ecfc3669139a5703ce9
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
4addfc5f3998e3d7fc0a2ed9a9051c034da2ea3d 25-Jun-2013 Craig Mautner <cmautner@google.com> Add API to convert translucent Activity to opaque.

Fixes bug 9298778.

Change-Id: If6198f42bdea8aa727a2abc672eb0062aaf63ca3
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
37f748db85a8bfc2f9daefb2e1e7a9af6117ac26 25-Jun-2013 Craig Mautner <cmautner@google.com> When an app dies launch home conditionally.

The determination for whether to launch home after an app dies
did not include whether the app would have returned home on exit.
This fixes that by checking what the app would naturally return to.

Fixes bug 9466261.

Change-Id: Ife6e895b9ef8c11b0a7f470d3eac4e88e763930b
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
fb1e20dfe2a1252625ea59d4fd5ad4601b118d68 24-Jun-2013 Craig Mautner <cmautner@google.com> Don't move stack with task for moveTaskToFront.

Earlier CL, ag/321609, was overly aggressive. It should only have kept
the stack from moving when moveTaskToStack() was called. Instead the
change was applied to moveTaskToFront() as well. In order to remain
consistent with earlier behavior of moveTaskToFront() the stack
containing the task must move to the front as well. This movement
launches the activity at the top of the task. Without the stack
movement the activity never gets launched causing bug 9498455.

Fixes bug 9498455.

Change-Id: I2cb9119c23a226f7d211851df9e49f10f702b3ef
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
d213beae7539d8feb7cf1ba8f25f9769f5890e0b 17-Jun-2013 Craig Mautner <cmautner@google.com> Don't bring stack forward when moving tasks.

Change-Id: I222eda9e3ea62119c8948a99a63de55b13ca69f4
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
7ad34e5fb2bc8eda0a64377cedf8a8e899644dd9 06-Jun-2013 Dianne Hackborn <hackbod@google.com> Improve debug printing in activity manager.

Dumping per-package data is now much cleaning, and only really
prints information related to the package. Also clean up the
formatting and such of the new activity stack states.

Change-Id: Ie5f31d72b7e77b34fd9acd835f28ed1db1dff328
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
3f7a6935d37e36190a7d131a0193739c272fbe05 01-Jun-2013 Adam Powell <adamp@google.com> Merge "Fix a bug resolving the correct icon/logo in action bars"
04fe6ebb9f919f196ec06a19bebc09b8e943f95b 31-May-2013 Adam Powell <adamp@google.com> Fix a bug resolving the correct icon/logo in action bars

Remove some abstraction-breaking magic in ActionBarView and replace it
with proper resolution of the icon/logo when creating a window. The
old implementation relied on the ActionBarView's context being an
Activity.

Bug 9171554

Change-Id: Idbbb1942622195dcb55e8119f2d64287b07bb509
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
390517be2d60dd6e6264150c190c372d89bb331a 31-May-2013 Dianne Hackborn <hackbod@google.com> Clean up some temporary allocations.

Yay to ArrayMap, letting me get rid of a bunch of temporary
iterators in core code paths like updateOomAdj. (Now I definitely
need an ArraySet to finish that up.)

Also clean up various other things that are doing unnecessary
allocations, clean up some debug output, make more of the debug
output respect package filtering.

Change-Id: Ib4979faf4de8c7912739bc0937c3fa9e7bfcde67
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
b3b36ba13895d779159799341d432f6380a0ba8a 20-May-2013 Craig Mautner <cmautner@google.com> Resize all changed windows and fix moveTaskToStack

- Add all changing windows to mResizingWindows when an ActivityStack
is resized.

- Stop calling TaskStack.setBounds if the bounds haven't changed.

- Make moving a task from one stack to another work properly.

- Eliminate unused methods and redundant variables in WindowState and
WindowStateAnimator.

Change-Id: I3a950c777bcc50cdeced150d44423d4d0b38af4a
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
f7bfefb5988cb652530dbf75b96c697cde506b9d 17-May-2013 Craig Mautner <cmautner@google.com> Reformat wrapped lines and merge sendMessages.

Change-Id: I2834966196c2e6a778fc0cb71e4a56411b24c3f0
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
0eea92c67b292b005c152641a12b920fe145826c 16-May-2013 Craig Mautner <cmautner@google.com> Move sleep from ActivityStack to Supervisor

- Move activitySleptLocked, checkReadyForSleepLocked,
mGoingToSleepActivities, mGoingToSleep, mSleepTimeout from
ActivityStack to ActivityStackSupervisor.

- Fix bug that was causing mGoingToSleepActivities to always be
empty.

- Add more debug logging.

Change-Id: Ibd57bd49bf6f468567571b390f3051faaeee1aa1
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
86d67a4faad2cca95f6ec7c93876d6d3d1c136d9 14-May-2013 Craig Mautner <cmautner@google.com> Move Recents into home stack.

Allows Recents activity to occupy a special place in the window/stack
hierarchy.

Change-Id: Ic11c94a075f70c7ba68bd554cd3e5fc6b7c407e7
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
525f3d9df632e485d1f75d8336e28a266eb7d96c 07-May-2013 Craig Mautner <cmautner@google.com> Do not launch home task if activities remain

When a root activity is finishing and it is supposed to return to
home make sure there are only lower activities waiting to start before
going home.

Fixes bug 8632206.

Various other refactorings for efficiency.

Change-Id: I8bbb9de78d0ea9f45a504cf4bad72c698e9cc3d8
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
add582122dcec5aeb20d9e8f8c49348e00a5fe76 07-May-2013 Kenny Root <kroot@google.com> resolved conflicts for merge of 485d7a31 to master

Change-Id: I058e19af8732df44457bdc614ee810a642dc25e4
b59dcfd5e108fdffbc610ef109cccecbbd11cd75 06-May-2013 Craig Mautner <cmautner@google.com> Call ensureActivitiesVisibleLocked from supervisor.

- Don't call ActivityStack.ensureActivitiesVisibleLocked directly.
Instead call ActivityStackSupervisor.ensureActivitiesVisibleLocked.

- Add detecting monochrome screenshots to black screenshots.

- minor refactors.

Change-Id: I050b1cd40cacaab451f1460a77a82125a8077ff2
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
05d290365f0b9ed781ffcb30b38a0c7c6e450e9d 03-May-2013 Craig Mautner <cmautner@google.com> Fix layering and launching issues.

- Replace calls to ActivityStack.resumeTopActivity() with calls to
ActivityStackSupervisor.resumeTopActivities().

- Move dim layers from display scope to stack scope. This applies to
both the animation background dim layer and the FLAG_DIM_BEHIND dim
layer.

- Move windows on stacks that are not targeting wallpaper above the
wallpaper. Otherwise wallpaper placement hides the non-focused stacks.

Change-Id: Ic6b97ac6b094672bb1ddac17ce46ea58c738f073
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
e418ecd129cc3056ed185822f089b0246acbbbcd 02-May-2013 Craig Mautner <cmautner@google.com> Propagate the return-to-home flag to next task.

If a task is supposed to launch home when it finishes but then
launches another task and finishes itself, then the new task must
launch home when it finishes.

Fixes bug 8778263.

Change-Id: I6495f6c2e99a906217e73b7b6dcae8ecff435e5f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
d94b1b480ea6ed069ad048e258a57e1911304851 01-May-2013 Craig Mautner <cmautner@google.com> Handle case where finishActivity removes activity

Fixes bug 8773046.

Change-Id: I2e9f15c19ee9b50347472542ace5287964964203
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
9e14d0fd9a36fdd81dbb4744d115b0059bd22590 01-May-2013 Craig Mautner <cmautner@google.com> Do not return to Home activity if not top task.

Add a test for being the top task when closing the last activity in a
task. Without this test, if the last activity in a task was flagged to
return to the home activity on completion but that activity had
launched a new task we would not go to the new task but would instead
launch the home activity.

Fixes bug 8775949.

Change-Id: I7fd9d9ebbdbff8064d894407c35190894a141ecf
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
9db9a0bde5e199a6043fdb0065012d1812906dae 30-Apr-2013 Craig Mautner <cmautner@google.com> Move task methods into TaskRecord.

Stop doing backflips to do task operations in ActivityStack.

Change-Id: I57b1be6affcb8b7d504ae33b3e44bde2e6253f1c
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
58b98d392d47c2acdf19cea988f0ac547b83e670 26-Apr-2013 Jeff Sharkey <jsharkey@android.com> Merge "Report dead activities as paused to stats."
5782da778ca2f282b763fa64a8f7ec079cad4d70 25-Apr-2013 Jeff Sharkey <jsharkey@android.com> Report dead activities as paused to stats.

Also tell stats about pause before dispatching to remote side.

Change-Id: I975d0fba65515fa768127792d5aa7976df2ba2d3
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
458dd87552ba556ee2195a3efa7cc9f057142b69 25-Apr-2013 Craig Mautner <cmautner@google.com> Merge "Fix launching non-full screen apps from home."
7efcc0c16d7a70327b93c7d230a85232c2db6ef1 25-Apr-2013 Jeff Sharkey <jsharkey@android.com> Skip reporting resumes due to config change.

This gives us matching pause/resume calls to updateUsageStats(),
since configuration changes never report the pause event.

Change-Id: I5c8afc28766cd90d4bd793980265ce7988750cae
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
580ea81ccdf29a7af0da88b43d2676fec93e4e5d 25-Apr-2013 Craig Mautner <cmautner@google.com> Fix launching non-full screen apps from home.

- Continue to display the home screen for non-fullscreen activities
such as Download. Previously launching Download from home would
display Download on top of the previous activity on the user activity
stack.

- Fix NPE when DEBUG_PROVIDER is true.

Change-Id: I705ea43e4b78a5f5e83fc3f5fa83e4c95e592268
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
eb95786fd3ffa9807a9d00c25e7c7e8a62d23658 25-Apr-2013 Craig Mautner <cmautner@google.com> Pause activities when leaving.

Missed a spot where an activity that is launching another was not
being paused. Fixes bug 8640130. At least in one case.

Release mWindowMap as soon as it is no longer needed.

Change-Id: Id2c63d3d715b98741e2ebe3c9985cb1e9ca5ffbc
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
858d8a6583b0c91c66960167b84c67b6c4e2d3c6 24-Apr-2013 Craig Mautner <cmautner@google.com> Fix user switching.

- Save and restore WindowManager stack states.
- Maintain ActivityManager activity states based on the stack
the activity is in.

Fixes bug 8646641.

Change-Id: I16c76c7708ab49121c3884a7e5bf219898b92d3f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
cf910b0c714b2ca90ea0013e5695850506a1d36f 23-Apr-2013 Craig Mautner <cmautner@google.com> Add tap detector for switching stack focus.

- New InputEventReceiver for detecting taps outside of focused stack
boundaries.
- Fixed bug that wasn't pausing the non-focused window when returning
home.

Change-Id: Ia51d312a7c029abc01eb5df1102814cc29d33b47
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
f333327782e14688e1c198c1192172d51308e90b 22-Apr-2013 Craig Mautner <cmautner@google.com> Move idle handling from ActivityStack to Supervisor

Along with mFinishingActivities, mStartingUsers and
mCancelledThumbnails.

Change-Id: Ia354225d72e694b7ac68b0869fcab903a3d06436
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
ce5f3cba6b95e1fbc800c0fc43d13bb830e87423 22-Apr-2013 Craig Mautner <cmautner@google.com> Refactoring Activity Manager.

Mid-course corrections.

- Simplify ActivityStackSupervisor and ActivityStack constructors to
get passed parameters from ActivityManagerService.
- Store WindowManagerService referecne locally in
ActivityStackSupervisor and ActivityStack.
- Rename getTopStack to getFocusedStack in ActivityStackSupervisor
and ActivityManagerService.
- Move mWaitingActivityLaunched/reportActivityLaunchedLocked and
mWaitingActivityVisible/reportActivityVisibleLocked from ActivityStack
to ActivityStackSupervisor.
- Moved reportResumedActivity to ActivityStackSupervisor.
- Added a Handler to ActivityStackSupervisor. Will populate it on next
CL.

Change-Id: I1bbe5eb737c5cac6b896bc9748f329891e94d00f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
165640bbc69c7831ec38d573dc1f85b264db2a5d 20-Apr-2013 Craig Mautner <cmautner@google.com> Use correct stacks for testing changes.

Fixes bug 8656057.

Change-Id: I88e48d28d240fced866a82bd3d49f8807300c0ad
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
7d9eaa435df1c753af225a150a5d04750b512083 19-Apr-2013 Craig Mautner <cmautner@google.com> Call updateUsageStats for all stacks.

Was only calling it for the frontmost stack. But if we are going to
or from the home activity then the pausing stack moves to the back.

Fixes bug 8666221.

Change-Id: I1d6d19b49da4aa23414303336fa266362ae5f4b1
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
f88c50f8daee2c813d788c19f7f04b9f365efaaf 19-Apr-2013 Craig Mautner <cmautner@google.com> Handle app dying.

Fix bugs related to handleAppDied.
Fixes bug 8658744.

Change-Id: I0ba2466ffac5e465e803e97a781810c34a6de371
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
69ada558f5f3b4cd1d7930e53902dba19c023cfd 18-Apr-2013 Craig Mautner <cmautner@google.com> Fix launching logic.

Fixes bug 8643197.

Change-Id: Ie09a767082dc492b449111da91bc0e77b43fa2f6
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
a9a3fb1da3d3d41f923e87d5b08b35c3e0c1f72e 18-Apr-2013 Craig Mautner <cmautner@google.com> Add transparent frame around focused stack.

- Also fix bugs when removing stack.

Change-Id: I3e0e3029f512f086601add00ccf34b2fea84296d
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
29219d963d1ec29ddea3e5814eb82c2aeaccc1ac 17-Apr-2013 Craig Mautner <cmautner@google.com> Steady improvement to multi stack.

- Fix back button behavior with two stacks. Stopping activities were
held in that state indefinitely. This change causes IDLE_NOW_MSG to
be sent immediately for the last activity in a stack.

- Touch in non-focused stack was being ignored because of focus tests
in AbsListView.

- Change the focused stack when the activity focus changes. Renamed
mMainStack to mFocusedStack to reflect this.

- Resume all top stack activities when resuming.

- Assign intent task to ActivityRecord if it doesn't have a task.
Fixes bug 8433463.

Change-Id: I8d3c806234511697bc209ab99890730ffa514d20
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
967212cb542e6eeb308678367b53381bff984c31 14-Apr-2013 Craig Mautner <cmautner@google.com> Implement stack splitting and task movement.

Split stacks and move tasks between them. Layout the windows
according to the new stack split.

After layout content rectangles are known split the available area
between all stack boxes. Then use those values for future layout.

Provide stack contents to ActivityManager.

Change-Id: I9746e6185445633810d506be514d0b7b540a7f99
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
de4ef020ec5c3acdc90c4ba43011dda20d98d4dd 08-Apr-2013 Craig Mautner <cmautner@google.com> Implement separate stacks.

One for home activity(s), one for other activities. Coordination
between the stacks is handled by the ActivityStackSupervisor.

Change-Id: I11395edea501d2f84a18a6a8bced1ce3d0797dad
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
d8ff71bdaf140527700c485cd9810ce793753c4a 11-Apr-2013 Santos Cordon <santoscordon@google.com> am 0a5eb3ec: am acd840d5: Merge "Obfuscate any phone numbers that pass through the event log." into jb-mr2-dev

* commit '0a5eb3eca776c414a2d170c8e697edad19f9e957':
Obfuscate any phone numbers that pass through the event log.
acd840d5c31bee48cc13a03f5e0c5e3b69ff23db 11-Apr-2013 Santos Cordon <santoscordon@google.com> Merge "Obfuscate any phone numbers that pass through the event log." into jb-mr2-dev
9cc60e81d700f12a5fa7e2246301268bbaafc6fb 05-Apr-2013 Ben Gruver <bgruv@google.com> Remove the sender package filter from the intent firewall

Change-Id: I3124c6969984eef646f22216c709bdfb324d6679
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
4efe9403afb0ba3b83fa647eb82e4f90d29f131b 03-Apr-2013 Ben Gruver <bgruv@google.com> Initial implementation of IntentFirewall functionality

This has the full filter functionality, but is currently only
able to block Activity intents. Logging intents, or blocking
service/broadcast intents is not yet implemented.

Change-Id: Ied3d8dedf982e17bcbdff3e328eeb87477954df7
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
8849a5ecb89834b55b6f83f201da6d7079f2cbb6 03-Apr-2013 Craig Mautner <cmautner@google.com> Move startActivityUncheckedLocked to Supervisor

This method can potentially act on different stacks so bringing
it to the supervisor from a single ActivityStack makes sense.

Change-Id: Ia2df3539dce39e8f050a9ffcef4371c0f172aaee
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
6170f73ed5464491b91685b57e116db033e98d5a 02-Apr-2013 Craig Mautner <cmautner@google.com> Move startActivity from ActivityStack to Supervisor

Change-Id: I188c8e95e6f8371a016ad6fceb0bfa5de04e4abb
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
dbcb31f28c7123f25e4b19c369332f23c36f9205 02-Apr-2013 Craig Mautner <cmautner@google.com> Fix potential synch problems.

- Do not schedule GC until all stacks are idle.
- Call sendPendingThumbnail outside of synchronized lock.
- Remove redundant synchronized locks.

Change-Id: I56581ca12a534765132bed405fa4b340c418436f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
e79d4268c0ee7971abb6ef99c76c2bd7f7818109 02-Apr-2013 Craig Mautner <cmautner@google.com> Yet more movement from ActivityStack to Supervisor

- Remove redundant synchronize in ActivityStack.activityIdleInternal().
- Move startSpecificActivityLocked from ActivityStack to Supervisor.
- Move handleAppDiedLocked from Supervisor to ActivityStack.

Change-Id: Id746ab3bdff861b61182282bea1deb8fcf284084
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
2420ead0326bfd2587da6231be419e758dba1930 02-Apr-2013 Craig Mautner <cmautner@google.com> More movement from ActivityStack to Supervisor

- Move showAskCompatModeDialogLocked from ActivityStack to
ActivityManagerService.
- Keep track of userId in ActivityStackSupervisor and initialize
new ActivityStacks with it.
- Move realStartActivityLocked to ActivityStackSupervisor except
for the part that actually updates the ActivityStack.

Change-Id: I7467302f1249fee2ea3cf027a49e0894c9a2213d
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
b0f7dc7588e2887a82dbaa462c665629a0c822aa 02-Apr-2013 Craig Mautner <cmautner@google.com> Move performClearTaskLocked into TaskRecord.

Make TaskRecord responsible for clearing itself.

Change-Id: I03fa50aaec108ab7f071412785da59ad58243d87
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
23ac33bb85de7e840dd3c35c21c05ead5bc39b03 02-Apr-2013 Craig Mautner <cmautner@google.com> Migrate activity starts into ActivityStackSupervisor.

Individual ActivityStacks should not be the place where stack
decisions are made.

Change-Id: If9c7a10e1127618c3ae008a0fea6e5943f776be4
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
e11f2b774b96662b2848cc0aa9e43454bd321425 01-Apr-2013 Craig Mautner <cmautner@google.com> Minor refactors

- Eliminate unused mLooper.
- Rename isSleeping to isSleepingOrShuttingDown.
- Fix dump formats.

Change-Id: I4cfc99605ac34213bf9b705562f2c701810434fd
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
8d341efad0850a6ff1a33375b33e3c7fdd8d9109 26-Mar-2013 Craig Mautner <cmautner@google.com> Move mStacks to ActivityStackSupervisor

Lift all ActivityStack behaviors from ActivityManagerService.

Change-Id: I356f1c22fe31f0442ff5e363f62fe99b7bfd6153
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
2219a1ba3d9f5c215be0eeb63fa8e8084da0f1ac 25-Mar-2013 Craig Mautner <cmautner@google.com> Modify primary ActivityStack accessing.

- Move mHomeStack to ActivityStackSupervisor.
- Move mMainStack to ActivityStackSupervisor.

Change-Id: I43522c9505f066b379ea172dd63663e78a0feece
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
00af9fe6ae0da5b716212fa754163d90b60c1ee6 25-Mar-2013 Craig Mautner <cmautner@google.com> Modify StackBox and TaskStack methods.

Also add dump() throughout.

Change-Id: I5369d2e71262645d9b1015bd4e72fad395cc7547
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
270843072cff8cd35c517ec6009ccda3ba9668f8 25-Mar-2013 Craig Mautner <cmautner@google.com> Introduce ActivityStackSupervisor.

- New coordinating class to juggle multiple ActivityStacks.
- First job: take singleton Keyguard dismiss behavior out of
ActivityStack.

Change-Id: I68e4b44411d3ec9401e86ac23703d6540dcb12e8
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
c00204b4d14d49a0417b44ca21aee4f0d4c466e0 06-Mar-2013 Craig Mautner <cmautner@google.com> Start moving Tasks from DisplayContent to TaskStack

- Create new classes for Stacks on WindowManager.
- Stop using DisplayContent methods and members:
addAppToken(),
removeAppToken(),
setAppTaskId(),
removeTask(),
mTaskIdToDisplayContents,
mTaskIdToTask.
- Start using WindowManagerService.createTask().
- Establish hierarchy of references: AppWindowToken=>Task=>
TaskStack=>StackBox=>DisplayContent.
- Clean up StackBox, TaskStack, and Task.

Change-Id: I798990aa7966784d22f4a43822087d8bb0404dd6
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
64f2b1738aec67b7814e27e6a13f35b38035ae0c 11-Mar-2013 Craig Mautner <cmautner@google.com> Add ActivityStack to PendingActivityLaunch

The task used by doPendingActivityLaunches is not known at the
time that the PendingActivityLaunch is created. Leading to an NPE.
Adding the ActivityStack to the PAL fixes this.

Fixes bug 8351149.

Change-Id: I64539b8f2e608128ef9d795c0739ef1de7a246d0
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
73ff7d8e64bb92be03e3e7ab35cdba2963c3d823 07-Mar-2013 Santos Cordon <santoscordon@google.com> Obfuscate any phone numbers that pass through the event log.

bug: 8203219
Change-Id: I455849cab9b2a8e08889cf44d1799448846c9151
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
d2328958de4f948756f8977ee8f2cc235b93d028 05-Mar-2013 Craig Mautner <cmautner@google.com> Prepare ActivityManagerService for multiple stacks.

- Replace mMainStack with mFocusedStack and mStacks.
- Remove stack from ActivityRecord.
- Add stack to TaskRecord.

Change-Id: I22e9ba34b12c2bd90806b14aafe063d5a2fe66ae
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
5854780df92294390e0f7ed4c70abf9ffafdcc13 05-Mar-2013 Craig Mautner <cmautner@google.com> Remove all vestiges of mHistory.

Change-Id: I3e9140bcf57f2437d7611419477c410d487f29c1
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
778787728d023e0f171e9d935ee1a9131c325857 05-Mar-2013 Craig Mautner <cmautner@google.com> Fix activity to task bugs

- Fix bug when task has been removed from mTaskHistory by
adding it back in at the top.
- Fix reparenting bug introduced by refactor of
resetTaskIfNeededLocked.

Change-Id: I93df2e62c6aed805fe888847dcf96a1fe0d7be26
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
70a86933b81eaa379a6e55a09ea65e96909e7777 01-Mar-2013 Craig Mautner <cmautner@google.com> Convert mHistory to mTaskHistory (9)

- Convert startActivityLocked from mHistory to mTaskHistory.
- Fix NPE bug in resetTaskIfNeededLocked.

Change-Id: I1598446199634bb455bc06377248fe940d5cb9d4
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
aab647ed57ba4a8f735e9b2d2d34833c85824ca4 01-Mar-2013 Craig Mautner <cmautner@google.com> Convert mHistory to mTaskHistory (8)

- Convert findTaskToMoveToFrontLocked from mHistory to mTaskHistory.
- Convert getTasksLocked from mHistory to mTaskHistory.
- Convert unhandledBackLock from mHistory to mTaskHistory.
- Convert dumpActivitiesLocked from mHistory to mTaskHistory.
- Convert getDumpActivitiesLocked from mHistory to mTaskHistory.
- Convert restartPackage from mHistory to mTaskHistory.

Change-Id: Ica654a964e91f6c6dae92e7fe326bc08b5ad36ac
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
0247fc80c133443b411d6468590548ac38284302 28-Feb-2013 Craig Mautner <cmautner@google.com> Convert mHistory to mTaskHistory (7)

- Remove TaskRecord from mTaskHistory and mTaskIdToTaskRecord when
last ActivityRecord is removed from it.
- Convert finishActivityLocked from mHistory to mTaskHistory.
- Convert navigateUpToLocked from mHistory to mTaskHistory.
- Convert removeHistoryRecordsForAppLocked from mHistory to
mTaskHistory.
- Convert moveHomeToFrontLocked from mHistory to mTaskHistory.

Change-Id: Ic632a8213f48dda1126c5e6853325a298b54f25f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
9658b3150954a25bb6a9f5fbd6aab2cb0111a3e2 28-Feb-2013 Craig Mautner <cmautner@google.com> Convert mHistory to mTaskHistory (6)

- Convert isInStackLocked from mHistory to mTaskHistory.
- Fix discrepancy between mHistory and mTaskHistory when all
activities in a task are finishing and a new one is being added.
mHistory was separating the task into two places in the stack,
mTaskHistory can't do that.
- Convert startActivityUncheckedLocked from mHistory to mTaskHistory.
- Convert finishTopRunningActivityLocked from mHistory to mTaskHistory.

Change-Id: I42b097c2f187d40ecd98b108794757063903218b
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
1603077067af1810c9e45d1ad7d1501ca363fa2c 27-Feb-2013 Craig Mautner <cmautner@google.com> Convert mHistory to mTaskHistory (5)

- Remove commented out resetTaskIfNeededLocked.
- Remove mHistory from performClearTaskLocked(int, ActivityRecord).
- Remove mHistory from performClearTaskAtIndexLocked.
- Remove mHistory from performClearTaskLocked(int).
- Remove mHistory from getTaskAccessInfoLocked.

Change-Id: I3616147f9e9befa297f244dc4fd5d7b1e97300b3
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
000f0028913ee9d9563023ab9a755b471809de92 27-Feb-2013 Craig Mautner <cmautner@google.com> Convert mHistory to mTaskHistory (4)

- Remove mHistory from getTaskForActivityLocked.
- Remove mHistory from findTaskLocked.
- Remove mHistory from findActivityLocked.
- Minimize mHistory usage in switchUserLocked.
- Remove mHistory from resumeTopActivityLocked.
- Remove mHistory from validateAppTokensLocked.

Change-Id: I0cc7cf2f1b5a66a1e3b3a9baff7712a3f2f0d5c4
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
d74f7d728f39d021fc2581212e44534a71f2b59a 26-Feb-2013 Craig Mautner <cmautner@google.com> Convert mHistory to mTaskHistory (3)

- Remove mHistory from topRunningActivityLocked(IBinder).
- Remove mHistory from topRunningNonDelayedActivityLocked.
- Remove mHistory from topRunningActivityLocked(ActivityRecord).
- Remove indexOfTokenLocked and its uses in
requestFinishActivityLocked and finishActivityAffinityLocked.

Change-Id: I96b44f66486406b4006b7937360fd92e8dd73060
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
2ad920759b1981eaf526fd37a314fbc5a3ed90ae 26-Feb-2013 Craig Mautner <cmautner@google.com> Revert ActivityManager changes for tasks. DO NOT MERGE

Keeping all activity=>task changes in master and removing them
from jb-mr2.

Revert "Update histories simultaneously."
Revert "Add null check to setAppGroupId."
Revert "Fix crashing bug in validator."
Revert "Switch topRunning* and moveTaskTo*"
Revert "Begin switch over to task based history."
Revert "Reset and reuse Iterators and don't new() one."
Revert "Remove AppWindowToken lists."
Revert "Fix build."
Revert "Remove unused App methods."
Revert "Stop using AppToken movement and start using Task."
Revert "Replace access to mAppTokens with AppTokenIterator"
Revert "Refactor setAppOpVisibility implementation."
Revert "Add AppWindowTokens to TaskList."
Revert "Make ActivityStack.mHistory private."
Revert "Migrate AppWindowToken lists into DisplayContent."

Change-Id: I5722c9a4956dccb52864207e2967690bc58e4ebb
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
56f52db423578e390d603d98c386afaf7d2ed2a5 25-Feb-2013 Craig Mautner <cmautner@google.com> Convert mHistory to mTaskHistory (2)

- findActivityInHistoryLocked
- moveActivityToFrontLocked
- forceStopPackageLocked

Change-Id: I9dec65fc4cff12184e144b1ad2d39ffbfed0b270
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
d44711ddd3a044853f04aa9ec0dd1f3fe1c31515 23-Feb-2013 Craig Mautner <cmautner@google.com> Conversion from mHistory to mTaskHistory.

Change-Id: I7c43a923ce248edb4ca7d5fc6d1e0c492522f5a0
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
e3a74d5d644ea67554ff87e86b3dcca739297fa0 22-Feb-2013 Craig Mautner <cmautner@google.com> Refactor resetTaskIfNeededLocked for tasks.

Change-Id: I1ad8b7ffe1f17490ebcb98ea48d57f0b15f888c9
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
b44de0d910a3ec22b9963e538117e257f621de47 22-Feb-2013 Craig Mautner <cmautner@google.com> Update histories simultaneously.

In moveTaskToBackLocked calls that used mHistory were being made
between the times that mTaskHistory and mHistory were modified. This
caused an inconsistent state that led to Windows arranged out of
order. Updating both history stacks at the same time fixes this.

Fixes bug 8244261.

Change-Id: I9669762ad39b06ab6d401122702b74969d4dc658
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
11bf9a52eb9fb02a8c553a1cb1d71725f9706dad 19-Feb-2013 Craig Mautner <cmautner@google.com> Switch topRunning* and moveTaskTo*

- More of the Activity to Task changeover.
- Fix bug in validateAppTokens().
- Improved validation of changeover.
- Eliminated iterator classes.

Change-Id: I934a208eabfc9a2668e5a6162452e1406f2c8d3a
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
5d9c7be84d9628c1cf199fcf9015942835c4671b 15-Feb-2013 Craig Mautner <cmautner@google.com> Begin switch over to task based history.

- Introduce the task history and add to and remove from it with
verification.

Change-Id: If97e74f5a13f85acdb1521fc6d0b066a7e8584ae
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
b0c0b1fd70e3edeb724e2b2fb2c7063eb943f05e 14-Feb-2013 Craig Mautner <cmautner@google.com> Remove unused App methods.

Now that the Task methods have replaced the App methods remove
the App methods.

Change-Id: I0e7432f2c6f99708759ed8c871d20eb5bd38c3c2
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
926f3839d81e4b6b60238e38350bec7cb6d0269e 13-Feb-2013 Craig Mautner <cmautner@google.com> Stop using AppToken movement and start using Task.

Change-Id: I5fbd3b2b692e0e127386051f782b1015515ba384
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
30e2d72810e699d7a61277b7ba1b6cace26b84aa 12-Feb-2013 Craig Mautner <cmautner@google.com> Replace access to mAppTokens with AppTokenIterator

More switching from Activity-based to Task-based control.

Change-Id: Ida47d71a52b875a6a6bd77cb62911053f942da15
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
05d6272bad2d707b488a6f8784ce8aea5e25b110 11-Feb-2013 Craig Mautner <cmautner@google.com> Add AppWindowTokens to TaskList.

- Add/remove/move TaskLists from ActivityStack.
- Further isolate mHistory.
- Cleanup warnings by parameterizing ArrayList.
- Fix previous bugs.

Change-Id: Ife8c7b7347479c70f10467cc384283456149ac50
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
cae015fea398e1d99c0b538991535330f31fe543 08-Feb-2013 Craig Mautner <cmautner@google.com> Make ActivityStack.mHistory private.

Isolate the Activity history for later conversion to Task-based
management.

Change-Id: I4b6bf22de035c768aa705df0cc4f84486e8ede56
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
2ceb08150512ca121acc474d94f84357f0bf0bbf 07-Feb-2013 Craig Mautner <cmautner@google.com> Merge "Migrate AppWindowToken lists into DisplayContent."
b1fd65c0ff5784b90d765edb7e3c3115d767dff0 05-Feb-2013 Craig Mautner <cmautner@google.com> Migrate AppWindowToken lists into DisplayContent.

In preparation for converting ActivityManager control to a task-based
interface the AppWindowTokens are being stored per-display.

Change-Id: Ie5e355219554523f5e56eaef138d382975cf1682
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
f265ea9d8307282ff1da3915978625a94fc2859e 01-Feb-2013 Dianne Hackborn <hackbod@google.com> App ops: vibration, neighboring cells, dialing, etc.

Improve handling of vibration op, so that apps are
better blamed (there is now a hidden vibrator API that
supplies the app to blame, and the system now uses this
when vibrating on behalf of an app).

Add operation for retrieving neighboring cell information.

Add a new op for calling a phone number. This required
plumbing information about the launching package name through
the activity manager, which required changing the internal
startActivity class, which required hitting a ton of code that
uses those internal APIs.

Change-Id: I3f8015634fdb296558f07fe654fb8d53e5c94d07
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
0798149082a22ac16ee1d44ee88779716cb96784 28-Jan-2013 Dianne Hackborn <hackbod@google.com> Fix bug where we could get stuck repeatedly launching an activity.

A previous change to avoid losing activities if their process
happens to be gone at the point of launch (by counting that
activity as having its state saved) has resulted in a problem
where an activity that crashes during launch will be repeatedly
relaunched.

This is fixed here by explicitly keeping track of our attempts
to launch the activity since it was last able to save its state,
and not keeping it around if it looks like the launch is
repeatedly failing.

Change-Id: Icefd952443b7eb1222f233db95e0157fc3dd72d1
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
4b71aa1f8a1a3b7189fd29241ea7c594ce01623c 28-Dec-2012 Craig Mautner <cmautner@google.com> Move app transition constants

Move app transition constants from WindowManagerPolicy to
AppTransition.

Change-Id: I8ae6c4d0da1db826c44eb4ea0c6b85016b50b1a3
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
b12428a128f358bbf23a54471e552dd49b2eaef4 21-Dec-2012 Craig Mautner <cmautner@google.com> Save most recent thumbnail Bitmap for reuse.

This keeps Recents from taking two identical screenshots, one for
the Recents thumbnail and one for the pause activity thumbnail.

Fixes bug 7351766.

Change-Id: Ia4d12802151666ec36e4d9b395cf10e1e02dc37f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
7b172a49a90ea6784dbfe0002474f9d4fd4ace1a 07-Nov-2012 Kenny Root <kroot@google.com> am 58ed5d74: am 768d9e1a: Merge "Correct executable bit for source files"

* commit '58ed5d748c0b9b64845975ef5844ad313de7c3f6':
Correct executable bit for source files
58ed5d748c0b9b64845975ef5844ad313de7c3f6 07-Nov-2012 Kenny Root <kroot@google.com> am 768d9e1a: Merge "Correct executable bit for source files"

* commit '768d9e1a72ceee7d4a5f608776b87b62d6ce4a04':
Correct executable bit for source files
3a084af2e90849aaa8beb3a610189e3399c63ea0 07-Nov-2012 Kenny Root <kroot@google.com> Correct executable bit for source files

Many media files and source code files were marked as executable in Git.
Remove those.

Also a shell script and python script were not marked as executable.

Change-Id: Ieb51bafb46c895a21d2e83696f5a901ba752b2c5
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
9221792e0b81d0a4560a7043dfc7167c9a67bdd0 24-Oct-2012 Dianne Hackborn <hackbod@google.com> am e9c9a4ce: am 619eea60: am ecf4725e: Merge "Fix issue #7401818: Wrong transition animation when clearing task" into jb-mr1-dev

* commit 'e9c9a4ce9e9766b8950f34adeedeb7705cadf71e':
Fix issue #7401818: Wrong transition animation when clearing task
9622ca4f8870f4e66ecb3ad771410620c950bb5c 24-Oct-2012 Dianne Hackborn <hackbod@google.com> Fix issue #7401818: Wrong transition animation when clearing task

When we are clearing activities off the top of a task, propagate
any activity options down from the top-most one to whatever top
activity we are keeping. This ensures that if we set the activity
options on the top activity of the task previously to give it the
correct animation, we still keep that animation for the activity
that really ends up being the top.

Change-Id: I6919b644a530ac283fe4d320496edc2bf72aa04e
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
8565363126ed2c39444eb42f9879d0a88ed7905b 07-Oct-2012 Craig Mautner <cmautner@google.com> am 337aa27a: am 8ee7ac22: am 33877e15: Merge "Adds showWhenLocked attribute to Activities." into jb-mr1-dev

* commit '337aa27a6307e0f40705ee676551dda4bf6cb894':
Adds showWhenLocked attribute to Activities.
5962b12bedc4a1d0354816c1cd6b06ba04f6d807 05-Oct-2012 Craig Mautner <cmautner@google.com> Adds showWhenLocked attribute to Activities.

The new attribute allows an Activity such as the alarm to appear
on all users screens.

Bug: 7213805 fixed.
Change-Id: If7866b13d88c04af07debc69e0e875d0adc6050a
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
8f5a94d938d5bc14be9a24f69c7b29748bb97ba6 04-Oct-2012 Dianne Hackborn <hackbod@google.com> am a718bc86: am 7df202e2: am 8a229195: Merge "Fix issue #6968859: home not exiting an ANR\'d dream" into jb-mr1-dev

* commit 'a718bc863aafd21a2bc7240974ca2a51d6af92cf':
Fix issue #6968859: home not exiting an ANR'd dream
5fe7e2a3043d6a8ca933c77ccf95c791b57b221a 04-Oct-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6968859: home not exiting an ANR'd dream

Add a new call to the activity manager for the input dispatcher
to report about any pid having an ANR. This has a new feature
where it can also tell the activity manager that it is above the
system alert layer, so the activity manager can pop its ANR dialog
on top of everything if it needs to. (Normally we don't want
these dialogs appearing on top of the lock screen.)

Also fixed some debugging stuff here and there that was useful
as I was working on this -- windows now very clearly include
their uid, various system dialogs now have titles so you know
what they are in the window manager, etc.

Change-Id: Ib8f5d29a5572542cc506e6d338599ab64088ce4e
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
2e0b54f61fdd81a32052ce9edc4b91370ac4e513 02-Oct-2012 Dianne Hackborn <hackbod@google.com> am ebe28f51: am 30b07b50: am 6f354ed9: Merge "Fix issue #7226101: Secure image capture takes 5 seconds to start" into jb-mr1-dev

* commit 'ebe28f519cfa637c8bca78e08428977a8390c1fd':
Fix issue #7226101: Secure image capture takes 5 seconds to start
cc5a055613efb463275633d83a04674b0be6d770 02-Oct-2012 Dianne Hackborn <hackbod@google.com> Fix issue #7226101: Secure image capture takes 5 seconds to start

Mostly (turned off) debug output. Main fix is to resume the next
activity if we are pausing while sleeping and the top activity is
not the now pausing activity. Also helped things by fixing a problem
where removing a task would leave around dead destroy timeout
messages.

Change-Id: I9d550c216b4d7e2afe3d93553bb680cec41e2ed1
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
c14a9113c5b3bf3a5b6d2f888d6669e8bc54b342 27-Sep-2012 Dianne Hackborn <hackbod@google.com> am e440f47d: am e5215730: Merge "Maybe fix issue #7211766: bindService() to User u0 While u10 is..." into jb-mr1-dev

* commit 'e440f47d95cefe02bc76d6b57d6e2b248b052f93':
Maybe fix issue #7211766: bindService() to User u0 While u10 is...
b12e1354f25f04e9c9a71da76c6fca858b7d39d0 26-Sep-2012 Dianne Hackborn <hackbod@google.com> Maybe fix issue #7211766: bindService() to User u0 While u10 is...

...Forground Sometimes Doesn't Take

The main change here is a one-liner in ActiveServices to check the
uid when deciding whether to remove an item from mPendingServices.
This could cause the problem being seen -- if the same service for
two users is starting at the same time, the second one would blow
away the pending start of the first one. Unfortunately I have had
trouble reproducing the bug, so I don't know if this is actually
fixing it. It's a bug, anyway.

The reason so much has changed here is because I spread around
logging and printing of the user ID associated with operations and
objects to make it easier to debug these kind of multi-user things.

Also includes some tweaks to the oom manager to allow more background
processes (I have seen many times in logs where we thrash through
processes because the LRU list is too short), plus to compensate an
additional time-based metric for when to get rid of background processes,
plus some new logic to try to help things like Chrome keep around
their service processes.

Change-Id: Icda77fb2a1dd349969e3ff2c8fff0f19b40b31d3
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
eeb8f979938678f6d99db32ec9d4b9f3f7ed0a42 24-Sep-2012 Dianne Hackborn <hackbod@google.com> am 2552e78a: am b939e352: Merge "Fix issue #7209355, #7214271." into jb-mr1-dev

* commit '2552e78a15d2a88dd0e885ebf9490f8f38d9a393':
Fix issue #7209355, #7214271.
79cc83f8d8b9d140afb15f70b0338fa7143d803b 24-Sep-2012 Dianne Hackborn <hackbod@google.com> am 6e40deb8: am 88923c97: Merge "Fix issue #7214462: Some recent thumbnails are black." into jb-mr1-dev

* commit '6e40deb81cbee41f4f4611f30854bd1d8a928d53':
Fix issue #7214462: Some recent thumbnails are black.
b939e35274334d1f5e71a526efe8d235eb6d7387 23-Sep-2012 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #7209355, #7214271." into jb-mr1-dev
8da429e80d1778d7bcfbfbd64355c70fb466b3ce 23-Sep-2012 Dianne Hackborn <hackbod@google.com> Fix issue #7209355, #7214271.

Issue #7209355: Intent on the secondary user results in an intent picker
in the Primary user.
Issue #7214271: Crash in system UI

Also fix a bug where I recently broke the removeTask() operation in the
activity manager where it would remove the wrong task.

Change-Id: I448c73a0e83a78d9d8d96b4629658c169888d275
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
6a864959e09ad700cc4815e8d751561ceb7e08e3 22-Sep-2012 Dianne Hackborn <hackbod@google.com> Fix issue #7214462: Some recent thumbnails are black.

Change-Id: I9a2704c95a8701c9fb6755662fb47d4743099bf9
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
f16c559cff2ab8721365df02b621db5d4f37a464 21-Sep-2012 Amith Yamasani <yamasani@google.com> am e6a5c571: am 74defbf2: Merge "Query users excluding any being removed" into jb-mr1-dev

* commit 'e6a5c571c3bb174fe66d2f418070c549bc195c98':
Query users excluding any being removed
920ace0bbc2d4133dbec991d2636c99a57d6245e 21-Sep-2012 Amith Yamasani <yamasani@google.com> Query users excluding any being removed

Keep track of user creation and last logged-in time.
adb shell dumpsys users
User switcher shouldn't show users about to be removed.
No need to check for singleton for activities.

Bug: 7194894
Change-Id: Ic9a59ea5bd544920479e191d1a1e8a77f8b6ddcf
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
79c8c7a4ff1971f82142774450c43fecce64eb8f 20-Sep-2012 Dianne Hackborn <hackbod@google.com> am 9b4d528d: am 09ad0832: Merge "Switch to showing top-most thumbnail of recent apps." into jb-mr1-dev

* commit '9b4d528d7edf3d55a925b79ab7ba7664a9cb7a5e':
Switch to showing top-most thumbnail of recent apps.
15491c6a728131e322c45bc440500a8a78e4a410 19-Sep-2012 Dianne Hackborn <hackbod@google.com> Switch to showing top-most thumbnail of recent apps.

The way it should have been, and with the new recents enter animation
the way it must be.

Added a new method to retrieve this thumbnail, since it would be less
efficient to use the existing API (which always returns the "base"
thumbnail). Probably at some point that existing API should be tweaked
to always return the top thumbnail instead, but that is for a later time.

Also removed code that would clear the thumbnail associated with an
activity when it is resumed. I don't think there should ever be a
reason to clear a thumbnail -- it's much better to have *something*
for the task, even if it is a little out of date.

Change-Id: I83e6ca6403eb2df5e4de3009dfe8c210e8cf8d5b
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
560f555c43b23ae38013d1453be21471b3d86568 18-Sep-2012 Dianne Hackborn <hackbod@google.com> am c0b59093: am 4246f695: Merge "Try again to fix issue #6912004:tap on gmail notification sends me to home screen" into jb-mr1-dev

* commit 'c0b590932d611e842836d1662a4baa4812d07b21':
Try again to fix issue #6912004:tap on gmail notification sends me to home screen
ad9b32115bf8c84a93ab30e6f30f8c46e86d7244 18-Sep-2012 Dianne Hackborn <hackbod@google.com> Try again to fix issue #6912004:tap on gmail notification sends me to home screen

Add a new call to the activity manager to tell it when the activity
is resumed, so it can mark its state as dirty then instead of when
it first tries to create it.

Also tweak things to update the LRU list for the upcoming activity
at the point we start pausing the current activity, to avoid an
inefficiency where we may decide to kill the process of the upcoming
activity if it is at the end of the LRU list.

Change-Id: Ia6dc8c34dc6d4b085a1efbe3a5d5f47721d55078
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
397c1d8467fa5ab64341a8edf37256572adda8c4 17-Sep-2012 Dianne Hackborn <hackbod@google.com> am 0fd909ba: am d65afc65: Merge "More multi-user stuff." into jb-mr1-dev

* commit '0fd909bad1151cc39061abb52ae5b8be090e05dd':
More multi-user stuff.
5dc5a00e7ebadc085ded7e29feacd17e53698486 16-Sep-2012 Dianne Hackborn <hackbod@google.com> More multi-user stuff.

- New public APIs to find out when a user goes to the foreground,
background, and is first initializing.
- New activity manager callback to be involved in the user switch
process, allowing other services to let it know when it is safe
to stop freezing the screen.
- Wallpaper service now implements this to handle its user switch,
telling the activity manager when it is done. (Currently this is
only handling the old wallpaper going away, we need a little more
work to correctly wait for the new wallpaper to get added.)
- Lock screen now implements the callback to do its user switch. It
also now locks itself when this happens, instead of relying on
some other entity making sure it is locked.
- Pre-boot broadcasts now go to all users.
- WallpaperManager now has an API to find out if a named wallpaper is
in use by any users.

Change-Id: I27877aef1d82126c0a1428c3d1861619ee5f8653
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
8ff4baf8e434baa4c1729db42f092f108fde6499 11-Sep-2012 Dianne Hackborn <hackbod@google.com> am aaf7fdbf: am 01a7c79d: Merge "Various fixes." into jb-mr1-dev

* commit 'aaf7fdbf89da3064a0ef95263a71b0a754b7e136':
Various fixes.
f0d067ba448c757347cd54460c61c3be06afa76c 11-Sep-2012 Amith Yamasani <yamasani@google.com> am 4cf05484: am 5fc62663: Merge "Resolve the correct home intent for secondary users" into jb-mr1-dev

* commit '4cf0548452493cabbb7f7c09ab3ecb2ebe77ff8e':
Resolve the correct home intent for secondary users
2d1b37819112274f538d1886c379ff337eb0d9ed 10-Sep-2012 Dianne Hackborn <hackbod@google.com> Various fixes.

Bug #7132226: Can't start instrumentation due to ActivityManagerService crash
Bug #6912004: tap on gmail notification sends me to home screen

Change-Id: I824128b01f368de95dee288f8e49039b84479a7e
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
259d5e56a82d721ccb7e7f514c80de69acae309e 01-Sep-2012 Amith Yamasani <yamasani@google.com> Resolve the correct home intent for secondary users

Fix some searches through the Activity stack.

This allows SetupWizard to be launched for the second user.

Change-Id: Icd306319f511c902557bd9985d80dda228e32d96
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
37f5ec2a2178a39cc933d048aaa34e9417616c01 01-Sep-2012 Dianne Hackborn <hackbod@google.com> am 9b52f007: am 2701f325: Merge "Remove Binder.getOrigCallingUid()." into jb-mr1-dev

* commit '9b52f0071780160355376484a3992d2710160a3f':
Remove Binder.getOrigCallingUid().
4120375d46091df8527bb701882e056fbb0e6b06 31-Aug-2012 Dianne Hackborn <hackbod@google.com> Remove Binder.getOrigCallingUid().

Replaced all remaining places that used it with explicit user
specification.

While doing this, I ran into stuff that was creating PendingIntent
objects (that now need to specify the explicit user they are for),
which are also posting notifications... but have no way to specify
the user for the notification.

So the notification manager in the system process now also gets a
formal concept of a user associated with the notification, which
is passed in to all the necessary aidl calls. I also removed the
old deprecated aidl interface for posting/cancelling notifications,
since we now always need a user supplied.

There is more work that needs to be done here, though. For example
I think we need to be able to specify USER_ALL for a notification that
should be shown to all users (such as low storage or low battery).
Along with that, the PendingIntent creation needs to be tweaked to
be able to handle USER_CURRENT by evaluating the user at the point the
pending intent is sent.

That's for another change, however.

Change-Id: I468e14dce8def0e13e0870571e7c31ed32b6310c
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
99c8584954774bfdc3bd9d1f5c7691c8c56c1c83 31-Aug-2012 Dianne Hackborn <hackbod@android.com> am f4444412: am b2dd4e87: am 1a907db0: am 862c3835: am 4b60a8d1: Merge "Added check of ActivityInfo launch mode when starting activity."

* commit 'f44444120b84da822077cddd4ed37359c7de7481':
Added check of ActivityInfo launch mode when starting activity.
b2dd4e87ae8ac6a0402b7a0ed37201f27bcb1b9c 31-Aug-2012 Dianne Hackborn <hackbod@android.com> am 1a907db0: am 862c3835: am 4b60a8d1: Merge "Added check of ActivityInfo launch mode when starting activity."

* commit '1a907db07ea105ea65e146713f436ed072d7084b':
Added check of ActivityInfo launch mode when starting activity.
f958b321fa6038fdc40b930c38313d467319f88f 09-Aug-2012 Zoran Marceta <marcetaz@google.com> ActivityStack handler now use ActivityManager looper instead of ServerThread looper

Bug: 6957716
Change-Id: I36feb45ef7a85885ab812092c7b28e91886a4821
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
80a4af2bbc6af42ae605e454bf89558e564f5244 28-Aug-2012 Dianne Hackborn <hackbod@google.com> Start implementing concept of "running" users.

The activity manager now keeps track of which users are running.

Initially, only user 0 is running.

When you switch to another user, that user is started so it is
running. It is only at this point that BOOT_COMPLETED is sent
for that user and it is allowed to execute anything.

You can stop any user except user 0, which brings it back to the
same state as when you first boot the device. This is also used
to be able to more cleaning delete a user, by first stopping it
before removing its data.

There is a new broadcast ACTION_USER_STOPPED sent when a user is
stopped; system services need to handle this like they currently
handle ACTION_PACKAGE_RESTARTED when individual packages are
restarted.

Change-Id: I89adbd7cbaf4a0bb72ea201385f93477f40a4119
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
a10d1aa6c790810990a09f5dfa616075fe198eed 21-Aug-2012 Amith Yamasani <yamasani@google.com> Multiprocess activity should be allowed to run on current user

Multiprocess flag should override singleton checks.

This allows ChooserActivity to run in the process/user that launched it.
Wallpaper chooser from Launcher now works for secondary users.

Change-Id: I17a99278ed2a6d2491c3016a549134a85bc2af00
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
f02b60aa4f367516f40cf3d60fffae0c6fe3e1b8 16-Aug-2012 Dianne Hackborn <hackbod@google.com> Rename UserId to UserHandle.

This is the start of turning this into a formal public API.

Change-Id: I5786d2c320f1de41a06ed5d0f65adb68967287a0
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
f363dfd26c304bca33f12065a9ed3de291193962 16-Feb-2012 Johan Viktorsson <johan.viktorsson@sonymobile.com> Added check of ActivityInfo launch mode when starting activity.

When starting a singleTop activity from a singleInstance activity,
the onNewIntent() callback was not called when expected. The
reason for this was that only the launchMode specified on the
intent was checked and not the launchMode specified in the manifest.

Fixes issue 17137.

Change-Id: I1a9bc1007d6f5145bf93a6161534732bf5214b7a
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
7d19e0242faac8017033dabb872cdf1542fa184c 08-Aug-2012 Dianne Hackborn <hackbod@google.com> More mult-user API work.

- You can now use android:singleUser with receivers and providers.
- New API to send ordered broadcasts as a user.
- New Process.myUserHandle() API.

For now I am trying out "user handle" as the name for the numbers
representing users.

Change-Id: I754c713ab172494bb4251bc7a37a17324a2e235e
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
599db5c85faa5733af538a712b870e1f507cd380 04-Aug-2012 Dianne Hackborn <hackbod@google.com> Refactor Service code out of main ActivityManagerService class.

Change-Id: I83ade73b48e8fda1ad413634c1eb0dba2a545ca7
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
59c009776dae5ccbdfb93d7151ff2065ca049dc3 30-Jul-2012 Craig Mautner <cmautner@google.com> Introduce multiple displays with DisplayContent.

Fix a couple of bugs that turned up.
Remove touch/focus from display. Add iterators for access.
Respond to comments. Remove TODOs, and some deviceId parameters.

Change-Id: Idcdb4f1979aa7b14634d450fd0333d6eff26994d
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
45a25bcfc9af74bc4275cc710347304e581f3c51 28-Jun-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6745498: Cannot view consecutive event details from agenda view

- There was a long-standing bug when using FLAG_ACTIVITY_REORDER_TO_FRONT
where we could find and use an activity that is currently finishing.
- There was a recently introduced bug where activities being destroyed
would not be removed from the history stack at the time they are done
being destroyed, allowing the above bug to be exposed.
- Removing a task would not kill any processes associated with the app
that had a different name from the app itself.

Change-Id: I4401ab6d348a69e1ac4fb8f719d2c69d5a78e567
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
9e608c12186d308fb1711e8824901fdf931a3a96 26-Jun-2012 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #6381224: Initial emulator boot fails and shows a blank black screen." into jb-dev
1927ae8a56a010919a7535231fa0f7db70f7e152 23-Jun-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6717667: expanded notification actions don't work on the lock screen

FLAG_ACTIVITY_CLOSE_SYSTEM_DIALOGS was a mistake.

Instead, and the infrastructure for the status bar to take care
of closing and hiding things itself when you press these buttons,
just like it does for the main Intent of the notification.

Bug: 6717667
Change-Id: I1b22186e0cedc05f46a1a3ec78053a72afaf61b1
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
42e620caf0407f1b5e02935ac4323742c65459fd 24-Jun-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6381224: Initial emulator boot fails and shows a blank black screen.

Make sure that all cases where we remove an activity from the history
stack, we call resumeTopActivityLocked() to cause the home activity
to be launched if the stack is now empty.

Also fixed a problem where some timeouts would not be removed when destroying
an activity, and a race condition in boot that would cause the
PhoneWindowManager to initially start out with the home key not working.

Bug: 6381224
Change-Id: If046bb01aed624b0d9ee3bbaaba68ed6b98fd1d0
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
6e3d6daa3753be0ce170c1140cddd945e01e0a03 15-Jun-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6636731: Mariner animation ring gets stuck

Weren't cleaning out any ActivityOptions that are still attached
to a finishing activity.

Bug: 6636731
Change-Id: If0520bbcbf1d4ce19d46ff769918893cefda9c87
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
d3f175c8179e8fbb275a5ef53b5a6fc4d88c1f24 14-Jun-2012 Christopher Tate <ctate@google.com> Don't finish noHistory="true" activities behind the lock screen

The foreground activity is stopped when the device goes to sleep,
and started again when the device is unlocked. We now distinguish
this case from a "normal" stop, and do not finish() a foreground
noHistory="true" activity inappropriately when the device sleeps.
We also detect the case where an activity is started while the
device is still asleep, in which case the foreground noHistory
activity is cleaned up as part of bringing the new activity to
the foreground.

Bug 6657549

Change-Id: I9c6a0830aed0e47e4207b62803b90067c8486112
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
5007ddded6ec4b47c253d3c039806eb5dd77b40e 12-Jun-2012 Christopher Tate <ctate@google.com> Make sure to stop noHistory="true" activities properly

The code was correctly inducing a 'finish' when such an activity was
being stopped, but then was not continuing with the rest of the stop
bookkeeping at that point. In some circumstances this could result
in an inconsistent state, with the activity marked as finishing but
neither in the foreground nor stopped.

Bug 6585403

Change-Id: Ib5c5be885bc6534e099e040d87a8589f7b7454ce
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
84375876fcef73c5fa9c3de205c7db908ee14e15 02-Jun-2012 Dianne Hackborn <hackbod@google.com> Work on issue #6579997: Mariner entrance animation

Add a new variation of ActivityOptions that allows you to
supply custom animation resources and get a callback when the
animation starts.

Use this in SearchPanelView to determine when to start hiding
the search panel instead of having a fixed delay.

Fix some issues in the activity manager where we would cancel
the options in cases where we should actually keep them to give
to the window manager for a transition. (Basically when the
activity being started is not actually ending up launched, but
just results in a shift in the activity stack.)

Note that this is not quite what the design calls for -- the
entire search UI is waiting and then disappearing when the
animation starts, instead of the ring first disappearing while
waiting for the time to fade out the circle.

Change-Id: Iee9a404ba530908d73cdbd4a9d0d2907ac03428f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
e302a162359e191633e966520a6bab4ad569390c 15-May-2012 Dianne Hackborn <hackbod@google.com> A few odds and ends.

- Add documentation on "television" UI mode.
- Tweak new documentation and implementation around propagating
URI grants through choosers.
- Add new activity launch flag for closing system dialogs.

Change-Id: I978c05f0dc3d16e1c55d43631828b9efa6335b19
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
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/services/java/com/android/server/am/ActivityStack.java
bfc1be1101b87f193b043b62edd1722b8c4eb23c 15-May-2012 Amith Yamasani <yamasani@google.com> Fix a problem in finish affinity in Activity Manager.

Finishing tasks with an activity affinity was failing if the
activity was found at index 0. This fixes the loop condition.

Change-Id: If2e0d294e3e4493bca8b7efd40f24adaf2eb0b6f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
b61a02657b9e577179c934bbb5e199ce919c4642 15-May-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6020164: Settings crashed on orientation change...

...while listening to TTS example

This was a nice one. What was happening is that immediately upon
being created, the activity was starting another activity in a
different process. The second activity would never show, just
immediately exit. However the original activity had time to
pause and get into stopping itself before the second activity had
come back to the activity manager to say it was going away, resulting
in the activity manager asking the original activity to resume.

At this point the activity manager's state is that the second
activity is finishing and gone, and the original activity is
resumed. However in the app process the original activity is
still working on stopping itself, and it eventually completes
this and tells the activity manager. The activity manager now
changes its state to STOPPED, even though it is actually resumed
and that is the last thing it told it to be, and it is now
proceeding to set itself in that state.

This would result later in the activity manager sending an
unnecessary state change to the application. In the case of
the screen here, we next do a rotation change, the activity
manager thinks the current state is STOPPED not RESUMED, so it
tells the application to relaunch the activity in a new config
but not in the resumed state. Now it does the whole "start a
new temporary activity" thing again, at which point it tries
to pause the original activity again, and we have an unbalanced
onPause() call to the app and it falls over.

Change-Id: I38b680746f4c61ae30e7ce831e1de187adf60902
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
9158cbcbc9895e476606c5191168ee4a6c67c9c7 09-May-2012 Craig Mautner <cmautner@google.com> Remove incorrect CLEAR_WHEN_TASK_RESET behavior.

Fixes bug 6447950.

Change-Id: I6b512d5dd44c54e7b51f85c51783e8c942238c1d
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
755c8bfbffe5134232217ef4c3998194b344ae17 08-May-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6319312: Consecutive call to Activity's onCreate()/onResume()...

...without onPause() in between

There was a bug in the handling of "always finish activities" where we
would go through destroying activities while in the middle of updating
the activity stack. This would result in the activity behind the
non-full-screen activity being created and then immediately destroyed,
which things were not expecting.

Change-Id: Idaa89089f7b1af7eb747d7b8f9f394beeb2d23fa
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
ecc5a9cca000b62d2a649b795460fd791a206a89 27-Apr-2012 Dianne Hackborn <hackbod@google.com> Add new Activity.finishAffinity() method.

It's cool!

Change-Id: I9fdcd9535b7f1ca2b311d3a1b23e5d058977b095
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
e29ccb0d678c712c71bf73f1c66626feff4fa346 24-Apr-2012 Dianne Hackborn <hackbod@android.com> am b3a76660: am 78e62111: am fee88fdb: Merge "Issue: Foreground activity performs [Resume] and [Pause] when any process died in sleep mode."

* commit 'b3a766600275a004dfa2423e87229082d7f1232b':
Issue: Foreground activity performs [Resume] and [Pause] when any process died in sleep mode.
dbad287b62966399d0d5029f3b10932895010337 18-Apr-2012 p13451 <cheoloh.park@gmail.com> Issue: Foreground activity performs [Resume] and [Pause] when any process died in sleep mode.

Step to Reproduce
1) Turn off device’s screen. (Sleep mode)
2) Kill any process.
A. Engineer Version: kill [PID]
B. User Version: am force-stop [Package Name]
3) Foreground activity proceed [Resume] and [Pause] consecutively.

Reason: Since ICS version, activity goes to stopped status when screen turns off.
stopIfSleepingLocked( ) makes activity to stopped status but, pauseIfSleepingLocked( ) was used in GB
and, activity keep paused status and, this problem did not occur.
This change give effect to resuming activity when any process was killed.
Because, resume is proceed without exception for activity status.
The exception only filtered for [ActivityState.PAUSED] in sleep or shutdown mode.
and, resume complete flow when activity status was [ActivityState.STOPPED].

Solution for this issue:
We think that exception’s condition have to change if stopped activity status is intended in sleep mode.
According to activity life cycle, activity can not resume from stop status.

Also check [ActivityState.STOPPING]. :)

Change-Id: Icca3366ac30ffa3b18f6e2393e4d7309089ef26a
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
35be7560300a97fc3675bdd325910f28827d9508 19-Apr-2012 Jeff Sharkey <jsharkey@android.com> Move SystemUI out of system UID.

Add permissions for various things it pokes. Create new permission
to control launching non-exported activities from recents. Hidden
API to relax WallpaperService checks.

Change-Id: I547fdcd7c213dd153ae101533ce7c56cd8f86a0d
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
7f58b95f7c2bd75a991ec6a2f05676aaba47a544 18-Apr-2012 Dianne Hackborn <hackbod@google.com> Fix to custom scale animations.

These now do something reasonable when performing transitions
across two activities that are both on top of the wallpaper.

Fixed computation of the pivot point of the animations.

Fixed issue where the recents panel was considered a status
bar element for purposes of deciding if the animating elements
are obscured by the status bar, which would result in us not
running the animation correctly.

Change-Id: I4b9b588b80243463e6f087a9703ee886ee281630
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
95a6a96e1cfb79b1960bb2a9e6bc22d9d8e5a238 18-Apr-2012 Amith Yamasani <yamasani@google.com> Fix an NPE when launching an activity that's not found.

Bug: 6356194
Change-Id: I66aeeda3ecab36a4aa32fb78c1d0559a73cd9a7a
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
a4a54e2a5f383e766bfecaec776e0b00002badd1 17-Apr-2012 Amith Yamasani <yamasani@google.com> Make sure persistent processes are not replicated for secondary users.

An intent is launched in a singleton process if the process is persistent
and the resolved activity/service/etc is not requested to run in a different
process.

Change-Id: I1463e73a76bc8bde4185f9cf4395edb47515841d
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
162bc0ea0d7862b92f18d0ce47310a85304205f7 09-Apr-2012 Dianne Hackborn <hackbod@google.com> Some small tweaks to improve memory management.

We now allow processes that currently have stopping activities to
be managed as if they were done stopping, so that memory trimming
can be done before the process goes to the background. Hopefully
this will reduce cases where the processes goes to the background
and immediately gets killed, but wouldn't have had to be killed if
it had a chance to trim its memory.

Also change window memory trimming to always do the aggressive
trimming when memory is critical, even if not on a low-end device.

And tweak web view trimming to not trim for foreground UI events.

Change-Id: I241b3152b52d09757bd14a202477cf69c9b78786
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
8078d8c8a282ca81344febe7256f63b1e805e3aa 20-Mar-2012 Dianne Hackborn <hackbod@google.com> Add new thumbnail animation.

Use it for recent tasks switching.

Not perfect yet by far, but something.

Also fix issue #6186758: Twitter crashes after tapping on a tweet on JRM75D

Change-Id: I49bf6c94aafde875ac652dedaf96d6c08cc9e7d2
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
483f3b06ea84440a082e21b68ec2c2e54046f5a6 14-Mar-2012 Amith Yamasani <yamasani@google.com> Package restrictions per user

Packages can be enabled/disabled per user.
This requires maintaining stopped/launched states and
enabled / disabled components and packages per user.

Refactored pm.Settings and PackageSettingsBase to keep
track of states per user.

Migrated the stopped-packages.xml to users/<u>/package-restrictions.xml

Changed intent resolution to handle individual user restrictions.
Bunch of IPackageManager calls now have a userId argument.
Make AppWidgetService handle removals of packages.

Added some tests for pm.Settings and PackageManager.

Change-Id: Ia83b529e1df88dbcb3bd55ebfc952a6e9b20e861
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
7a2195cdd33f27c79eda343defc1f7ccf59cc8ac 20-Mar-2012 Dianne Hackborn <hackbod@google.com> Start using the new activity options argument.

New class lets you make an options bundle defining a custom animation,
as an alternative to Activity.overridePendingTransition().

Change-Id: I8e209bf52398a98ab9f1bcafa1ec0a580dae57c0
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
29ba7e66804e91cbd05fed74893061b4971ec52b 16-Mar-2012 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of 354e0346 to master

Change-Id: I432f5f43aa1e19c6a474e8656fe0e3715828e8af
2a29b3ad1350785aedea3442b38042885533576c 15-Mar-2012 Dianne Hackborn <hackbod@google.com> Debugging code for #6169553: Make Phone launch faster

The activity manager now has a tick when launching an app every
500ms, where it collects the current stack traces of the app if
it hasn't finished launching. These traces are included as part
of dumpstate.

This is only done on non-user builds.

Change-Id: I7f09ea00aab821ac81795f48c9d68fcca65f89fe
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
9da2d403344d7e8b67c966db4f064c4c7a2f5901 15-Mar-2012 Dianne Hackborn <hackbod@google.com> Fix swiping away recents to always kill processes.

This would only kill processes if there were activities associated
with the recent task; now it always kills processes.

Always fix some debug output.

Change-Id: Iccda19ba0a20823347b06c13b450587283d28284
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
a4972e951bf2bdb7afdafee95b3ab0c15b8bacae 14-Mar-2012 Dianne Hackborn <hackbod@google.com> Add new "options" argument to all startActivity APIs.

This will be used to allow new features to be requested... such as,
say, a special kind of animation. Right now there are no options
defined.

Change-Id: I4eb6f27275cdd4bf186f6da316ab93a2372ad4b7
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
92a8b22e7410e74e1cba1b856333116652af8a5c 10-Mar-2012 Siva Velusamy <vsiva@google.com> ActivityManager: add option to allow OpenGL trace.

This patch adds an option to enable tracing of OpenGL functions.
OpenGL tracing can be enabled by passing "--opengl-trace" option
to am start. This option requires either a device in debug mode,
or that the application itself has debug permission set.

Change-Id: I77788bfe97c9108943b1f947ce81afe8293d78a0
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
28ca8f9f95b1ee8186463bfc3f33b9383c0d1dd0 09-Mar-2012 Amith Yamasani <yamasani@google.com> Merge "Make SyncManager and AccountManagerService multi-user aware."
21c241e061de29a538008ca42df9c878184bcfb8 08-Mar-2012 Dianne Hackborn <hackbod@google.com> Add new Intent API for associating a ClipData with an Intent.

Allows applications to propagate multiple URI grants through an
Intent.

Later on, we should probably redefine the share actions to be
based on this ClipData with the old extras-based approach only
there for compatibility. Even if we don't do that, though, this
allows you to do a multi-select share that grants multiple URI
permissions by stuffing the URIs in a ClipData.

Also add some documentation in various places telling people how
they can grant URI permissions.

Change-Id: Id4ba8e72c11caf7e1f1f438cb7af058d1586a37c
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
04e0d265e3385e9d1fbc35e43c4e8caffbbe3290 14-Feb-2012 Amith Yamasani <yamasani@google.com> Make SyncManager and AccountManagerService multi-user aware.

AccountManagerService
- Maintain multiple account lists, one per user
- Keep multiple databases of accounts
- Account db moved to /data/system/users/<userid>/

SyncManager
- SyncStorageEngine keeps track of multiple users' accounts.
- SyncQueue maintained as a single instance, queueing requests from
multiple users.
- Changed some methods to take userId arguments
- Removed some deadc0de
- Store the userId in the SyncOperation, so we know which provider
instance to bind to when queued operations are processed.

ContentService
- Pass along the userid to sync manager calls.

ActivityManagerService:
- Fixed a bug in cancelIntentSender
- Don't bring other user's task forward when resetting tasks.

Updated tests

Change-Id: If317340ef68e902787aa3f5ceb4cf96f14aea695
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
00e6fc4c738a766c6f42b144c473385b944aa399 29-Feb-2012 Dianne Hackborn <hackbod@google.com> am 4953ec1c: am a2e0e3b5: am 27e20ccd: Merge "Fix issue #6073913: onActivityResult() not getting called..." into ics-mr1

* commit '4953ec1c71c4c2c134da2c969945c0d8b4fcb03c':
Fix issue #6073913: onActivityResult() not getting called...
5c607433e3d609e1a023adb496018fd1389a8ec8 28-Feb-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6073913: onActivityResult() not getting called...

...if the process is killed and restarted

Try to ensure that in all cases we deliver an activity result if one
was requested.

Change-Id: Id43e830d2ee782f98ed1e3b68e5e16f3258d4ad8
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
621e2fecb559d5afa5e43d58e8a7ee2d71c74430 17-Feb-2012 Dianne Hackborn <hackbod@google.com> Revert "Don't wait for current activity to pause before resuming next."

This reverts commit cbb722ed06092a9e2be37150aa8bc635f0fe21da.
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
40c8db5a28e9abae2033facce1354e3677911fcc 11-Feb-2012 Dianne Hackborn <hackbod@google.com> Move BroadcastQueue out of the ActivityManager class.

Change-Id: Ib468481588a1aa506ff00f3c4b1a6ecf672c7b99
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
a0c283eac33dd2da72235751bbfa4f2d9898d5ea 09-Feb-2012 Dianne Hackborn <hackbod@google.com> Add new feature for running services in "isolated" sandbox processes.

This reserves a range of uids (for each user) in which these processes
run. These uids are not associated with an application, so they
effectively run with no permissions. When a Service requests to
run in such a process through android:isolatedProcess="true", each
time it is brought up a new isolated process is started with its
own unique uid.

What we have so far gives us the basic infrastructure; more work
remains to further lock down what these uids have access to.

Change-Id: Ibfd27c75619cba61f528f46ede9113f98dc5f45b
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
cbb722ed06092a9e2be37150aa8bc635f0fe21da 08-Feb-2012 Dianne Hackborn <hackbod@google.com> Don't wait for current activity to pause before resuming next.

We can do this now that we ensure processes are not killed until
they have been stopped. If the two activities are in the same
process, the ordering will still be correct because we schedule
the pause before the resume.

Change-Id: I209ba739b41e832d35db3edd34d1e7af354cc183
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
742a67127366c376fdf188ff99ba30b27d3bf90c 04-May-2011 Amith Yamasani <yamasani@google.com> Multi-user - 1st major checkin

Switching activity stacks
Cache ContentProvider per user
Long-press power to switch users (on phone)

Added ServiceMap for separating services by user
Launch PendingIntents on the correct user's uid
Fix task switching from Recents list
AppWidgetService is mostly working.

Commands added to pm and am to allow creating and switching profiles.

Change-Id: I15810e8cfbe50a04bd3323a7ef5a8ff4230870ed
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
ae0a0a84d1a1e5fcba0b18d473e1f31e11b7018e 07-Dec-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5144065: Tap on Music icon from Home screen...

... a different app opens

In some cases when reparenting activities we could end up with a reply
chain that crosses task boundaries, so if an activity below that needs
to be reparented we pull that and the activities above it up into the
new task.

Change-Id: Ia4fa041ab7069e39dac162ddbf5b8e1de98675b9
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
50685606cfa045213bcc1bf29ce1c00c256b055c 01-Dec-2011 Dianne Hackborn <hackbod@google.com> Improve how we manage the previous app.

Setting it when a new activity is being resumed is too soon, because
things like an activity launching an exiting (without being seen by
the user) can knock out the real previous app that we want.

So now we set it when an activity is stopped. At this point it is
going to move from the preceptible to background oom adj, so it is
a good point to determine whether it should be a previous app to
instead put it to that oom adj. This also avoids things like
activities that start and immediately finish from impacting the
previous app.

Further, we keep track of the time each activity was last shown, and
use this to further filter what is set as the previous app.

Change-Id: I72d1cac4de0cc2d4598170296028f11b06918d4f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
813075a67897fec54699289972c642a48a2ba9d5 15-Nov-2011 Dianne Hackborn <hackbod@google.com> Maybe fix issue #5405788: Device continuously opening and closing...

...the "Complete action using" dialog

I have never been able to reproduce this consistently, but here is
another stab in the twilight. It looks like during boot we have
a potential race where we could reset the config sequence number after
we had gone through a config change, causing ActivityThread to ignore
a following config change. Maybe this change will help.

Change-Id: I4b731df5fd5c63894ca2e9bd34693b31ab1c0565
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
be70785f9b2dbd2c52fd8676d99bc64b22784201 11-Nov-2011 Dianne Hackborn <hackbod@google.com> Make activity manager more robust in the face of app activity leaks.

This came up from bug #5601885: Memory increase (leak?) in system_server
Stingray MR1

This isn't *really* a leak in the system process -- it is a leak in an
application process that is causing the system process to keep around
a bunch of ActivityRecord objects longer than it should, until that app
process is ultimately killed.

Unfortunately these days leaking an ActivityRecord also often means
leaking a thumbnail, which is a big slab of memory.

So make the activity manager better about this, using a weak reference
from the handle the object has so we can still clean away most of the
state associated with the ActivityRecord even if the client side leaks
its own reference.

Change-Id: Idbab45e09749cdfb54899203da7981e7b3576e25
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
28695e0c70db82e7ba0ce1c25ab10cc7fb04d40b 03-Nov-2011 Dianne Hackborn <hackbod@google.com> More performance work:

- ActivityManager now keeps track of previous app as you
move across the home app.
- Better debug info about why an activity is being destroyed.
- New performance tests.

Change-Id: I3a5ae7cb1b9f1624c6792a4f6184353f532b8f3b
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
f35fe23669aeeebd2db2acb6baacae503dba03a8 02-Nov-2011 Dianne Hackborn <hackbod@google.com> Add new OOM adjustment for the "previous" process.

This is the process that you had previously been interacting with
in the UI before the current one. Treating it specially should
allow us to improve the scenario of switching back and forth
between two apps.

Also add API constent for ICS MR1.

Change-Id: Ib3fe4df36b270be11dfd6b7e8d107c9994058a4d
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
98cfebc6e871937e296fc1c6b89e07cdc8d5ba28 18-Oct-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5461497: Landed on Welcome screen after a tap on 'Next' in Screen 500

The basic problem was that at some points during setup wizard, this would
happen:

1. The app's process is killed.
2. The app's process is restarted, but not to actually resume the
setup wizard activity, just to put it in the stopped state.
When doing this, the saved state is cleared but the app will
never provide a new one.
3. The app's process is killed again. At this point, because the
saved state is cleared, the activity is completely removed.
4. Eventually the entire activity stack becomes empty, and a new
setup wizard activity needs to be created as the home app.

There is a combination of bad stuff going on here.

First, why is the process being killed? At this point the setup
wizard is the home app, so it shouldn't be killed. There were two
reasons why this was happening:

- CryptKeeper still was not completely cleanly going away. To fix
this, I removed the check in the activity manager to not allow
an activity to finish if it is the only activity on the stack and
maybe-kindof looks like the home app. This really wasn't necessary
(we always take care of starting a new home activity if we find the
stack is empty), and outright dangerous with all of these things
purporting to be home but not.

- There was an issue in computing the oom_adj where the home app
would not be marked as "not hidden", and if we had to re-compute
its oom adj in the current sequence would then give it an
adjustment as a background process... and with all the processes
we spin through during boot, it quickly got down to background
#16 and killed.

Second, what is going on with the state? This is easier, the code
in the activity manager to create a new activity but put it in the
stopped state was still clearing the saved state. The saved state
should only be cleared when going in to the resumed state. When
going in to the stopped state, we can just keep holding the same
saved state.

Change-Id: I7d21cdcfa082d98ca70c79d9923e29605ee4353e
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
eabd328deea453a31d6b8f738c5bf0c3974d48b1 14-Oct-2011 Dianne Hackborn <hackbod@google.com> Fix bug with CLEAR_TASK -- wouldn't clear the top activity.

Maybe this will also fix bug #5144065 as well.

I doubt I am so lucky, though.

Change-Id: I60bf595d3eff79353fdd94b0f2a089e81218bc30
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
58f42a59bda3bc912d0d2f81dc65a9d31d140eaa 10-Oct-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5405788: Device continuously opening and closing...

...the "Complete action using" dialog

When an application goes idle, it sends back to the activity manager
the configuration it last used, to make sure the two don't get out
of sync. Fix a bunch of edge cases here in dealing with that, and
be sure to also send the current configuration when launching an
activity so the client is always up-to-date when launching.

Also a small fix to not show the upgrading dialog during first boot.

Change-Id: I14ed366a87cd689d1c78787369e052422290ac6f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
90c52de28691ca0bbbf7c039ef20f85ce46882cc 23-Sep-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5173952: Opening a Notification From Lock Screen...

...Should Skip Unsecure Lockscreen (ICS)

Also while I am in there, clean up logging of intent objects to include
even less sensitive information, while showing the true Intent in dump
output (since apps can't get to that).

Change-Id: I35fed714645b21e4304ba38a11ebb9c4c963538e
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
80a7ac10634dabb39644004f3edfc648a2c036f7 23-Sep-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5321282: Force Stop Button in Battery Screen Not disabled correctly

If the app had activities still finishing, when we checked whether it was
now stopped we would get told no. Also some other improvements:

- Schedule an idle as part of the force stop, to get any finishing
activities out of the stack soon rather than waiting for some activity
to idle.
- Don't filter out stopped system apps. This is dangerous because
system apps may have no way for the user to explicitly launch them,
so they could get put into a stopped state for which there is no way
to get them out. Also if the user really wants a system app to not
run, the new disabling mechanism is more appropriate.

Change-Id: I34003f21dac29e2ca0f66a23b88c710de41bab99
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
905577f6345c014fc2489a8068ea967ba8c18012 08-Sep-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5263361: Browser instance not created in application picker

The resolver activity was hiding the following activity from recents.

Also some other fixes: a little better memory use debugging, removed
some unneeded code from window manager, moved some system activities
into their own process, added some more running process information for
manage apps.

Change-Id: I66687d16989ff965d524b92dc360f37c19199717
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
29aae6f36e565b8f2a99f2193597b964bb800ee8 19-Aug-2011 Dianne Hackborn <hackbod@google.com> Fix issue #4279860: previous UI flashes before showing lock screen...

...(when turning display on after recently turning it off)

Also clean up when we decide to turn the screen on to improve that
transition. There are still problems here with turning it on
before the wallpaper gets dispayed.

Change-Id: I2bc56c12e5ad75a1ce5a0546f43a845bf0823e66
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
62f20ecf492d2b29881bba307c79ff55e68760e6 16-Aug-2011 Dianne Hackborn <hackbod@google.com> Add new am option to profile the launching of an activity.

Change-Id: Ie71a8043eafe41f53a0b3dbb5170276d87acbc9b
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
8e8d65ff5fdef12c6af3d003dfef19aadc39bea9 12-Aug-2011 Dianne Hackborn <hackbod@google.com> Fix some crashes that are happening in the system process.

- When shutting down, if the screen goes to sleep there is code
that tries to do a notifyAll without holding the lock:

java.lang.IllegalMonitorStateException: object not locked by thread before notifyAll()
at java.lang.Object.notifyAll(Native Method)
at com.android.server.am.ActivityStack.checkReadyForSleepLocked(ActivityStack.java:776)
at com.android.server.am.ActivityStack$1.handleMessage(ActivityStack.java:282)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at com.android.server.ServerThread.run(SystemServer.java:603)

- If an invalid Uri object is sent to the system process it can crash because
the Uri class throws an assertion while unmarshalling. Change this to an
IllegalArgumentException so it gets sent back to the caller:

java.lang.AssertionError
at android.net.Uri$PathPart.readFrom(Uri.java:2224)
at android.net.Uri$HierarchicalUri.readFrom(Uri.java:1106)
at android.net.Uri$1.createFromParcel(Uri.java:1689)
at android.net.Uri$1.createFromParcel(Uri.java:1681)
at android.content.IContentService$Stub.onTransact(IContentService.java:53)
at android.content.ContentService.onTransact(ContentService.java:120)
at android.os.Binder.execTransact(Binder.java:338)
at dalvik.system.NativeStart.run(Native Method)

- StrictMode can try to access the first index in the stack crawl of a stack crawl
array of length 0. Not sure why this happens, but make the code more robust:

java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
at android.app.ApplicationErrorReport$CrashInfo.<init>(ApplicationErrorReport.java:341)
at android.os.StrictMode$ViolationInfo.<init>(StrictMode.java:1978)
at android.os.StrictMode$AndroidBlockGuardPolicy.startHandlingViolationException(StrictMode.java:1097)
at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1068)
at libcore.io.BlockGuardOs.read(BlockGuardOs.java:137)
at libcore.io.IoBridge.read(IoBridge.java:426)
at java.io.FileInputStream.read(FileInputStream.java:179)
at java.io.InputStream.read(InputStream.java:148)
at com.android.internal.os.ProcessStats.readFile(ProcessStats.java:804)
at com.android.internal.os.ProcessStats.getCpuSpeedTimes(ProcessStats.java:564)
at com.android.internal.os.ProcessStats.getLastCpuSpeedTimes(ProcessStats.java:545)
at com.android.server.am.ActivityManagerService.updateCpuStatsNow(ActivityManagerService.java:1470)
at com.android.server.am.ActivityManagerService.batteryNeedsCpuUpdate(ActivityManagerService.java:1522)
at com.android.internal.os.BatteryStatsImpl$MyHandler.handleMessage(BatteryStatsImpl.java:110)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at com.android.server.am.ActivityManagerService$AThread.run(ActivityManagerService.java:1302)

(Also fix this code to not cause strict mode to trigger at all, because there is
no need, because this is just reading stuff from /proc.)

- The system seems to crash during boot if it thinks it needs to rotate
the screen, when it is trying to take the freeze snapshot way too early.
There is no need to freeze the screen during boot or if the screen is off:

java.lang.NullPointerException
at android.view.Surface.init(Native Method)
at android.view.Surface.<init>(Surface.java:256)
at com.android.server.wm.ScreenRotationAnimation.<init>(ScreenRotationAnimation.java:91)
at com.android.server.wm.WindowManagerService.startFreezingDisplayLocked(WindowManagerService.java:8758)
at com.android.server.wm.WindowManagerService.startAppFreezingScreenLocked(WindowManagerService.java:3971)
at com.android.server.wm.WindowManagerService.startAppFreezingScreen(WindowManagerService.java:4003)
at com.android.server.am.ActivityRecord.startFreezingScreenLocked(ActivityRecord.java:515)
at com.android.server.am.ActivityStack.ensureActivityConfigurationLocked(ActivityStack.java:3997)
at com.android.server.am.ActivityManagerService.updateConfigurationLocked(ActivityManagerService.java:12535)
at com.android.server.am.ActivityManagerService.updateConfiguration(ActivityManagerService.java:12439)
at com.android.server.wm.WindowManagerService.systemReady(WindowManagerService.java:6161)
at com.android.server.ServerThread.run(SystemServer.java:521)

Change-Id: I85062bb5f6b0909a0f52feedaa75e7611d9d7fbd
/frameworks/base/services/java/com/android/server/am/ActivityStack.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/services/java/com/android/server/am/ActivityStack.java
f0754f5ba7a45b517cffcb3c2c96f2a32aeac06d 22-Jul-2011 Dianne Hackborn <hackbod@google.com> Fix bug where memory trim was not being delivered with correct level.

Also improve how we handle services, keeping track of whether they showed
UI and if so putting them immediately on the LRU list.

Change-Id: I816834668722fc67071863acdb4a7f427a982a08
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
31ca854cdba31ec6ab089af743a8701a6192e07e 19-Jul-2011 Dianne Hackborn <hackbod@google.com> Fix issue #4976176: Font size setting does not persist

Change-Id: Id58caf990bdd3aac5ea97aaba45652ffad1f678a
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
ce86ba86df61de8b34b226a4eb6c23ec33e866e0 14-Jul-2011 Dianne Hackborn <hackbod@google.com> Improve handling of low memory.

Now classify background processes into a set of bins of how much
memory they should try to clear. The last bin also involves
destroying all activities in that process.

Removed the old code for the simulator that is no longer needed
(yay). The debugging features it had are now integrated into the
regular oom adj code.

Small fixes to load average service.

Change-Id: Ic8df401714b188c73b50dbc8f8e6345b58f1f3a0
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
6c418d585e0a91054b168fde3130188afd006c98 29-Jun-2011 Dianne Hackborn <hackbod@google.com> Fix issue #4902856: Don't let apps register non-explicit PendingIntents

Location manager now checks for such intents, and logs a warning when
they are given to it. Nothing thrown yet, it needs to check the
targetSdkVersion of the caller somehow.

When sending the pending intent, we require that the recipient hold the
appropriate permission. This should pretty much close the security hole.

Includes a bunch of infrastructure in the activity manager needed to
support all this.

Change-Id: I4dba7a98a7b8bbb9e347666451aa9cb1efad1848
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
b961cd2c80abf1d2834e5ad690904da4fe56d755 21-Jun-2011 Dianne Hackborn <hackbod@google.com> Don't report a resize unless the window's surface actually changed.

Change-Id: I133cf8e417753dba60d23a3bfc1c84ace983b335
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
2515db74fe2e75018f618591fabe23fda8362bf3 03-Jun-2011 Dianne Hackborn <hackbod@google.com> am 3a80c504: am 8b9a2b6c: am e6676351: Work around OpenFeint bug.

* commit '3a80c50485809fe72d6de83dacad494c5e84ed24':
Work around OpenFeint bug.
50469db07167e3a837e10f215baa4eacb1319604 03-Jun-2011 Dianne Hackborn <hackbod@google.com> am 7322e557: am a4cfcf10: am 75d6b3c2: Merge "Fix issue #4502672: Wrong xml resources used for homescreen widgets." into honeycomb-mr2

* commit '7322e557cfe42da42779625d69ced2db74a9df90':
Fix issue #4502672: Wrong xml resources used for homescreen widgets.
7dad2c24fa7811c115f850fd2a8f2ecc8874061e 03-Jun-2011 Dianne Hackborn <hackbod@google.com> am 9b94aa18: am e5d37701: am 8ea5e1d7: Fix compat mode bugs when updating apps.

* commit '9b94aa18f78e6c6281202e72b5a7451bc479fe82':
Fix compat mode bugs when updating apps.
e66763516a9c27c192adaba417616371a1c3c9bf 02-Jun-2011 Dianne Hackborn <hackbod@google.com> Work around OpenFeint bug.

Change-Id: Ib8320e50bb63fc56dc0118d5c8e9e328dbd3fcb1
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
36f80f3a5a3de42d4e7ca4b53d4aa3e567f4df6f 01-Jun-2011 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of 590ec479 to master

Change-Id: I30503da6a73b9cb15eee66a67c75d50ccdc4b9f0
2f0b17573d4324832f7a20402a3d2b5920bc4866 01-Jun-2011 Dianne Hackborn <hackbod@google.com> Fix issue #4502672: Wrong xml resources used for homescreen widgets.

There was a race in the system process between applying the initial
configuration and executing code in higher-level system services
like the app widget service that relies on the config. For some
reason it starting showing up more after my code changes; it should
now be completely fixed.

Also fix the activity starting window to run in compatibility mode
if its application is going to be in compatibility mode.

And some various cleanup and small fixes.

Change-Id: I0566933bf1bbb4259c1d99a60c0a3c19af1542e5
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
8ea5e1d79eb1f05ee7628b0d45ea8fc8eea5330d 28-May-2011 Dianne Hackborn <hackbod@google.com> Fix compat mode bugs when updating apps.

No longer accidentally puts an app into compatibility mode.

Also various cleanup, freezing screen while switching between modes.

Change-Id: Ic1b3958be7800189a93f68e9dee3c5adfc45fe57
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
36cd41f8efa6f6a683d3353d309ff548295af9e9 26-May-2011 Dianne Hackborn <hackbod@google.com> Spiffy new compatibility mode UI.

Change-Id: I1207eaafae59a434fcc979ad60a83e2d685288af
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
4a627c71ff53a4fca1f961f4b1dcc0461df18a06 01-Apr-2011 Christopher Tate <ctate@google.com> Full local backup infrastructure

This is the basic infrastructure for pulling a full(*) backup of the
device's data over an adb(**) connection to the local device. The
basic process consists of these interacting pieces:

1. The framework's BackupManagerService, which coordinates the
collection of app data and routing to the destination.

2. A new framework-provided BackupAgent implementation called
FullBackupAgent, which is instantiated in the target applications'
processes in turn, and knows how to emit a datastream that contains
all of the app's saved data files.

3. A new shell-level program called "bu" that is used to bridge from
adb to the framework's Backup Manager.

4. adb itself, which now knows how to use 'bu' to kick off a backup
operation and pull the resulting data stream to the desktop host.

5. A system-provided application that verifies with the user that
an attempted backup/restore operation is in fact expected and to
be allowed.

The full agent implementation is not used during normal operation of
the delta-based app-customized remote backup process. Instead it's
used during user-confirmed *full* backup of applications and all their
data to a local destination, e.g. via the adb connection.

The output format is 'tar'. This makes it very easy for the end
user to examine the resulting dataset, e.g. for purpose of extracting
files for debug purposes; as well as making it easy to contemplate
adding things like a direct gzip stage to the data pipeline during
backup/restore. It also makes it convenient to construct and maintain
synthetic backup datasets for testing purposes.

Within the tar format, certain artificial conventions are used.
All files are stored within top-level directories according to
their semantic origin:

apps/pkgname/a/ : Application .apk file itself
apps/pkgname/obb/: The application's associated .obb containers
apps/pkgname/f/ : The subtree rooted at the getFilesDir() location
apps/pkgname/db/ : The subtree rooted at the getDatabasePath() parent
apps/pkgname/sp/ : The subtree rooted at the getSharedPrefsFile() parent
apps/pkgname/r/ : Files stored relative to the root of the app's file tree
apps/pkgname/c/ : Reserved for the app's getCacheDir() tree; not stored.

For each package, the first entry in the tar stream is a file called
"_manifest", nominally rooted at apps/pkgname. This file contains some
metadata about the package whose data is stored in the archive.

The contents of shared storage can optionally be included in the tar
stream. It is placed in the synthetic location:

shared/...

uid/gid are ignored; app uids are assigned at install time, and the
app's data is handled from within its own execution environment, so
will automatically have the app's correct uid.

Forward-locked .apk files are never backed up. System-partition
.apk files are not backed up unless they have been overridden by a
post-factory upgrade, in which case the current .apk *is* backed up --
i.e. the .apk that matches the on-disk data. The manifest preceding
each application's portion of the tar stream provides version numbers
and signature blocks for version checking, as well as an indication
of whether the restore logic should expect to install the .apk before
extracting the data.

System packages can designate their own full backup agents. This is
to manage things like the settings provider which (a) cannot be shut
down on the fly in order to do a clean snapshot of their file trees,
and (b) manage data that is not only irrelevant but actively hostile
to non-identical devices -- CDMA telephony settings would seriously
mess up a GSM device if emplaced there blind, for example.

When a full backup or restore is initiated from adb, the system will
present a confirmation UI that the user must explicitly respond to
within a short [~ 30 seconds] timeout. This is to avoid the
possibility of malicious desktop-side software secretly grabbing a copy
of all the user's data for nefarious purposes.

(*) The backup is not strictly a full mirror. In particular, the
settings database is not cloned; it is handled the same way that
it is in cloud backup/restore. This is because some settings
are actively destructive if cloned onto a different (or
especially a different-model) device: telephony settings and
AndroidID are good examples of this.

(**) On the framework side it doesn't care that it's adb; it just
sends the tar stream to a file descriptor. This can easily be
retargeted around whatever transport we might decide to use
in the future.

KNOWN ISSUES:

* the security UI is desperately ugly; no proper designs have yet
been done for it
* restore is not yet implemented
* shared storage backup is not yet implemented
* symlinks aren't yet handled, though some infrastructure for
dealing with them has been put in place.

Change-Id: Ia8347611e23b398af36ea22c36dff0a276b1ce91
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
aa9d84c37e05f696ec158dac98ce38cf41e18314 10-May-2011 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of 05be6d6f to master

Change-Id: Ic6a6c5bb300f6f1d43f9ed550b284282b4f16212
e2515eebf42c763c0a2d9f873a153711778cfc17 28-Apr-2011 Dianne Hackborn <hackbod@google.com> Better compat mode part one: start scaling windows.

First step of improving app screen size compatibility mode. When
running in compat mode, an application's windows are scaled up on
the screen rather than being small with 1:1 pixels.

Currently we scale the application to fill the entire screen, so
don't use an even pixel scaling. Though this may have some
negative impact on the appearance (it looks okay to me), it has a
big benefit of allowing us to now treat these apps as normal
full-screens apps and do the normal transition animations as you
move in and out and around in them.

This introduces fun stuff in the input system to take care of
modifying pointer coordinates to account for the app window
surface scaling. The input dispatcher is told about the scale
that is being applied to each window and, when there is one,
adjusts pointer events appropriately as they are being sent
to the transport.

Also modified is CompatibilityInfo, which has been greatly
simplified to not be so insane and incomprehendible. It is
now simple -- when constructed it determines if the given app
is compatible with the current screen size and density, and
that is that.

There are new APIs on ActivityManagerService to put applications
that we would traditionally consider compatible with larger screens
in compatibility mode. This is the start of a facility to have
a UI affordance for a user to switch apps in and out of
compatibility.

To test switching of modes, there is a new variation of the "am"
command to do this: am screen-compat [on|off] [package]

This mode switching has the fundamentals of restarting activities
when it is changed, though the state still needs to be persisted
and the overall mode switch cleaned up.

For the few small apps I have tested, things mostly seem to be
working well. I know of one problem with the text selection
handles being drawn at the wrong position because at some point
the window offset is being scaled incorrectly. There are
probably other similar issues around the interaction between
two windows because the different window coordinate spaces are
done in a hacky way instead of being formally integrated into
the window manager layout process.

Change-Id: Ie038e3746b448135117bd860859d74e360938557
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
0c5001d776d56bae02a5cc2663286a125d99bc5e 13-Apr-2011 Dianne Hackborn <hackbod@google.com> Add APIs to remove tasks.

You can remove sub-tasks inside of a task, or an entire task.

When removing an entire task, you can have its process killed
as well.

When the process is killed, any running services will get an
onTaskRemoved() callback for them to do cleanup before their
process is killed (and the service possibly restarted).

Or they can set a new android:stopWithTask attribute to just
have the service automatically (cleanly) stopped at this point.

Change-Id: I1891bc2da006fa53b99c52f9040f1145650e6808
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
f26fd99a7c2f554b0297760bb66336473c7db61f 09-Apr-2011 Dianne Hackborn <hackbod@google.com> Rework thumbnails in activity manager.

We now only keep a thumbnail for the task, not for each
activity. However if you use FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET,
we will make a new secondary thumbnail for that series of
activities. There is a new API for the app to get these
secondary thumbnails.

Also set a default thumbnail size for non-xlarge screens
so we have thumbnails on phones. (We need some smarter
code in the platform for computing the actual thumbnail
dimensions of the current device). And add a test app
to show recent tasks + thumbnails.

Change-Id: Ic36759f6635522118a2cb7f156662229a610c492
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
a925cd4101dceefae6b9c0634084f9fa72b12344 10-Mar-2011 Dianne Hackborn <hackbod@google.com> Fix issue #4081756: Crash when un-stopping applications

Change-Id: Ifc23481f8feaeacb410375eefd015ebdb997e39c
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
e7f972122db87dc54e41ed1a6e417534d43bca3a 24-Feb-2011 Dianne Hackborn <hackbod@google.com> Implement issue #3426299: Introduce application "stopped" state

The package manager now keeps track of whether an application is
stopped. There are new intent flags to control whether intent
filters in a stopped application will match the intent. This is
currently used in one place, sending broadcasts, so that stopped
apps can not be launched due to background processes.

The package manager during first init makes sure no applications
are in the stopped state. When new applications are installed,
that begin in the stopped state. When the activity manager is
launching a component of an application, it ensures the application
is taken out of the stopped state.

The "force stop" button in manage applications will now put an
application back in to the stopped state; it can't go back out
of the stopped state until one of its components is launched by
the activity manager.

There will probably be a few more places where we need to filter
stopped applications out of intent matches, but doing this for
broadcast is a very big first step.

This also introduces a new broadcast that is sent to an application
after it is replaced with a new .apk. But only if the app is not
in the stopped state. This makes it a lot easier for developers to
implement code to get their application back in proper running shape
after an upgrade.

Finally another new broadcast is added that is sent to a package's
installer at the first time it is launched. This allows the installer
to tell the package about it being installed only when it is first
actually used.

Change-Id: I589c53ff0e0ece868fe734ace4439c0d202dca2d
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
57f1ac41337b019f6ad568769264ec519f917cf7 26-Jan-2011 Dianne Hackborn <hackbod@google.com> Fix issue #3380072: Switching in and out of gmail not preserving position in label

We were doubly-decreasing the task's activity count, so when selected
from recent tasks it would re-launch the last Intent rather than
switching to its current state.

Change-Id: I6e58c930a0755ae0142604d42b5cd2c668a2b492
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
ff801ec71399f7e8aa95bcbb9937c53144fe17c5 23-Jan-2011 Dianne Hackborn <hackbod@google.com> Fix issue #3302006: Cannot see the dialog lunched from a transparent activity.

The activity manager was not performing the layout pass on the new window,
because its app token was still hidden, because the activity manager / window
manager were still waiting for it to be ready to show.

Just ignore whether the app token is hidden for this case.

Also fixes some problems with animations, and tweaks the ViewConfiguration
values for xlarge screens.

Change-Id: Icbe9c77ba8127d1e02df2d6f27b8e86ec842e50a
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
4eba96bb314d8ff773ea33d6cb3179f25751ecce 21-Jan-2011 Dianne Hackborn <hackbod@google.com> Fix issue #3377999: Activities need to be stopped when sleeping

This is a band-aid over the existing kludgy stopping mechanism
where the semantics of stop are different in the activity manager
than in the clients.

This change is intended to be as unobtrusive as possible, only
impacting the sleep case. I have a different change that
completely reworks how we stop activities to simply this all
a lot by unifying the semantics between the server and client.
However, it is too late in HC for such an extensive change. Later
I'll revert this one and put in the better solution.

Change-Id: Id77f2db1ec83469cdd888acb8fbc4679daa7766e
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
6c2c5fc9930d14d502a22326dee9bf4475dbd649 19-Jan-2011 Dianne Hackborn <hackbod@google.com> Just a little 'ol activity manager permission change.

We no longer enforce permissions for applications that are accessing
their own components. This allows an application to require a permission
on one of its components that it does not itself have. This is useful
for example with the new advanced widgets, which require a system-only
permission on the implementing service to ensure the app's data stays
private but it is nice to allow the application to still touch its own
widget service.

Change-Id: I5d61930a083816919545870039ad191314ed48c6
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
94cb2ebfc3e789384a4c32b24ac1522cdcb3ae79 14-Jan-2011 Dianne Hackborn <hackbod@google.com> Fix issue #3330037: Unnecessary orientations appear...

...when the device's physical orientation is portrait.

We now hold off on computing app token orientation while preparing
to open or close app tokens.

Also clean up a few other little issues.

Change-Id: Iae125a975c7706fb4d068c872fd172e69854ff15
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
88819b276b8a91943e7ff6f0509a87307562b30f 22-Dec-2010 Dianne Hackborn <hackbod@google.com> Rework how recent tasks are added.

Now recents is updated every time an activity is resumed. This
should ensure the recent list is more consistent, in the face of
pressing back or things crashing.

Change-Id: Ibf59419014e549fac55f18633185edcb5ffcaa3c
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
7c8a4b37765b7b491ab7979d589062ef546212bf 15-Dec-2010 Dianne Hackborn <hackbod@google.com> Turn thumbnails back on.

Change-Id: I5b895d4f3558cbae3c5920a3672f02e48c00a8b4
/frameworks/base/services/java/com/android/server/am/ActivityStack.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/services/java/com/android/server/am/ActivityStack.java
17d9550029c443968e488ddcfb9549563a141823 10-Dec-2010 Dianne Hackborn <hackbod@google.com> Turn off screenshot capturing for thumbnails.

May reduce occurance of graphics hangs as a temporary stop-gap until
the real problem is fixed.

Change-Id: I57f831944cc621bcb1d1d2051bb48f14e53879b1
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
7da6ac33a9de82be52e22846d5f22d502452854c 10-Dec-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3272051: Use backward transition when going backwards.

Also know as:

Issue #3272051 Contacts edit view: Tapping the in-app back button
results in a forward transition

Yeah more complexity in deciding which animation to use.

Also reduce complexity in deciding which app's animation set to use,
to balance things out (and make it have less stupid behavior).

Change-Id: I78c6c5c5249a96206f7e03ce587c1dcb9a7dc14f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
0aae2d4e0075fd699cf40b26dca0eb2c3b3e37d2 08-Dec-2010 Dianne Hackborn <hackbod@google.com> Rework activity lifecycle so onSaveInstanceState() is after onPause().

The goal is to fix a bunch of fragment-related bugs caused by various
things trying to do fragment transactions after onPause()... which
currently throws an exception, since this is after the activity's state
has been saved so the new fragment state can be lost.

The basic change is relatively simple -- we now consider processes
hosting paused or stopping activities to be unkillable, and the client
code now does the onSaveInstanceState() as part of stopping the
activity.

For compatibility, if an app's targetSdkVersion is < HONEYCOMB, the
client side will still call onSaveInstanceState() prior to onPause()
and just hold on to that state until it needs to report it in once
being stopped.

Also included here is a change to generate thumbnails by taking
screenshots. The code for generating thumbnails by re-rendering
the view hierarchy is thus removed.

Change-Id: Iac1191646bd3cadbfe65779297795f22edf7e74a
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
621e17de87f18003aba2dedb719a2941020a7902 23-Nov-2010 Dianne Hackborn <hackbod@google.com> Implement issue #3221502: New APIs to support new back stack / task navigation

What this adds:

- A new Intent activity flag to completely replace an existing task.
- A new Intent activity flag to bring the current home task up behind
a new task being started/brought to the foreground.
- New versions of startActivity() that take an array of Intents to be
started, allowing applications to start a task in a specific state.
- A public moveTaskToFront() method on ActivityManager, with a new flag
that allows the caller to have the task moved to the front with the
current home task immediately behind it.

Change-Id: Ie8028d09acffb5349d98043c67676daba09f75c8
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
7eec10e6c99c30d5ee061fec08ac89ad4254ac32 13-Nov-2010 Dianne Hackborn <hackbod@google.com> Get rid of the extended themes.

We now decide whether to use a bitmap background based on whether the
window's drawing is hardware accelerated. To do this, there is a new
"state_accelerated" that state list drawables can be parameterized on,
and the standard window background uses this to select a solid color
or bitmap drawable as appropriate.

Introduces a little hackery to have wm preview windows pretend like
they are hardware accelerated even if they aren't, so the preview looks
closer to the actual app.

Also Add a DialogWhenLarge variation for the light theme.

Change-Id: I215a79d5df65ba3eed52ab363cade9d8218a6588
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
66a5d695ed9268869ca50e304bfeabd2a021c6cd 26-Oct-2010 Jean-Baptiste Queru <jbq@google.com> resolved conflicts for merge of b4ae2f1b to gingerbread-plus-aosp

Change-Id: I9d4e2649375d9262efe8aaade0778f638d04afa8
efb581018bbede2ecdc76bcd9722ded5b6903254 15-Oct-2010 Dianne Hackborn <hackbod@google.com> Debug logs for issue #3101415: Apps seem to have their UID changed over time.

- Activity manager now prints the pid doing a startActivity request.
- Package manager now remembers messages about problems it has parsing
packages.xml.

Change-Id: I11a75aa3953dbfa5dd41cfbdf69116c764ec228f
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
ba0492d5edd3e6e24d948c531b74ffb5fc9b922e 13-Oct-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3089800: adb shell am -W causes ActivityManager crash

Change-Id: I5508afeb523d84e552117f94c8b70e2bae2c33fa
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
3c4c2b7e6f0674068d13b42d4dcf0fd009df0c49 06-Oct-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3001368: API REVIEW: android.app.Activity

Bye bye, lots of junk.

Change-Id: Idd72fc525851277362b2a1ff3bb0f7865fe655fd
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
54e570f78b45d6c47578a4a2513097b590b6d43f 05-Oct-2010 Dianne Hackborn <hackbod@google.com> Make it easier to figure out whether an app can go on sd card.

Change-Id: I9195a0881b2c435b138f39c2ab1505dc820caf10
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
cef65eeb0315c3118bf8860d6f723cb49ff6bc52 01-Oct-2010 Dianne Hackborn <hackbod@google.com> Rub in a little 'ol log-b-gone.

Mmmmmm... great fresh scent!

Change-Id: I050e70b31b5d4a9c6731f15a4b51a3620a33a78d
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
034093a4ae94c0363cad36c60b41d41ea59420b1 21-Sep-2010 Dianne Hackborn <hackbod@google.com> Fix issue #2999757: "Application Redirected" dialogue showing up erratically

Give up on this for now.

Change-Id: Ic66a36d468f8bcb313d9bde2809124cdfd74adb3
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
8c5755aab5bac94a15e923d07c423629737fa6a2 14-Sep-2010 Dianne Hackborn <hackbod@google.com> Work on issue #2991868: A toast pops up informing users...

...that Market took over the screen after signing into a Google account

Don't warn the user about a new activity coming up on an activity that
is finishing.

Change-Id: I573073139d42a485473d0c8a7df450c1a23c35c3
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
0dad364adb9e9cbc2f7fa115602552f4897387ad 10-Sep-2010 Dianne Hackborn <hackbod@google.com> Add toast when an app intercepts the launch of another app.

The activity manager looks for cases where one app launches immediately
after another. If this happens, a brief toast is shown telling the user
when app is actually running and what was originally starting.

Change-Id: If94cf5bd393dd0bc0f09789dae044fde1386c481
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
a1c69e084b5242ad4e4a1ef2fe8d99ba259b5af4 02-Sep-2010 Dianne Hackborn <hackbod@google.com> Fix a small bug when granting permissions through activity results.

Change-Id: I2a5c4025fb5f566e29c219fde4d50ed2eba6e174
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
02486b1327e3007c62d253dd89ba9db1852b87f8 26-Aug-2010 Dianne Hackborn <hackbod@google.com> Hide heavy-weight API.

And give it a better name, for when it is later un-hidden.

Change-Id: Iae0d3054d44f873b9f953bc41d175a47802a185e
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
7e269644fcc319835f1e7f762f3cbd8087e3e22f 26-Aug-2010 Dianne Hackborn <hackbod@google.com> Don't retain global ref to last inflated context.

Also rework URI permission granting to support upcoming
clipboard use.

Change-Id: I9842920350955531c5a511c2ecc5215e8c783343
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
39792d2262352ae775091876d5488d2412a2ff92 20-Aug-2010 Dianne Hackborn <hackbod@google.com> Fix bugs with granting permissions through onNewIntent().

It would grant the permission to the temporary ActivityRecord,
not the real one, so it never got cleaned up.

Also allow granting of permissions to services because... well,
it would be really really useful. And it introduces some
refactoring that we'll need to support cut/paste.

Change-Id: If521f509042e7baad7f5dc9bec84b6ba0d90ba09
/frameworks/base/services/java/com/android/server/am/ActivityStack.java
50dc3bca5afbce911636b3ba15ee953bc203a9d6 25-Jun-2010 Dianne Hackborn <hackbod@google.com> Refactor ActivityManagerService activity stack.

Introdude a new ActivityStack class that holds all of the
state and management of a stack of activities. Paves the way
for having multiple activity stacks, though at this point
there should be no change in functionality and the activity
manager is still assuming there is only one stack.

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