History log of /frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ff7add011a3742bc5ba609de2abd9b7bf35c71e1 17-Aug-2015 Christopher Tate <ctate@google.com> Check component permissions like 'exported' before assigned permissions

In particular, don't assume that the absence of an explicit permission
requirement means that the activity is freely launchable unless you have
also checked thing like exported="true" first.

Bug 23223804

Change-Id: Idbfd1f5662b374a7a447b738591b267a1c497e41
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
74aefdf28f4accbaa5d8f0978008472fe562196a 07-Aug-2015 Dianne Hackborn <hackbod@google.com> Debugging for issue #22556778: Starting under voice control not allowed

Better error messages in log to explain what is going on.

Change-Id: Ie686a323ceedd42453b6581fe79653b407d49ee5
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
fb81d09d359480f9e43bbf300877b60de05f4816 04-Aug-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22860466: viapi security bug - rubber stamping in nested VIs

Add new Activity.isVoiceInteractionRoot() API that an activity can use
to determine whether it is the root activity of a voice interaction
session started by the user's designated voice interaction service.

This is a special new API that apps must explicitly check, because as
with visual activities the model behind an activity should usually be
that it accomplishes its task by interacting with the user (implicitly
getting their approval) rather than trusting that whoever invoked it
is telling it to do what the user once. In the voice world, however,
there are some cases where quick interactions want to allow for immediate
execution without further user involvement, so this API allows for that
without opening up security holes from other applications.

Change-Id: Ie02d2458f16cb0b12af825641bcf8beaf086931b
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
28b239711597981ecb79b12db1a69f49c1033cbd 30-Jul-2015 Wale Ogunwale <ogunwale@google.com> Fixed out of bounds exception while handling app crash

The current stack we are proccessing can be deleted as part of
the clean-up process, so the size of the stack list is reduced
by one.

Bug: 22822743
Change-Id: I6a6af5d8d811e231f345f01dd2aa4a61510c8d2b
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
a7cfbe0e548ac76f20915b65851b8bc9095aa541 16-Jul-2015 Dianne Hackborn <hackbod@google.com> Work on issue #22516282: ChooserTarget URI grants not forwarded

Add new option to startActivityAsCaller() which allows you to
specify that we should not do security checks on the target
activity being launched.

Change-Id: Ie6b28807b96fef35ccdff93b0a01066cfd8fa307
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
99b6043dad9d215cf15810b885b6b8c215dd5b5a 27-Jun-2015 Svet Ganov <svetoslavganov@google.com> Teach receivers, activities, providers, and services app ops.

Perform app op check in addition to the permisison check for all four
paltform components - activities, content providers, broadcast receivers,
services - if they are guarded by a permssion that has an associated app
op. This ensures that legacy apps will behave correctly if the permission
of the caller has been revoked, i.e. the app op for that permission was
disabled.

bug:22199666

Change-Id: Ia22d1c38d58b3cd6aabdc655cb7c7bddd85da7a2
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
7008b51817361443fc6f136c5b187e1d471c94f5 25-Jun-2015 Svetoslav <svetoslavganov@google.com> Prevent certain actions of app has revoked permissions

bug:21808294

Change-Id: I7214c1fe47c15fe185423a54a74b58caf8d82daa
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
a51f8b90f53acbd8967755a39096705704980d05 20-Jun-2015 Filip Gruszczynski <gruszczy@google.com> am 73187e57: am dd91362c: Make sure home activity gets resumed after started.

* commit '73187e5761063340d2092c37f5584c9b56e4a11e':
Make sure home activity gets resumed after started.
73187e5761063340d2092c37f5584c9b56e4a11e 20-Jun-2015 Filip Gruszczynski <gruszczy@google.com> am dd91362c: Make sure home activity gets resumed after started.

* commit 'dd91362c2c65dbcd781034a16f293d5489946f3e':
Make sure home activity gets resumed after started.
dd91362c2c65dbcd781034a16f293d5489946f3e 20-Jun-2015 Filip Gruszczynski <gruszczy@google.com> Make sure home activity gets resumed after started.

When there is only one activity and it gets paused, activity manager will
try resuming some other activity. If there is no other activity, it will
start home activity and try to resume it. This will fail, because the
activity stack doesn't want to enter recursive resuming. We need to
detect this situation and schedule additional resume of top activity
after home gets started.

Bug: 21500945
Change-Id: I6ca703f8d97bcc4001e7da4cd5a5db63bfb5c861
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
b94761d0a48522b23c54f786445658bb58258da4 20-Jun-2015 Amith Yamasani <yamasani@google.com> Merge "App Standby : Association between content providers and their sync adapter" into mnc-dev
37a40c24deb02bca3868a8085069afae112f22e4 17-Jun-2015 Amith Yamasani <yamasani@google.com> App Standby : Association between content providers and their sync adapter

Set sync adapters to active if the associated content providers are used
at foreground process state.

Minimize how frequently published content providers are reported by
keeping track of last reported time.

Also cache sync adapters associated with an authority in SyncManager.

Bug: 21785111
Change-Id: Ic2c8cb6a27f005d1a1d0aad21d36b1510160753a
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
25d237b8ea8f573c1d6c27f7d9e87b5ebd5b5429 19-Jun-2015 Jason Monk <jmonk@google.com> Fix security whole in lock task

When flags NEW_TASK and CLEAR_TASK are set, the task gets reused
which causes the lock task to be ignored. Add a special check
for this to be a lock task violation.

Bug: 20893212
Change-Id: Ibf3c71f40e197f0830410eb4e20429e901998378
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
6974f22d1148f0140b4abc76cc58e6bd6ad7842a 09-Jun-2015 Filip Gruszczynski <gruszczy@google.com> am 47e53319: Revert "Recompute focus stack if cleared while starting an activity."

* commit '47e53319509474c2f00847ac391dd32776712470':
Revert "Recompute focus stack if cleared while starting an activity."
47e53319509474c2f00847ac391dd32776712470 09-Jun-2015 Filip Gruszczynski <gruszczy@google.com> Revert "Recompute focus stack if cleared while starting an activity."

This reverts commit 0b3d573e46b8be0f0cf170802214320859c94905.

Unfortunately, we need more than just that.

Change-Id: I42ac79cb396812b91cec67ba681144592c0e2e01
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
64b586e19f3cd4069d57424ddc21c5213c94a767 09-Jun-2015 Wale Ogunwale <ogunwale@google.com> am 0b3d573e: Recompute focus stack if cleared while starting an activity.

* commit '0b3d573e46b8be0f0cf170802214320859c94905':
Recompute focus stack if cleared while starting an activity.
0b3d573e46b8be0f0cf170802214320859c94905 17-Mar-2015 Wale Ogunwale <ogunwale@google.com> Recompute focus stack if cleared while starting an activity.

When starting an activity with Intent.FLAG_ACTIVITY_CLEAR_TOP flag,
the activity is destoried which can also cause its task to be removed
from its current stack if the activity process record is null. We now
recompute the stack for the activity task when this occurs so we
don't NPE later on.

Bug: 19552874

Change-Id: I50f51ca6dc32d4642f78d59cae93b0774bc6cdb7
(cherry picked from commit 86920fe630911cbbc0839b341dc694c2b905ef9e)
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
8b20cdb27bc5b4c433c4fc650203be9a25842bbd 22-May-2015 Dianne Hackborn <hackbod@google.com> Merge "Add API to track usage time of apps." into mnc-dev
b5a380d409a1431a38db978864b9d85b689e3cce 21-May-2015 Dianne Hackborn <hackbod@google.com> Add API to track usage time of apps.

This adds a new ActivityOption for the caller to ask the
system to track the time the user is in the app it launches,
delivering the result when they are done.

The time interval tracked is from when the app launches the
activity until the user leaves that app's flow. They are
considered to stay in the flow as long as new activities
are being launched or returned to from the original flow,
even if they cross package or task boundaries. For example,
if the originator starts an activity to view an image, and
while there the user selects to share, which launches gmail
in a new task, and they complete the share, the time during
that entire operation will be included.

The user is considered to complete the operation once they
switch to another activity that is not part of the tracked
flow. For example, use the notification shade, launcher, or
recents to launch or switch to another app. Simply going
in to these navigation elements does not break the flow
(although the launcher and recents stops time tracking of
the session), it is the act of going somewhere else that
completes the tracking.

The data is delivered to the app through a PendingIntent,
which includes the total time the app was in the flow along
with a time break-down by app package.

Change-Id: If1cf8892d422c52ec5042eba0e15a8e7e8f83abf
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
db49fec8aaf78ffe091014bbfe04a9843f974986 22-May-2015 Craig Mautner <cmautner@google.com> For getHomeActivity() only return current user.

Previously getHomeActivity() returned the topmost home activity
independent of which user was currently running. That defeated the
purpose of the method. This fix returns the home activity of the
current user or null if one has not yet been created.

Also remove some cruft that accumulated.

Fixes bug 21055376.

Change-Id: Ic1d58129aedbe3624f8a9d12c05c84674687b0a4
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.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/ActivityStackSupervisor.java
4d89374483c61c107a4ad758656cb76e46f7c5c5 13-May-2015 Stefan Kuhne <skuhne@google.com> Merge "Ensure activity visiblity when moving task" into mnc-dev
54714cd21e272a4edca16d10f67b0ba3043af535 12-May-2015 Stefan Kuhne <skuhne@google.com> Ensure activity visiblity when moving task

There was a visibility problem when multiple already running
activity got resized at the same time.
Only the last activity launched that got focus was shown and all others
were not.

The problem arose when a new ActivityStack got created and the
(existing) window got attached which led to the divergence of the
visibility states in different objects. The WindowState thinks
that it is visible, but the AppWindowToken thinks that it is not.
Subsequent calls to WindowState::ShowLw ignore calls to show the window
and the application logic enters the GONE state until it recieves focus.

Bug: 20692085

Change-Id: Ifc0e3686398ccd1d1ff32e1a266163b8db5b7f26
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
b501330a1b6ef14ff512a5727f7a01bc423d6fbb 18-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Disable multi-user background recording

On user switch, kill existing processes of the background user with
android.permission.RECORD_AUDIO permission. Home activity should not be
killed to avoid an expensive restart of the home launcher, when the
user switches back.

Introduced DISALLOW_RECORD_AUDIO user restriction, which is enabled for the
background user, and removed for the foreground user.

Introduced a concept of system controlled user restriction, which can only
be set by the system, rather than device administrator.

Bug: 20346194
Change-Id: Ic942fd565e80d14424230dae612965a8e229c4ef
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
540e123b14ef71f0bfda325e11773c1c510fb8ba 02-May-2015 Wale Ogunwale <ogunwale@google.com> Clean-up component states in AMS when component is disabled

Bug: 15804187
Change-Id: I2b5856c5a0a012f34698fb64f8596d32924bbd1f
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
58f68b56ea84c8d84937d9ec5210bdf71b2b9acc 22-Apr-2015 Wale Ogunwale <ogunwale@google.com> Merge "Move home task to front when home stack is moved to front."
81786701b61f8295c8f7c9c1861642233910b056 22-Apr-2015 Craig Mautner <cmautner@google.com> Merge "Add API for putting up locktask pinning toast."
c21ae9ed221912b61306e075d3f22726ac04013c 15-Apr-2015 Craig Mautner <cmautner@google.com> Add API for putting up locktask pinning toast.

Fixes bug 18993662.

Change-Id: Ic1753285044857f8ea897784485fd1a9580acf25
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
0bd2aa760346edd096f7c27283f394631f246f30 16-Apr-2015 Wale Ogunwale <ogunwale@google.com> Fail early when starting a background user activity.

If it shouldn't be displayed for all users.

Bug: 13507605
Change-Id: I8fe8e5a98759c1ca058cc7d222817f6d580ffa11
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
6dfdfd6741c5a3dd8d8a49ddbd6ee5dfe2fd292d 15-Apr-2015 Wale Ogunwale <ogunwale@google.com> Added attribute showForAllUsers that deprecates showOnLockScreen

The new name is more meaningful to what the attribute actually does.

Also, force the FLAG_SHOWN_WHEN_LOCKED flag for windows that belong
to acitivties with the showForAllUsers attribute set.

Bug: 20227306
Change-Id: Ifd49166c3ec0e67ae43addc0fb30038523332ea5
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
4870e9d5eba59fb257a87f97f1adf0b734cf48d3 09-Apr-2015 Dianne Hackborn <hackbod@google.com> More work on device idle mode and other power stuff.

Add idle mode support to the alarm manager. Introduce
a new concept of flags associated with alarms to tell
the alarm manager how to treat the alarm -- they allow
everything from the alarm that will bring us out of idle
mode, to alarms that are allowed when idle or should
also bring us out of idle. The standalone boolean is
now also a flag.

(Note there is currently no protection from user space
setting the flags however it wants; I will be working
on that in a follow-up change.)

When in idle mode, the alarm manager pushes all alarms
that shouldn't execute during that time over to a
separate list that is not executed until out of idle.
To help with this, I reworked a bit how Alarm objects
are managed, so that when rebatching or moving between
lists we don't have to allocated new objects but can
just use the same existing instance.

Also tweaked the sync manager to deal with idle mode,
which currently just means doing the same thing as when
low on storage -- turning off sync.

Add new ACTION_CHARGING and ACTION_DISCHARGING broadcasts
that apps can listen for to know when the device is actively
charging and discharging. These are better than the old
POWER_CONNECTED and POWER_DISCONNECTED ones because we only
report charging when we actually see that there is enough
power being provided to charge the battery (and will report
discharging if there is not enough power).

The job controller uses these new actions for scheduling
jobs that want to run while plugged in. Removed the
"stable charging" stuff while doing so, since the new
charging state serves as an even better signal for that.

Introduced two new process states: FOREGROUND_SERVICE and
TOP_SLEEPING. This will allow us to treat foreground services
specially (such as still allowing network access to them for
background music playback) while not mixing them together with
whatever happens to be the top activity while the device is
asleep.

Also some other small cleanup here and there.

Change-Id: I7a9808b578bad6f50deb8e1baf919298512a0d3a
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
73eba74d11f936b5109d462c9b184649b0785c5b 07-Apr-2015 Wale Ogunwale <ogunwale@google.com> Fixed issue with prematurely removing display for child activities.

When relaunching a parent activity we finish all its children and set
a 2sec timeout to clean up their tasks/stacks/displays if we don't
hear anything back. This time might not be sufficient for the client
activity to respond back in time depending on what else is happening
on the system and we might end-up prematurely removing its display
which will cause it to crash. In this specfic case, the client
activity which wasn't the focus activity was been relaunched with a
bunch of other activities due to a configuration change.

Instead of having a timeout for the clean-up we now let the activity
go through the normal clean-up process that occurs as it changes
states which will eventually clean-up the right states in a max.
time of 10secs (on destroy timeout) or sooner. This is in line with
activity cycle expections.

Bug: 17702043
Change-Id: I484124e07ad32b9056f75ec41af1dd7718488335
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
9e0f8deae851ec917613256dfbe899ae5c1b1ca5 04-Apr-2015 Wale Ogunwale <ogunwale@google.com> Merge "Don't remove task from recents when moving task to another stack."
000957cef387dc7d08fc6563e2221e9023194984 03-Apr-2015 Wale Ogunwale <ogunwale@google.com> Don't remove task from recents when moving task to another stack.

Also, made event log reason for remove task when moving different
from when removing.

Bug: 19946163
Change-Id: Iea2b7a84040759e9ad0a7dc8c6f4aee67b15467b
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
b1e8e5e505c46f988706ba4b83159ba51bcbd77f 03-Apr-2015 Olawale Ogunwale <ogunwale@google.com> Merge "Remove debugging for bug 19823482."
eb0e38a812ace6134a2e029f8084f099b6d44318 03-Apr-2015 Craig Mautner <cmautner@google.com> Remove debugging for bug 19823482.

Change-Id: Ibedfb3353e6f7f64e39ad076b329d9cd9657fe5f
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
f16a281066ed7b524676698f95642c0a550b0b62 01-Apr-2015 Wale Ogunwale <ogunwale@google.com> Fixed NPE when trying to animate a windows whose display is gone.

In some cases it is possible for the AppToken.allAppWindows list to
get out of sync with the list of windows known to WMS if the client
doesn't call Session.remove(Window). This can lead to an NPE when
the animation threads runs and the display for the window has been
removed.

Also corrected some method names/scopes I ran across while debugging.

Bug: 19972099
Change-Id: Ib0ae7ede6c506f833bbdd66723b88e7504a61907
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
356c628e1b3ff6a3f327fdc512deb5288710ab47 01-Apr-2015 Wale Ogunwale <ogunwale@google.com> fixed build breakage due to bad merge. again...

Change-Id: I601bade61837e4408be083530d10c48c0595b38c
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
16a6279e5f1dde063707adc852f8de1e14206905 01-Apr-2015 Wale Ogunwale <ogunwale@google.com> resolved conflicts for merge of 2094bf7b to master

Change-Id: I1820d186ca602bb3cd21a15f3c23f7d6d309d43b
4e88ecf4bc344557af31eb367e6e01b2d5b60471 01-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 086071e7: Merge "[ActivityManager] Reduce report wrong anr activity"

* commit '086071e7306a73c9b3c5a56277884b4e19543b3e':
[ActivityManager] Reduce report wrong anr activity
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/ActivityStackSupervisor.java
db46d6b0744d286efc6ad6df600e15285868c2ab 01-Apr-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Reduce report wrong anr activity

Symptom:
Report ANR on wrong activity.

Reproduce steps:
(All launchMode, taskAffinity are default and
without additional intent flag)
Case 1:
1.Launch activity A from launcher.
2.Activity A starts B activity.
3.Press home key.
4.Launch activity A from launcher (B is top).
5.Press back key twice to finish B and A,
A sleep 10s in onResume.
6.ANR will report on launcher.

Case 2:
1.Launch activity A from launcher.
2.Press home key.
3.Kill process of A.
4.Launch activity A from launcher.
5.A sleep 10s in onResume, press back key immediately.
6.ANR will report on launcher.

Possible root cause:
Focused activity will not be updated every time when activity
resumed. (the condition to call setFocusedActivityLocked)

Case 1:
Launcher was stopped and not waitingVisible due to launcher
is not the previous one, then getWaitingHistoryRecordLocked
has no chance to correct the real ANR activity.

Case 2:
Due to process of next activity is died, bring existed
task will not set mResumedActivity (it will be set when its
process is started), so when assigning waitingVisible from
processStoppingActivitiesLocked, the return value of
allResumedActivitiesVisible will be true even there is no
mResumedActivity. That results set waitingVisible to false
to previous activity (e.g. launcher), then also cannot
correct ANR target as case 1.

Change-Id: I0b24f46a8fab266382ebc6e2ed84ebeca9358768
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
6cd6cec2adae647ca6ec3aa7ef3288cbb1f814b1 01-Apr-2015 Craig Mautner <cmautner@google.com> Revert "Add lockTaskOnLaunch attribute."

This reverts commit 0fb1cb56abf708291c09c783463408c7074ae9a7.
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
0fb1cb56abf708291c09c783463408c7074ae9a7 31-Mar-2015 Craig Mautner <cmautner@google.com> Add lockTaskOnLaunch attribute.

The new AndroidManifest activity attribute, lockTaskOnLaunch attribute
is a boolean that puts the system in lockTask mode when true and if
the activity specified is the root of a privileged task.

This bug also fixes lockTask mode for root activities that finish
themselves. Previously finish was not allowed even if there were
activities left in the task that were still valid.

A NullPointerException for lock task toasts has also been fixed.

Fixes bug 19995702.

Change-Id: Iba6976b1a0cc5a22eb526db66d2e9af66445541f
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
2568c3abcbfc93838fbc8fff270da0ead8878b40 26-Mar-2015 Craig Mautner <cmautner@google.com> Do not set visibility of unstarted activities.

If an activity is started in the stopped state then it shouldn't have
its window manager visibility set to visible. It also should not have
its screen frozen.

Fixes bug 19823482.

Change-Id: I74637a8eefcc97d1ef4d8ea3c661dc7c0c322f59
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
efadd572b93eee88e4b63feb6b2cc0741d900c76 20-Mar-2015 Craig Mautner <cmautner@google.com> Merge "Fix bad nesting count when remote calls fail."
92acaf2074b2c5100ad8a652787f11a05158a6c0 18-Mar-2015 Wale Ogunwale <ogunwale@google.com> Always position home stack either at the top or bottom of the list.

The current implementation was okay since we mostly had
2 stacks (the home stack and 1 application stack), so moving the
application stack to the top meant the home stack was automatically
moved to the bottom. This is no longer the case if you have multiple
application stacks.

Change-Id: I8ec7cfdc3650a73a00c4e8dad869fb2bec2a4eac
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
5f2bb4c9bc27aee581bf888f1fd22c5c9311240d 13-Mar-2015 Craig Mautner <cmautner@google.com> Fix bad nesting count when remote calls fail.

The nesting count for services depends on callbacks decrementing
ServiceRecord.executeNesting in response to remote service calls. If a
remote call fails the callback does not get made and the nesting count
gets out of sync. This causes orphans in the executingServices set.

This fix makes the callback locally when the remote call fails.

TransactionTooLargeExceptions caused by Intents containing large
amounts of data were being caught and not propagated to the calling
methods.

This fix propagates TransactionTooLargeExceptions back to the calling
methods.

Fixes bug 19698308.

Change-Id: I9eb6ae414d14d6b3a2709abb1f2bdfbd4cbc3c03
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
ee0f4b4d0b9e6c89429d167d79a3b2e2580e241c 17-Mar-2015 Wale Ogunwale <ogunwale@google.com> Merge "Recompute focus stack if cleared while starting an activity."
86920fe630911cbbc0839b341dc694c2b905ef9e 17-Mar-2015 Wale Ogunwale <ogunwale@google.com> Recompute focus stack if cleared while starting an activity.

When starting an activity with Intent.FLAG_ACTIVITY_CLEAR_TOP flag,
the activity is destoried which can also cause its task to be removed
from its current stack if the activity process record is null. We now
recompute the stack for the activity task when this occurs so we
don't NPE later on.

Bug: 19552874

Change-Id: I50f51ca6dc32d4642f78d59cae93b0774bc6cdb7
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
3ab9a27e3d612efef6a046d4df7880803df1eef9 16-Mar-2015 Wale Ogunwale <ogunwale@google.com> Convert some log points to in AMS to use ActivityManagerDebugConfig class.

Change-Id: I02154b0e1c2c64af840848fd6def054342922efa
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
fd5767fa37485952b7291ea701cc84c38c2621fc 17-Mar-2015 Wale Ogunwale <ogunwale@google.com> Merge "Remove duplicate move of home stack that can cause animation jank."
3d07c94c393831091958fe6a98811843db8973bd 14-Mar-2015 Dianne Hackborn <hackbod@google.com> Add new voice request for picking from a list.

Also add API for voice interaction service to control
whether the system should hold a wake lock while it is
working with an activity (and actually *do* hold a wake
lock while doing so, duh!).

And while in there, clean up the launching wake lock to
correctly give blame to the app that is launching.

Change-Id: I7cc4d566b80f59fe0a9ac51ae9bbb7188a01f433
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
d80c263e2a45f0a2b65fd9762aa8deea49c8ca72 13-Mar-2015 Wale Ogunwale <ogunwale@google.com> Remove duplicate move of home stack that can cause animation jank.

Each move of the home stack in the ActivityManager ends up calling
into the WindowManager which causes layout to be performed.

Also, fixed issue where ActivityStack.moveTaskToFrontLocked()
could move a task to the front without the focus been adjusted to
the new top activity.

Bug: 19692494
Change-Id: Ib4c999c6dfa1af3fda0fced52b58da614b154d00
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
04f4d6bb8892fe9b6e8f60d18a4f4dd051ab8124 11-Mar-2015 Wale Ogunwale <ogunwale@google.com> Revert "Revert "Remove activity and window stacks when last task is removed.""

This reverts commit 7a7bf5ea48b12f044c591fb03ed3e58acd28ceb7.
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
de01b03a855eb482e2264ee31e98fb4d3a42ebab 11-Mar-2015 Wale Ogunwale <ogunwale@google.com> Merge "Converted some AMS log points to use ActivityManagerDebugConfig."
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/ActivityStackSupervisor.java
7a7bf5ea48b12f044c591fb03ed3e58acd28ceb7 10-Mar-2015 Wale Ogunwale <ogunwale@google.com> Revert "Remove activity and window stacks when last task is removed."

This reverts commit 0f95e3f0753508344b198c0a76afb892df514f52.

Bug: 19644506
Bug: 19083170
Change-Id: I2eb2a0400be58fe2c5d48a4b68368725e98aaf6f
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
47d740b92b631b1f69b63702f5edfc83538345cf 05-Mar-2015 Wale Ogunwale <ogunwale@google.com> Merge "Made AM package debug log more configurable."
43261140c3995dea77d87b587f882e651617f4b4 11-Feb-2015 Benjamin Franz <bfranz@google.com> Clean up the lock task APIs for COSU devices.

Clean up and increase readability of internal handling of lock task mode APIs.
Add a public API to query the lock task mode state with pinned and locked as
possible outcomes. Additionally, change wording in lock task toasts when in
locked mode and update the javadoc regarding onLockTaskModeEntering and
onLockTaskModeExiting to represent the actual behaviour.

Bug: 19377096
Change-Id: Ia563078ca6ef6d6fc7e75130e6b94ba18af69340
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
d57969f6ec38c7633ca65bcd5bdd766cd972cfe4 16-Nov-2014 Wale Ogunwale <ogunwale@google.com> Made AM package debug log more configurable.

* Added class ActivityManagerDebugConfig.java for housing all debug
log configuration for activity manager package.
* Added ability for using default activity manager log tag or class
specified tag string which is very helpful during debugging.
* Added ability to prepend log category name to log tag that can
also be useful during debugging.
* Converted BroadcastQueue.java and ActiveService.java to use the
new log class. Other classes in the package will be gradually
converted.

Change-Id: I0e4b343da75cb2e539b5ad5f0f79f6bc7af46d7b
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
4bd091414a8eab104875d0115347307411e27ebd 03-Mar-2015 Craig Mautner <cmautner@google.com> am 5d3f00e3: am 358188f5: Merge "Change ActivityView startActivity state sequence" into lmp-mr1-modular-dev

* commit '5d3f00e38b84c107037de1250a6e55d89f84ef77':
Change ActivityView startActivity state sequence
5d3f00e38b84c107037de1250a6e55d89f84ef77 03-Mar-2015 Craig Mautner <cmautner@google.com> am 358188f5: Merge "Change ActivityView startActivity state sequence" into lmp-mr1-modular-dev

* commit '358188f5891f5645dbff4fd8cb1a3e7341371f74':
Change ActivityView startActivity state sequence
b916836e8dcd4aa3564479be508d7a9d73dcbce8 27-Feb-2015 Craig Mautner <cmautner@google.com> Change ActivityView startActivity state sequence

Problems arise if an activity is started in an ActivityView when the
parent activity is not resumed. In particular the ActivityView can
be brought to the front in front of other activities that have been
started by the parent.

This change checks the state of the parent when the ActivityView is
starting and if it is not resumed, throws an Exception.

This change also removes the queueing up of Intents if the surface
does not exist when startActivity is called. Now, the owner of the
ActivityView is notified when the surface becomes available. If
startActivity is called before that notification an Exception will be
thrown.

Fixes bug 19147472.

Change-Id: I6712cf1929fe65c4238ce7f3feb4e8511ed97244
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
cb82f30186ea0f664cdb880cae1114cecd20ebc6 25-Feb-2015 Wale Ogunwale <ogunwale@google.com> Revert "Revert "Have AMS.setFocusedActivityLocked() move the focus stack to the front""

This reverts commit 3426b72cff7f8eeea4c802f4f0fcae4b995e177a
and fixes bugs 19505341 19507107

Bug: 19219490
Bug: 19507107
Bug: 19505341
Change-Id: I7d6fc9fa41ed03bb7834facbb4c453e2561f13c9
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
3426b72cff7f8eeea4c802f4f0fcae4b995e177a 25-Feb-2015 Wale Ogunwale <ogunwale@google.com> Revert "Have AMS.setFocusedActivityLocked() move the focus stack to the front"

This reverts commit af0e44885992b0675d7881c391caeff88414695f.

Unblock the release while I figure-out how the change broke things...

Bug: 19505341
Bug: 19507107
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
af0e44885992b0675d7881c391caeff88414695f 24-Feb-2015 Wale Ogunwale <ogunwale@google.com> Have AMS.setFocusedActivityLocked() move the focus stack to the front

Bug: 19219490
Change-Id: I089c42a6cf6277f5975064103c9804c2ab05dcd6
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
53a29a90f35f72462c0d6ad650921d5566c1f8f0 24-Feb-2015 Wale Ogunwale <ogunwale@google.com> Added ActivityManager API and AM command to resize a task.

Also fixed issue with ActivityStackSupervisor.moveTaskToStackLocked()
functionality not working correctly.

Change-Id: Ia13f1e92a7c59ce6543c226533ac8ea623488290
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
d697ceac0227822ab33d8f7cbe5442cc37d9d74a 21-Feb-2015 Wale Ogunwale <ogunwale@google.com> Improved back button behavior in multi-window mode.

Pressing the back button on the last activity in a stack that isn't
full screen causes the home stack to move forward and hide all other
visible stacks. This change allows the affected stack to be removed
while keeping the other stack visible.

Bug: 19423645
Change-Id: I30d84f84d525c114ee4993c1e4178af70fe47440
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
0f95e3f0753508344b198c0a76afb892df514f52 20-Feb-2015 Wale Ogunwale <ogunwale@google.com> Remove activity and window stacks when last task is removed.

Also,
* Only restore recent task to a full screen stack instead of any
randomly sized stack.
* Fixed issue where we were restore task from recents for some
operations when we didn't need to.
* Null out TaskRecord.stack when the task is removed from the
stack.

Bug: 19083170
Change-Id: I4e006f101f9d0f2aebde130ad77afc4d258c6612
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
05ecfd308d983755bc7cab39ba99a37c321f176b 11-Feb-2015 Alex Klyubin <klyubin@google.com> am 33d3c53d: resolved conflicts for merge of 517e0274 to lmp-mr1-dev-plus-aosp

* commit '33d3c53da021f0d044028860ace0f4ad817273f5':
Move hidden ApplicationInfo flags into a separate field.
33d3c53da021f0d044028860ace0f4ad817273f5 11-Feb-2015 Alex Klyubin <klyubin@google.com> resolved conflicts for merge of 517e0274 to lmp-mr1-dev-plus-aosp

Change-Id: Ic20b6c8851458483dd73a144bd5ae6e8d141e62a
b9f8a5204a1b0b3919fa921e858d04124c582828 03-Feb-2015 Alex Klyubin <klyubin@google.com> Move hidden ApplicationInfo flags into a separate field.

The public API field android.content.pm.ApplicationInfo.flags can
support only 32 flags. This limit has been reached. As a short term
workaround to enable new public flags to be added, this CL moves flags
which are not public API into a separate new field privateFlags and
renames the affected flags constants accordingly (e.g., FLAG_PRIVILEGED
is now PRIVATE_FLAG_PRIVILEGED).

The new privateFlags field is not public API and should not be used
for flags that are public API.

The flags that are moved out of ApplicationInfo.flags are:
* FLAG_HIDDEN,
* FLAG_CANT_SAVE_STATE,
* FLAG_FORWARD_LOCK, and
* FLAG_PRIVILEGED.

NOTE: This changes the format of packages.xml. Prior to this CL flags
were stored in the "flags" attribute. With this CL, the public flags
are stored in a new "publicFlags" attribute and private flags are
stored in a new "privateFlags" attribute. The old "flags" attribute
is interpreted by using the old values of hidden/private flags.

Change-Id: Ie23eb8ddd5129de3c6e008c5261b639e22182ee5
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
0e1621850b70662f120a733ac6adb45b838423d3 05-Feb-2015 Wale Ogunwale <ogunwale@google.com> Fixed NPE when trying to resize stack with no running activity.

Change-Id: If5b6a1110aa8a615def97c9707364e0cc12f4b39
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
0e0b7310a83942f6df67c69344020acf384c2bd4 30-Jan-2015 Winson Chung <winsonc@google.com> Merge "Adding some debug controls to test multi-window."
d16c565a607de754379fe699a4def21bd0e3de2f 27-Jan-2015 Winson Chung <winsonc@google.com> Adding some debug controls to test multi-window.

Adding some preliminary controls to mirror the currently exposed api
to create new activity stacks, resize stacks, and to move tasks
between stacks.

Change-Id: I3fb51c248f53a1d4c4eb23ca9fb3a76888def1de
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
783f28691e27b7b116730fad4f9fd9c083bab283 27-Jan-2015 Wale Ogunwale <ogunwale@google.com> Merge "Support activities in the same process having different resources."
8f5f7e9245278a46326ea0f04f193976c363695e 27-Jan-2015 Craig Mautner <cmautner@google.com> Precompute FLAG_ACTIVITY_NO_ANIMATION

Save lots of passing around of ActivityRecords when all you care
about is the flag.

Fixes bug 18088522 item #14

Change-Id: Ib6d95ef06b44faa1715a196ab710f96ed4517213
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
60454dbc4d815c90ff2713e224953d6547fc3ad5 24-Jan-2015 Wale Ogunwale <ogunwale@google.com> Support activities in the same process having different resources.

Activities can be of various sizes in a multi-window environment.
This change allows them to have override configurations that allows
different resources to the loaded if needed.

Bug: 19002213
Change-Id: Ib2c7be0b427f5ce05e7a362bcdd496ddbc9164f0
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1de57d883e41e7ea46fa4fab6b9da7044ed5cd7c 26-Jan-2015 Craig Mautner <cmautner@google.com> resolve merge conflicts of 2322ea5 to master.

Change-Id: I1570e633bf0d552a32d7fa9a2e0ebd81953f632b
299f960e5e5837da44cd81692388f3cbd5d2c362 26-Jan-2015 Craig Mautner <cmautner@google.com> Add reason string for bringing stack to front

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

For bug 17721767.

Change-Id: Ie1c0652a38a0c6ae6db27a52a9e5da29e252e300
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
d31c16457a7360bc892d71c308c7ab76cdb45af1 23-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Even more debug for bug 17721767." into lmp-mr1-dev automerge: dbabf37 automerge: 5cb31f2
automerge: b978450

* commit 'b978450b1c91f73eff63669ae3390627c0148dc4':
Even more debug for bug 17721767.
de313753d0fd0173d0558518d9a410fdc0127c76 22-Jan-2015 Craig Mautner <cmautner@google.com> Even more debug for bug 17721767.

This time adding events for stack movement and focus change.

Change-Id: Icdff9763ac2daf85c615992fa2c8e418e907908c
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
4900bf9d82c4905fadc43d8e2dd9a7f896da2d81 17-Jan-2015 Todd Kennedy <toddke@google.com> Expose new binder call createStackOnDisplay()

Creates a new, empty ActivityStack on a display. Use the binder call to
launch an activity on said stack.

Bug: 19001243
Change-Id: I0f04e8f2703bcc706f58e75333869fb35f6b1ee9
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
8ec2f1f04ea7958caac1ea5221178903621979a3 16-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Replace waitingVisible and other refactors"
8c14c15aad749d285b6f395019467a12da7fc9c6 16-Jan-2015 Craig Mautner <cmautner@google.com> Replace waitingVisible and other refactors

- ActivityRecord.waitingVisible is identical to
ActivityStackSupervisor.mWaitingVisibleActivities.contains(). This
ArrayList is never very large so much code can be simplified by
eliminating the waitingVisible member.

- The processStoppingActivityLocked() method can eliminate a lot of
variables by traversing the list top down. This makes the code
simpler to analyze and maintain.

- Declarations of ArrayLists do not need parameterization in the new
constructor. These have been removed in ActivityStackSupervisor.

Fixes item #5 of bug 18088522.

Change-Id: Ib9d648c5fa32c8dd7313882864886c929e1ebc21
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
28432f03600ee7e33cb030f2f113f1458531f608 16-Jan-2015 Todd Kennedy <toddke@google.com> Merge "Rename the binder call createActivityContainer"
ca4d842205ce256aab53825920a791c7ab9d62f1 16-Jan-2015 Todd Kennedy <toddke@google.com> Rename the binder call createActivityContainer

Change the call to createVirtualActivityContainer to better describe what's
actually being created with the call.

Change-Id: Id3a32df19a5bb6740cbabcd65897349e9f2f2946
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
ea002666cff0980752632c64432137732f463a40 13-Jan-2015 Craig Mautner <cmautner@google.com> am ef04ae79: Merge "Complete booting when frontmost activity is idle" into lmp-mr1-dev automerge: 82da2ee
automerge: 1549346

* commit '1549346a98227c1f41fa4bd99921139f2cf97a14':
Complete booting when frontmost activity is idle
f3ea23ad9bcd44bdbc8380c413989fc887b89cc8 13-Jan-2015 Craig Mautner <cmautner@google.com> Complete booting when frontmost activity is idle

The boot process is intended to complete when the frontmost activity
becomes idle. This change fixes a corner case where the system was
booting and the Home activity became idle when it was not at the
front causing the system to never complete booting.

Before ag/603303 a secondary stack was created for the TaskPersister
at the beginning of activity manager systemReady(). Following that
change the secondary stack was created for the first time when a task
was restored from system ui recents when getTaskThumbnail() was
called. At the time it was created it was also moved to the front of
the stack order.

If that stack creation happens to occur after the Home activity is
started but before the Home activity becomes idle then the new stack
will obscure the Home activity and the boot process does not
complete.

1. This change adds a test for an idle activity coming to the front
when a stack is moving to the front and we haven't completed booting
yet. If this situation is detected the boot sequence is then
completed.

2. This change fixes the stack ordering so that creating a new task
when restoring recents does not automatically move the stack to the
front.

Fixes bug 18949470.

Change-Id: I243f0bb4396b518a0a8835c0c7bdccb2581a3520
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
c82f2f5f9cb1bd4f5bcbd39a8ddf0d8da84f7104 09-Dec-2014 Wale Ogunwale <ogunwale@google.com> Add RecentTasks class to house recent tasks functionality.

Cleaned-up ActivityManagerService a little by moving recent
tasks functionality to new class RecentTasks.

Bug: 18556524
Change-Id: I4c877c9695b63d7fdb1b6b7addb737fd663e86c7
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
62fbd4feb1bccfdfa08a96c71eb5a1b102ac4c2c 05-Jan-2015 Wale Ogunwale <ogunwale@google.com> am 170a678c: am 1d893785: Merge "Don\'t restore persistent task to a stack until needed." into lmp-mr1-dev
automerge: b8e5139

* commit 'b8e51390af6015c1eaff7679546a5a7d2dfa701d':
Don't restore persistent task to a stack until needed.
1d893785bdd8af210eab861653e3e7664c728897 05-Jan-2015 Wale Ogunwale <ogunwale@google.com> Merge "Don't restore persistent task to a stack until needed." into lmp-mr1-dev
6c13f5921dd69e94d0dcf6bad7ce2ab9a038cdfa 18-Dec-2014 Craig Mautner <cmautner@google.com> am 2eb575b4: am 2281e7d6: Merge "Make window mgr stack movement track activity mgr" into lmp-mr1-dev
automerge: 4ed8a33

* commit '4ed8a336efc76847fbf3e11a0ae66aa74c422846':
Make window mgr stack movement track activity mgr
6b904ef4741321dcb01caee9795c2a044018706c 18-Dec-2014 Craig Mautner <cmautner@google.com> Make window mgr stack movement track activity mgr

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

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

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

Fixes bug 17721767.

Change-Id: Ibf01389810dd36724eaec5a4a07560144b2f4cef
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
7de0535701351d76b634ab18577269e8130749ea 13-Dec-2014 Wale Ogunwale <ogunwale@google.com> Don't restore persistent task to a stack until needed.

On boot-up we restore all persistent tasks to an activity stack.
This can cause issues with the activity stack supervisor when it
tries to make restored tasks with activities visiable when they
shouldn't be. Which ends up messing up the order of the recents
list. Now we don't restore persistent tasks to an activity stack
on boot-up. Instead we add the task to the stack when it is needed.

Also, fixes issue with not been able to launch task records with
activity records that were restored from an other device.

Bug: 18692762
Change-Id: Iad0e6635f8c5d1dab4d341feb3e7b06291a94739
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
cd5d198d7e852bc68871a279afbaa1b94e86a023 01-Aug-2014 louis_chang <louis_chang@htc.com> [ActivityManager] Fix NPE when start activity

Cherry picked from aosp.

Fixes bug 18593457.

Symptom:
NPE occurs in line 1184 (resultStack.sendActivityResultLocked)
because resultStack is null.

Root cause:
When starting activity with FLAG_ACTIVITY_FORWARD_RESULT flag,
the resultRecord could be updated, but the resultStack is not
updated as well. In that case, the resultStack is still be
null. The exception will occurs if the activity is not
granted to launch due to permission denied.

Solution:
Update resultStack when resultRecord updates.

Change-Id: I91634e4f713c2e8dbd1a71f358a8fd9beed83ec7
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
33bae1f49669e46ddbd1e68bc4e4a37843adc196 01-Aug-2014 louis_chang <louis_chang@htc.com> [ActivityManager] Fix NPE when start activity

Symptom:
NPE occurs in line 1184 (resultStack.sendActivityResultLocked)
because resultStack is null.

Root cause:
When starting activity with FLAG_ACTIVITY_FORWARD_RESULT flag,
the resultRecord could be updated, but the resultStack is not
updated as well. In that case, the resultStack is still be
null. The exception will occurs if the activity is not
granted to launch due to permission denied.

Solution:
Update resultStack when resultRecord updates.

Change-Id: I91634e4f713c2e8dbd1a71f358a8fd9beed83ec7
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
30bd3bb77b8bd1ac70723bcf7f1017fc40ea89b2 13-Nov-2014 Craig Mautner <cmautner@google.com> Revert "Debug for bug 18017409"

The bug has been fixed. No longer needed.

This reverts commit 5a3c231dc832c205d2bb2f7f0881925b92c9e5e2.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

And always improve logging.

Fixes bug 15991916.

Change-Id: I0d21c5337f0e89d9eacc8dab2cdaa52fec43ac0b
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
2e647efe01dcdb82d2d7f8a23540ba6b690a95d6 03-Nov-2014 Jason Monk <jmonk@google.com> Merge "Move LOCK_TO_APP_EXIT_LOCKED from System to Secure" into lmp-mr1-dev
c0d2d0ad6ddcd23b7bbe6b1a5668d6d719e4c86c 01-Nov-2014 Craig Mautner <cmautner@google.com> Animate starting windows when keyguard dismissed.

Starting windows are displayed prior to their app windows visibility
being set. Consequently the WindowToken.hidden boolean for starting
windows is still true even when it is shown. The keyguard logic uses
the method WindowState.isVisibleNow to determine whether to animate
each window. This method incorrectly determined that starting windows
were not visible based on WindowToken.hidden and consequently didn't
animate in the starting window.

This change fixes isVisibleNow() to correctly determine when
starting windows are visible and animates them in as part of the
keyguard transition.

This change also adds keyguard debug.

Partially fixes bug 15991916.

Change-Id: Iac3e5f3f33876be5801ec619bbe7a1579e648322
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
94cfd9d7c42287c18bde29aa1ae34944eb448f45 31-Oct-2014 Jason Monk <jmonk@google.com> Move LOCK_TO_APP_EXIT_LOCKED from System to Secure

To prepare for controlling from settings.

While here, add lock to app settings to backups.

Bug: 16957435
Change-Id: I059140cd07a7a0d5ceb4e0bfe5e0176cb96629d3
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
5a3c231dc832c205d2bb2f7f0881925b92c9e5e2 22-Oct-2014 Craig Mautner <cmautner@google.com> Debug for bug 18017409

Log adding and removing windows. Log activity state changes.

Change-Id: I544be89ff9af6b13ffde70dedec291793b46a420
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
3d7485c1728b56dd5cde7b0097c907ad494702a8 15-Oct-2014 Craig Mautner <cmautner@google.com> Remove unnecessary logging.

Change-Id: Ia5b5325707f2f02f2c585130938565065e974938
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
737fae2b2ea77e390c0dc1c91e9e1a98dac07d22 15-Oct-2014 Craig Mautner <cmautner@google.com> Move desired task to top if not already there.

Under certain circumstances when launching a new activity, the
topmost stack activity is moved to the front even though the
activity is being created in a different task.

This checks if the topmost stack task matches the desired
task and if not, moves the desired task to the top.

Also make activity dump ordering consistent.

Fixes bug 17721767.

Change-Id: I59397f31b629a208f3863887c57d6f6fb1f6e1f3
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
9449a6162e275531857464acc2279894d5d6a240 02-Oct-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17740687: Device does not boot after flashing LMP dev TOT(1478825) build.

There was a path through idle where we could clear mBooting but not set
mBooted, so we would no longer start activities. This is probably happening
because if you start a user or userdebug build with the device plugged in
to adb, the system early on starts the USB security dialog, before home is
started. If that goes idle first, we will end up in the case where we
clear booting (because something went idle) but not set booted (because it
was not home that went idle).

Change this so that we always set booted when clearing booting.

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

...but dev.bootcomplete flag is not set

Rework things to address a few issues I found:

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

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

Change-Id: If30c1f287af73bc2164e7aadbe98022ae42cc5e7
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
ff072725e39b8c6928d6ca2d7e263d7d081a2288 24-Sep-2014 Dianne Hackborn <hackbod@google.com> Work on issue #17624121: Settings crash while launching on wiped device

Cleaner paths and better error reporting when a problem goes wrong
while binding an application. This gets rid of the (recently added)
error about removing a process that hasn't been killed, and cleanly
kills the process along with more detailed errors about where things
failed.

Change-Id: I710a209c14da1515929e6254396b793177eee115
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
103b143ecd347dd0f4894209188fd6afa561c9a3 18-Sep-2014 Craig Mautner <cmautner@google.com> Merge "Don't remove active stacks from window manager" into lmp-dev
88924b62fc63ecaf6410f1a1d76e9c54cab0ebef 18-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17536024: The am start's wait option doesn't..." into lmp-dev
6025770e6b8e19f2fd9f5099ec30f59bc439b48e 18-Sep-2014 Craig Mautner <cmautner@google.com> Don't remove active stacks from window manager

Background:

In ag/406771 we stopped deleting empty stacks in activity manager
and window manager. This fixed a problem where dormant tasks were
being added back to stacks later.

In ag/476888 we introduced a callback to inform the ActivityView
holder that the embedded task was complete. This callback was made
from the new method ActivityContainer.onTaskListEmpty().

In ag/483035 onTaskListEmpty() was expanded to detach the stack of the
ActivityView and also removed the stack from window manager. There
was a mistake in that CL that causes it to remove any non-home stacks,
not just ones in ActivityViews.

That mistake left us with an empty stack in activity manager and no
corresponding stack in window manager. As a result, when trying to
bring back a task that used to be in this stack window manager threw
up an exception.

This fix limits the stacks detached by onTaskListEmpty() to those
on VirtualDisplays.

Fixes bug 17469145.

Change-Id: I85a4452e8e85625e657d88e4cb9f366fd4026441
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
6cfbb718905210d146fbe8fb18c8e124f24845ec 17-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17536024: The am start's wait option doesn't...

...give time in some cases

This switch to multiple stacks broke the check to determine if it
should actually wait for a new activity to be shown. The new check
now also requires that the top activity be resumed, which means
we may get some false positives where we decide to wait and shouldn't,
but that is better than consistently not deciding to wait in some
cases when we should. (And we will always finish waiting then next
time something becomes visible).

Also add another time, which is how long it took from the startActivity
call to return with the result. And fix when we decide to report that
we are done so that, in the case where we are bringing an existing
activity to the foreground, we don't wait until its animation is complete.

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

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

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

Change-Id: I63fbc2bcabf585e6d2810a2309f0613fdf91fdf5
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
f075330db4d0831588b45a1206467da03c0d906f 15-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #16907799: Processes containing bound services..." into lmp-dev
465fa3963534e41ead0dce1273b71fd50c58c973 14-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16907799: Processes containing bound services...

...are killed over eagerly.

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

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

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

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

Change-Id: Ib0cdf78c321cbb035259fc9dd6ee27b5ba1f90c5
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1a70a16b64620e416ae8353960c6af6c40274e7a 13-Sep-2014 Craig Mautner <cmautner@google.com> Add null checks for quickly disappearing Displays

If a display is removed right after it is added we will get null
when trying to retrieve it from the DisplayManager. Check for that
null before commiting to using that display.

Fixes bug 17478906.

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

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

Fixes bug 17383648.

Change-Id: I837ac087ef965d99d12c98ab1c779de46716e204
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
aea5ceded8015b45e8372b83a02f184974f52d6e 08-Sep-2014 Craig Mautner <cmautner@google.com> Relax requirements on Activity.requestVisibleBehind

The requirement that the top app be resumed in order to request
background visibility was too strict. In particular when the
background app is pausing the top app will be stopped waiting for
pause to complete. This is an appropriate time for the background
app to request visibility but we were rejecting that request.

Also, there is no need for the top app to have an active thread
except to notify it of the changed state.

Fixes bug 17383876.

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

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

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

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

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

Change-Id: Ia1da0fac90d7bdbaafdda2e34850d795ce17a39f
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
02a4aa261c28df2466234106d61282289276b462 03-Sep-2014 Craig Mautner <cmautner@google.com> Unconditionally move stack to front.

Recents was depending on using moveTaskToFront() to also move the
task's stack to the front. But that only works if the task is
actually in the stack because moveTaskToFront() doesn't do the
stack movement if the task is no longer in the stack. This change
calls ActivityStack.moveToFront() in addition to moveTaskToFront().

Fixes bug 17361027.

Also logs callingUid when starting an activity.

Change-Id: I023f956bafae00f45c58757ff5707ce520f02b55
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
c8838dfbec12d17cdf89a03bd4512d13e93ae910 02-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17322903: Crash in systemUI while launching an app from recents tab" into lmp-dev
962d535464eb79b11c346236f6889ad76a966e56 30-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17322903: Crash in systemUI while launching an app from recents tab

We now do sane things when adding a NEW_TASK to a task that already
has activities in it.

Change-Id: I965d6d44f9523e6199b1d90293f61ae5b8c352a4
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
2c924fb2c7dfba69d2913943598cbc61945d4f1d 29-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17329066: Crash in ActivityManager

Change-Id: Ib59b7a8d65b3abece82bc58897e21600af4d73f5
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
d7c9289f935992f4ae2fc032747f9e04bb86a7d0 28-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17289876: startActivityFromRecents appears to launch the wrong task

It would be good to actually bring the task to the front.

Also, make the flow when inTask is provided better match what happens when
we go looking for a task on our own.

And this includes another fix that was supposed to be part of a different
change but I forgot this class is part of the framework project now.

Change-Id: I3cf05f2e585c0fd7a0dbb7c7cf9fb1655764dd93
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
80e29b66c5966f6af77e7404ab4b6321ef5cf23b 27-Aug-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17179314: Make recents limits consistent" into lmp-dev
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/ActivityStackSupervisor.java
1b012d302b56b4adf950035136d1d191a1936d5a 20-Aug-2014 Jeff Hao <jeffhao@google.com> Add sample profiling option to am.

Also bundles all profiling options into a class.

Bug: 17040932
Change-Id: I85d675ee1494bdc7308caffdf94145d27c996e9d
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
4610545dd28ebf316704e119572521e97dbbd6bd 26-Aug-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #16311398: Limit number of documents a process can open" into lmp-dev
89ad456ea49cb62615ebdcac83a2515743bbe5fa 25-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16311398: Limit number of documents a process can open

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

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

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

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

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

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

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

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

Change-Id: I2bb81c3f92819350c868c7a7470b35817eb9bea9
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
79323120dd1faf139c4d881e2d817d1b8085d252 26-Aug-2014 Craig Mautner <cmautner@google.com> Remove redundant call to window manager addTask()

If there are activities in persisted tasks then calling addAppToken()
will automatically call addTask(). If there are no activities then
calling addTask() is a nop. In either case the call to addTask() is
unnecessary. It was actually worse than unnecessary because in the
former case we ended up with two identical tasks in the Window
Manager.

Fixes bug 16958544.

Change-Id: I2dc4b50aa94668873c1a783c47e0c696d62616f0
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
abc2358778b13137b2d49b0f2d10ac0b9bf277d2 21-Aug-2014 Jason Monk <jmonk@google.com> Merge "Lock task doesn't always end properly." into lmp-dev
835495c1175cd159635997ecff4281eb51e72fe6 20-Aug-2014 Jason Monk <jmonk@google.com> Lock task doesn't always end properly.

This can result in the keyguard not being re-enabled, the status
bar being in a bad state, and various other weirdness. When a task
is going away, it needs to send the standard lock task ending
messages so that exiting the state can be handled properly.

Bug: 16010327
Change-Id: Id7ee632f4765af0af209b70fb69dd75f2e541820
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
34ff492978d30569e694f7427be430dce66cac06 19-Aug-2014 Jose Lima <joselima@google.com> Fixes for a few bugs related to visible-behind activities

- Allow activities currently not visible to switch back to not
visible-behind state.
- Do not allow an activity that is not set as the visible-behind
activity to cancel the visible-behind state.
- Immediately mark a finishing activity as no longer visible behind.

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

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

Bug: 16959028
Change-Id: I526eac22f44273b3254dd6201f89194d13e597e2
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
ad400af809d4f0da7e3747922ddae6c1828a96bb 14-Aug-2014 Craig Mautner <cmautner@google.com> Fix singleInstance usage when singleTop intended

In ag/499591 launchSingleInstance was mistakenly used to replace
r.launchMode==ActivityInfo.LAUNCH_SINGLE_TOP. This fixes that
and...

fixes bug 16898764.

Change-Id: I0c0cc3b67eda69276dbe1dd5da4f17556651b1ff
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
4a8dddbf18fedb33bb2c725db489669a141e1d73 13-Aug-2014 Craig Mautner <cmautner@google.com> Clean up app following death when creating service

If an app has died, run through the cleanup before relaunching its
service.

Also a little simplifying refactor.

Fixes bug 16979752.

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

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

Bug: 15991916

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

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

Fixes bug 14469711.

Change-Id: I7e4346987cb620cb3a8c09096ff3a639cf344679
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
e069779dea07c77fb858a403c42020e39b3d9c60 04-Aug-2014 Jason Monk <jmonk@google.com> When exiting lock task require authentication

When exiting lock task with screen locking on make sure to notify
that the credentials need to be entered again.

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

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

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

Fixes bug 16045752.

Change-Id: I6b5981ffcce674139837b06362e573299bbc9e52
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
4b4971b8a31f29e9dd3d27d54a49914a7c3ec1fb 26-Jul-2014 Jeff Brown <jeffbrown@google.com> Fix a deadlock due to AMS calling into WMS with its lock held.

The full deadlock cycle involved ActivityManagerService,
WindowManagerService, and DevicePolicyManagerService.

Fixed by posting the work of enabling the screen to the handler
instead of doing it immediately while holding the activity manager
lock.

Bug: 16578860
Change-Id: I10514cd2df993c7193747ae823e1990a2c34e196
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
2961ce599ebee4895d2c9720fff7f011e7d4a0cd 23-Jul-2014 Jason Monk <jmonk@google.com> Make the 'locked' lock task not lock keyguard on exit

While here also fix mIsLockTaskLocked to actually be set to a value
so that it can be used.

Bug: 16347391
Change-Id: I27416f4787b28d19d84f895889eea1d3202c1759
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
9353e1a2b2e8f02377c3f73565964ffb0927c776 17-Jul-2014 Prashant Malani <pmalani@google.com> Merge "Make the booting flag update unconditional" into klp-modular-dev
84b08adcbb71fcaa860987f341310c7902a5a7ac 16-Jul-2014 Prashant Malani <pmalani@google.com> Make the booting flag update unconditional

In case an Activity is started before we idle, there is a chance
the booting flag might never get updated.

Bug: 16015648
Change-Id: I46504bd126573e3a2ce1f914be922765ae9fe560

Conflicts:
services/core/java/com/android/server/am/ActivityStackSupervisor.java
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
c39d47a8e7c74bd539104b0efab898ef6fc43ddf 09-Jul-2014 Michael Wright <michaelwr@google.com> Add MediaProjection APIs.

The new MediaProjection infrastructure allows the system to hand out
tokens granting the ability to capture the screen's contents, audio,
etc. at a granular level. It's intended to be used both for screen
casting, via the cast APIs, as well as screen sharing via third party
applications.

The screen sharing case is implemented, but all of audio capturing
is still forthcoming.

Change-Id: I4b24669bed7083e11413c10ed8d6b025f5375316
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
e2e280ec591d59f47d55b8a8552de2f4c7fb1636 17-Jul-2014 Craig Mautner <cmautner@google.com> Merge "Restore calling identity before checking permission" into lmp-dev
85c11a8831ba9572813f122674b3680ae4d14010 17-Jul-2014 Craig Mautner <cmautner@google.com> Restore calling identity before checking permission

Using the system service identity to check the CHANGE_CONFIGURATION
permission isn't likely to catch a security violation. Changing
back to the original caller and then checking permissions is
preferred.

Fixes bug 16215650.

Change-Id: Iff08d04422bcc052a487194154f1fd0d727d38f4
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
aa9b0f15753541ff8e4d62e6497c11800c737077 17-Jul-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 0a931069 to lmp-dev

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

Change-Id: I68e8290566b51fadb5671abdd9d05faf28502e22
ee36c77acd3b92c64e53e19c570e2482382db870 16-Jul-2014 Craig Mautner <cmautner@google.com> Additional cleanup after stack deletion.

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

Fixes bug 16045752.

Change-Id: Ia69a449e7f5e08ab6e36157d0fd793c4d2fdaca4
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
14bff9f55eccaf279419cb529711039e13e1e1d7 16-Jul-2014 Prashant Malani <pmalani@google.com> Make the booting flag update unconditional

In case an Activity is started before we idle, there is a chance
the booting flag might never get updated.

Bug: 16015648
Change-Id: I46504bd126573e3a2ce1f914be922765ae9fe560
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
febcb9d42bb6b458a3bbe59730476518f5a252d7 16-Jul-2014 Jason Monk <jmonk@google.com> Merge "Finalizing lock-to-app UX" into lmp-dev
bb742462781a73bb25516067c8fe6311c1c8a93e 08-Jul-2014 Craig Mautner <cmautner@google.com> Launch activity behind launching task.

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

Fixes bug 16157517.

Change-Id: I0a94af70b4748592e94673b958ee824cfb3d7ec0
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
7779bf1ce8243d9f856c05db3cc5a37a8227a970 14-Jul-2014 Jason Monk <jmonk@google.com> Finalizing lock-to-app UX

Simplifications have happened to remove the enter/exit layouts
and just use a toast to notify the user, and the in text icons
have been removed.

The enter dialog now has a checkbox to see if the lockscreen
should be locked on exit (since it isn't in settings anymore).

Also updated strings.

Bug: 15836599
Change-Id: I3ab685bf3672c8a7f9d83d12e81f0099968cdfde
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
409297da182267465adbc21cfb75a23e8d678117 11-Jul-2014 Dianne Hackborn <hackbod@google.com> Allow INTERACT_ACROSS_USERS for service access.

But only if the two users are in the same profile. Also
apply the same rule for the recently allowed interaction
across content providers.

The activity manager now keeps track of which users are in
the same profile group, and the handleIncomingUser function has
an option to allow a non-full caller to do the interaction
if the two users are in the same profile group.

Spread this joy all over the place.

Also turn off multi-user on Svelte devices.

Change-Id: I231484ea2a6bfccbb3cd51357d7a387bd75039ea
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
ee2e45acbff28986c2ced636b7550d0afbb0eeb7 27-Jun-2014 Craig Mautner <cmautner@google.com> Add Media Playing API

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

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

Fixes bug 14469711.

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

They would leave active voice activities lingering around.

Change-Id: I5b6716ab303636ebdf2f13c3172552a73dae3bb1
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
a8f569c10a423ced5be7e019c3df2bca11b052f5 07-Jul-2014 Jason Monk <jmonk@google.com> Add toast when user tries to leave lock-to-app

The toast will describe how to exit when entered normally, but when
entered by a DPM whitelisted app it will just notify them they are in
the mode.

Bug: 15780115
Change-Id: I75ac8540c31a75ac68e34b3b5c8260e191894b39
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
76e2a765b495f15a718dc4dfd9d81e9539a7074b 24-Jun-2014 Craig Mautner <cmautner@google.com> Don't set return to recents on every resume

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

Fixes bug 15832448.

Change-Id: Ib64fe26f3fd3fdcd878edafb041928ec02757e63
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
858aef2942e3e2b5759a8bc27fc4f1954573da7b 21-Jun-2014 Jason Monk <jmonk@google.com> Merge "Add lock-to-app mode"
62515beee67307d8859beec521b7baedfa54b2b5 21-May-2014 Jason Monk <jmonk@google.com> Add lock-to-app mode

Added a dialog that shows when app has not been authorized by
DevicePolicyManager.isLockTaskAuthorized. This allows any app
to trigger lock-to-app mode. This same dialog is used when
startLockTaskOnCurrent is triggered by the recents long-press.

Can exit the mode by long-pressing recents again.

Keyguard is disabled when lock-to-app is active.

This CL also prevents apps from finishing when they are the root
task in a lock task TaskRecord.

Change-Id: Ib54d858e570cccf6bfd986958868e15f49bcef75
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
3bd90617ec07a1093139de39591a624b21468e46 19-Jun-2014 Christopher Tate <ctate@google.com> Don't end lock task mode when not in lock task mode

Change-Id: I3724d68ed7116d47024638d56c5bf43c4866f82e
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
f329d050b8e72ba6daf67edc1b1b64b0035a6050 20-Jun-2014 Dianne Hackborn <hackbod@google.com> Merge "Add kernel and native memory data to procstats."
f7097a5b697fedb6976774e55a51471405a23c0e 13-May-2014 Dianne Hackborn <hackbod@google.com> Add kernel and native memory data to procstats.

We now collect memory use data in the kernel and native
application for aggregation in procstats. This should
allows us to do aggregated summaries of how memory use
is distributed across the system -- how much is free vs.
how much is in use.

Fix a bug in how we were tracking per-app version codes:
apps that used a shared user id to have multiple packages
run in the same process could get their version codes
cross-wired. Now we keep track of version codes in the
list of packages associated with a process.

Bumped the checkin version code to 5, so that we can
distinguish checkins that have this corrected data.

Also fix a bug in battery stats monitoring radio state.

Change-Id: I1c849f2df442df679a34ad7b0ca0c5870bfac8df
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
fbe6be4f653d73d5c51ee0a2fb40d2a34c2366fd 18-Jun-2014 Jason Monk <jmonk@google.com> Merge "Notify any profile/device owners of lock task"
35c62a4668a85aa4318c9ec564f2e06e8a2d2a30 17-Jun-2014 Jason Monk <jmonk@google.com> Notify any profile/device owners of lock task

Add a method for DeviceAdminReceivers of profile/device owners to
be notified that lock task mode has entered or exited for an app
they have whitelisted.

Change-Id: Id124287d41564bbfccdacccf1977b7acb3ddec3f
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
ebf55ad6dec7e59dca668cf97ac81619793defe0 18-Jun-2014 Jason Monk <jmonk@google.com> Merge "Change lock-task DPM authorization to packages"
2c43c339de5aaf4fef58aa9b5ac3af48609263a8 13-Jun-2014 Jeff Brown <jeffbrown@google.com> Resolve boot time dependencies related to the power manager.

This change fixes a bug where native daemons may try to communicate
with the power manager before it was fully initialized due to a race
between publishing the binder service and completing init().

The solution was to simplify the dependencies related to the power
manager. It turns out that most services that were passed in
init are not actually needed until systemReady. What remained
was a dependency on the activity manager to check permissions for
incoming calls. So now we start activity manager first.
However, the activity manager also depends on power manager for
wakelocks. To break the cycle, we now defer initializing the activity
manager's wakelocks until after the power manager has been started.

Cleaned up a bunch of boot-time service dependencies so that we
can have better confidence that they are correctly maintained.

Bug: 13884219
Change-Id: If08e2d7ccd44e7026a72441bb6bd5afd7bb9fffe
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
d7b8621bde44857ebb07130693a00f5f777887d4 16-Jun-2014 Jason Monk <jmonk@google.com> Change lock-task DPM authorization to packages

Switch the DPM lock-task authorization to be controlled by a package
rather than a component.

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

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

This reverts commit 4a9f129874785d34930f165268dbc618e4bc2618.

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

Change-Id: Ic1f4df7f4cb644de7ddebcdc8ce632b46c5ba8f2
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
be63495101dba3b0c3c496cdd810df9e30e926d4 12-Jun-2014 Craig Mautner <cmautner@google.com> Fix permission problem and NPE

Remove uid before calling into Window Manager. Restore afterwards.

Check for null stack value before dereferencing.

Fixes bug 15591112.

Change-Id: Ida3de556940440162c91b8c1614d0f21e364abd8
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
4a9f129874785d34930f165268dbc618e4bc2618 11-Jun-2014 Craig Mautner <cmautner@google.com> Close ActivityView and ActivityContainer cleanly.

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

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

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

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

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

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

This reverts commit dd5c94717077c9366dee364c88a86a78e5ee2688.

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

Conflicts:
services/core/java/com/android/server/am/ActivityStack.java
services/core/java/com/android/server/am/ActivityStackSupervisor.java
f391ebccea9090fac64201d284641be3882f857a 13-Jun-2014 Chad Jones <chadj@google.com> resolved conflicts for merge of 4849aa86 to master

Change-Id: I7ec55bdb7a3a1618f33dfdb3b19b2bd201789677
4c07d0246fb37e6a77be2c5cdcdf55a989b90f75 12-Jun-2014 Craig Mautner <cmautner@google.com> Merge commit 'f5030ecb' into manualmerge

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

Change-Id: Ie38e3e8b82f588d36e955664904f3ab84bdfaaf5
0aad830d1b3006c75a66c02d29d3147c8765b815 11-Jun-2014 Craig Mautner <cmautner@google.com> am 28084383: am e33010a2: Merge "Add NO_ANIMATION flag to ActivityView Intents." into klp-modular-dev

* commit '28084383c13660864f75452f99183c377c2798ec':
Add NO_ANIMATION flag to ActivityView Intents.
e6d80f4ce433e16dc72ea3291801169eb507a695 10-Jun-2014 Craig Mautner <cmautner@google.com> Add NO_ANIMATION flag to ActivityView Intents.

Add Intent.FLAG_ACTIVITY_NO_AMINATION to all Intents passed into
ActivityView.

Fixes bug 15393526.

Change-Id: I1899a5019416109e982f0254aaba410bb1f4a38d
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
7683baad6c437af2931020423bf227f97a3ce0ba 10-Jun-2014 Craig Mautner <cmautner@google.com> am a7c5791a: Merge "Redefine FLAG_ACTIVITY_NEW_DOCUMENT without NEW_TASK" into lmp-preview-dev

* commit 'a7c5791a95bf732c2381f698d78930ee61efd36b':
Redefine FLAG_ACTIVITY_NEW_DOCUMENT without NEW_TASK
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/ActivityStackSupervisor.java
b6011c1c2a2452174c7ce973e1867b912996081d 05-Jun-2014 Craig Mautner <cmautner@google.com> Merge commit '21483b9f' into manualmerge

Change-Id: If9261cc1625f9f492697fe16c21d2b71c0cc0e11
d94b47f3b671f5afbc79b061a9b8fa7aa8b22f87 03-Jun-2014 Craig Mautner <cmautner@google.com> Add callback when ActivityView activities complete

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

Fixes bug 15330616.

Change-Id: I39d55bdb0db8b0a12ee751cdcb039b7fbb899c85
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
a4ab093ddca0ea34e9923f24184f46201d2016c8 30-May-2014 Jose Lima <joselima@google.com> am 9dbe6159: Merge "Only allow 1 Stack on Leanback-only devices" into lmp-preview-dev

* commit '9dbe6159a0eef0f14825ceee101681df7272d9af':
Only allow 1 Stack on Leanback-only devices
4f8a92bd20be374811b2cab855f390221893279a 30-May-2014 Jose Lima <joselima@google.com> Merge "Only allow 1 Stack on Leanback-only devices" into lmp-preview-dev
1015efb143b51a5d31f2f932528f295cfa1add1f 29-May-2014 Nicolas Prevot <nprevot@google.com> Merge "Making the content resolver work with result intents."
71ac80c46a1b094ad951e59c24791d9e9ef769bf 29-May-2014 Craig Mautner <cmautner@google.com> Merge "Revert "Modify task navigation to return to recent tasks." DO NOT MERGE" into lmp-preview-dev
b9a6c8ad99c7885dccc23223068c0a551f350cd5 29-May-2014 Craig Mautner <cmautner@google.com> Revert "Modify task navigation to return to recent tasks." DO NOT MERGE

This reverts commit 1a4e211e03f1f795d935058e27356a0e8bc5df7c.

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

This reverts commit 19174878e25ebfd8806595f83df7bdea1d239c07.

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

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

Change-Id: Id81280c23247aeda7ad56e34af9b12a6f3a00a3c
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
d3a5b916b1655c9a36d531afc8420fc5ca0ccfdd 29-May-2014 Dianne Hackborn <hackbod@google.com> am c2091a1f: Merge "Add system layer for voice interaction services." into lmp-preview-dev

* commit 'c2091a1fbc463941b3e42db36e369124ac3c1013':
Add system layer for voice interaction services.
e30e02f5d9a9141c9ee70c712d4f9d52c88ea969 28-May-2014 Dianne Hackborn <hackbod@google.com> Add system layer for voice interaction services.

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

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

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

Change-Id: Ic9e0e8c843c2e2972d6abb4087dce0019326155d
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
58e66d69f9f239a444a90c7ff5eae32557fe350c 28-May-2014 Jose Lima <joselima@google.com> Only allow 1 Stack on Leanback-only devices

- For Leanback only devices we will force all activities to
live in the same app stack. This is a design decision for the
shy/gregarious changes we are planning to implement for
leanback devices.

Change-Id: I5e65f9b079830a9485b5a136700993755c3f555f
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
4a4a17aa1107e75ba4c0ece87c90a3eff6d4c918 28-May-2014 Fabrice Di Meglio <fdimeglio@google.com> am f52b9c8a: Merge "Revert "Only allow 1 Stack on Leanback-only devices"" into lmp-preview-dev

* commit 'f52b9c8a4aebf6d04b747e45c921fa4f51344b34':
Revert "Only allow 1 Stack on Leanback-only devices"
c82e7d30e34ff7cc273edf1ea8ddd11b713fec5b 28-May-2014 Fabrice Di Meglio <fdimeglio@google.com> Revert "Only allow 1 Stack on Leanback-only devices"

This is making a HH device (and probably others) in a reboot loop

This reverts commit 0cac71e9bdee1e9e6b2faafec0f9f894effbcb67.

===

See:

W/dalvikvm( 2320): threadid=1: thread exiting with uncaught exception (group=0x952d3f28)
E/AndroidRuntime( 2320): *** FATAL EXCEPTION IN SYSTEM PROCESS: main
E/AndroidRuntime( 2320): java.lang.RuntimeException: Failed to create service com.android.server.am.ActivityManagerService$Lifecycle: service constructor threw an exception
E/AndroidRuntime( 2320): at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:89)
E/AndroidRuntime( 2320): at com.android.server.SystemServer.startBootstrapServices(SystemServer.java:304)
E/AndroidRuntime( 2320): at com.android.server.SystemServer.run(SystemServer.java:244)
E/AndroidRuntime( 2320): at com.android.server.SystemServer.main(SystemServer.java:161)
E/AndroidRuntime( 2320): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2320): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 2320): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836)
E/AndroidRuntime( 2320): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)
E/AndroidRuntime( 2320): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 2320): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 2320): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 2320): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
E/AndroidRuntime( 2320): at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:78)
E/AndroidRuntime( 2320): ... 8 more
E/AndroidRuntime( 2320): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 2320): at com.android.server.am.ActivityStackSupervisor.isLeanbackOnlyDevice(ActivityStackSupervisor.java:3508)
E/AndroidRuntime( 2320): at com.android.server.am.ActivityStackSupervisor.<init>(ActivityStackSupervisor.java:220)
E/AndroidRuntime( 2320): at com.android.server.am.ActivityManagerService.<init>(ActivityManagerService.java:2145)
E/AndroidRuntime( 2320): at com.android.server.am.ActivityManagerService$Lifecycle.<init>(ActivityManagerService.java:2073)
E/AndroidRuntime( 2320): ... 11 more
E/AndroidRuntime( 2320): Error reporting crash
E/AndroidRuntime( 2320): java.lang.NullPointerException
E/AndroidRuntime( 2320): at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:89)
E/AndroidRuntime( 2320): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
E/AndroidRuntime( 2320): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
E/AndroidRuntime( 2320): at dalvik.system.NativeStart.main(Native Method)
I/Process ( 2320): Sending signal. PID: 2320 SIG: 9
I/ServiceManager( 174): service 'power' died
I/ServiceManager( 174): service 'sensorservice' died

Change-Id: Ib90ae4dff6542d67f5827b100a3ab6158ce88ae2
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
ca7ddbfef7ae5f205b456d5c4dce70c2f5eec489 28-May-2014 Jose Lima <joselima@google.com> am 00430954: Merge "Only allow 1 Stack on Leanback-only devices" into lmp-preview-dev

* commit '004309546b7efa188df56e58539e4227ed192cf7':
Only allow 1 Stack on Leanback-only devices
a5c7e0f80f6a0ea59e29df01c886376da56ebbbc 27-May-2014 Jose Lima <joselima@google.com> Only allow 1 Stack on Leanback-only devices

- For Leanback only devices we will force all activities to
live in the same app stack. This is a design decision for the
shy/gregarious changes we are planning to implement for
leanback devices.

Change-Id: I201f56541ba22356e9598f09419ad41e588c74dc
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
8f4f2ff5cbd9cf5733437afeb54f8a2453d9e616 27-May-2014 Winson Chung <winsonc@google.com> Merge "DO NOT MERGE " into lmp-preview-dev
39c1f59541c806471bd538adfb981f26f58b647f 27-May-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 754a8c4c to master

Change-Id: I750b714248486eb8609951caa10be7a543f624da
c752919c7cd29b497918618cc9ebf56c18995a76 27-May-2014 Craig Mautner <cmautner@google.com> Merge "Do not start tasks on ActivityViews unless explicit. DO NOT MERGE" into lmp-preview-dev
b539b3aafb2b0e55fc9578344eff35256fd5a94e 27-May-2014 Craig Mautner <cmautner@google.com> Do not start tasks on ActivityViews unless explicit. DO NOT MERGE

New tasks were being started on ActivityViews because they
matched packages. This fix enforces a rule that new tasks
can only be started on ActivityViews if they are explicitly
targeted for that ActivityView.

Fixes bug 15162447.

Change-Id: I9ccb72171b5cda0897a0b9ffe4cbebfbb0d92c2c

Conflicts:
services/core/java/com/android/server/am/ActivityStackSupervisor.java
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1b4bf857d34dc58a4ef84f5f0761bb7685051fbb 27-May-2014 Craig Mautner <cmautner@google.com> Do not start tasks on ActivityViews unless explicit

New tasks were being started on ActivityViews because they
matched packages. This fix enforces a rule that new tasks
can only be started on ActivityViews if they are explicitly
targeted for that ActivityView.

Fixes bug 15162447.

Change-Id: I9ccb72171b5cda0897a0b9ffe4cbebfbb0d92c2c
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
e88d180d6cc5713049489d9f30e998fe846145f1 27-May-2014 Craig Mautner <cmautner@google.com> am e2c92ac8: Merge "Update launchFlags after changing Intent flags" into lmp-preview-dev

* commit 'e2c92ac847d151cbf4d578ee85d3ff10126e9ada':
Update launchFlags after changing Intent flags
a254cd7e0ffd7d3b131f3c7a69c9fa13dbacc0bd 26-May-2014 Craig Mautner <cmautner@google.com> Update launchFlags after changing Intent flags

If you don't you're going to have a bad time. In particular we
did not act on the new flags and the documentLaunchMode setting
was ignored.

Fixes bug 15245852.

Change-Id: Ie1c435c4a821b9fc787e5e06e7b24aa98a242225
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
df6523f2703920a1d2a84c45b862b325b8cebf40 21-May-2014 Craig Mautner <cmautner@google.com> Modify task navigation to return to recent tasks.

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

Fixes bug 14464114.

Change-Id: Ic0d3731fc7248d1eaa80e5ee399753d80e80c979
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
deec695253aa5856135be3ffdcd35eaafed9e526 24-May-2014 Craig Mautner <cmautner@google.com> Merge "Add code for persisting tasks and activities to disk"
5286d3ff47135976d66d67888cadca52ef2ab244 12-May-2014 justinzhang <justinzhang@google.com> Hide status bars in lock task

Call StatusBarManager to show/hide status bars for lock task.
(Same CL as https://googleplex-android-review.git.corp.google.com/#/c/461068/,
sorry for the confusion.)

Bug: 13669575
Change-Id: I5c90bdb1d868aa02d3679e854b5ccbe434d996d6
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
376543bc5f1f8a4465f6f0f9c9b45f96f37b3d06 22-May-2014 Winson Chung <winsonc@google.com> DO NOT MERGE

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

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

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

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

Change-Id: Ifb820a01c412fe1f8c0f6e41aa655fafd89eaa8d
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
31d8b9333bf3b1e6048182885149b80c6fa6b500 22-May-2014 Winson Chung <winsonc@google.com> Merge "Invalidating screenshots when we resume the task that they were taken in. (Bug 13587139)"
cc12f28e5dc6bd027971c995c7aab63dadcc0d35 22-May-2014 Winson Chung <winsonc@google.com> Invalidating screenshots when we resume the task that they were taken in. (Bug 13587139)

- Removing multiple calls to get the same thumbnail screenshot
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
2d437d04614ba79ad54546b05f9aec93a479b603 21-May-2014 Jason Monk <jmonk@google.com> Don't exit lock task on sleep

Change-Id: I332088ce31ce06a771461a78fcc63f4afc824813
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
810c2b5f4dab0de8fe38a9091ea68e3e35567c77 18-May-2014 Craig Mautner <cmautner@google.com> Merge "Pass correct task to window manager"
abcc59c32fd67c507f2ff192e82fef971968b2db 18-May-2014 Craig Mautner <cmautner@google.com> Pass correct task to window manager

The target task when starting is not always the top task. If it's not
the window manager gets into a bad state.

Fixes bug 14684143.

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

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

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

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

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

Fixes bug 13736007.

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

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

Change-Id: I5cffe903bc82041fe79bfc63107df71ddf01232c
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
63812fd9f20d2a0f96ef0fac69497d3334ae6d97 08-May-2014 Amith Yamasani <yamasani@google.com> Merge "Send boot_completed for users started in the background"
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/ActivityStackSupervisor.java
1a7eaaa50e7f1a021129ebbe2f6ae1ac469b8812 07-May-2014 Amith Yamasani <yamasani@google.com> Send boot_completed for users started in the background

Bug: 14587584

Change-Id: I7abfad0a7102376e1665b528f3fd110a4b6ed164
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
6856ef87a579fd20ec4a14d7ebf7c2cb352d958e 05-May-2014 Craig Mautner <cmautner@google.com> am 9bb4df3a: am e88097bd: Merge "Pause and resume ActivityView when visibility changes" into klp-modular-dev

* commit '9bb4df3a7d9ed479f8ef10b08bbc3354a1984aab':
Pause and resume ActivityView when visibility changes
b12646210f15b7f1b7cf0b1cbc56f5cb4bbfe02d 05-May-2014 Craig Mautner <cmautner@google.com> am 6dffeb9e: am 8890013a: Merge "Add null check to embeddedAllowed check" into klp-modular-dev

* commit '6dffeb9eeba785dcf738bfabfec334a6c188d104':
Add null check to embeddedAllowed check
e88097bd00d5710bbfb6c24a934743c8d6cac9cf 05-May-2014 Craig Mautner <cmautner@google.com> Merge "Pause and resume ActivityView when visibility changes" into klp-modular-dev
05678d5a3136a747a2e7eaccca0ad148c52a2d00 05-May-2014 Craig Mautner <cmautner@google.com> Add null check to embeddedAllowed check

If the component being checked has been removed an NPE will be
thrown. This checks for that situation and handles it.

Fixes bug 14562234.

Change-Id: Ica5713378f356ac8441862d455b7d284ea111212
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
d13a5583971a5905ac2ec240282383bde96fc25e 05-May-2014 Craig Mautner <cmautner@google.com> Pause and resume ActivityView when visibility changes

Once a Surface has been established the activity in an ActivityView
must be paused and resumed as the view goes in and out of visibility
= View.GONE.

Fixes bug 14034658.

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

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

Change-Id: Ie2b85b3020ef1206d3f44b335b128d064e8f9935
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
e361268e6efd48d815e85ce32a357f1346ac892f 26-Apr-2014 Craig Mautner <cmautner@google.com> am cb48b962: am 1a7e9e66: Merge "Throw exception from startActivity if not allowed." into klp-modular-dev

* commit 'cb48b96223071dc9d8633aab8f6cd9a91b3676bf':
Throw exception from startActivity if not allowed.
247ab65a4985470feff9cb5b5d40d2b8c64f5ada 25-Apr-2014 Craig Mautner <cmautner@google.com> Throw exception from startActivity if not allowed.

The ActivityView.startActivity method may defer calling
ActivityContainer.startActivity if the ActivityView is not yet
visible. If the activity being started doesn't have allowEmbedded
attribute set to true then the SecurityException will not be
thrown until the ActivityView is visible. In such a case the caller
of ActivityView.startActivity cannot catch the SecurityException.

This fix checks the attribute at the time ActivityView.startActivity
is called.

Fixes bug 14317210.

Change-Id: I7fff23e39b67a9a0aa1b2e555920d02ae38906d9
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
2e46e65e9dafe1f6a911efa213fcb0d105394b09 25-Apr-2014 Craig Mautner <cmautner@google.com> Too soon.

Change-Id: I1abb1d4841e4e6342c3b861d33ae22e22ed0a161
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.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/ActivityStackSupervisor.java
6c66d1fd79968ad286d3cb6477e762d7e8bdc5ec 24-Apr-2014 Craig Mautner <cmautner@google.com> am 7e28afd9: am 7d2d2272: Merge "Force ActivityView activities to start in new task" into klp-modular-dev

* commit '7e28afd9568c590c7110f83b252dbb77f165fcb3':
Force ActivityView activities to start in new task
75731016e9231cc867e99a3d9269fc16c8f3f606 24-Apr-2014 Craig Mautner <cmautner@google.com> Add test for attribute android:allowEmbedded

Throw a SecurityException if it is not true for an activity launched
using ActivityContainer.startActivity().

Change-Id: Id1d70e630195a49a3eccdc64a0beccc420400332
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
7f7bdb2712d4988efa5e914c0b54271752b49407 23-Apr-2014 Craig Mautner <cmautner@google.com> Force ActivityView activities to start in new task

Activities were associating with existing tasks when their
components matched. This was causing them to be launched
into existing stacks rather than into their ActivityView. Adding
these flags forces the launches to be in unique tasks on their
ActivityView.

Fixes bug 14252286.

Change-Id: I9ba65a4a2da198435748c0a17396d3f7f8c75f5e
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
96997a6148161e525a91f9d04f6468fbe01c2d69 23-Apr-2014 Ying Wang <wangying@google.com> am d12bf275: am d0dc8981: Merge "Javac (at least for 1.7.0_51 on Mac) wants fully qualified class name" into klp-modular-dev

* commit 'd12bf27575bc2df114abc0aadd1a62ff476b5a42':
Javac (at least for 1.7.0_51 on Mac) wants fully qualified class name
b081a59a0fdec88dd9b0f68b45c2f625f751d625 23-Apr-2014 Ying Wang <wangying@google.com> Javac (at least for 1.7.0_51 on Mac) wants fully qualified class name

It looks like a Javac bug.

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

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

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

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

Fixes bug 12821632.

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

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

Fixes bug 14107002.

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

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

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

Change-Id: I6b719be0cb57542f022a3cc14e8f4efde60b1a50
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
f32b22e9c78cbc0109adbad67e9ff3d7045bd954 25-Mar-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of ca903d38 to klp-modular-dev

Change-Id: I44b8cbeb9ae9f6e5c8b2fe1363127d6eccfdf041
fea8d956649589f1cfd378571cc9ad61a92cd480 24-Mar-2014 George Mount <mount@google.com> Merge "Fix null ActivityOptions when starting an Activity in a new Process."
2c92c9700c7b06f3c7dd5ab15d8343dfce68c833 20-Mar-2014 George Mount <mount@google.com> Fix null ActivityOptions when starting an Activity in a new Process.

Bug 13563265

Change-Id: Ie56cd6d55f13dbf68bafb82ab4bd6b27fde60df6
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
dd221b3780800f03900c52bfc4a1ac7d01b72bc2 20-Mar-2014 Craig Mautner <cmautner@google.com> Fix oversight when checking in last CL

Too much was deleted due to the order of operations while
debugging. CL 435015 removed some critical lines.

Fixes bug 13410184.

Change-Id: Ia1fbf985d73163742c4c531e8505606454897f69
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
95e9daab03d0349a69940625c7f718175f371581 17-Mar-2014 Craig Mautner <cmautner@google.com> Fix activities appearing behind home icons

Notify the Window Manager when a task has been moved to the front.

Fixes bug 13410184.

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

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

Change-Id: I719168532134ab2c5ea3300df676c2b2a0e81795
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
c9519fcd386a43d3908111c468903329b9346a3d 14-Mar-2014 Dianne Hackborn <hackbod@google.com> am 32a9180a: am f29a4981: am d4981014: am e5191aab: am a796168d: Merge "Fix issue #11965706: Calls using IntentChooser are now Broken in 4.3 and 4.4" into klp-dev

* commit '32a9180a6c1ac12503aaf0d123c2bfff73349508':
Fix issue #11965706: Calls using IntentChooser are now Broken in 4.3 and 4.4
d4981014d486c3ff72813d0d37048ee2abdb3d63 14-Mar-2014 Dianne Hackborn <hackbod@google.com> am e5191aab: am a796168d: Merge "Fix issue #11965706: Calls using IntentChooser are now Broken in 4.3 and 4.4" into klp-dev

* commit 'e5191aabff5b9b751349b8634836a858af744905':
Fix issue #11965706: Calls using IntentChooser are now Broken in 4.3 and 4.4
aea74a5977ca9f1054926eb24f247562c3a4a6ba 08-Mar-2014 Craig Mautner <cmautner@google.com> Add Lock Task Mode.

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

Change-Id: I6cfe92fe1bcf22cd47b5398c08e23c52a4092dda
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
dae57a14141a90d71332086c3d6e8bd3ebf84fe5 12-Mar-2014 Alexandra Gherghina <alexgherghina@google.com> Check for empty activity stack. This avoids a null pointer exception
when switching from an user with no open apps.

Change-Id: I02629818f2bc82ee3a2825cf484ef1e32e3e6067
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
a77cf8735432daddb233164f41103a0ff38408bb 25-Feb-2014 John Spurlock <jspurlock@google.com> Merge "Tabs -> spaces in frameworks/base."
b5abedbd5cef473574884a7453cdf4d412af26af 25-Feb-2014 Craig Mautner <cmautner@google.com> am c407ace3: am d4c819c0: am dd9ce628: Merge "Clean up activities and displays when done" into klp-modular-dev

* commit 'c407ace3019c4e542654cf17fd04d9436d3f3436':
Clean up activities and displays when done
95da1087ed3c7b9983b571bc5409827ae390f15f 25-Feb-2014 Craig Mautner <cmautner@google.com> Clean up activities and displays when done

More maintenance fixes.

Fix bug 13157352.

Change-Id: Ic86d39a84452a1cf1dc1762cec517b419ad0a852
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
8a985d24ce9a38f40ed88fecbdcd0e75e3a68f44 25-Feb-2014 John Spurlock <jspurlock@google.com> Tabs -> spaces in frameworks/base.

Change-Id: I5a84e8e93ac99b5ed0212b37bf66efa5e53864be
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
92a507986af512d248a1987971b59911406721a9 22-Feb-2014 Craig Mautner <cmautner@google.com> am 3dc57b39: am c004c9a8: am ffda4648: Merge "Fixes for ActivityView on home activity" into klp-modular-dev

* commit '3dc57b39f2a87fe3692b5606de2b0c0693fc485c':
Fixes for ActivityView on home activity
12ff7391a10fff5107e2734d50ed0b428fb75f67 22-Feb-2014 Craig Mautner <cmautner@google.com> Fixes for ActivityView on home activity

When the ActivityView is part of the home activity special checks
must be made. Things like don't move the home stack to the back
when the ActivityView activity is resumed.

Fixes bug 13119389.

Change-Id: I3a6040c9824dfd4b8ee97d58d131b14a519b470a
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
ca9bc702df5c14a89c9b8b0109a05894bf74962e 11-Feb-2014 Jeff Brown <jeffbrown@google.com> Add support for injecting events into ActivityContainers.

Modified ActivityView to inject touch events it receives back into
its activity container. The container then injects the event into
the input system along with the display id of the underlying virtual
display.

Change-Id: I23d018a2f7dd30f1f833f522eb7f143b43d8e637
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
38f96e5020b3e82b98fe97b0be363a5ad185860f 11-Feb-2014 Jeff Brown <jeffbrown@google.com> Add support for injecting events into ActivityContainers. (DO NOT MERGE)

Modified ActivityView to inject touch events it receives back into
its activity container. The container then injects the event into
the input system along with the display id of the underlying virtual
display.

Enhanced the input system to support concurrent dispatch of touch
events on multiple displays which is required for this to work.

Change-Id: I9cf1870db3be6f99a52ed9a1e3ceafe42c940093
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
56aa06c4249efe32c82af1dc71df9701dc8f457c 10-Feb-2014 Craig Mautner <cmautner@google.com> am 779d204a: am 9ef471f7: Don\'t remove Activities and Tasks until animation done

* commit '779d204abe6a3922b572822df5cd775ffd5d77e8':
Don't remove Activities and Tasks until animation done
9ef471f7f2f59de032d7cb9c3c7241486109979e 07-Feb-2014 Craig Mautner <cmautner@google.com> Don't remove Activities and Tasks until animation done

Just like stacks and displays, activities and tasks need to stick
around until animations have completed.

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

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

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

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

Fixes bug 12747909.

Change-Id: I509007ee23fda400b353f483cf6ecce08177763b
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
921f4f926472e5f5864cae203538f47fda6cdbdf 25-Jan-2014 Craig Mautner <cmautner@google.com> am 38eda9c4: Remove unnecessary logging.

* commit '38eda9c42bf327f6f521c766ea716305e5f71c05':
Remove unnecessary logging.
38eda9c42bf327f6f521c766ea716305e5f71c05 25-Jan-2014 Craig Mautner <cmautner@google.com> Remove unnecessary logging.

Fixes bug 12593710.

Change-Id: I55c33bb4d6c9e17e810be7cc033e01fb9d2d6cf7
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
fc8fa54f80b419966b3893a0992354a17c270333 16-Jan-2014 Craig Mautner <cmautner@google.com> am e9ddaa0b: Merge "Cleanup after ActivityView" into klp-modular-dev

* commit 'e9ddaa0b183d979be782a63970929cebd861b7c9':
Cleanup after ActivityView
34b73dfaa3a92e5a85abf62317183fb114f2ffff 13-Jan-2014 Craig Mautner <cmautner@google.com> Cleanup after ActivityView

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

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

* commit '9cfb2e5f4c95c16d8ca531808f60486f214f9039':
Retain stacks even if they are empty.
9cfb2e5f4c95c16d8ca531808f60486f214f9039 15-Jan-2014 Craig Mautner <cmautner@google.com> Merge "Retain stacks even if they are empty." into klp-modular-dev
8ad31fb08d7d0d4209590e191fa68a6716d595fa 14-Jan-2014 Craig Mautner <cmautner@google.com> am 5c44c51c: Merge "Use new DisplayManager flag to show own content only." into klp-modular-dev

* commit '5c44c51c2a0b5a2268de07fab6854623188b5a7c':
Use new DisplayManager flag to show own content only.
5c44c51c2a0b5a2268de07fab6854623188b5a7c 14-Jan-2014 Craig Mautner <cmautner@google.com> Merge "Use new DisplayManager flag to show own content only." into klp-modular-dev
529cbcd0af105aeda46759f92e2b0d1d469554f0 13-Jan-2014 Craig Mautner <cmautner@google.com> Use new DisplayManager flag to show own content only.

Change-Id: I8b2666e5849e57b5eb2ed73ed3d5e39da2dbd55d
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
04a0ea60ac7e20369e63edc4f3f8cedf8425a439 13-Jan-2014 Craig Mautner <cmautner@google.com> Retain stacks even if they are empty.

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

Change-Id: Ia79ac65d17c42eff3a7b1321980c21b29996001b
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
80a6e776e008f3a048ec568ea5a0ca63e0b6d936 13-Jan-2014 Craig Mautner <cmautner@google.com> am cf6e0d68: Merge "Add display synchronously." into klp-modular-dev

* commit 'cf6e0d686f42036992bdac4f47d37bc8c0775027':
Add display synchronously.
cf6e0d686f42036992bdac4f47d37bc8c0775027 13-Jan-2014 Craig Mautner <cmautner@google.com> Merge "Add display synchronously." into klp-modular-dev
ad25fa36cb63f134acf636d70696bbf81548802e 13-Jan-2014 Craig Mautner <cmautner@google.com> Add display synchronously.

Adding the virtual display to window manager through a handler message
causes timing issues. Add the display directly to fix it.

Change-Id: I3ad6b16ce6dff2a48abd120a8e873e11a028e2c3
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
7ef6c04afdf45bb5bfacd3c5a5bd24f349af140e 11-Jan-2014 Craig Mautner <cmautner@google.com> am d7c97a79: Merge "Remove misleading warnings." into klp-modular-dev

* commit 'd7c97a798f25d54a00adc0cfb2af4dedd5a4e3f2':
Remove misleading warnings.
330a6bd8a643c33318c751239a092ce393d87b06 11-Jan-2014 Craig Mautner <cmautner@google.com> Remove misleading warnings.

Error messages that are obsolete and/or incorrect.

Fixes bug 12421138.

Change-Id: I43f095048757f7ae9bff47abed594dd34d8387ce
/frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
1f7488e21994d7b6e143a4540659c1fbae630634 10-Jan-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 4504de5d to master

Change-Id: I8d96fd2b479aebd6de913e617ca190f66c25aaa5
4504de5d5a8e1c7dfb306b16282f348856c24764 20-Dec-2013 Craig Mautner <cmautner@google.com> Implement ActivityView.

With an existing ActivityContainer a caller can now create an
ActivityView which consists of a new VirtualDisplay immediately
attached to the ActivityContainer.

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

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

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

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

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

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

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