History log of /frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
5022da313f6b2fbd16e55ebabaadbb308e96e908 22-Jun-2016 Chong Zhang <chz@google.com> Unblock 'am start -W' if activity is brought to front without launching

If -W is used to start an activity successfully, but this activity just
brings another activity to front without actual launching, the waiting
will be stuck because neither activity will report launch complete.

In this case, we have to treat it as if the -W started an activity and
received return code START_TASK_TO_FRONT. It needs to wait for the new
activity to become visible (or report launch complete if it's already
visible).

This reverts earlier commits afb776d5447e19565c9a826a554911decb9ed92a,
since it's causing problems with launch time reporting.

bug: 28333487
bug: 29451567
Change-Id: I9fd79ab5b3ed8f9de5df34ed9c7b0be3a94620b2
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
92ab103cb666059d48eca9e79977cf559abdde0a 04-Jun-2016 Chong Zhang <chz@google.com> Set fontScale in override config to be equal to global.

The default fontScale in EMPTY config is 1.0. This will result in
updateFrom always overriding the fontScale to 1.0 since it's non-zero.

We can't set it to 0.0 either as that will make the override config
not equal to EMPTY. The rest of the code doesn't work well with that.

So here we always set the override fontScale to be idential to global.

bug: 29113700
Change-Id: I1dbe507145b8190a9ae5e108948c833d4e037e1d
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
206b9faa09ada62ce07026301723805b687e9892 02-Jun-2016 Andrii Kulian <akulian@google.com> Fix task selection logic

When task was selected for activity launched with flag FLAG_ACTIVITY_NEW_TASK
first matching task was omitted if there was another match lower in stack.
This lead to task shuffling in same stack.

Bug: 28848683
Change-Id: I94e55693fc7ed926fc151ba988d257bd2417dd45
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
a8cc378d15b21c5d49c267fe300dbc7408dafb51 01-Jun-2016 Chong Zhang <chz@google.com> Do not sanitize override config for fullscreen

bug: 29063336
Change-Id: I65c5d635133a6b3791ce1aef63547f8d38ca24b5
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
f12fce1a3aa4b28335e3644057c346e205693189 28-May-2016 Andrii Kulian <akulian@google.com> Update override config to include some changes from global config

In override config for task we set Configuration#screenLayout field based on
initial global config + shrink to fit the area on screen given for this task.
However this field also contains information (like layout direction) that we
do not intend to override and it can be changed in global config separately.
In this case we need to update the override config with changes from global
config.

Bug: 28616488
Change-Id: I22673257621b3f9ae7933b37bd0fb9446c6042ea
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
f66a83db41711ebd1187bf9e99d0b21e428075f5 17-May-2016 Andrii Kulian <akulian@google.com> Rename minWidth/Height attributes

Rename WindowLayout#minimalWidth and #minimalHeight to #minWidth
and #minHeight to be consistent with other APIs.

Bug: 28775586
Change-Id: Ib7dc26318c4391693ef23f908b4d6090138dd0d7
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
3b23239d6ec9ded858d75f272ca1a677c5c431f9 14-May-2016 Wale Ogunwale <ogunwale@google.com> Fixed bugs with starting windows when displayng forcedResized activity

- Added ActivityOption to mark a starting activity as a taskOverlay
activity. That is the activity will always be the top activity of the
task and doesn't cause the task to be moved to the front when it is added.
- Only set the starting window state of the ActivityRecord to shown if
window manager actually showed the starting window for the activity.
Avoids incorrectly trying to remove starting window for an activity that
didn't show any.
- When starting additional activity in a task, transfer the starting
window from the top most activity with a starting window. It is possible
the top most window does have a starting window like in the case of the
forcedResized activity.
- Only ensure visiblity of an activity we are starting in a task whose top
activity is a task overlay. They need to start in the visible-paused state
and not the resumed state which just causes extra churn in the system.
- Always add additional starting activities in a task with an overlay
activity below the overlay activity.

Bug: 28751186
Change-Id: I3624a4313ae9c406d42c67a3537f67ad685791af
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
8563943bd39107b5a7ff9ea475592d0040423ba1 07-May-2016 Jorim Jaggi <jjaggi@google.com> Fix smallest width configuration calculation

For calculating the smallest width, we need to iterate through all possible
orientations, snap the task bounds to a valid snap target and then use the
smallest width across all orientations.

In addition to that, when flinging the divider handle to the bottom of the
screen, we need to pass in fullscreen task bounds to avoid that this new
logic applies so the maximizing app only receives one configuration change.

Change-Id: I37aa9a40938517dfaf26770eb41327d76aec7c62
Fixes: 28469673
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
afb776d5447e19565c9a826a554911decb9ed92a 23-Apr-2016 Chong Zhang <chz@google.com> fix "am start -W" hang on activity start

Normally launch time counts from the point when the activity is
resumed, to when the first window is drawn. However the activity
could become visible before it is resumed, due to some other
activity in the same task being launched. In this case we still
need to report launch time to unblock
ActivityStarter.startActivityMayWait().

bug: 28333487
Change-Id: I445b602f495ed0c3cb669e2d81a137280317534f
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
a09b4d2a611a7606e8fc8c73a24bd941b6fc173f 15-Apr-2016 Narayan Kamath <narayan@google.com> Remove unnecessary allocation+unboxing of objects.

Transforming String->int can be done with 0 allocations
using Integer.parseInt.

bug: 28078871
Change-Id: I8d9f322d7154728849dde61ef282046032858d60
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
dd3d44faf9d74a793458a515fddf153432601dd6 14-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix configuration calculation in multi-window

Bug: 27975877
Change-Id: I97dcbe7570fe2fdb82dafef8a07fe7351d901704
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
daea3572b3dcf2a40033896425e90c6bce52acc2 08-Apr-2016 Andrii Kulian <akulian@google.com> Fix minimal size for tasks in right-hand pane

Minimal size adjustment was not applying correctly to right-hand pane.
Also when task with minimal size set was moved to docked stack on the
right, first configuration was calculated only for its visible part.

Bug: 27621228
Change-Id: I36bc5cdfe08056ee1aea8b0cc08fd28e87e578cc
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
730bf061371129378f7b223998c2c623f896a849 01-Apr-2016 Winson <winsonc@google.com> Fixing issue where affiliated task last-active-times were inconsistent.

- We rely on the last-active-times of the task records to order tasks
in Recents, but for affiliated tasks, their last-active-time was never
set until the task was launched. This change just ensures that all
tasks have a valid last-active-time, and for affiliated tasks, ensures
that the task that they were launched behind always has a later
last-active-time.

Bug: 27597746
Change-Id: I9692c2b48ac6d12266de90bdf423f689402a94c2
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
933076d80561751618f462b26309ce9e4c3ff3bf 30-Mar-2016 Andrii Kulian <akulian@google.com> Refactor usages of Picture In Picture and Multi Window (1/4)

Bug: 27365860
Change-Id: I1590e430a12ceb84cb83da295e0bf7e4378fea96
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
49f87a6bb41bda9beda6bc07bbfb5e73fbb776c5 28-Mar-2016 Andrii Kulian <akulian@google.com> Merge "Persist task minimal width and height" into nyc-dev
650df4ae44cc81adef410c505d85306c40a2e103 28-Mar-2016 Andrii Kulian <akulian@google.com> Merge "Use correct task bounds after updating override config" into nyc-dev
18d751227ac802b27e928c79c44899ef67cd9e6b 28-Mar-2016 Andrii Kulian <akulian@google.com> Persist task minimal width and height

Previously minimal width and height were not applied if task was launched
from recents after device reboot. This CL persists minimal width and height
to XML and restores them when TaskRecord is restored.

Bug: 27621228
Change-Id: I74b98ac54e99755fa0c366e7b0e9577a2dfa9011
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
73336d81a62a975b4f57f592ff46fa3223f7df27 24-Mar-2016 Andrii Kulian <akulian@google.com> Use correct task bounds after updating override config

Use new task bounds after updating override configuration
when we move existing task to front or launch new one.
This fixes issues when task with defined minimal size is
launched in freeform or split-screen modes. In these cases
minimal size was not applied until task was resized manually.

Bug: 27621228
Change-Id: I0630962578815a77bfb556150cb71fec5a74ee37
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
2e751b8c778fd991fcdcec3bc2d1f32a722f436b 17-Mar-2016 Andrii Kulian <akulian@google.com> Update ActivityInfo#WindowLayout apis (1/3)

Adds documentation, renames Layout to WindowLayout and
splits #minimalSize to #minimalWidth and #minimalHeight.

Bug: 27528326
Change-Id: Idb440cb081a14ccdc83309284e906454633c4504
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
89182d5b476afd51f379341c6e74518b00eb9d64 11-Mar-2016 Wale Ogunwale <ogunwale@google.com> Notify task changed listeners when a pinned activity is removed

Bug: 27558494
Change-Id: I68573e5654f476e0b3027ad80d0e86496867f128
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
756ac8e0737499c638cdf7979435eae7fd4c48a5 11-Mar-2016 Rob Carr <racarr@google.com> Merge "Do not enforce minimum size for pinned stack." into nyc-dev
9c5867d8cd7f99bb601d7d8cbd6e7f8d53891d83 11-Mar-2016 Robert Carr <racarr@google.com> Do not enforce minimum size for pinned stack.

We don't need to enforce a minimum size for the tasks in
the pinned stack as the bounds are controlled by the system.

Bug: 27536840
Change-Id: I9ecb2ebd3792b2739d05e9f403fe0acba969e46a
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
7745c14aa0128da1358ec5d6e6ba4b609a5ac52b 08-Mar-2016 Suprabh Shukla <suprabh@google.com> Setting TaskRecord#mUserSetupComplete directly from Settings

TaskRecord#mUserSetupComplete flag was being set by checking
UserController#mSetupCompletedUsers which was being populated by a
callback which was getting delayed long enough for some tasks being
launched with mUserSetupComplete set to false, which is not expected for
any task other than Setup Wizard. This change checks the flag directly
from Settings before setting the property.

Bug: b/27455564
Change-Id: I9ae2e969b590a95f71002a54c7de224b26e9da79
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
715a1dcffd06e7d27a6c980a0ac8ca935362f08b 29-Feb-2016 Wale Ogunwale <ogunwale@google.com> Use realActivity name when comparing if intents are the same

The TaskRecord intent (usually the intent of the root activity) component
names are based on the realActivity (the activity we are actually launching
and not the input alias) and the ActivityRecord intent is based on the input
component name which can be an alias. This leads to issues when we are trying
to compare the intent of a task and an activity to see if they resolve to
the same thing since the component names will be different in the case of
aliasing.
We know base the activity intent component name on the realActivity before
comparing with the task record intent.

Bug: 27403679
Bug: 27112965
Change-Id: I196e03bb018582cbac977fb3ad45354f00f51578
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
9a08f827a4f8ac333402e22e5d45228abe8d98fa 18-Feb-2016 Wale Ogunwale <ogunwale@google.com> Apply minimal task dimension to all task bounds change.

We only used to apply the minimal dimension on resizeTask in
ActivityStackSuperior which is mostly used for freeform and
missed resizes that went through other channels like resizeStack
which is used for split-screen.
We now apply it on TaskRecord.updateOverrideConfiguration which
all task bounds changes go through.

Bug: 27220870
Change-Id: I856948c371f5f5f144e61029ced4a467f7ebe33a
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
82c9dc951e8e19b9eab6120b6465e08c5d69beba 06-Feb-2016 Jorim Jaggi <jjaggi@google.com> Fix configuration calculation when task is non-fullscreen

Apparently only the navigation bar is excluded when calculating
Configuration.screenLayout. Make the calculation for non-fullscreen
tasks consistent with fullscreen tasks.

Change-Id: I027e41e49ffe95245116f3d134e0bc93af0ee450
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
34f5c494df827c6f757cbfd50cb61b43e222f80e 12-Feb-2016 Winson Chung <winsonc@google.com> Merge changes If90955f4,I9fa48c06,Ib4681a43 into nyc-dev

* changes:
Adding view debug annotations to simplifying debugging state.
Disallow launching third party apps in safe mode.
Drawing thumbnail background color for empty space in view.
1af8eda6ea1c89d44123b2bfd5fa0293bb9d68cb 05-Feb-2016 Winson Chung <winsonc@google.com> Drawing thumbnail background color for empty space in view.

Change-Id: I2e8dfbe9c11a61876956658eff0674adb26d855d

Signed-off-by: Winson <winsonc@google.com>
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
d829d36f09d0ec9af3606a401f7773397fe0bbc5 11-Feb-2016 Wale Ogunwale <ogunwale@google.com> Force pre-N apps to be resizeable.

We feel this experience is better than the 2-finger gesture.
Added ActivityInfo.RESIZE_MODE_FORCE_RESIZEABLE resizeMode
to indicate we are force resizing an app.

Bug: 27132829
Bug: 26847884
Change-Id: I65db2de0d9f3f171cc3bb136cc1282b3ef3549b0
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
74e26595e609c3b6ddafb705779296d67ac9735b 05-Feb-2016 Wale Ogunwale <ogunwale@google.com> Further improvement to determining visiblility of tasks in home stack.

673cbd2b6932b39d6804cda2969b7f059c1ce748 introduced logic to make
non-top activities in the home stack invisible under certain
conditions. However, this caused problems with the set-up wizard which
uses the home stack to launch all its activties. Changed the logic to
determine if the next task in the home stack should be visible behind
vs. the next activity in the same task. So, activities in the same task
in the home stack can be visible at the same time, but not activities
in different tasks.

Bug: 26922407
Bug: 26571156
Change-Id: Ied20d45cd27a1adcc105703d8ca21861d1856700
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
39d1b5b0f74962a4f2a6b8125f841ecf6e7cb2ee 05-Feb-2016 Wale Ogunwale <ogunwale@google.com> Merge "Exclude tasks manipulated before user setup is complete from Recents"
f80170f455c269b8e0264a5441770faf39e69416 05-Feb-2016 Wale Ogunwale <ogunwale@google.com> Exclude tasks manipulated before user setup is complete from Recents

We don't want any tasks manipulated before the user is done setting-up
their device included in the tasks list we give to the Recents activity.
However, the task can be included back in Recents if it is manipulated
after the user set-up is complete. E.g. you go into the gmail activity
during setup the task will be exclude, but if the user goes back into
gmail after setup then we start including the task.

Bug: 25959392
Change-Id: I421d48f0a9bcfc782d1ef19aa2f63e8b34a668e2
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
8202b2a5db2219c72c4895b497d256ddca216821 04-Feb-2016 Jorim Jaggi <jjaggi@google.com> Use separate flag to suppress resizes

When moving a task between stacks, we temporarily suppress resize
changes because while moving, the task is still in another stack
which might get resized by the docked stack because when fetching
the stack, we might create it and thus resize the other stack.

Introduce mTemporarilyUnresizable which makes it really not resizable,
regardless of whether we are force resizing our activities.

Change-Id: Ib51163a0606106fd55f5bdeecf8e53f08add4b4b
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
0a932141980b576e0b9bcec9a077f55b7b269a02 02-Feb-2016 Jorim Jaggi <jjaggi@google.com> Exclude stable insets from task config

When a app is in fullscreen, we exclude navigation bar and status bar
size when calculating the config. However, when in multi-window, and
the task was almost fullscreen, the height/width reported to the app
was actually larger than when it was in fullscreen. In order to fix
this, exclude the stable insets when calculating the task
configuration, and also fix a bug when calculating the screen layout.

Change-Id: I843ae012fb3050c79643d125550aacb6e73d27da
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
22e2526b64a124a641f79de504d201005174754b 01-Feb-2016 Wale Ogunwale <ogunwale@google.com> Improved timing of when system sends multi-window change event to app

We were previously sending multi-window/PiP mode changed events to
apps once the task config is changed in activity manager.
However, the actual changing of the multi-windowing or PiP mode
might not be fully complete when the app receives the event so they
might be wrong state information they query for like currnet config.
We now schedule the events to be send once the current transaction
cycle is done.

Bug: 26877409
Change-Id: I393b56035bb4197f99b3db3d27c0599835b5f86c
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
cd872fb2663ff2e1b018ddbe9187f355c066f5cd 01-Feb-2016 Wale Ogunwale <ogunwale@google.com> Merge "Improved logic for determining visiblility of activities in the home stack"
3b93a4d351aeb154fba8a4b2fa66ca25a951993d 30-Jan-2016 Wale Ogunwale <ogunwale@google.com> Renamed Activity class multi-window APIs

As requested by API council.

Bug: 26507736
Change-Id: I2a87c5eb3c1b48d52703103c2a4f72c250a9a827
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
673cbd2b6932b39d6804cda2969b7f059c1ce748 31-Jan-2016 Wale Ogunwale <ogunwale@google.com> Improved logic for determining visiblility of activities in the home stack

- No other activity in the home stack should be visible behind the home
activity. Home activities is usually a translucent activity with the
wallpaper behind them. However, when they don't have the wallpaper
behind them, we want to show activities in the next application stack
behind them vs. another activity in the home stack like recents.

- We don't want any other activities in the home stack visible if the
recents activity is going to be returning to an application activity
type. We do this to preserve the visible order the user used to get
into the recents activity. The recents activity is normally
translucent and if it doesn't have the wallpaper behind it the next
activity in the home stack shouldn't be visible when the home stack
is brought to the front to display the recents activity from an app.

- Also fixed issue with not setting correct return type for tasks
when they don't have Intent.FLAG_ACTIVITY_TASK_ON_HOME flag set.

Bug: 26571156
Change-Id: I45ef795c6a19ab859e9f6204fb059e875ad798c5
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
513346d8f58e13999133872478a966ea4262701f 27-Jan-2016 Wale Ogunwale <ogunwale@google.com> Don't allow non-dockable activities/tasks in docked stack.

Prevent activities and tasks that are not resizeable and don't
support crop windows resize mode from going into the docked stack.

Bug: 26774816
Change-Id: I1fd23114685be15908e80e8bc5a0216d8bfd049e
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
b1faf60b896afe235175354ffd90290ff93a54b4 27-Jan-2016 Wale Ogunwale <ogunwale@google.com> Use resizeMode integer instead of resizeable boolean.

Changes activity manager and window manager to use resizeMode
as defined by ActivityInfo#resizeMode instead of a boolean.

Bug: 26774816
Change-Id: I8cef46d9fba6bfdd21df7da63ed5d5330ad03d4b
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
d26176f36039e33b575c044aa119c57e82744847 26-Jan-2016 Wale Ogunwale <ogunwale@google.com> Support different multi-window compatibility modes

- Change idea of activity resizablility from true or false to
unresizeable, cropped_windows, resizeable, and resizeable_and_pipable
- Default pre-N apps to cropped_windows mode and N or greater apps to
unresizeable or resizeable depending on the value of resizeableActivity
attribute.
- Mark legacy apps that specify fix orientation or immersive only mode
as unresizeable.
- Change to hide docked stack when unsupported app is the focus app.

Bug: 26774816
Change-Id: Ie473d36ca95f08e9332ab10fd2f0ec17ef50a02f
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
4ccec532d704725cd6115c220f56330edf101674 13-Jan-2016 Andrei Stingaceanu <stg@google.com> Hide suspended apps from recents

* Introduce a new boolean realActivitySuspended in TaskRecord to
keep track of the suspended state (this also makes sure the
information is persisted across reboots).
* Introduce a new method onPackagesSuspendedChanged
in RecentTasks which flips the realActivitySuspended for each
TaskRecord for the desired user and packages sent
* Register a new broadcast receiver (for SUSPEND/UNSUSPEND)
in ActivityManager#finishBooting which calls
RecentTasks#markPackagesSuspendedStateForUser
* In ActivityManagerService#getRecentTasks filter out
Taskrecords for suspended apps by checking realActivitySuspended

Bug: 22776761
Change-Id: I52e3593ccb2dae223d1ea11d017a6b1626646639
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
a95ca8de4d8b971d41abe44cd54e82560d1e0b37 16-Jan-2016 Jorim Jaggi <jjaggi@google.com> Fix unneccesary activity relaunches

When going from fullscreen to non-fullscreen configuration, task config
changes was always non-zero because in fullscreen, task override config
was empty. Instead, use the actual previous configuration to calculate
diff.

Also make recents handle screenLayout changes.

Bug: 26593320
Change-Id: I57633d60b1e0fc4ae506e276410191a44e1fe221
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
d49352afd40b521cefae3d2ba6f4ef1aff866de0 20-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Merge "Revert "Temporary logging to debug ActivityStarter crash.""
5ded99777adb734a62f7c367b29f589e72955e48 20-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Revert "Temporary logging to debug ActivityStarter crash."

Bug: 26541093

This reverts commit 7fca6d50a57cbc1a45beca1d5d1e5cd1e696fbef.

Change-Id: I41fb70e79f2da6523c40f09a74d1980cbeb2149e
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
be9dabdc0f279744953c61b8362c27c858fef135 19-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Don't remove task needed for reuse when clearing during activity start.

Bug: 26541093
Change-Id: I4ed39110e9bd72e5f7e11a49acc0a36dc8414df4
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
7fca6d50a57cbc1a45beca1d5d1e5cd1e696fbef 17-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Temporary logging to debug ActivityStarter crash.

Bug: 26541093
Change-Id: Ia2887c1735ea6a5a964c01b63019288b96ef6172
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
3ee3b9d17b2aec84e791f3efa6b9453cab0d9c9b 16-Jan-2016 Suprabh Shukla <suprabh@google.com> Merge "Keeping only running users recents in memory"
09a88f5f3e7d4a3bbfce04ac06594ac590c67d27 02-Dec-2015 Suprabh Shukla <suprabh@google.com> Keeping only running users recents in memory

Currently, all the users' recent tasks are loaded into memory and kept
in sync with the persistent storage. This changes the system so
that it loads a users recents into memory lazily (i.e. when
getRecentTasks is called for that user) and unloads them from the
memory as soon as the user is stopped. This also required bucketizing
the taskIds per user, so that the next available taskId can be assigned
without having knowledge of all the tasks that are stored away in
persistent storage but are not available in memory.
Bug-Id: b/24569398

Change-Id: Ia5cb64d9f4ee727225dce34e45ca63e946ac27a8
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
3e979d6229a0ad2d9c3c7b05a97d01b5cde03337 13-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Merge "Only request stack resize after non full screen bounds were set."
dce2d161701f318ec71f8fe8de03031e1c4b0046 13-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Only request stack resize after non full screen bounds were set.

Also make sure that the bounds passed to stacks and tasks are not bogus,
as these would mess up the configuration.

Bug: 26512887
Change-Id: I1a3a9c867a2c258a326b31df2bac614ccbb00579
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
7d5f510e6c4bfde4f9f1d3d2d7ee696efa0460d8 13-Jan-2016 Chong Zhang <chz@google.com> Launch non-resizeable task with fullscreen bounds in docked stack.

This case could happen in real world if a non-resizeable activity opens
another activity (eg. Messenger app opens an activity to write up the
message). Need to make sure the new activity is not resized.

Change-Id: I222985fa7ee2cbd94c843ac1190239cce31d3c0c
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
3c2db1d174f4ac7462f8b95430bde1d867b47797 07-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Set screenLayout in task configuration override.

This prevented loading of correct resources when activities are in multi
window mode and the resource had a qualifier that used screen layout.
Specifically, it was causing problem with having the correct minimum
dialog size.

Bug: 26251921
Change-Id: Ia4c16685bd4ef51fcf8283f4fa29602fc93fa10f
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
6cae765b67d3a3b37e2cacbc9816665b5bc080b9 26-Dec-2015 Wale Ogunwale <ogunwale@google.com> Added support for android.R.attr#alwaysFocusable

Allows an activity to always be focusable regardless of if it is in a
stack whose activities are normally not focusable. For example, activities
in pinned stack aren't focusable. This flag allows them to be focusable.

Also, changed ActivityInfo.#{resizeable, supportsPip} to use flags.

Bug: 26273032
Bug: 26034613
Change-Id: I8c63e6d3256757e2e6931e08b8a65269f5169d35
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
d046a013921c2ac67318c1543a8b7b9c83b40d65 24-Dec-2015 Wale Ogunwale <ogunwale@google.com> Consolidate resume activity code around focused stack.

Cleaned up the code to make it obvious that only the top
activity in the focused stack should be in the resumes state.

Bug: 26273032
Change-Id: I8d60270f707fe022007c59d25f5678b33a005acf
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
393819709787326a38cde883493ebf04fe62bd8b 18-Dec-2015 Wale Ogunwale <ogunwale@google.com> Fixed some issues with tasks with the same affinity in different stacks

- It is possible for tasks in different stacks to have the same root
affinity. This can be an issue when we are looking for the best task to
launch an acitivty into since there can be a better match in a different
stack based on class name. We now save the task matched by root afinity
and try to find a better match by class name. If we don't find a better
match we use the match based on root affinity.
- For pinned stack we don't allow root affinity matching as no other
task should be launching in the stack based on affinity.
- Correct ASS#moveActivityToStackLocked to use the passed in stack id
instead of the PINNED_STACK_ID.

Bug: 26015860
Change-Id: I6ec44bc97bf3c669c2305a58563518cf9bfc7804
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
5f986095bed776c119d2f5452e0afeac3a437ea2 05-Dec-2015 Wale Ogunwale <ogunwale@google.com> APIs for activity to know when its windowing/pip modes change

Added APIs that allow activities to ask the system if they are currently
in multi-window or picture-in-picture mode and also get notified when
their modes change.

Bug: 25509834
Bug: 25683717
Change-Id: I4b8c316a49940bd6a8b31a93b345f9fd725a4721
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
75b3720c50752d988d361a57b2d32f8baaee3e28 04-Dec-2015 Chong Zhang <chz@google.com> Fix app over lockscreen being cropped by docked stack

When secure apps are launched over lockscreen, the bounds should always
be fullscreen. Also docked stack and divider shouldn't be visible while
lockscreen is shown.

bug: 25837786
Change-Id: I0bc681cdb46404fb79e9332d1f82fee51f338da9
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
b15758ab7a6481717d0d29612e870d7241061c31 17-Nov-2015 Chong Zhang <chz@google.com> Support scrolling for non-resizeable tasks in side-by-side mode

Display toast when a non-resizeable task is put into side-by-side mode.

Scroll the task upon a two-finger scroll gesture.

bug: 25433902

Change-Id: I69967056a564cfe7773afb80aa7e7ea7167a791a
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
8b1871d74137d7e36ba0fed5608772f51f62015b 20-Nov-2015 Winson <winsonc@google.com> Adding tuner params for paging and full screen thumbnails.

- Adding “focused” stack state to support paging
- Changing the paging to match UX spec (only auto-page after the first
tap)
- Removing old header focus animation

Change-Id: Id72825b8a1b1c0a2238ee184a6695b13c1d8cb1c
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
3856bf7fb9ed3987cd08760d92ca3e19dc3b5f51 20-Nov-2015 Wale Ogunwale <ogunwale@google.com> Fixed unexpected configuration change causing activity relaunch

In commit ebcc875f we migrated the setting of the task override
configuration from WM to AM. However, the migration changed the
construction of the override configuration to take in the service
configuration as the starting value. This is incorrect since the
only values that should be set in the override configuration are
the ones that change due to resizing. We now seed the override
configuration with the EMPTY value to make it obvious that the
object should be constructed with the default values.

Also, fixed issue with WM telling activity manager to resize a stack
when the stack is already the size it wants.

Bug: 25776219
Change-Id: I882979aa87b49e7a5dc993bd9223fbd6e6cf6471
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
ff3c66c5977df8371a77a1c38158abe8ab039a0a 19-Nov-2015 Wale Ogunwale <ogunwale@google.com> Fix build breakage.

Change-Id: Ie60b148d61d746de354b12852d4a6db2d82121c5
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
76415ee5008a60e015a2861f75de3a44f60741cc 19-Nov-2015 Wale Ogunwale <ogunwale@google.com> Merge "Allow apps to set launch bounds for activities."
7a8fa60962110878ff4e5db67f3b2710189dffb9 19-Nov-2015 Wale Ogunwale <ogunwale@google.com> Allow apps to set launch bounds for activities.

unhide ActivityOptions APIs for setting launch bounds for
an activitiy so apps can use it. Only works on devices that
support PackageManager#FEATURE_FREEFORM_WINDOW_MANAGEMENT.

Bug: 25499677
Change-Id: I75424681f25cbb9fe92f2ed73e6afbab765dab29
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
2359314fd41801005993fc8416eeb4fb38dd75a0 04-Nov-2015 Suprabh Shukla <suprabh@google.com> Moving recent tasks information to a user directory

The directories recent_tasks and recent_images are moved from
/data/system/ to /data/system/users/<n>/

Bug: b/24569398
Change-Id: I538969d86ebf14fb2d44257be1e6c0a7ff61ed8d
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
c6a2da07bf6334818c184fed486cecf39976f089 12-Nov-2015 Winson <winsonc@google.com> Fixing crash when trying to set thumbnail info.

- The TaskThumbnailInfo can have the same lifecycle as the TaskRecord, and
we should just reset it instead of setting it to null when the thumbnail
is disposed.

Bug: 25652261
Change-Id: I54384e208b19e60d469bf3471dd555f78f04290c
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
7790fda948e0d878bfda72a18d132eabea0a49cf 11-Nov-2015 Wale Ogunwale <ogunwale@google.com> Merge "Set right bounds/configuration for task when positioned in stack."
935e50292e1404dc5f1705b2a1719cdaee3072b0 10-Nov-2015 Wale Ogunwale <ogunwale@google.com> Set right bounds/configuration for task when positioned in stack.

When AMS.positionTaskInStack API is called we need to make sure
the task has the right bounds and configuration if it is moving
to a different stack.

Bug: 25501082
Change-Id: I2a80aa08a4ee52d860502ab16b6cdb432c954084
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
974f55fa13358cd3f4ffebaf4d9fddbb4c9a3431 10-Nov-2015 Winson Chung <winsonc@google.com> Merge "Saving additional context when taking task screenshots."
6c5eb1c6fea1475bbc75a9f13317d039073ed1eb 10-Nov-2015 Wale Ogunwale <ogunwale@google.com> Fixed issue with not been able to dock task from recents after reboot

- Always set the docked stack mode when starting a task from recents
even if the task is already in the docked stack. The caller might want
to change the docked stack location.
- Return last persisted bounds for task that hasn't be restored into a
stack yet when AMS.getTaskBounds is called.
- Make sure there is a valid top activity when moving a task to a stack
before trying to preserve the window.

Bug: 25590206
Change-Id: Id115fc62c28913f999c62cdbbaccd887daa0fab5
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
c809cbb92692cf5140fd5a452fc24214a098d937 02-Nov-2015 Winson <winsonc@google.com> Saving additional context when taking task screenshots.

- Save the original task size and screen orientation. This ensures that
we will be able to display the screenshots in the right orientation if
we start taking non-square thumbnails.

Change-Id: I17ffe1fc05a447f67753149695a4eaf0baa36e8e
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
74f9f165c2b57112b170deb23ce62ac408043d13 07-Nov-2015 Suprabh Shukla <suprabh@google.com> Fixing recent tasks not getting restored at startup

Check for empty list before reading activity at index 0.

Change-Id: If87e3c4d2cedd86fdb427ddfb27d1f32f8f93412
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
6d42df6d176a8defb3e1f1dedc128763a8b91677 05-Nov-2015 Wale Ogunwale <ogunwale@google.com> Set correct focus activity when using FLAG_ACTIVITY_REORDER_TO_FRONT

When FLAG_ACTIVITY_REORDER_TO_FRONT is used to launch an activity we
move the activity to the front of the task, but the ActivityRecord.frontOfTask
isn't set because the activity isn't in the resumed set yet.
This causes issues later on when we try to detemine the focus activity in
ActivityStack.adjustFocusedActivityLocked.
We now set ActivityRecord.frontOfTask for the activity we are moving
due to FLAG_ACTIVITY_REORDER_TO_FRONT

Bug: 25487874
Change-Id: I4a20e6fb11e04ae16361da27c59aec2641b82bfb
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
3797c22ea16e932329ebffdc7e7ce09f9ecd9545 27-Oct-2015 Wale Ogunwale <ogunwale@google.com> Added StackId object for checking what features a stack supports

Helps make the code easier to follow since we are no longer checking
multiple stack ids at various decision points.

Bug: 25282299
Change-Id: Ifa6864a1ef56ce2eca4c94f87a4e0b993de987cd
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
8ccdf3ac49b658737b8106bc921347a3d3e3bbbc 22-Oct-2015 Jorim Jaggi <jjaggi@google.com> Add development option to force everything resizable

Add a development setting to force all activites to be
resizable. Currently, a restart is required after changing
this setting. Also remove all the code that forced a single
task to be resizable, as we have a global option now.

Bug: 24815256
Change-Id: I3237c9b6ce96ff9aa9819592ab0c2807fde88dc4
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
99db1863a84364339fc5dc9142f15910cdd96ed8 24-Oct-2015 Wale Ogunwale <ogunwale@google.com> Added support for pinned stack.

Used to support picture-in-picture use case for multi-window

Bug: 25006507
Change-Id: I3bef3f75e0c003f5974274294f1250171d424625
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
fdcc4d4235c829a41b4d23043431bb8fa915a440 15-Oct-2015 Chong Zhang <chz@google.com> Assign different oom score to visible apps based on layer ordering.

Pass oom score in kernel's full range [-1000,1000] to lmkd directly

bug: 21411311

Change-Id: I0cab2aa46269a716ea613025d3b84fe7d04404bb
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
64776ef01f6ba73348d4412f19e6725e6a55558a 17-Oct-2015 Wale Ogunwale <ogunwale@google.com> Merge "Revert "Dont update thumbnails of freeform windows on focus change""
d2f1d94fe5acc5d23f03bb3b653061184fd67eb5 15-Oct-2015 Filip Gruszczynski <gruszczy@google.com> API for minimal width/height of an activity.

Bug: 21409825

Change-Id: Id6286064713672366dd4dc1f80258450a8039c36
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
979f5ed923db91b08279bb25799c3d54d743d1a7 12-Oct-2015 Wale Ogunwale <ogunwale@google.com> Revert "Dont update thumbnails of freeform windows on focus change"

This reverts commit 17690ffcf7ed47b2719c65bb148190ddcdf4232c.

Can not reproduce the problem reported in the original bug that
required the reverted CL.

Bug: 23591449
Bug: 23562904
Change-Id: I8262cef52036816e9b3f422f6b75b1959a4da7cd
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
3e85ba293f00874d86998d650b54e580c454f3ae 06-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Refactoring: Remove unused parameter from topRunningActivityLocked.

Change-Id: I350e9459af13858e4ed95fe6511383266f509cb8
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
dc8d48c0d380400cd2a1a218112e8c8bf373161a 30-Sep-2015 Chong Zhang <chz@google.com> fix crash when restoring freeformed task to recents

bug: 23798697

Change-Id: I2f6c6cc9d5db5114de6a0cd662a36d8031863f1d
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
a6e902ec61ab1cd8f7d5df84deab6f26471c22fd 22-Sep-2015 Wale Ogunwale <ogunwale@google.com> Properly size tasks based on stack size.

There were a few places we weren’t doing this correctly

* When a new task is created the bounds should be the stack bounds
if the task is resizeable and not in freeform mode.
* When resizing a stack each task in the stack should be resized
base on if it is resizable vs. using the top running activity in
the stack to determine if all the tasks should be resized.

Change-Id: If3448c5629313e7e7fb91ffe8506014f16ad72db
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
3e3e66f418dfb8ddd30e561e9bbc73ccf9ba0ca2 11-Sep-2015 Wale Ogunwale <ogunwale@google.com> Properly resize freeform stack when docked stack is resized.

We were previously setting the task bounds for freefrom tasks to the
stack bounds when the stack is resized. So, all the tasks in the stack
are sized to the stack bounds vs. trying to fit in the stack bounds
while maintaining their size.
Also, we only want to apply fit to bounds on a task bound when we are
resizing the stack. So, moved method from TaskRecord to
ActivityStackSupervisor.

Change-Id: Ia6e046d6f2c3b0d80b06530a3e07d6ed1bb9b79f
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
0fa656b95256b7ad6d3dce287107a79ace3abdb8 01-Sep-2015 Chong Zhang <chz@google.com> Allow apps to pass in launch bounds when moving/starting a task

Pass in bounds via ActivityOptions for moveTaskToFront and
startActivityFromRecents. Allow bounds to be overriden by rects
in starting intents.

Set bounds to null in RecentsView for full screen layout.

Change-Id: I0ff79fd75068f4ba82d5e2c0a21881fabebdadb8
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
aff7f134a29d0eeac9ec07db4b97c36ecb202ea5 03-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Fix fitWithinBounds to actually apply stack bounds.

Bug: 23749629
Change-Id: Idfca4a83647c3a70c954caeca70d73aa9deee38b
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
ebcc875f10f05db7365cd8afbf4e9425221ab14d 26-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Move Configuration creation from Window Manager to Activity Manager.

Currently the construction of configuration is split between thease
two entities. This poses two problems: it's harder to follow the
construction logic and more importantly we can't determine if
configuration changes significantly before delegating work to the
Window Manager. This CL moves the configuration override logic to
the Activity Manager, since it both detects configuration changes and
informs clients about them. Window Manager becomes purely a recipient
of the information.

Change-Id: I075570ee055cce9c5665772fa8d4fe8ccb5c6313
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
17690ffcf7ed47b2719c65bb148190ddcdf4232c 27-Aug-2015 Skuhne <skuhne@google.com> Dont update thumbnails of freeform windows on focus change

Windows should not update their thumbnails upon a focus change since
it costs a lot of time to capture the content and the thumbnail would
be outdated short time later anyways since the window is still
visible anyways.

Bug: 23562904
Change-Id: If5d23a1058e83030770905827d682f649a579f7a
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
9b1ce52f254b4d9c17ebf437f19f45603d3ad5b2 21-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Using initial activity layout to position the launching activity.

The activity can be positioned in the center or in one of the corners.
From there it shifts its position and tries to find a spot where it
doesn't collide with other activities.

The CL also includes a few fixes necessary to pipe the information about
the initial layout through the system.

Change-Id: I2aaf5b6d20044aafec713b7bd4193b05cfbd16f3
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
e5390e7379303cfef6160f4679bd7b288b57a9f8 19-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Non colliding positioning of entering resizeable tasks.

When a new task enters freeform work space, it becomes full screen. This
CL makes it non fullscreen upon entry and also tries to position the
task in a way, that won't collide with existing tasks (so it's clear to
the user, that they are still there).

Change-Id: Ia04fdcadd0e85b268c323358cd4b3e04affa7939
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
0fad22712c9b8bffb29c01902788a701d098ce6f 19-Aug-2015 Ben Kwa <kenobi@google.com> Merge "Fix XML early-outs."
b34a7ad1af54132b6b046ab8f768e0ffb81cf581 14-Aug-2015 Wale Ogunwale <ogunwale@google.com> Added support for docked stack

Docked stacks occupy a dedicated region on a display.
When a docked stack is present all other static stacks bounds
are restricted to the region of the screen not occupied by
the docked stack.

Change-Id: I6aec3aa19c41a7e756375002f3a925977b5533b5
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
1e10ba2183c32cc64f2b9a5d02083f9c46df0ba7 06-Aug-2015 Benjamin Franz <bfranz@google.com> am 1f149663: am f7a2eb5a: am a17c5bac: am dc89dafa: am 339a9bbf: Merge "Use realActivity as indicator for task locking" into mnc-dev

* commit '1f149663b81a7cab81a896078c55d5ea6460d3bc':
Use realActivity as indicator for task locking
6fd84cc878c7df75777644944288cce558c1cd51 06-Aug-2015 Benjamin Franz <bfranz@google.com> Use realActivity as indicator for task locking

When lock task mode is started, we verify that the package is
whitelisted and currently use mCallingPackage as indicator. However,
the calling package is not necessarily identical to the package trying
to lock itself, so lock task mode sometimes fails. Switching over to
using realActivity as package marker.

Bug: 22916291
Change-Id: Ifd4df2d634842c8106b0b0f690bcf1faba0ed5fa
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
706ed793409f800a2b8dfbe66ac6992d057549de 02-Aug-2015 Wale Ogunwale <ogunwale@google.com> Support creating/launching a task with non-fullscreen bounds

Change-Id: Icc6d6b25b5f6f236030e654a3eb3ec7f00287d2f
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
e4a0c5722b1d8db95dfc842d716452dbbf02c86d 30-Jun-2015 Wale Ogunwale <ogunwale@google.com> Allow stacks to hold tasks on various sizes.

Tasks are now resizeable just like stacks. Adjusting the size
of a stack will also adjust the size of all it's containing
tasks. This model allows us to be more flexible
in using stacks as workspaces (like you would have in a
desktop environment) and tasks as the resizeable windows
within the workspace.

Also added "adb shell dumpsys window visible-apps" for
getting the list of visible app windows.

Bug: 22068114
Bug: 19182363

Change-Id: I5bf77063252a5abae4e327f6fc42e607091749f9
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
069fbe4b581a6a26f1ce600b0b25ca9274d15b5b 29-Jul-2015 Wale Ogunwale <ogunwale@google.com> Added stack id to TaskRecord dump.

Bug: 22812470
Change-Id: Ic8f3550e61ad1cf175423abe900c5f60686338a2
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
8814cf426d0b021d78133b1df7fd28dfe576df36 08-Jul-2015 Ben Kwa <kenobi@google.com> Fix XML early-outs.

Fix an incorrect check that was causing the XML parsing code to early
abort prior to completely deserializing the ActivityRecord and its
contents.

BUG=22348567

Change-Id: I7cfb171c4bc46bd5319e3bfdb4cc36b225f14407
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
469dd58baecb08d8f6daf559595362ada5fbe545 09-Jun-2015 Benjamin Franz <bfranz@google.com> Align the behaviour of different lock task modes

Currently lock task modes started by the activity flag
android:lockTaskMode behave differently from those started using
startLockTask(). With those changes lock tasks initiated by non-priv
apps cannot finish without calling into stopLockTask. Revoking the
whitelisting on a locked task will also kill that task, independently
of the way the lock task mode was started.

Bug: 21608206
Change-Id: I841abf1103855e2d7218a4a8ca9b43c105630dc9
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
0fc365c1455ebd4064474d27774f41cfcd8e1cb5 26-May-2015 Wale Ogunwale <ogunwale@google.com> Converted more AMS Log calls to use ActivityManagerDebugConfig

Bug: 21276405
Change-Id: I90d47b1b28f716e650df7f4377ed7cdd30b46ec8
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
432f64ee969271dc236b63431e5f6e306993dfce 20-May-2015 Craig Mautner <cmautner@google.com> Avoid resuming activity before launch.

The locktask logic would always bring a locked task to the front and
then resume it when locking. When a task is to be locked at launch that
would cause it to resume immediately before onLaunch was called. Which
would cause havoc because the token was not yet in
ActivityThread.mActivities. This lead to premature finish() calls and
looping restarts.

This change causes the resume to only be called when an app calls
startLockTask. Otherwise the resume call is skipped.

Plus additional locktask debug logging.

Fixes bug 21031298.

Change-Id: I756b0d607827d0ec7a123377db04d9377c41776d
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
e88d1e5926d3f3e8a4ceaced7dad7bdc8bc61fa4 18-May-2015 Stefan Kuhne <skuhne@google.com> Revert "Backup/restore recents task list"

Reverts commits 92dd1abef4c0a22db40c5f7bbd100e6b471a1ad3,
18795a2299fefd88ee16393f22324b999ace6ce4, and
ac6a3a5e9d90edb533e5b377a4a14ef514be955a which make-up
changes required for backing-up and restoring recent
tasks from one device to another.

The implementation had too many unresolved issues including
the ordering of the restored recent tasks which was depending
on when the task package is installed on the new device that
puts the restored recents list out of order compared to the
old device.

Bug: 15986349
Bug: 19014377
Bug: 20763296

Change-Id: I06fd35a43036ef0b7260cf4db9c42890df63b95d
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
e0570201f59342ef02412ece2f179ef42441a032 13-May-2015 Craig Mautner <cmautner@google.com> Lock top task if whitelisting arrives after start.

If the DevicePolicyManagerService updates the whitelist after a task
in the whitelist has started then the task won't have started locked.

When the updated whitelist arrives this change automatically locks the
topmost task if it is in the whitelist.

Also more locktask debugging.

Fixes bug 21031298.

Change-Id: I2494af6f2819ca91bc01abc5decb3d1adc088226
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
a7afaa211de291b35ebeeabdb8f39927a6a71c41 02-May-2015 Wale Ogunwale <ogunwale@google.com> Determine if TaskRecord is privilaged from creating ActivityInfo.

It is not reliable to try to get it from the process since it might
not be running yet.

Bug: 20016740
Change-Id: If3e748a97015c6623741d9374ab4ed1ed5f4b11f
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
2d0f39bf33b9f3dc90ce4d8bc34d59e00a06658d 18-Apr-2015 Wale Ogunwale <ogunwale@google.com> Move home task to front when home stack is moved to front.

Make sure the home task is moved to the front when we are moving
the home stack to the front for HOME_ACTIVITY_TYPE task type.

Bug: 20323082
Change-Id: I035cc86c48633089086f61d3a890ff87b4091479
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
15df08abd8190353e1430f88c2ed6462d72a5b25 01-Apr-2015 Craig Mautner <cmautner@google.com> Introduce android:lockTaskMode

The ability for tasks to be started in locktask mode or pinned is
dependent on the value of android:lockTaskMode for the root activity
of the task.

For bug 19995702

Change-Id: I514a144a3a0ff7dbdd4987da5361b94bdfe9a437
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
ee006da858459e91666ae53432659e934c8a8dbd 30-Mar-2015 Wale Ogunwale <ogunwale@google.com> Converted more log points in AMS to use ActivityManagerDebugConfig.

Change-Id: I59e777de30e2e9a3c7d086dc634129cd19135fab
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
843bfb9e4711230b8441035e8a5c52543de85b04 27-Mar-2015 Wale Ogunwale <ogunwale@google.com> Fix not persisting activities with FLAG_ACTIVITY_RETAIN_IN_RECENTS.

Bug: 17566588
Change-Id: Ifd64b0f5da68a79918820f120f09480aab25da73
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
7d701174f423754a2dade39fd16f102c085bd865 11-Mar-2015 Wale Ogunwale <ogunwale@google.com> Protect against NPE for ActivityRecords without a stack.

A previous change allowed us to remove stack that no longer contained
any task. This was causing some NPE when an ActivityRecord.Token or
some other cached ActivityRecord later gets converted back to an
ActivityRecord and we try to access its stack.

Bug: 19552874
Change-Id: Ie9454bbce56591b337f97af40f8c00b8597becdf
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
e23149f1555303940d212b742707518b7f9f84ab 07-Mar-2015 Wale Ogunwale <ogunwale@google.com> Converted some AMS log points to use ActivityManagerDebugConfig.

Change-Id: I0563bafd29ae0bbe596ed8c06fcc573b5ead50b7
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
9d3de4cfb42519fefe9d8b03c38ba440bd6bc886 02-Feb-2015 Wale Ogunwale <ogunwale@google.com> Support for activity to opt-in/out of resizeable/multi-window support.

Bug: 19178148
Change-Id: I5819a71cdc48e0af4add11a6d4a503ec5cbe5d63
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
885e727ab4e55155d1735f78c8a0550f7f180c8a 20-Jan-2015 Wale Ogunwale <ogunwale@google.com> am f5f54dd6: am 92dd1abe: Update restored task uid to match the package uid on current device. automerge: 7fd985f

* commit 'f5f54dd69122bc07ea0a25b8d98b9048cbe4582f':
Update restored task uid to match the package uid on current device.
92dd1abef4c0a22db40c5f7bbd100e6b471a1ad3 16-Jan-2015 Wale Ogunwale <ogunwale@google.com> Update restored task uid to match the package uid on current device.

The uid on the task we are restoring from another device are
meaningless on the current device. Change updates the uid of any
task we restore to match the package uid on the current device.

Bug: 19014377
Change-Id: I285fbe9f509cae3d2e9a212a59e88f34b4db20e5
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
539db51a7d45d95673f21b579bf9b353e9c19c70 15-Dec-2014 Todd Kennedy <toddke@google.com> propagate reason to finishActivityLocked()

Bug: 18704347
Change-Id: I830ad08f344db5be99760e0112d96729077b29c6
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
18795a2299fefd88ee16393f22324b999ace6ce4 03-Dec-2014 Wale Ogunwale <ogunwale@google.com> Add support from restoring recent's backup.

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

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

Change-Id: I8bd9155d7a05e89c190a20429acff69a17808208
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
be23ff4949612ecea89d112eff7f5e2c3dbf7685 22-Oct-2014 Wale Ogunwale <ogunwale@google.com> Fix issue #17674789: Recents icon resets if persist mode is 'persistNever'

Changed TaskPersister worker thread to not delete task information on disk
for tasks that are in recents but not persistable.

Also, changed logic that writes tasks information (excluding thunmbnail)
to disk to not write information for tasks that are not persistable.

Bug: 17674789
Change-Id: Iff7c5d24677f8a75157bb6be504fc2d9d6bcc098
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
39569afc9fc2d2ff1d254eb2924fbd05a9ea37c0 23-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17307700: retarget a relinquished task is not working

Missed by 1!

Change-Id: If6504e37563d1242df8da4609cbcbcd550d68fdd
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
6920feedb59899373040447e351c35909ffa1b45 19-Sep-2014 Craig Mautner <cmautner@google.com> Merge "Don't count finishing activities as effective activities." into lmp-dev
4767f4b3a97ce468c6ef9abf8fb06e0b8051dba1 19-Sep-2014 Craig Mautner <cmautner@google.com> Don't count finishing activities as effective activities.

They were being counted as effectiveRoot even though they were
finishing.

Fixes bug 17550936.

Change-Id: Iaf7201e6150095e55f88344e4b257e4ae8f19a2b
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
bc3126f859f626938810889cdc58b217c78caef5 18-Sep-2014 Craig Mautner <cmautner@google.com> Merge "Remove activity icon bitmaps from system process." into lmp-dev
648f69b95ce7fc95f551f6e08a2408d6e57dbab9 18-Sep-2014 Craig Mautner <cmautner@google.com> Remove activity icon bitmaps from system process.

When a TaskDescription is sent up to the system process, the Bitmap
contained in the mIcon member is immediately flushed to disk and the
name of the file replaces it in the TaskDescription. Thereby saving
mucho RAM for better uses.

Fixes bug 17527308.

Change-Id: Ifac63ea5d12ed091d1eb03e178b8b847a827f940
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
47b20ba8f667a0cf3ed9a1e34c93dcfdfd50eacb 18-Sep-2014 Craig Mautner <cmautner@google.com> Protect from null Intent

No bad intentions.

Fixes bug 17482657.

Change-Id: I0234787eb5e39cbdb548fb219341635cddd8b5d9
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
7922882189a5c1cc62de7e91b067f90d9a3e2f2b 16-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16662560: SingleTop activity is getting instantiated multiple time

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

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

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

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

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

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

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

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

Change-Id: Ibbe3f0f64197671d279c3fc519edfc720d442938
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
096f36b8db3e513687b78da3e1dd0197fce148a3 21-Aug-2014 Winson Chung <winsonc@google.com> Minor tweaks to recents thumbnails.

- Reducing the size of the recents thumbnails
- Skip persisting if we never update the last thumbnail
- Don't bother loading the last thumbnail file descriptor if we have it in memory
- Fixing warning in getting drawable from resource

Change-Id: Ieddaeac75a5e5d80876a9b6b1d50f7cc84c7d6fd
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
b91bd653c95593f1bd00faa6ca93bf731c1a8cbd 21-Aug-2014 Winson Chung <winsonc@google.com> Merge "Fixing issue with inconsistent icon filename. (Bug 16992882)" into lmp-dev
aec68bb89fe614181a20eb97340149406218ce2f 21-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17038762: Add API to add entries to the recents list

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

Repercussions:

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

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

Change-Id: I01e543db4d15320ee1701e95872fef73c116526c
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
3bad5cc0f5b8ac3018e413ce480692e40039027c 20-Aug-2014 Winson Chung <winsonc@google.com> Fixing issue with inconsistent icon filename. (Bug 16992882)
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
fee26771cfed736d207a8ee9c97134c848be1a52 05-Aug-2014 Winson Chung <winsonc@google.com> Ensuring that we update the calling uid/package when updating a task's original intent. (Bug 16676636)

Change-Id: I5d75a912e86e83f05717cb19e9b6edb02eb053e6
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
ec396d6399c5c31d697d81e94aff459e9771b0c6 07-Aug-2014 Winson Chung <winsonc@google.com> Initial changes to add task affiliation styling. (Bug 16656169)

- Fixing issue with launch-in-background animation
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
f4f8bb793fe101af770dc974b29c26722bce285f 29-Jul-2014 Craig Mautner <cmautner@google.com> Eliminate memory leak in TaskPersister

Bitmaps added to TaskPersister were piling up in the queue.

- The mRecentsChanged flag was being modified without holding the
lock. There is no mRecentsChanged flag now. Everything to be
written goes into a queue.
- TaskPersister now runs until the queue is empty.
- Bitmaps being written to the same file were being added to the
end of the queue without replacing the earlier bitmap. Now we
search the queue for matching tasks and replace the bitmaps
if needed.
- Method notify() was renamed to wakeup() so IDE could find usages
quicker.
- Bitmaps that were being requested but were still in the queue
are now being fetched from the queue.

Fixes bug 16512870.

Change-Id: Idca1c712e5d2df8196e93faaf563a54405ee96bf
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
0b633fc12188ac9a78c0cea9cacc8e90d08260dc 23-Jul-2014 Craig Mautner <cmautner@google.com> Disable back button goes to recents behavior

Using a static final boolean to do this so if policy is changed it
can be enabled easily.

Also fix fetching task from wrong list. Was causing
ActivityNotFoundExceptions.

Fixes bug 16512561.

Change-Id: I9b47a86fd740d45104aa14712e71df830218c5a7
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
dc00cbe2c15eef5141656311a6d05c753d7c6db6 21-Jul-2014 Craig Mautner <cmautner@google.com> Create API for launching from recents

Relaunch apps from recents using the same uid and package as was used
in the original launch.

Fixes bug 16358208.

Change-Id: I340800bfee79926b197929360d69f1d570bbf1eb
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
494f6bdd9a6d9bf7dad623128c37813cf9d737c0 21-Jul-2014 Craig Mautner <cmautner@google.com> Convert from elapsed time to absolute time.

Using uptime to determine most recent task doesn't work across
reboots.

Fixes bug 16370277.

Change-Id: Icef3342aba3fc009c307175b7524530c4cb617d2
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
13420f2311757554c314f620c83cb55153b67612 19-Jul-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16400873: Apps that show ads as new tasks stay in recents...

...even when I hit back or close the activity in UI

Change the semantics of NEW_DOCUMENT to have the recents entry be
removed by default when its activity is finished, with various ways
to explicitly turn off this behavior.

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

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

Fixes bug 16157517.

Change-Id: Ia1386af50da2f01809278b62d249f05c6a0de951
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
ffa2ec664479bff6b4b61d4c349d9db2cb37ca16 04-Jul-2014 Winson Chung <winsonc@google.com> Refactoring to support groups.

- Removing RecentService, determining animations just in time
- Fixing a few issues with animations of newly picked up tasks from the pool
- Moving helper classes into sub package

Change-Id: Ie10385d1f9ca79eea918b16932f56b60e2802304
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
c0ffce5ddd6446f1d46a49cdfaeda4a2ce408e1d 01-Jul-2014 Craig Mautner <cmautner@google.com> Use cached thumbnails in Recent tasks.

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

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

Fixes bug 15828934.

Change-Id: I0fd0320a1a04e3c78d79357899b83a2fff97abf2
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
d4a69704befb830ae58d8d6884b5a472eb6a2076 30-Jun-2014 Martijn Coenen <maco@google.com> Fix NPE in TaskRecord.

setIntent() calls toString() when in verbose
mode, which NPEs on an uninitialized mActivities.

Change-Id: Idccfe857bedc6cac18c590b0f2858166c0a665df
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
2cb86c723195e24278f983241cd6b1e307acf159 25-Jun-2014 Winson Chung <winsonc@google.com> Saving last TaskDescription for TaskRecord.

Change-Id: I531e0fc661fdedeb78bee7d5472668de8e9c2104
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
f1fbd77cf057e43926f9a0347692611386d09f40 25-Jun-2014 Winson Chung <winsonc@google.com> Use Task last active time to ensure we don't reload items for the cache.

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

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

Fixes bug 15703876.

Change-Id: I98dc36e4dbcb238d59e2175832076de7225bfdd9
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
75dc9900c6441bb5e1b31281de067d1f4fe2e28a 23-Jun-2014 Craig Mautner <cmautner@google.com> am 9587ee02: am a2121e49: am 5957d6a8: Merge "Fix frontOfTask assignment."

* commit '9587ee02038f20602d1ab79610e8c19b9633ab81':
Fix frontOfTask assignment.
9587ee02038f20602d1ab79610e8c19b9633ab81 23-Jun-2014 Craig Mautner <cmautner@google.com> am a2121e49: am 5957d6a8: Merge "Fix frontOfTask assignment."

* commit 'a2121e497c2e82676b4bf5dc35b0015c38ddc5ab':
Fix frontOfTask assignment.
362449af58ff56dfc768605326730d1af661ac3a 20-Jun-2014 Craig Mautner <cmautner@google.com> Do not delete stack if empty task is being reused.

If a task is being cleared due to Intent flags and that clearing
was causing the last activity in the last task on a stack to be
deleted, then we were deleting the stack. Immediately after
this we were refilling the task with the same activity but the
stack had already been deleted.

This fix preserves the task and stack when it is only being
cleared for the new activity.

Fixes bug 15611901.

Change-Id: I7bcfa826d0852d9c640daa73fe1324b89471fecd
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
5afcd4df22675295013c757177d6bcfbb34a014d 22-Jun-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of aaadf922 to master

Change-Id: I8b89a326453fc8827a84eb9516271d2bf3b71e2c
4132620f92b4ffd412d0cbac6ee32948a2e22649 20-Jun-2014 Craig Mautner <cmautner@google.com> Fix index out of bounds exception

When removing the last activity in a stack.

Fixes bug 15776859.

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

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

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

Fixes bug 15675610.
Fixes bug 10428661.

Change-Id: Ib28a9eae3b9832eeeef9106adbebe344184ee5ae
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
43e52ed32e2d55ef4aee18c4b4bc13b7fdef9cc4 17-Jun-2014 Craig Mautner <cmautner@google.com> Fix persistent tasks and expand scope

- Fixed missing tag closure on the xml for storing Intent categories.
- Shortened timeout for flushing tasks to persistent storage from
one minute to ten seconds.
- Made persistency the default except for those tasks on the home
stack and those tasks that exclude themselves from the recent task
list.
- Fixed deletion of tasks after restoring. Tasks now survive a second
reboot, not just the first reboot.
- Fixed sort order so most recent tasks will be restored at front.

Fixes bug 15672002.

Change-Id: I16d87d58c6fd2e879cfd0c0b18b2694432a79b71
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
d38aed81420d7d992f65ef2efb5f69c1900fc61d 11-Jun-2014 Dianne Hackborn <hackbod@google.com> Some tweaks to improve document task creation.

- Mark the chooser activity as never launching in to a new
task, even if the caller asks for it. These are dialogs
so don't make sense as stand-alone tasks. (Maybe later
the policy should be to not launch into a new task in any
case that the activity is a dialog or even transparent at all.)

- Keep track in the task record of whether any activities in
it have been shown to the user, and use this to automatically
remove the task when all activities finish. This leans up
cases where apps are launching stub activities that get turned
in to tasks but are never seen by the user because they
immediately launch another activity in another task and
then finish.

Change-Id: I00b641c80aa96bd5071479f36ee2e4d8e3a81aeb
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
f357c0ca514d73273a18b3896e565b2272e608ad 09-Jun-2014 Craig Mautner <cmautner@google.com> Redefine FLAG_ACTIVITY_NEW_DOCUMENT without NEW_TASK

Change definition of FLAG_ACTIVITY_NEW_DOCUMENT from
FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET to
FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET alone.

Also add new documentLaunchMode of "never" to allow activity
writers to keep their activity from being launched in document mode.

Fixes bug 15468528.

Change-Id: Ied11adf97e85c5d3f99f4c0bbbb4a2905dcfb24e
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
ffcfcaadfefec2fb56f67a0a614a54bf4599d62b 05-Jun-2014 Craig Mautner <cmautner@google.com> Implement maxRecents and fix TaskPersister bug

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

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

Fixes bug 13736052.

Change-Id: I7ccb4e6f89d6202ff31c8577bb7b9d8d1b7e5e8d
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
b9a6c8ad99c7885dccc23223068c0a551f350cd5 29-May-2014 Craig Mautner <cmautner@google.com> Revert "Modify task navigation to return to recent tasks." DO NOT MERGE

This reverts commit 1a4e211e03f1f795d935058e27356a0e8bc5df7c.

Change-Id: Ia691b93347c7eb2395933e5a5ba385ea94e08d6f
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
e67a784eb2c914c04c62ea5dfa1e3751df5582cc 21-May-2014 Craig Mautner <cmautner@google.com> Modify task navigation to return to recent tasks. DO NOT MERGE

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

Fixes bug 14464114.

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

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

Change-Id: Ifb820a01c412fe1f8c0f6e41aa655fafd89eaa8d
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
a449dc033b79775b8945d9cc5a035a6deb145065 16-May-2014 Winson Chung <winsonc@google.com> Refactoring RecentsActivityValues into TaskDescription, and ensuring they are resolved when set. (Bug 14995928, 14832629)

Change-Id: I582221468e63a96a5dfd132a31b09e72099b170f
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
1147c406515bbfbcb7dbd750f81c7a5de928c5c6 14-May-2014 Winson Chung <winsonc@google.com> Adding method for applications to query their own tasks. (Bug 14627210)

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

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

Fixes bug 14463859.

Change-Id: I34c4c79775ef44d65e1967be5601997a2d46b210
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
03a9baedc9b933bb6a550c0cb84649b1b45b872c 02-May-2014 Winson Chung <winsonc@google.com> Refactoring activity method to update recents values.

Change-Id: Ic525be207714d34abe0c2d26091c3e46abcd9bad
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
09233289624a85093b1d99e4a6a149bf09059d8d 30-Apr-2014 Dianne Hackborn <hackbod@google.com> Make GET_TASKS signature|system.

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

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

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

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

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

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

Change-Id: I7646d0af8fb4ac768c63a18fe3de43f8091f60e9
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
3b3f464445d1d369c8e87f526deba606ca62f76c 22-Apr-2014 Winson Chung <winsonc@google.com> Piping through ability for an Activity to remove its own task. (Bug 13735914)

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

Make ActivityManager and WindowManager understand related users.

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

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

Change-Id: I3bd87b32aec69c3f8d470c8b29b144f4e849c808
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
e0a3884cb627efc650e19fbe76b1b3343468cf57 17-Dec-2013 Craig Mautner <cmautner@google.com> Extend stack management to other displays.

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

Change-Id: I4fcb83ae844c5839ee3e2722229623d1a80ed921
/frameworks/base/services/core/java/com/android/server/am/TaskRecord.java
9158825f9c41869689d6b1786d7c7aa8bdd524ce 22-Nov-2013 Amith Yamasani <yamasani@google.com> Move some system services to separate directories

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

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