History log of /frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
36ebab675cba49e5201c5c228a524e6e1bb7dcea 17-Feb-2015 Craig Mautner <cmautner@google.com> Do not make ActivityContainer available to apps. DO NOT MERGE

A security leak was discovered whereby a malicious app could get the
IActivityContainer object from one app and use it to inject events
into another app. This fix removes the availability of the
IActivityContainer and replaces its one use with a method for
returning the information the IActivityContainer was used for.

Fixes bug 19394591.

Change-Id: Ib3cec25b25130cd8e098892c057742cfd575cfdd
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
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/ActivityManagerService.java
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/ActivityManagerService.java
92dd1abef4c0a22db40c5f7bbd100e6b471a1ad3 16-Jan-2015 Wale Ogunwale <ogunwale@google.com> Update restored task uid to match the package uid on current device.

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

Bug: 19014377
Change-Id: I285fbe9f509cae3d2e9a212a59e88f34b4db20e5
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
66c4a824b9b11a47c7bd1bf858d92fe207409ab9 16-Jan-2015 Craig Mautner <cmautner@google.com> More debugging for bug 18201239.

Fixes bug 19045133.

Change-Id: I2ef2b8600278ed91df59db4acf4740dac970ee3a
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
c63a16b8e46f2f3ecce6c548663cc3185f011fd6 13-Jan-2015 Narayan Kamath <narayan@google.com> Fix unexpected language changes on SIM card insertion.

There are two separate issues here that need to be fixed, both
boil down to the fact that adding an imperative (userSetLocale)
to the Configuration is a bad idea. Because of this:

- We'd never persist the first user set configuration if it was en_US,
because of an erroneous call to Configuration.setLocale.

- ActivityManager.getConfiguration would sometimes return a
Configuration with userSetLocale == true, which means callers with
the right permissions would inadvertently persist a locale they didn't
want to persist.

bug: 18879010

Change-Id: Id330ffde9d2a6e516fd60edc33f5529df719c634
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
b3d4cb369e37b1b7e85832cc035226dc7cc8f380 09-Jan-2015 Dianne Hackborn <hackbod@google.com> Fix issue #18942959: Phone getting stuck then restarts after unplugging from Audi

FastPrintWriter needs to have its own lock for each instance, or
else one getting blocked can cause others to block and whacky deadlocks
result.

Also:

- Improve error reporting of SystemConfig to tell you which config
file is the problem.
- Fix CoreSettingsProvider to not spew errors if a setting is not
defined (it should just use a default value).
- Get rid of noisy init output of ConditionProviders.
- Reduce log noise of starting a process; move some of that information
to ProcessRecord to print on demand.

Change-Id: I1032d141ddd449968b74ab7b88ab36f2d228ad1a
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a7881fd30b973f923c98d53bddf397d744b4229c 08-Jan-2015 Dianne Hackborn <hackbod@google.com> Merge "Add new debug feature to track associations between processes. Also add some debugging for spurious service ANRs." into lmp-mr1-dev
ab2df067fc9757f19061b968c53953ca90a4c384 07-Jan-2015 Dianne Hackborn <hackbod@google.com> Add new debug feature to track associations between processes. Also
add some debugging for spurious service ANRs.

Bug: 18201239
Change-Id: Icd43f35c696d71453e1d4deea855984b2d14b347
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
7bc33c0d252b190af8258c827de8a8a5382210db 07-Jan-2015 Wale Ogunwale <ogunwale@google.com> Bring task with root activity to front when launching from recents.

Change makes sure we cover all cases where a task should be brought
to front if it already has a root activity and we are launching
from recents.

Bug: 18846206
Change-Id: I2e67a4c163c5a5ed6784ed620583f85d9c6ed731
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
15cd63027bc8413659114714068a665869a4b3b2 11-Dec-2014 Narayan Kamath <narayan@google.com> Merge "Avoid tearing down process groups twice." into lmp-mr1-dev
ee24d848a5f270fb2d18150ab14200e62c9fd118 10-Dec-2014 Amith Yamasani <yamasani@google.com> Merge "Stop guest user on exiting, to conserve resources" into lmp-mr1-dev
6f96a44df3457350f2d290fb811319bb888cc19c 09-Dec-2014 Amith Yamasani <yamasani@google.com> Stop guest user on exiting, to conserve resources

Bug: 18672730
Change-Id: I17bc26ce2e10ceebeb18b75565daf21aa7df7774
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
034ef013ecb14203a005f88abb1c765055b7d4f4 10-Dec-2014 Narayan Kamath <narayan@google.com> Avoid tearing down process groups twice.

The second removal always triggers a warning.

Change-Id: Ieafa8374dbffdaff0d576de004a688cae6f8ac18
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ae6cc8af2674909924fb18cb73763a110bee63dd 10-Dec-2014 Dianne Hackborn <hackbod@google.com> Further work on issue #18640385: Add procstats test mode

Tune sampling periods:

- Lower minimum sample interval when in test mode.
- Add a check when sampling pss to make sure this is at least 1
second since the pss changed, to reduce the amount of bad
data (very small pss samples) that we see.

Change-Id: I624a7d0480f3f6b22d229744e028d13a2c7b0e89
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
0d2ebc29689cc7cb8a5447c38ac01fe433ed693b 09-Dec-2014 Amith Yamasani <yamasani@google.com> Allow user shutdown broadcasts to be delivered

Fixes a regression that prevents the user from being fully shutdown
after being stopped. Wasn't killing all user processes.

Bug: 7462778
Change-Id: Iee7231f7c8a167e8a61549b149294b2dbef071c1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1a4b5a4f02e7d8ff8ff645377d97e6062d36aeaa 09-Dec-2014 Dianne Hackborn <hackbod@google.com> Work on issue #18640385: Add procstats test mode

You can now do "adb shell dumpsys procstats --start-testing" to
enable high frequency pss sampling.

Also improved the low on RAM mem reporting to separate out RAM
from memtrack, in case the data we are getting from that is bad.

And fixed meminfo --oom to work correctly again.

Change-Id: I7af17eab110a82298bd7b0ce381f8fa5c96c1f6a
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
0029f0ac36c28b60d59d3d70d148ba3136971b95 05-Dec-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17323751: Additional items in aggregated battery stats" into lmp-mr1-dev
1e01d16982e6b22ec4c0e2d6dc1e261eb6f92c8e 05-Dec-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17323751: Additional items in aggregated battery stats

- Now aggregate number of times each process has crashed and ANRed.
- Now aggregate total number of connectivity changes.
- Now record connectivity changes in the history.

Crash and ANR counts are new entries at the end of "pr" in checkin.

Connectivity change counts is a new entry at the end of "m" in checkin.

Connectivity changes in the history checkin are Ecn and include the
type of connection and its state.

Change-Id: I0c01186446034cf6c3fb97d45f5e3b5c69a0438a
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
43606641f6a2b7f31b289da4548231306f4e5156 05-Dec-2014 Amith Yamasani <yamasani@google.com> Merge "Correct check of is user running" into lmp-mr1-dev
308fa0548b8be4d8cca7ba55846d6f61b36f1a7d 11-Nov-2014 Sergii Skorokhodov <sergii.skorokhodov@sonymobile.com> Correct check of is user running

Before the ActivityManagerService sends an intent or
starts an activity it checks if target user is in
mStartedUsers array.

When removing a non-owner user process the
UserStartedState instance will still be in mStartedUsers
array with mState STOPPING or SHUTDOWN.

This should be checked before sending an intent or start
an activity.

isUserRunningLocked(...) will interpret mState STOPPING
and SHUTDOWN as a non running user.

Bug: 7462778
Change-Id: I1b51bcdb62bdd0f6dbe05dab4d529d4ad40d0d44
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
25d2c2d61b546f730ccd4bab67c68b2eaa4281a0 05-Dec-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #18593636: Turn on "kill important processes that..." into lmp-mr1-dev
6b54d38a2c859f1c2cc176d1d9a33837cfc351db 04-Dec-2014 Wale Ogunwale <ogunwale@google.com> Merge "Add support from restoring recent's backup." into lmp-mr1-dev
57a873fcaa4dd95fc844887b0c255f650b9159e5 04-Dec-2014 Dianne Hackborn <hackbod@google.com> Fix issue #18593636: Turn on "kill important processes that...

...have ballooned" for all devices

Actually, this was supposed to be on for all devices, but it was no
longer being run due to changes in the idle maintenance code in L.
So now we run it again. And moved the idle maintenance window to 3am.

Change-Id: I8e90723e1431b82896d261cf90f8bf84f43b0bf2
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
afca4dba31f2da85265b97ad50638fc34bad292c 04-Dec-2014 Craig Mautner <cmautner@google.com> Merge "bug fix possible NPE while startProcessLocked()" into lmp-mr1-dev
799cb730298591a9d7303ea051451a3b6dc8e51f 04-Dec-2014 Craig Mautner <cmautner@google.com> Merge "[ActivityManager] Fix race condition in pss collection" into lmp-mr1-dev
bc0975b3afdb8ba80a6d54d898b299483ad680ad 02-Dec-2014 younghwan1.kim <younghwan1.kim@lge.com> bug fix possible NPE while startProcessLocked()

In case, process doesn't create well while startingProcessLocked().
There is possibility to make NPE.
Setting app's crash handler needs to be assigned after null check routine.

Change-Id: I67fb6427f72d93f79fed36eb44c47d37eafdac31
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
71e737c8e8b970d780b930ebc6eacb4464d4a6aa 01-Dec-2014 louis_chang <louis_chang@htc.com> [ActivityManager] Fix race condition in pss collection

Symptom:
There has a race condition that two threads are accessing
the mPendingPssProcesses simultaneously. One of the thread
is collecting the process pss by looping the mPendingPssProcesses.
The other thread is requesting to collect pss of all processes,
which clears mPendingPssProcesses and adding processes back.

Solution:
Avoid race condition by adding synchornized protection.

Change-Id: Ifb090eda9c4a1b8e3fd980fe0171e9dd77773b46
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
8920e1cabb56be6c46df40f5329aadbce3132fde 29-May-2014 Kazuki Nakayama <kazuki.x.nakayama@sonymobile.com> Reset killedByAm flag at attachApplicationLocked

Cherry picked from aosp.

Fixes bug 18593309.

ActivityManager reuses a process record object that killed
by him under some situation. That reused process record inherits
a killedByAm flag unexpectedly.
The killedByAm flag must be reset otherwise ActivityManager can't
judge the process can be killed or not.

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

Bug: 15986349
Change-Id: I899f81d317fcd5277a75db7ba50ecca14112df26
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
5bbb1af74a40f60d6609c2b1c580cb91ffb12c54 24-Nov-2014 Dianne Hackborn <hackbod@google.com> Merge "Work on issue #18486438: Reduce size of bugreport output" into lmp-mr1-dev
d052a9416ae3f7e42fc1e7de0740021df385ee48 22-Nov-2014 Dianne Hackborn <hackbod@google.com> Work on issue #18486438: Reduce size of bugreport output

Reduce how much stuff ProcessStats spews, and do collapsing of
repeated intent filter targets when dumping IntentResolvers.

Also add to pm's checkout output to include shared user ids,
and fix output formatting in a few places.

Change-Id: Ic9fc6731f0439101ba9343535e66cdbbad47e291
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1740062728bf66f416b47b0c7f7d89c8d6b77504 22-Nov-2014 Jeff Sharkey <jsharkey@android.com> Merge "Avoid NPE in forceStopPackageLocked()." into lmp-mr1-dev
27f36f426702acf7ba3103997e5009da2cd67c80 21-Nov-2014 Jeff Sharkey <jsharkey@android.com> Avoid NPE in forceStopPackageLocked().

Bug: 18477180
Change-Id: I5d91ae11ed2fd6e1e67e54d83fa945bb4dcee221
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
9ef94019386183cb88ad090965418ef294bbb79a 21-Nov-2014 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 694c1d2b to lmp-mr1-dev

Change-Id: I9a9b724e0fd12aa161ff276540431b9d8e218e2b
fbe96706bb9754f9ea3f6345f32e058a45ad10b4 20-Nov-2014 Jeff Brown <jeffbrown@google.com> Support keeping activities resumed while dozing.

If the lock screen is not shown, then let activities keep running
while dozing. This is important to support ambient mode on watches
since it allows the home app to keep running.

To make this possible, we need to inform the activity manager about
the exact wakefulness state, not just the overall boolean
interactive state.

Bug: 18284212
Change-Id: Ia35c99127ce51ffc178f3a2f51fca67d24061c71
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d9968438bcf439e7a8c6058a95b85286a632dc1c 20-Nov-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue with call backs from media process." into lmp-mr1-dev
1f4c02bb18ef8e8cc0fecd6786209089f84de147 13-Nov-2014 Wale Ogunwale <ogunwale@google.com> Stop activity onVisibleBehindCanceled()

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

Bug: 18191707
Change-Id: I472eee949c1a78b4d944454463f03c90e7d2618b
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ff17024e583b170312d82089fd358d278ce16c9a 19-Nov-2014 Dianne Hackborn <hackbod@google.com> Fix issue with call backs from media process.

All but a few lines of this is for issue #16013164, which allowed
apps to do some operations as the media uid by having it call
back to them to open a file. The problem here is with the tempory
identity stuff in the activity manager, allowing us to make the open
call as the original caller... ideally we should figure out a way
to just get rid of all of that, but the solution here is actually
easier (even though it doesn't look it) -- we now hand a token over
to the openFile() call that it can use when doing permission checks
to say "yes I would like the check to be against whoever is responsible
for the open". This allows us to do the uid remapping for only this
one specific set of permission checks, and nothing else.

Also fix issue #17487348: Isolated services can access system services
they shouldn't be able to. Don't send any system service IBinder objects
down for the first initialization of an isolated process.

Change-Id: I3c70e16e0899d7eef0bae458e83958b41ed2b75e
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d6447bbc88b8c1c238dd8e5bfb4b0daf6d2266cb 19-Nov-2014 Jeff Sharkey <jsharkey@android.com> Merge "Speed up GrantUri.hashCode()." into lmp-mr1-dev
3597b55d12f77d2fb3019b2bbc3496673c78be7d 18-Nov-2014 Jeff Sharkey <jsharkey@android.com> Speed up GrantUri.hashCode().

It's used as a key for all outstanding permission grants, so let's
keep it fast.

Bug: 18381401
Change-Id: I4db8dba13302b98f33aacfa3e9acd9a394541cd0
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
465e996776d916d8d1b62c539142827bd96a42bc 17-Nov-2014 Wale Ogunwale <ogunwale@google.com> Merge "Consolidated processing of package boardcasts in AM service." into lmp-mr1-dev
9c76a7b3e85ce7056071ac8627c8d675cc5c1599 17-Nov-2014 Jeff Sharkey <jsharkey@android.com> Merge changes Id7f9fb53,I897d7ee8 into lmp-mr1-dev

* changes:
Prevent user ID reuse until after reboot.
Warn user when build fingerprints differ.
2cffc7dafd390f6fe24a9fbb3ef3bc8226f5b385 14-Nov-2014 Jeff Sharkey <jsharkey@android.com> Warn user when build fingerprints differ.

We're now shipping devices with several partitions which may end up
mismatched, causing subtle runtime issues. To help manufacturers and
users catch this case, show wanring when we detected mismatched
fingerprints.

Bug: 18357469
Change-Id: I897d7ee8cbf3b8042d3d7d282afab277d242ed3f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
0a41a578023fc3614f8888552b32fe9ea0d74eae 14-Nov-2014 Wale Ogunwale <ogunwale@google.com> Consolidated processing of package boardcasts in AM service.

Bug: 18230409
Change-Id: Idc048eb6cfece792b1cdc651146fba965f874430
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
86677c9a511f4478bf94418208e600b1f40db733 14-Nov-2014 Winson Chung <winsonc@google.com> Fixing regression in screen pinning button visibility. (Bug 18390050)
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
222722ee73c38dea5544118df6bd349e630d1c26 12-Nov-2014 Narayan Kamath <narayan@google.com> Merge "Tell installd when boot completes." into lmp-mr1-dev
e042bf2b22b391f13d8e43ddcd657183992c7197 11-Nov-2014 Craig Mautner <cmautner@google.com> If task isn't found in recents, look in the stacks.

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

Fixes bug 18017409.

Change-Id: Idcfe2e263c9d0fe9a063fdf22515ac4e7fe89ecb
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
76a748e62f354c799342044f724e1f4b80121837 10-Nov-2014 Narayan Kamath <narayan@google.com> Tell installd when boot completes.

installd can then clear the ".booting" marker from the dalvik-cache
(owned by root). This marker is used to detect boot loops.

bug: 18280671

Change-Id: I878f1463c7f523892605c17b980a51ac3b6645e2
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
395b519f4bfec6e1c171aaca2c62a75a5c07de07 08-Nov-2014 Amith Yamasani <yamasani@google.com> Merge "Inform PendingIntent sender if broadcast was not queued." into lmp-mr1-dev
83b6ef01a07d2e7f06dfee7fd698b27bd62ca9a0 08-Nov-2014 Amith Yamasani <yamasani@google.com> Inform PendingIntent sender if broadcast was not queued.

If the broadcast could not be queued due to a stopped user, the
party trying to send a PendingIntent should be notified right away.
Otherwise, for instance, AlarmManager could be waiting forever to
be called back after the broadcast is delivered.

This is a potential fix for:
Bug: 18290018

Change-Id: I07c0751e80f11e69dfa2be5c96a033aecb298b81
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2f04d16f16ea935895872efe4dfcff3366070e9c 07-Nov-2014 Jason Monk <jmonk@google.com> Merge "Plumbing for screen pinning request from sysui" into lmp-mr1-dev
3ed9f2f903a8e6c38ca9f2ce3819ac063281a020 07-Nov-2014 Winson Chung <winsonc@google.com> Merge "Adding bounce animation for affiliated tasks. (Bug 16656169)" into lmp-mr1-dev
044d52934e57a337665f707aa4be1d423ee3fb29 06-Nov-2014 Winson Chung <winsonc@google.com> Adding bounce animation for affiliated tasks. (Bug 16656169)

Change-Id: I39e4a57c4e6b707d15513dacde2d40c23bb05058
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a11bb7427171418681428754051d5ee4dce851ee 06-Nov-2014 Craig Mautner <cmautner@google.com> Add logging for failure to finish.

Will help with bug 17648830.

Change-Id: Ib73c14cee332649a3e57a4779814a394f7d13173
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5565cb42f2ac07fcdbe3aab2503de07fbeb39504 12-Sep-2014 Jason Monk <jmonk@google.com> Plumbing for screen pinning request from sysui

Removes lock-to-app request dialog from the AM.

Added a showScreenPinningRequest to IStatusBar to handle the
flow from app requesting lock task to showing the dialog.

This CL also allows startLockTaskOnCurrent (system|signature) to
start lock task directly. (Note: this is the less locked version
that always allows exit through back + recents)

Bug: 16957435
Change-Id: I284918dd5989de6cb2767c2a717529eb5e9c6db4
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
d54b578e47fb410c776bb3a4272c2c523153f657 24-Oct-2014 Wale Ogunwale <ogunwale@google.com> Fix issue #17305377: Don't kill process if it still has tasks.

We previously killed a process when one of its task was
swiped away in the recents UI. This had negative performance
implications for apps with multiple tasks in recents. Now we
will only kill the process if there are no more tasks associated
with it.

Changed also removes the need for the
ActivityManager.REMOVE_TASK_KILL_PROCESS since ActivityManager
will now only kill a task process if it process has no out
standing tasks.

Bug: 17305377
Change-Id: Ibc39bb328d13c7eab05c04798c2f14887923d9d4
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6edb5c665dcb024ae7cfb95b9a92e30dcc5777c1 31-Oct-2014 Dianne Hackborn <hackbod@google.com> Improve low on RAM reporting.

- Don't print every little native process.
- Print in different sections, so if one is too long we don't get the
rest truncated in the log.
- Include other info from meminfo -- ksm and free/used/lost summary.

Change-Id: Iea4ec3860212667e195d2b60b3ded23bfec78436
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
42dc85a848285b021d03179131efe416e804cc6b 12-Sep-2014 Jason Monk <jmonk@google.com> Make lock task check if focused better

Previously using mFocusedActivity, which doesn't seem to update
until after touch (or something). This now uses
StackSupervisor.getFocusedStack(), which seems to be working ok.

Bug: 17469165
Change-Id: Id06a27addeac1576a71fbc0d8ade1bd87e97b0cb
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
b3af4ec6bae4fe93d40f021e54cbbce10cc7b4c6 18-Oct-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17948288: Improve accuracy of memory use reporting

We now use Mapped to not double-count cached pages that are
mapped in to app processes. Also read in some more values that
count towards kernel RAM use, and count buffers as free rather
than used RAM.

It also looks like the zram accounting is broken -- it was never
collecting the total zram reserved space. I need to figure out
how I was finding that before.

Change-Id: I883f6fc93966774b5c7d2801d1801666dd11ed41
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
9797880808320e3a7bae1f59bc7e0c5a13189e5f 14-Oct-2014 Jeff Sharkey <jsharkey@android.com> Start cross profile intents as caller.

The system should always be using new startActivityAsCaller() when
starting activities on behalf of someone else, to ensure that
security checks are enforced as the original caller.

Bug: 17983737
Change-Id: Ic40816a797cfdb13c0adb48b86ed4ed7d6aae8eb
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ce09f5a53c8408d995c116a4430c000574d9875a 11-Oct-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17829949: Don't kill Bluetooth service...

...even in extreme low memory condition

Bind to Bluetooth with BIND_IMPORTANT, so that it is allowed to
go to a higher oom adj level.

Fix some problems when this is done from a system or persistent
process, where this would go to a level that is *too* high. Instead,
introduce a new oom adj level for it that is right below persistent.

Change-Id: I002bcc4accc36c8579c4cda161be7d2fba21ba17
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ab4a81b3c625e33d04ae8070fcce6b6baee6522c 10-Oct-2014 Dianne Hackborn <hackbod@google.com> Improve some docs, fix some debugging.

- Add docs to Binder, Messenger, ResultReceier to explain their
relation (or lack there-of) to process lifecycle.
- Clarify some aspects of process lifecycle for services.
- Fix help text of am command.
- Fix per-package dumping of battery stats to not include history.
- Fix per-package dumping of proc stats to only include aggregated
and current stats and fix some formatting.
- Fix per-process dumping of meminfo to have an option to interpret
the input as a package, so including all processes that are
running code of that package.
- Fix top-level per-package debug output to correctly include all
of these improvements and give them a little more time (10s) to
complete for timing out.

Change-Id: I2a04c0f862bd47b08329443d722345a13ad9b6e2
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
fdf5b35ab46639759d6389a4e2a4d5799cb6814b 09-Oct-2014 Dianne Hackborn <hackbod@google.com> Implement issue #17906468: Allow search request to fall back to global search

Change-Id: I04834b2a9f1ec4a68c6a3fed14da2f8dd93b3be7
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2d7576b082b84068fb9d68419b710b9bec49139b 04-Oct-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17752399: Multiple apps broken by GET_TASKS permission change

Keep around GET_TASKS as a permission available to apps, so apps still
think they have it and don't get all uppity because they don't.

Add a new REAL_GET_TASKS that is the actual permission now.

Plus some temporary compatibility code until everyone can transition
fromn GET_TASKS to REAL_GET_TASKS.

Change-Id: I12c1102eed24844685dcbd2fa3b612811603958f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
8d05172112436a81bed6e4a0810f8914509d8a4d 01-Oct-2014 Dianne Hackborn <hackbod@google.com> More work on issue #17656716: Unhandled exception in Window Manager

Fix Slog.wtf to not acquire the activity manager lock in its code
path, so that it can never deadlock. This was the original intention
of it, but part was missed.

Now we can put back in the code to detect when strict mode data is
getting large (a little more targeted now to the actual problem),
and use Slog.wtf to report it. And as a bonus, when this happens
we will now clear all of the collected violations, to avoid getting
in to the bad case where IPCs start failing. So this should be
good enough for L to fix the problem, with wtf reports for us to
see if the underlying issue is still happening.

Finally, switch a butch of stuff in the system process from Log.wtf
to Slog.wtf, since many of those are deadlocks waiting to happen.

Oh and fix a crash in the settings provider I noticed in APR.

Change-Id: I307d51b7a4db238fd1e5fe2f3f9bf1b9c6f1c041
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
144508d5da4dec37183617ec259ab83d2db4f012 02-Oct-2014 Dianne Hackborn <hackbod@google.com> Merge "Revert white space changes." into lmp-dev
01945f240a0cad450b5a417cf9380066f5736a01 02-Oct-2014 Dianne Hackborn <hackbod@google.com> Revert white space changes.

Change-Id: I3bc9995adf5cefd91f5a9fd4d2a701056dba3ca9
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
dcf21d15456e5aca28d063aea73139e30842e6d1 01-Oct-2014 Winson Chung <winsonc@google.com> Fixing invalid check to get component enabled state. (Bug 17679693)

Change-Id: I225d59bf766122d667d990d7e5b1971c6e8af2aa
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
62321ab11460fd852449b3f6a2113694e3e04e7a 01-Oct-2014 Dianne Hackborn <hackbod@google.com> Merge "Maybe fix issue #17700474: manta: high occurrence of device booted..." into lmp-dev
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/ActivityManagerService.java
c0322ecda54d9c2db12e861f4d36ef50595b9740 30-Sep-2014 Jeff Sharkey <jsharkey@android.com> Clear ident when obtaining provider across users.

When calling getContentProvider() across user boundaries, and
creating the provider for the first time, we need to clear caller
identity. (We could have torn down the provider while the system
was under memory pressure.)

Bug: 17409650
Change-Id: I67713a03e5f7106f5e8fcf33fe3fdae81ce644ec
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
208678718f9f8db3bc279c7d5bd1445af2831ae3 10-Sep-2014 jgu21 <jinghui.gu@intel.com> Frameworks/base: Early init native bridge

Add the app directory to the arguments for starting a process.
Add a check for NeedsNativeBridge and a call to PreInitializeBridge
in the native fork code.

(cherry picked from commit 2eacd06bfb82b33dfcbccafbcfc0bf1218484bb5)

Bug: 17671501
Change-Id: I970db5b284b0c12e2d8a45df3950c1fff2927a4e
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f839b4fcb6b179529585765517895a8c90fe315b 26-Sep-2014 Elliott Hughes <enh@google.com> Set the system locale correctly even on an encrypted device.

Bug: 17659622
Change-Id: Ibbbd5b959bfab5345f20b556c4720d0910b50084
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
192554b59bd53087b4079de3e371103ec574dba6 26-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17671802: "content" command always prints..." into lmp-dev
2f1993ec460166413e7887f151630f6708077c0f 26-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17671802: "content" command always prints...

..."uid 2000 does not have android.permission.UPDATE_DEVICE_STATS"

Make sure to clear calling identity before getting into the guts
of the activity manager. Also fix the places the activity manager
calls in to battery stats to not require a permission check, anyway.

Change-Id: Ifd90937875b9fe0c36aa3f5cf1ec173746914e6b
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
95cce9f382693ad13039d1a1fb15529017a20929 23-Sep-2014 Paul Lawrence <paullawrence@google.com> Don't set dev.bootcomplete until interacting with user

Specifically we want to not set it when encrypting and showing
progress.

Bug: 17606949
Change-Id: I668cf47781011e7fcea7aa3b43c7783b3dea77a1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2ca21efdde386c660832c86faf74d61fd3f9330d 26-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17661444: Persistent service not automatically restarted

The code to recover when running processes are removed from the
LRU list turned up an existing problem where we would remove a
persistent process from the LRU list, making it more obvious.

Now it is fixed.

Change-Id: I94ccb924b3e5649b2819d3392b6f6c9c725dc903
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
fae2aabc30b0c3143fe3096140f8f4a9b00d87a7 24-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Work on issue #17624121: Settings crash while launching on wiped device" into lmp-dev
b294eac086e7dba9c13cfb6cb4e24e39a1b88631 24-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17614141: Add protection for accessing images" into lmp-dev
337abb3b4e705b06f9385df063be4cc06604be04 24-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17614141: Add protection for accessing images

Add basic filename protection, also only file names that are for
app icons so this can't be abused to access thumbnails.

Change-Id: I2831c0f3f08a39aa734f93f76b6fd4aaf97e87c6
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
bdc07b6986d6ba5cab2ab98a36814ed9f8e3b520 24-Sep-2014 Zoltan Szatmary-Ban <szatmz@google.com> Merge "Register ActivityManagerService.PackageMonitor for all users." into lmp-dev
0bec95d0525971d5b78ff082150e05291275a939 23-Sep-2014 Zoltan Szatmary-Ban <szatmz@google.com> Register ActivityManagerService.PackageMonitor for all users.

With the introduction of managed profiles, ActivityManagerService.PackageMonitor
can receive Intents from users other than current one.

Bug: 17580914, 17314317
Change-Id: I7c601618f7819d6775cf422dca70a929ee1089d9
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
c7437dd7c0fd90757698934d199fe864b40254e1 23-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "I am such an idiot." into lmp-dev
4a1ef0b171e1b87b815df0ac718eb9fe2c2af4fe 23-Sep-2014 Dianne Hackborn <hackbod@google.com> I am such an idiot.

Seriously, don't look at this. It is so dumb.

Brought up by issue #17307700: retarget a relinquished
task is not working

Change-Id: I947438d3502f75510e2974211bb78d31008eaa90
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2e51cc684271071759231fca1e17f94ed2e6bdfb 23-Sep-2014 Adam Lesinski <adamlesinski@google.com> Merge "Revert behavior of Lockscreen Activity Launch to KK" into lmp-dev
246a8bcadde961f6bc8172811a052af3568a6f4d 23-Sep-2014 Adam Lesinski <adamlesinski@google.com> Revert behavior of Lockscreen Activity Launch to KK

There exists a lifecycle regression where launching an
app from the lockscreen (camera, etc.) causes a series
of onResume, onPause, onRestart, onStart, onResume.

This CL reverts the behavior to what it was in KK, which
is to say that the Launcher is first resumed/paused, then
the Activity being launched has a simple onRestart,onStart, onResume
lifecycle.

Bug:17459745
Change-Id: I04091d2f86a929ee972c8d6debc1beb033c135a8
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
19c3b5d0d9852dedef485479473e0c4c1d9f78ea 22-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Work on issue #17581375: Nexus 5 getting low on RAM" into lmp-dev
d412563922f46feb4d3c3ba1500f34bddd21d73c 22-Sep-2014 Dianne Hackborn <hackbod@google.com> Work on issue #17581375: Nexus 5 getting low on RAM

Try to catch any cases where we remove a ProcessRecord from the LRU
list when it may still have a process associated with it, report
that this happened, and try to make sure the process is killed.

Change-Id: Icd74439caba5e1c283c01a49a46dae926a00ba71
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6e53b7476e9a1b1ecc30488252e183cff114ad0b 20-Sep-2014 Jeff Brown <jeffbrown@google.com> Merge "Decouple turning screen on from waking up in policy." into lmp-dev
79572afb33955ce4570b855521c67caf3e1e3a9f 19-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Add new activity dumpsys command to persist all data." into lmp-dev
36c4db8bd3bd7dad4b6cb8abd9cdc1a627fe3bbc 19-Sep-2014 Jeff Brown <jeffbrown@google.com> Decouple turning screen on from waking up in policy.

This allows us to ensure windows are fully drawn before unblocking
screen on while dozing.

Bug: 17516245
Change-Id: Ibe63c212b8db855ce26a34a8169f33764b266ee6
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ce0fd7665f297c5693ee23b3d6daf26baeed4e9d 19-Sep-2014 Dianne Hackborn <hackbod@google.com> Add new activity dumpsys command to persist all data.

Very useful for testing persisting/restoring, to make sure
that all pending changes have been written.

Change-Id: I0e3b7cd3af8afb0b6e751e086081566ab00b76c9
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
29b2516012cf69022ebe33409223095fb3c99405 19-Sep-2014 Jeff Sharkey <jsharkey@android.com> Only revoke ownerless grants when unprivileged.

Recently we relaxed revokeUriPermission() to allow apps to revoke
Uri permissions that had been granted to them, but this uncovered
bugs in apps that had been relying on the previous no-op behavior.

To mitigate this, only revoke ownerless Uri permissions when in the
unprivileged state; an active owner indicates that another component
of the calling app still needs the permission.

Bug: 17554268
Change-Id: Icc412933b29041ffb699d20136a623440ecc71ec
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
648f69b95ce7fc95f551f6e08a2408d6e57dbab9 18-Sep-2014 Craig Mautner <cmautner@google.com> Remove activity icon bitmaps from system process.

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

Fixes bug 17527308.

Change-Id: Ifac63ea5d12ed091d1eb03e178b8b847a827f940
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.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/ActivityManagerService.java
a0e0c0dfadf54ea7ba0eb1cfc5225c9887d3150a 07-Aug-2014 Jing Ji <a5705c@motorola.com> Fix creation issue of stack trace dump directory

Use the dirname instead of the filename to create the directory

Change-Id: I16e49303b2ff5e2592ed60eab766db32d02262fe
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
13f3c9344ff8358af4cfc9419e2178afb8bec762 14-Sep-2014 Adam Lesinski <adamlesinski@google.com> Merge "Fix issue with lifecycle of Activities launched from Lockscreen" into lmp-dev
54eab3b35d798ce9ab061c53ac8219526132ac2d 13-Sep-2014 Adam Lesinski <adamlesinski@google.com> Fix issue with lifecycle of Activities launched from Lockscreen

ActivityManager still thinks the device is going to sleep, so
any Activity started while the lockscreen is showing is immediately
stopped. When Keyguard calls ActivityManager.keyguardWaitingForActivityDraw(),
then we must make sure that the ActivityManager thinks we are not sleeping.

Bug:17459745
Change-Id: I5c45c88e3a72e1f08e1b32101d0d0b4675f7a5ff
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6225dd239f6dcffb49bd1e1f33fdbb00623f378a 13-Sep-2014 Craig Mautner <cmautner@google.com> Merge "Rework the task affiliate chain validation" into lmp-dev
2ade126e626d5d6d2d2e82fce4060458a0ca21c5 12-Sep-2014 Craig Mautner <cmautner@google.com> Rework the task affiliate chain validation

The old chain was problematic. It started verification at the end of
the chain and then went no further. Then it went back down the
chain to the beginning with no checks. It also removed entries and
tried to add them back past the end of the ArrayList during boot
which caused the system process to shut down.

This method uses the ordering imposed by taskIds which is the same
order that the tasks were created. It fixes up and notes dropped
links and then reconstructs the list correctly.

Fixes bug 17467284.

Change-Id: I746ec2cdcc7ac6403278cfefc7a6db9b5549d226
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
12a1d81de7c2e76a3eda9b997a8f8842b7ed2ff5 11-Sep-2014 Amith Yamasani <yamasani@google.com> Check for singleUser attribute even for persistent apps

This enables Nfc to start a service on a different user.

Bug: 17462401

Change-Id: I92b2bcc2867a380ee18f77a40032bc43e4672c23
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f58e532e015ef31d879ee51aeeb251349784717c 11-Sep-2014 Amith Yamasani <yamasani@google.com> Merge "Apply cross-user restrictions to Shell" into lmp-dev
0ecb0c4397445984a5c5db4c31f1210fb9b594a1 11-Sep-2014 Nicolas Prevot <nprevot@google.com> Merge "Fix: always allow getProviderMimeType within the same user." into lmp-dev
023b6812abbca465773acd6141ff672d525a83ee 11-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17414533: update batterystats occasionally takes a couple..." into lmp-dev
547f6e1803f3193b117bb396bfbce8851b85a68b 11-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17428001: Fix revokeUriPermissions" into lmp-dev
8cd28b57ed732656d002d97879e15c5695b54fff 09-Jun-2014 Amith Yamasani <yamasani@google.com> Apply cross-user restrictions to Shell

Even though Shell user is allowed to perform cross-user actions,
lock that path down if the target user has restrictions imposed by
the profile owner device admin that prevents access via adb.

If the profile owner has imposed DISALLOW_DEBUGGING_FEATURES, don't
allow the shell user to make the following types of calls:
start activities, make service calls, access content providers,
send broadcasts, block/unblock packages, clear user data, etc.

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

...hundred milliseconds.

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

Change-Id: Ie615a033f7f8b523b67abee62c581d1a8fce324c
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
192679a7d37d268854f4b17876c702625f9475eb 10-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17428001: Fix revokeUriPermissions

You can now revoke permissions that were granted to you.

Change-Id: I9a1872059edc715b10bbd2d653e45420d43331c3
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6e2f395a86d557d2de4b52dda419a5f3eee00c84 09-Sep-2014 Craig Mautner <cmautner@google.com> Wait for animation complete before completing boot

Defer the boot process in ActivityManagerService,
WindowManagerService and PowerManagerService until the boot
animation has completed.

Fixes bug 16309312.

Change-Id: Ic5e0d627ca4ded3e211c5d2afece89da40d34642
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
c7c04890beaf459808aeecb7418913939abbd169 10-Sep-2014 Nicolas Prevot <nprevot@google.com> Fix: always allow getProviderMimeType within the same user.

Even if the ContentProvider is locked down.

BUG: 17428869
Change-Id: Id54edcd2589677973b7db538356943d23b250660
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6b0ed64fb868e64684031558cbdeedcd94d40713 05-Sep-2014 Andreas Gampe <agampe@google.com> Frameworks/base: Add native bridge post-fork initialization

(cherry picked from commit d7746a8b65ee4690427ed798816f970218578fa3)

Change-Id: I5a20de1cb68dd1802937b369b14c50c9c1031c67
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
a6863ad62296a5280504165a1fbc70523940a9c8 05-Sep-2014 Michael Wright <michaelwr@google.com> Merge "Allow for event dispatching when in non-interactive states." into lmp-dev
70af00abf73160235d4efe114fcf4753007a8ff3 04-Sep-2014 Michael Wright <michaelwr@google.com> Allow for event dispatching when in non-interactive states.

We need to allow for event dispatching in non-interactive states so
that we can enable a richer set of interactions when a device is
dozing (i.e. is in a low power state with an Always-on-Display).

Bug: 17167296
Change-Id: I8ae0f544a8106cb91ff38c2309b8b57cbe2f2c72
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
430f5680b67c585611c24fc342559019198ba361 04-Sep-2014 Adam Lesinski <adamlesinski@google.com> Merge "Add Configuration changes to UsageStats" into lmp-dev
7f61e96db7c90c1f4418359672aa4656aebee500 03-Sep-2014 Adam Lesinski <adamlesinski@google.com> Add Configuration changes to UsageStats

Bug:17354208
Change-Id: I9b2f595e51b656607e30e798926cfb7e25134944
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
0f6c32af063a44e22af72825f19f51808a2c0cf3 04-Sep-2014 George Mount <mount@google.com> Merge ""Back" with translucent window now sets ActivityOptions." into lmp-dev
9e18397112df0ebe49b9e4325d7040498b2afcfa 03-Sep-2014 George Mount <mount@google.com> "Back" with translucent window now sets ActivityOptions.

Also made convertToTranslucent set the canvas opacity.

Bug 16215650

Change-Id: Id4325eaed34cda1269d874f239aeb5f6f82c959f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a7a61594df2f0b6ee9e3577f3d928e5f01ab4a75 03-Sep-2014 Jason Monk <jmonk@google.com> Add lock task checking to moving tasks to back

Chrome seems to use this method of moving itself to the back on
back presses, causing it to escape lock task mode.

Bug: 17365048
Change-Id: I2e8bc614f771951ed96cfc36f9789d12b1742e70
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
cc1f2c08e3f7d0223ff8a2fb042863e6b03d98db 03-Sep-2014 Jason Monk <jmonk@google.com> Merge "Enforce permissions on start/stopLockTaskModeOnCurrent" into lmp-dev
a42c0de977fcd06e6c7a5be5b072fd661101ac58 03-Sep-2014 Dianne Hackborn <hackbod@google.com> Add more slow execution logs.

This time *without* mixing in an bunch of unintentional reverts!

Change-Id: Iab4cb9eb6d475d9fe5ebe16e9ea4be24c6f312e8
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1257e82b94f2de290f78955ea9ed507ed098b9a5 03-Sep-2014 Dianne Hackborn <hackbod@google.com> Revert "And yet more logging for slow execution."

This reverts commit 113390ac113083884b6f498424b3f6afa2df4ebc.

Change-Id: I16fdb08f83ad31c10d943862bae639f622542339
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
36927a3600520686495cba4f3fc19e1445f8a64c 02-Sep-2014 Dianne Hackborn <hackbod@google.com> And yet more logging for slow execution.

Change-Id: Idd485d3b4339e22a38fd688cbd435818ca38d233
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f71edcaa1446c54956ea5d29a44343361a668755 02-Sep-2014 Jason Monk <jmonk@google.com> Enforce permissions on start/stopLockTaskModeOnCurrent

Bug: 17308601
Change-Id: If3c941e206236023108a55360a627d24ca8ba608
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2cdcc7d360c9ca592a656cdd3aef3da0614ab1aa 02-Sep-2014 Amith Yamasani <yamasani@google.com> Merge "Make it possible to remove current user" into lmp-dev
b4558e7e5f33ee4964c5395b2dc017509ebf3f1a 02-Sep-2014 George Mount <mount@google.com> Merge "Update window always on convertTo/FromTranslucent" into lmp-dev
1df1473008c24487701c5bc15f39ed9f9697f421 30-Aug-2014 Amith Yamasani <yamasani@google.com> Make it possible to remove current user

Due to the async nature of switching users, it's not possible to
switch and remove immediately. So mark the switch target user as
soon as the user switch is requested, so that a remove will proceed
without failing at stopUserLocked().

Also, fix a similar problem with deleting the current guest and
switching to a new guest. It was attempting to remove the current
user which will result in a failed stopping of the user.
Added a way to mark the current guest
for deletion so that a new one can be created, switched to and the
old one deleted. If runtime fails, old guest is already marked for
deletion and will be cleaned up on restart.

Bug: 17321533
Change-Id: I4be0fb956227e0bb95588b5b1f2867fb1e655c0d
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
828bd38a074ae62e9363267ad62214796d94e0de 30-Aug-2014 Dianne Hackborn <hackbod@google.com> More debug for issue #17310019: pause when launching settings

Dang, I missed a lot of opportunities to log!

Change-Id: I566597269fe73b0f798df4f00ad26d062021081d
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ecf1cda068c95c58d296d508d34706d659e4a1ae 29-Aug-2014 Dianne Hackborn <hackbod@google.com> Debug issue #17310019: pause when launching settings

Let's log!

Change-Id: Icaf42d46aff6e74ee5fc98611dd77083a5d5052e
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
8bd5d6900827c465f0770290776ec52753dc9622 28-Aug-2014 Winson Chung <winsonc@google.com> Merge "Change API to return thumbnail size instead of individual dimensions. (Bug 17295512)" into lmp-dev
7e7f9a3f7c8ed6d17e1295cd1c61b4fc1ac98ec1 28-Aug-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #16953886: History and batterystats checkin summary..." into lmp-dev
48a10a56e98b008ac55b9d50aee1ad33b377e367 27-Aug-2014 Winson Chung <winsonc@google.com> Change API to return thumbnail size instead of individual dimensions. (Bug 17295512)

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

Change-Id: I6d667cbf37b844939e5fc466da613bb78ca05082
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
7d9eefd871f1cdc5ebc36fa92dae48a737ae2928 28-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16953886: History and batterystats checkin summary...

...start timestamps are in 1970s

Look for the wall clock time being very small, and try to update
it to a better value if we see one.

Also handle time change events to update the current time we a re
tracking.

Change-Id: Ifbae2b8c43ab5baa75ee4f672a752a542e23b52d
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
53dc7eac05324261a51443059b5fb5d468f33594 27-Aug-2014 Craig Mautner <cmautner@google.com> Add null check to cleanupRecentTasksLocked.

If during boot, the package manager broadcast occurs before
TaskPersister has restored the recents list then mRecentTasks will be
null and an NPE will occur. This checks for null mRecentsTasks and
returns before the NPE happens.

Fixes bug 17300409.

Change-Id: I1588ad3a3c0d04bc6f273630ef5dadf6821e5710
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
85b764e22babfe5508286fbad5d7fee12345704f 27-Aug-2014 Craig Mautner <cmautner@google.com> Update window always on convertTo/FromTranslucent

Previously we would only update the window if the activity's
translucency was changed. That meant that if the window was
opaque for a translucent activity, transitioning to translucent
would not change the window to translucent. This change forces
the window to follow the convertToTranslucent and
convertFromTranslucent calls.

Also fix for setting background on enter and exit transitions.

Partial fix for 16215650.

Change-Id: I86ea68e4bbf604d0cc60cc6e34bf8090199525d6
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5232271a41323594ae406be7476b6ca2f08af3d8 27-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17146552: system anr

Add a safe path for Slog.wtf that doesn't acquire an activity manager
lock or block in any way.

Change-Id: I8fef8251a0cb85081442cae55d85063944248d15
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.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/ActivityManagerService.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
1771d39ebf9d0696f7c3deb7eb477056e49834ff 26-Aug-2014 Amith Yamasani <yamasani@google.com> Merge "Fix SetupWizard crash when creating Guest or Restricted profile" into lmp-dev
5c1b42e4f5d7307ad09d0d7ad094adf34650fb62 26-Aug-2014 Winson Chung <winsonc@google.com> Merge "Multiple performance changes to speed recents invocation/app launching time. (Bug 16987565)" 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/ActivityManagerService.java
f3054ea8e0bca0c04650cef92f7a1ed0f1d31640 26-Aug-2014 Amith Yamasani <yamasani@google.com> Fix SetupWizard crash when creating Guest or Restricted profile

Delay the launch of Home until after the USER_INITIALIZE broadcasts
are delivered, to make sure that any disabled HOME activities are
enabled.

Bug: 15709297
Change-Id: I796a40131f82989782cf5699bcc2e1da2cafbc6b
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
83bb610fad994b9046acc3feeba9d9a5264fd918 12-Aug-2014 Nicolas Prevot <nprevot@google.com> Preventing apps from granting uris to any other user.

And adding some javadoc.

BUG: 16996334

Change-Id: I02b03e513050e2704c28da8e17c2c977d858627b
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a4ccb86ddc8f9f486aee25fb836f4aff97bf7679 23-Aug-2014 Winson Chung <winsonc@google.com> Multiple performance changes to speed recents invocation/app launching time. (Bug 16987565)

- Reverting changes to the existing thumbnail transition to prevent breaking applications
that currently depend on that transition. As a result, we need to create a new, hidden,
aspect-scaled thumbnail transition, and instead use that thumbnail to animate the
recents header so that we don't have to wait to do that inside the Recents activity.

In order for this to work, we also have to ensure that the thumbnail surface destruction
is synchronized with the application that is currently closing (when going down to
recents) or opening (when coming back up). The current thumbnail is destroyed when the
animation ends, but that can be at least 1 frame before the surface for the animating
window is destroyed. We change this by deferring destruction of this thumbnail window
to the animation that is being closed.

Especially on the way up, not having to wait for us to hide the header before doing the
transition up can save us the duration of that first animation (> 100ms).

- Other optimizations:
* No longer creating a new stack view on each transition to calculate the target rect
* Removing unnecessary call to get the thumbnail when transitioning up/down (the actual
window does its own animation.
* We reduced numerous system calls per task by adding a flag to ignore home-stack tasks
and caching the activity label and icon (and task description icon). These caches
follow the same eviction schemes as the thumbnail and icon cache.

- Also tweaked the touch slop for the nav bar swiping gesture to prevent conflicting with
tapping on home (Bug 17109581)

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

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

Change-Id: Ibbe3f0f64197671d279c3fc519edfc720d442938
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6dd08fdd9104faa75a2cea83e81eae31993c7392 22-Aug-2014 Amith Yamasani <yamasani@google.com> Merge "Show a user switching dialog before starting the user switch" into lmp-dev
250bf41b8ee61c7b5707fefad1456634c7e73bbb 22-Aug-2014 Dianne Hackborn <hackbod@google.com> Merge "Work on issue #17011123: Hit Back/Recents button when in Recents..." into lmp-dev
7805a10c86a2de9fb5ddf41d63075eef342a59ea 22-Aug-2014 Amith Yamasani <yamasani@google.com> Show a user switching dialog before starting the user switch

switchUser() now first shows a dialog and the dialog calls
startUserInForeground to do the actual switch.

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

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

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

Change-Id: Ief874e46e9a9897379dda1010bcce4c5b03d82f1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1889c5c36df8cd027f1f3f69aa227a6bdad17849 21-Aug-2014 Jason Monk <jmonk@google.com> Merge "Show lock to app request on all users" into lmp-dev
fffe00dfda10fa2c121f955bcfd84a4886c2dd32 21-Aug-2014 Nicolas Prevot <nprevot@google.com> Merge "In startActivityAsCaller, changing the way we get the userId." into lmp-dev
63f29d9d7cab8c714f54db520eebd3047977d19c 21-Aug-2014 Jason Monk <jmonk@google.com> Show lock to app request on all users

This way secondary users can see it. To avoid it being displayed
on the wrong user, clear it on user switch.

Bug: 17151184
Change-Id: I1699f85d2d90cbc0e17f39f9971f20d90637b38f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
da115ebe700f334ca9f7c8fc4e9debd77c625a82 21-Aug-2014 Nicolas Prevot <nprevot@google.com> In startActivityAsCaller, changing the way we get the userId.

BUG: 17170098

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

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

Repercussions:

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

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

Change-Id: I01e543db4d15320ee1701e95872fef73c116526c
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d26bfec44bc7537ba1697af44562a51912d1c8f7 20-Aug-2014 Nicolas Prevot <nprevot@google.com> Merge "Allow the system in other users to call startActivityAsCaller." into lmp-dev
5ef7e19a0e1656a7dc6af8cf785d75ddc319cd8c 20-Aug-2014 Nicolas Prevot <nprevot@google.com> Allow the system in other users to call startActivityAsCaller.

BUG: 17148852

Change-Id: I4c9811b7da90b5705e72001dd36bf67d559cb189
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
255dd04271088590fedc46c8e22b2fd4ab142d39 19-Aug-2014 Selim Cinek <cinek@google.com> Added notification color to all system notifications

Bug: 17128331
Change-Id: I81a94510ef51b99916f314c0dd65852426a1fbeb
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
028ceeb472801bcfa5844fc89ed0da8463098824 18-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #14617210: Apps can gain access to any ContentProvider...

...with grantUriPermissions (no user interaction required)

Add a new path in to the activity manager to start an activity as
if it was directy started by the original calling activity. This
is specifically for the resolver activity and chooser activity to
be able to safely launch its data after serving as an intermediary.

Access to the new method is highly restricted -- it can only be
called by an activity that is declared in the framework apk itself,
and the execute-as-the-caller behavior will only happen if the
code is running under the system uid. (This means we could still
have these run in the client's process in some cases and still work
correctly.)

Note there is some commented out code here half-done about trying
to propagate security exceptions back to the original calling
activity. This would be really nice, especially now with the
chooser activity running in a system process so any errors made
by the app (bad permission grants, bad intents, etc) no longer
actually appear in the app so are essentially invisible. I'd
really like to figure out a way to propagate these exceptions back
to the app, but this is hard since the app's process may no
longer even be running at this point.

Also tweak activity manager dump output to split the recents
dump out from activities, since recents can now be super large.

Change-Id: I50410c4783faf9302c69290589a068a846e0973a
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
29564cd24589867f653cd22cabbaac6493cfc530 07-Aug-2014 Narayan Kamath <narayan@google.com> Remove system_server classes from the boot image.

We set the system_server classpath in the environment
(like we do with BOOTCLASSPATH). After the zygote forks
the system_server, we dexopt the classpath (if needed)
and then launch the system server with the correct
PathClassLoader. This needed several small / medium
refactorings :

- The logic for connecting to installd is now in a separate
class and belongs in the system_server.
- SystemService / SystemServiceManager have now moved to
classes.jar. They are only used from there, and since they
use Class.forName, we want them to be loaded by the
system_server classloader, and not the bootclassloader.
- BootReceiver now moves to frameworks.jar, because it is
used by ActivityThread and friends.

bug: 16555230

Change-Id: Ic84f0b2baf611eeedff6d123cb7191bb0259e600
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.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/ActivityManagerService.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/ActivityManagerService.java
93baa0ed9b6b582e28454a4c636b2bfc91d90fcf 12-Aug-2014 Winson Chung <winsonc@google.com> Clearing tasks along with application data. (Bug 16952119)

Change-Id: Ie986712a7d7d0911b6de7a4b34b7d03bf7874d6f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6d2a9492e2b19421165f0cd918d9f28595bfb770 08-Aug-2014 Jeff Brown <jeffbrown@google.com> Eliminate power manager latency for boot completed.

The power manager disables the power button until boot completed
occurs. If there are many pending broadcasts in the queue, it
may be possible for BOOT_COMPLETED to be delayed for several
seconds after boot.

To avoid the delay, introduced a new boot phase which is
sent to system services immediately when boot completed happens.

Bug: 13398280
Change-Id: I1833d2ffb20305009dd76363b43e534034f1d0a2
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a351ab96987381ffe7ea29a7cdec1e7fbd1497d5 09-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issues 16739817 and 16709247 in voice interaction service.

Issue #16739817 VIS doesn't start for non-primary user(s)
Issue #16709247 GSA is not the default voice interaction agent

These are both fixed by getting rid of the existing code for applying
the default voice recognizer, moving it in to the voice interaction
manager service, and extending it to also set up the default voice
interaction service.

Change-Id: If8d5936c28aebfa7eff77c8d99241c3a2ffdb0a4
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
81f6d857c1baef5e159bb34dad540baf77572782 09-Aug-2014 Adam Lesinski <adamlesinski@google.com> Merge "Second iteration of the UsageStats API" into lmp-dev
3516800b611a79339a3c188332d13a26e9086b09 22-Jul-2014 Adam Lesinski <adamlesinski@google.com> Second iteration of the UsageStats API

Based on feedback from API council, updated the API.
Also added support for querying the event log.

Change-Id: Ibaa008b9e5bd145acdfe8e20c25c2ed2d96be123
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
c2f20b66fd28c10e2ec8654bd74cb501eb7f837b 08-Aug-2014 Amith Yamasani <yamasani@google.com> No need to send PRE_BOOT_COMPLETED for new users

Since the primary purpose is to upgrade databases, no need
to send this broadcast. If system apps care to be informed early
on new user creation, USER_INITIALIZE is an early broadcast.

Also remove some logs that spew when switching users.

Bug: 16846465
Change-Id: Ibd7f8630ce1f41f8cadbda616de05844b127d1a8
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
c3093eb86bdc02ecf30c32693abafdaa01568a41 08-Aug-2014 Nicolas Prevot <nprevot@google.com> Merge "Making getProviderMimeType work across users." into lmp-dev
1dddc7fc790f14208516b4551ff12b2db8528864 07-Jul-2014 Nicolas Prevot <nprevot@google.com> Making getProviderMimeType work across users.

For apps with cross-user uri grants, but without INTERACT_ACROSS_USERS.

BUG: 16128346

Change-Id: I0136cd274eaf457804d196c09f746f66c1fe599f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
faa4b3cb06f3b10ece1f1d246a3530fc2f30a6da 06-Aug-2014 Robin Lee <rgl@google.com> Disallow switching managed profile to foreground

Another check in the ActivityManager to stop us from getting into an
invalid state by a fat-fingered 'am switch' etc.

@bug 16814252

Change-Id: Id65ab647d5a535cc2f965139a1b717cf65aa7e69
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
0068d3dcf1f1a804554a1a09e3b173ac12651786 07-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue @16555033: Battery history overflowing too much

- No longer track process starts/stops normally.
- Increase buffer size to 256KB.
- Buffer size increase requires reworking how battery stats
are retrieved, since it is going to be hitting IPC limits.
- Also, store the last full stats after a reset, to be reported
at the next checkin.
- Also, discharge and charge times are tagged with the screen
and battery save state during that time.

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

- Fixing issue with launch-in-background animation
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
cead2839a5ed586e18299b84c4c93f095b8498b7 05-Aug-2014 Robin Lee <rgl@google.com> Permit crash report button for user profiles

Loosens the restriction for reporting an issue with an app from "same
profile" to "same user".

Fixes bug 16792315.

Change-Id: I25100a3f7030b2a74e9fe40894103677e8db6cdd
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f17e498fea935a389d88193dde2d236ea674d10b 06-Aug-2014 Amith Yamasani <yamasani@google.com> Merge "Allow phone UID to export singleton providers" into lmp-dev
41c1ded7f042a4cf303479550b38fa66d7a18906 05-Aug-2014 Amith Yamasani <yamasani@google.com> Allow phone UID to export singleton providers

Also add a user variant of replacePreferredActivity for use
by SmsApplication.

Map user restrictions for SMS/MMS to AppOps perms.

Bug: 16681533
Change-Id: I3dfed5fc754e33bb51c6f571851653a7c2770e46
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
504d78ea10b04baee2a1a65707dc7003c94d1ee4 26-Jun-2014 Nicolas Prevot <nprevot@google.com> Security fixes related to cross-user content.

Enforcing that only uri grants work across users (not permissions).
Fixing a security hole where malicious Apps could access a uri if they had uri grants to the same uri on another user.
Enforcing that userIds in uris, if they exist, are the one of the ContentProvider.

BUG: 16779492

Change-Id: Iaa5264bd6c3aa0e15be3a4a64f9dc88238e0cb2e
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
cc9537ce558de42577feebeb91a8cc72e102ae2e 04-Aug-2014 Craig Mautner <cmautner@google.com> Call method while holding lock.

The method removeRecentTasksForUser() was being called without the
ActivityManagerService lock held. This change calles it while the
lock is held and renames it to indicate that it should be called
while holding the lock.

Fixes bug 16775111.

Change-Id: I002f9f96d407de458934da8bc728acd54f0c398c
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ad3aa32fee096f6887ba41bf0bf2b767cbdefeab 25-Jul-2014 Eunae Kim <eunae.kim@lge.com> Fix a bug that the RecentTask list of other’s may show up to non-primary users.

Cherry-pick from aosp to lmp-dev.

When switching to a newly created user, the user may face this bug
when he opens the RecentTask screen.

A possible bug scenario is described as follows:
A user id of a removed user may be recycled when created a new user.
However, mRecentTasks is not correctly controlled so that old
information may still remain and be possibly mapped to wrong user.
This patch prevents this bug by explicitly removing old information
in mRecentTasks when removing existing user.

Change-Id: I1874dbd604598a5d740ae1e034981e21214c15c6
Signed-off-by: Eunae Kim <eunae.kim@lge.com>

Conflicts:
services/java/com/android/server/am/ActivityManagerService.java
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
214be42ea690ee99e1b404844afbe2c138447b59 30-Jul-2014 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Prevent coredump file may not complete for testing.

Cherry-pick from aosp to lmp-dev

Sympton:
During testing, skip kill native crash process manually because it
will continue to die by default.

Root Cause:
Large process may take some time to do coredump.In auto test, crash
process will be killed immediately that results incomplete coredump
file.

Solution:
If the tester (IActivityController) will handle app crash event,
Do not kill native crashed process if the rom is debuggable.

Change-Id: Ia360af147d694125d440e5ba2f958c4759a50494

Conflicts:
services/java/com/android/server/am/ActivityManagerService.java
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
994e219da8ebee85d8c6b9564995e8ed9eae81e4 30-Jul-2014 Primiano Tucci <primiano@google.com> Cherry pick Move startIsolatedProcess implementation in ActivityManagerService DO NOT MERGE

This CL addresses the comments in CL 512432, moving the implementation
of startIsolatedProcess in the outer ActivityManagerService class and
making the entry point in the ActivityManagerInternal sublcass just
a proxy method.
This change also addresses a potential NPE, due to startProcessLocked
returning null in some failure cases.

Original BUG:16403706
Original Change-Id: I21eff88c23221653f552cfc171647a839e42a802

Bug: 16723226
Change-Id: I4af9fd7eea10b11e06a5c37d8160c220376b3ed1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
161536b5970ba5ab43233e7695ef69ba2bb804f4 28-Jul-2014 Primiano Tucci <primiano@google.com> Cherry pick Refactor ActivityManagerService and make WebViewFactory more pedantic. DO NOT MERGE

This CL adds more robustness to the logic in WebViewFactory, checking
whether the isolated process did start at all and catching exceptions
in its java side.
Also, this addresses the refactor comments received in CL 509840.

Original BUG:16403706
Original Change-Id: Iaaea6d36142ece6d974c2438259edf421fce9f2e

Bug: 16723226
Change-Id: Id308f2ffde9b67a3eb4719c7b81b4f46421f0c2e
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
810c052d9b117217152c2a609ccec056a2a61d1e 25-Jul-2014 Primiano Tucci <primiano@google.com> Cherry pick Introduce startIsolatedProcess private API in ActivityManager DO NOT MERGE

The new API spawns a isolated process, using a custom uid, entrypoint and
abi. Such API is used by the WebViewFactory to spawn its unpriviledged
but trusted process (hence the fixed uid) which rewrites the rerlo file
on boot / when an update occurs.
Since both the ActivityManager service and the WebViewUpdate service
live in the SystemServer their calls be dispatched locally and no
binder interface needs to be exposed for the new startIsolatedProcess API.

Original BUG:16403706
Original Change-Id: I327b59735c12698595e0dbcc4da5d759c9103b0a

Bug: 16723226
Change-Id: Iecb49888e11eec9d302d9712953fd498db5821af
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a0995ab8212a26945fe377346e110fa9a6e663dd 31-Jul-2014 Robin Lee <rgl@google.com> Always show error dialog for other profiles

Apps running on another profile of the same user were previously
considered to be running in the background, so their error dialogs
would not show unless ANR_SHOW_BACKGROUND was set.

@bug 15665024

Change-Id: I7e559c6b7f8befc1553bc0ec06e89e5d7906d198
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f4f8bb793fe101af770dc974b29c26722bce285f 29-Jul-2014 Craig Mautner <cmautner@google.com> Eliminate memory leak in TaskPersister

Bitmaps added to TaskPersister were piling up in the queue.

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

Fixes bug 16512870.

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

Bug 16626030

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

Change-Id: Ib5400b157eb741ae484aae0cc83172a3db637a3e
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
3c153519ca5f2b66b88901374383f943c9d77df7 24-Jul-2014 Adam Lesinski <adamlesinski@google.com> Add Per-User logging of UsageStats

Change-Id: I4518c5d3c56b3821292accb886f9fb21f3a8b25f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d1c99b1fe85ed03261a77a14ae52e7fa3a6e523a 04-Jul-2014 Nicolas Prevot <nprevot@google.com> Migrate extras to ClipData for image/video capture intents.

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

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

BUG: 15534203

Change-Id: I8f79666b726bc6d7745bf777ad3c7518945c5cc3
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
8746a478abcfb3b0d73b156232051af1e8d21ce2 25-Jul-2014 Craig Mautner <cmautner@google.com> Create end of animation callback for Activity

Activities cannot draw while their entering animations are active.
This change introduces a callback, onEnterAnimationComplete() so
that activities can know when their draws will be effective.

Fixes bug 13658460.

Change-Id: Ic48540cd4c7e37538f10cb2dc0852aa3f55d11e1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
422570ea3fe5bf6c4dbc4d96cf47734252ffe703 23-Jul-2014 Amith Yamasani <yamasani@google.com> Call PRE_BOOT_COMPLETED on starting any user

Refactor PRE_BOOT_COMPLETED delivery code.
Continue to call it on all existing users on system update.
Call it on any user being started, as part of
initialization.

Change-Id: Ie188a823fb19afde3781d6c45ada55d6e92edfac
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f1939901d2ed0480069f0b23be64f122fce93995 25-Jun-2014 Nicolas Prevot <nprevot@google.com> Making the clipboard work across users.

When copying from the parent: the ClipData can be pasted in the managed profile.
When copying from a managed profile: it can be pasted in the parent,
unless the policies says it's disabled. In which case, the clipboard of the parent becomes empty.
Supporting content uris.

BUG: 15186236

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

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

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

Fixes bug 16512561.

Change-Id: I9b47a86fd740d45104aa14712e71df830218c5a7
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
66adae84d7e1475c4422d80860eed17e234ab8a9 21-Jul-2014 Nicolas Prevot <nprevot@google.com> Fixing cross-user content.

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

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

Fixes bug 16358208.

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

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

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

Change-Id: Idc717706d27de80f28b53ad76f9e375d85118d71
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
0debc9aff4c0cbc28e083a948081d91b0f171319 17-Jul-2014 Adam Lesinski <adamlesinski@google.com> First iteration of a public UsageStats API

UsageStats API that allows apps to get a list of packages that have been
recently used, along with basic stats like how long they have been in
the foreground and the most recent time they were running.

Bug: 15165667

Change-Id: I2a2d1ff69bd0b5703ac3d9de1780df42ad90d439
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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
0a93106964eec2462ec86e372def1b0d1526cd7d 17-Jul-2014 Justin Koh <justinkoh@google.com> am 65d7c332: Merge "Additional cleanup after stack deletion." into klp-modular-dev

* commit '65d7c332d7b613f23a26066051cc7496e0efa994':
Additional cleanup after stack deletion.
fee756ff91ab4d8f0e09ddb050d22d88ebb66ae7 17-Jul-2014 Dianne Hackborn <hackbod@google.com> Implement issue #16330060: Inform ActivityManager about WebView...

...state changes.

Add a new API to tell the activity manager about a new dependency
one process has on another package. Start using it already for
when apps is Context.createPackageContext() to load code from another
app.

Also do some work on getting the monitoring of proc/uid states
in shape so it can be used by unundled code, along with an
AppImportanceMonitor class for doing so.

Some small fixes and additions to VoiceInteractionService.

Improve handling of unaccounted/overcounted battery use so that
they aren't shown to the user unless they are significant.

Change-Id: I22dd79a73f4e70103d3f8964494aebc8a31f971c
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
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/ActivityManagerService.java
9034620dd5a13e4b76cf6c31fb1fd7e5b79678e3 17-Jul-2014 Amith Yamasani <yamasani@google.com> Merge "Allow content provider access across users" into lmp-dev
ebf1fd99d67875c36c7dcd09b2246b6c3e22e9ae 17-Jul-2014 Amith Yamasani <yamasani@google.com> Allow content provider access across users

If the package has INTERACT_ACROSS_USERS. This had recently
regressed. Bringing back the functionality needed for multiuser
call log syncing.

Bug: 16298776
Change-Id: I4fdc3d676bb8a2bf78f5c27c41a74c0491e343cd
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2053168eb4506e2f8795afdbe9731c6451e1589c 14-Jul-2014 Narayan Kamath <narayan@google.com> Dexopt for Context.createPackageContext when code is included.

The package manager now keeps track of per ISA dex-opt state.

There are two important things to keep in mind here :

- dexopt can potentially be very slow. In cases where the target
package hasn't been dexopted yet, this can take multiple seconds
and may cause an ANR in the caller if the context is being
created from the main thread.
- We will need to remove the constraint that dexopt can only be
requested by the system (or root). Apps will implicitly be
requesting dexopt by asking for package contexts with code included.
It's important to note that unlike dalvik, the dexopt stage in ART
isn't optional. ART cannot load classes directly from dex files.

bug: 15313272
Change-Id: I0bd6c323a9c1f62f1c08f6292b7f0f7f08942726
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
fdb1956ff71ff57fcdaafaaeb7f42c19de3d7c2f 12-Jul-2014 Dianne Hackborn <hackbod@google.com> Fix issue #15681802: Missing RESET:TIME in complete battery histories

But wait, there's more!

- Keep track of sync durations in the aggregated stats.
- Add events for users that are running and in the foreground.
- Rework the activity manager's tracking of stuff using
battery in the background to be based on proc stats, which
allows it to be better about determing when it should reset
its tracking of background work.
- Also add tracking of scheduled job execution, like we are
doing for syncs.
- And once I started hooking battery stats in to
JobSchedulerService, I found a few things I couldn't stop myself
from changing: (1) make it very explicit that it doesn't start
scheduling jobs until we have reached the point in system boot
where third party apps are allowed to run, and (2) adjust
the various for loops to not use iterators.

Change-Id: I69d812e27bcfee9e58a614f0f6b1c7545d7530b1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
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/ActivityManagerService.java
a2ff611fd6312510f03a2556c2932f87ba3144af 15-Jul-2014 Alan Viverette <alanv@google.com> resolved conflicts for merge of dca272b8 to lmp-dev

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

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

Bug: 15750584

Change-Id: I0b2bfb46022b46d7649f6d9ba9ba74cdfc70a6ea
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
3c58775a126c9c9b2f86bc22bd82cedbdcb06024 11-Jul-2014 Dianne Hackborn <hackbod@google.com> Merge "Allow INTERACT_ACROSS_USERS for service access."
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/ActivityManagerService.java
41cd577c12a3525663101ff9217ded509bb869d6 11-Jul-2014 Amith Yamasani <yamasani@google.com> Send USER_FOREGROUND and USER_BACKGROUND to all related profiles

Also do a check for null applicationInfo object during user creation.

Bug: 16211029
Change-Id: Ib49c241cf3698735e273edf5704bef277f1142a5
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
0161bbc6e54744d5e0348af3d123858818f966e9 03-Jun-2014 Colin Cross <ccross@android.com> ActivityManager: use Process.killProcessGroup to kill forked processes

Place newly-created processes in a process group, and use
killProcessGroup to kill any forked processes.

Bug: 15313911
Change-Id: I0f3e2eeebd9a910dae3f6b2801826c92aea03030
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ff110bd61a69f7ed8602ae14b27f7befec76b2e7 04-Jul-2014 Narayan Kamath <narayan@google.com> Multi-arch application installs.

Each application now has two ABIs, the primary
and the secondary. The app is always launched with
the primary, but the secondary might be used by other apps
that load the given applications code. This implies we
must:

- dex2oat the app both ways.
- extract shared libraries for both abis.

The former is relatively straightforward but the latter
requires us to change the layout for shared libs that we
unpack from applications. The bulk of this change deals
with the latter.

This change continues to fill in nativeLibraryPath during
scans for backwards compatibility. This will be removed in
a future patch.

Change-Id: Ia943dd11ef815c5cbfc60f17929eaa2a652a385a
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
61659e5daaea80104d4d0fd567e78b5f757b5df4 10-Jul-2014 Dianne Hackborn <hackbod@google.com> Add tracking of uid process states in battery stats.

We now keep track of how long each uid had processes in
various states: foreground, active, running. This is based
on a collapse of the various activity manager process states
into these three bins.

You'll see these in a checkin like this:

8,10013,l,st,61504,61504,83109

Also fix issue #16021555: App showing up as on "top" even
when the screen is off. This is "fixed" by just saying we
always report the current app at the top of the activity stack,
regardless of the state of the screen.

Change-Id: I1204904225101243eb00b43425d9806bffdd2ab9
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d908edd810dd22d8ec512a19c32637df464e9d0a 13-Jun-2014 Colin Cross <ccross@android.com> ActivityManager: pass the main uid of the app to lmkd

The uid and pid will be used to together to find any forked processes
and kill them.

Bug: 15313911
Change-Id: I2edb51527e5d1a977c0fad0e6c959c8438bb4be9
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
0a9927025041a6dde3f3878bdd868a69ab1b3266 07-Jul-2014 Craig Mautner <cmautner@google.com> am 09c1af5d: am c66da9d6: Merge "[ActivityManager] Prevent kill a restarted process again."

* commit '09c1af5d5c43f716fb4093eae6cf5442e7bb88d1':
[ActivityManager] Prevent kill a restarted process again.
53cc7d7998a9a656fe89ec8eba40ad479bded274 07-Jul-2014 Craig Mautner <cmautner@google.com> am 7611a5d3: am 5acdd0f6: Merge "[ActivityManager] Ensure alive process is not killedByAm."

* commit '7611a5d32889f54b1763cf076a442a0575c69b51':
[ActivityManager] Ensure alive process is not killedByAm.
f621a5b1b3268cafaf5b398f7cde0727a46891be 08-Jul-2014 Makoto Onuki <omakoto@google.com> Merge "Cross-user provider access no longer requires ..._FULL"
4451419fc675e02acd6df2664e6c4eafcca9c261 08-Jul-2014 Makoto Onuki <omakoto@google.com> Cross-user provider access no longer requires ..._FULL

Now only INTERACT_ACROSS_USERS is required.

Change-Id: If5bdbfb055d9d57a3180885f2aea652b889e7705
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
88085ad05bd62be8f3c53917e3449a8fc5c37f10 08-Jul-2014 Winson Chung <winsonc@google.com> Merge "Refactoring to support groups."
ffa2ec664479bff6b4b61d4c349d9db2cb37ca16 04-Jul-2014 Winson Chung <winsonc@google.com> Refactoring to support groups.

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

Change-Id: Ie10385d1f9ca79eea918b16932f56b60e2802304
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.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/ActivityManagerService.java
b633657be45091cbb123843a36d8b44dece5676f 07-Jul-2014 Craig Mautner <cmautner@google.com> am 0a992702: am 09c1af5d: am c66da9d6: Merge "[ActivityManager] Prevent kill a restarted process again."

* commit '0a9927025041a6dde3f3878bdd868a69ab1b3266':
[ActivityManager] Prevent kill a restarted process again.
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/ActivityManagerService.java
d61dc20de10452dcc6905dcf0654f30c64762a1d 07-Jul-2014 Craig Mautner <cmautner@google.com> Add Activity.isTopOfTask() method

Used by scene transition to determine if an activity has launched the
next activity into its own task or into another task.

Fixes bug 15771895.

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

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

Fixes bug 14869070.

Change-Id: I09b136b3213aae5d3521894e17a7500ac793f3d2
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
17fcc01c33fae16c9fca77ea8c0a696986563a3f 07-Jul-2014 Craig Mautner <cmautner@google.com> am 53cc7d79: am 7611a5d3: am 5acdd0f6: Merge "[ActivityManager] Ensure alive process is not killedByAm."

* commit '53cc7d7998a9a656fe89ec8eba40ad479bded274':
[ActivityManager] Ensure alive process is not killedByAm.
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/ActivityManagerService.java
497175beffe26336c092ee11a67b90f79dcdaca7 01-Jul-2014 Dianne Hackborn <hackbod@google.com> Rework network stats to use proc state for fg/bg.

Switch to using the process state to determine whether a
process should be foreground or background, instead of the
boolean foreground given by the activity manager.

This is for battery save mode, where we can now allow more apps
to havenetwork access: everything whose process state is at
least IMPORTANT_FOREGROUND, which allows music playback
and other use-visible things to continue to have network
access.

Note this also impact the traditional background data disabled
state, where now we allow anything top or better to have
network access. This automatically includes all persistent
processes, the current top activity, and any other processes
hosting the top activity or being used by the top activity.
So it broadens the set of apps that get network access, but I
think this increases it to a reasonable set of things that may
actually be needed for the foreground app to work correctly.

Change-Id: Icb609a2cea280dc3fa3e83417f478ed77f3685aa
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
be7c50e0a14e91330ce13161bc14a33d34ff6aca 30-Jun-2014 Dianne Hackborn <hackbod@google.com> Add network access blocking when in battery save mode.

The network policy manager now monitors battery save mode and,
when in battery save, uses its facility to block access to metered
networks to block access to all networks. That is, it tells the
network management service that all networks have an (infinite)
quota, and puts various app uids to be restricted under quota
interfaces as appropriate.

This new network blocking needs a new facility to be able to white
list apps, such as GmsCore. To do this, I refactored the package
manager's permission configuration stuff into a separate SystemConfig
class that can be used by others, and it now has a new tag to
specify package names that should be white-listed for power save
mode. These are retrieved by the network policy manager and used
to build a whitelist of uids.

The new general config files can now go in system/etc/config,
though currently everything still remains in the permissions dir.

Still left to be done is changing the semantics of what uids are
allowed in this mode, to include all perceptable uids. (So that we
can still do things like background music playback.) This will be
done in a follow-on CL.

Change-Id: I9bb7029f61dae62e6236da5ca60765439f8d76d2
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
312bc5430ac7da898f4c8a10da34f8939fb317d3 30-Jun-2014 Winson Chung <winsonc@google.com> Using base intent to check the calling app instead of uid. (Bug 15940115)

Change-Id: I571f1d3f90707046cca0eaaae3e8e958444cc971
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
80f74b544975900fa69fa078d424fa5cde9ad5c7 20-Jun-2014 Nicolas Prevot <nprevot@google.com> Splitting the different authorities of a content provider

So that sharing from contacts works across user.
When getting a contentProvider, checking that read/write permissions are not null,

Change-Id: Ib4f0419aebd9ec4e742ef08c9ed9348fde62cc11
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
bc5ddd69dd1a0771f02409e96476ea8ebe89debb 27-Jun-2014 Christopher Tate <ctate@google.com> Change permission guard on bindBackupAgent()

Bug 15829193

Change-Id: Ief86fdfb0ef73e2a5a5d34af950726c4d5c0a167
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a4e946bb6f4481d44463c620332d0666e3b8ad20 23-Jun-2014 Jason Monk <jmonk@google.com> Fix crash in starting lock task

Sometimes when coming from a dialog the current activity has changed,
which causes AM to crash and take down the framework. Instead don't
check the current activity as the user has confirmed the operation
so it is not coming from the background.

Change-Id: I0daeabcfcf814c52bcc7907a624fe6e9453c427f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
c286444f14798b783662f62c4ad3d7e8c71e9fda 26-Jun-2014 Winson Chung <winsonc@google.com> Merge "Use Task last active time to ensure we don't reload items for the cache."
d96e4948daf687f3f631ba8d93c89026fd3ce272 26-Jun-2014 Andres Morales <anmorales@google.com> Merge "interface for nfc handover supplicant commands"
f1fbd77cf057e43926f9a0347692611386d09f40 25-Jun-2014 Winson Chung <winsonc@google.com> Use Task last active time to ensure we don't reload items for the cache.

Change-Id: I29206de0453f5d7d1370b27a27ef6d3594eff8e7
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
04d480e1c338a921a8659e165d74f8437785acc1 25-Jun-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix some problems with proc stats collection."
306af678a5f1938629e1182b46cc43f2da6e7774 25-Jun-2014 Dianne Hackborn <hackbod@google.com> Fix some problems with proc stats collection.

Also start debugging why we aren't being able to open
/proc files.

Change-Id: I4655904691ac22108c29858cbd01153a251ccbf5
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.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/ActivityManagerService.java
1e2f374e712ef23d696616f70b284557c8bcbdcf 20-Jun-2014 Nicolas Prevot <nprevot@google.com> Merge "Making more ContentProviders work across users."
5b21454e6f81724ea48c2f85265ff107a8174005 17-Jun-2014 Nicolas Prevot <nprevot@google.com> Making more ContentProviders work across users.

If a ContentProvider makes a uri available to every app:
For an app on a different user, we grant a uri permission,
even if the ContentProvider would not normally allow granting uri permissions.

BUG:15721503
Change-Id: I0b865ae80f588137256387eba14a2e29b1129b00
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
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/ActivityManagerService.java
ebf55ad6dec7e59dca668cf97ac81619793defe0 18-Jun-2014 Jason Monk <jmonk@google.com> Merge "Change lock-task DPM authorization to packages"
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/ActivityManagerService.java
9740e468bc895cbc08c71aecc35fc56c3faafa06 08-Feb-2014 Andres Morales <anmorales@google.com> interface for nfc handover supplicant commands

expose:
NFC_GET_HANDOVER_SEL
NFC_GET_HANDOVER_REQ
NFC_REPORT_HANDOVER

These are used in for setting up WFD with NFC and
are only accessible given the CONNECTIVITY_INTERNAL
permission.

Change-Id: Ia43afc137d474822cad896d335530654081a808c
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
82b3201a95063a1fe51842417c444c0dfd8cf780 07-Jun-2014 Nick Kralevich <nnk@google.com> resolved conflicts for merge of 13ed83ee to master

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

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

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

Fixes bug 13736052.

Change-Id: I7ccb4e6f89d6202ff31c8577bb7b9d8d1b7e5e8d
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
7f2d5162fd19345945d54cc864b3cc82bea35a2e 04-Jun-2014 Robin Lee <rgl@google.com> am c774caff: am 4891a9f9: am e46e6004: Merge "Assign AID_EVERYONE gid to newly-created processes"

* commit 'c774caff86d2e5dc5ca3a0008007cb0fd384568b':
Assign AID_EVERYONE gid to newly-created processes
c774caff86d2e5dc5ca3a0008007cb0fd384568b 04-Jun-2014 Robin Lee <rgl@google.com> am 4891a9f9: am e46e6004: Merge "Assign AID_EVERYONE gid to newly-created processes"

* commit '4891a9f9cfee569c0d362f1781f44493f5e320c0':
Assign AID_EVERYONE gid to newly-created processes
522a0278065b929e0d75d1d118e26a39ed57f010 03-Jun-2014 Narayan Kamath <narayan@google.com> am 41aa48be: am 032c5c05: Merge "Log process abis during start."

* commit '41aa48beacc93a1511a290e91293402eeb787165':
Log process abis during start.
41aa48beacc93a1511a290e91293402eeb787165 03-Jun-2014 Narayan Kamath <narayan@google.com> am 032c5c05: Merge "Log process abis during start."

* commit '032c5c054c331b63f2d45ee9c497ac852faec633':
Log process abis during start.
dfed4bc99f9f3d48ee7bf9e8ea051a8d5bc4f299 30-May-2014 Narayan Kamath <narayan@google.com> am f7871c31: am b9b31f4b: am bd4d3203: Merge "Support an ABI flag for instrumentation."

* commit 'f7871c31469c6245c1b232a15104704f7481103c':
Support an ABI flag for instrumentation.
f7871c31469c6245c1b232a15104704f7481103c 30-May-2014 Narayan Kamath <narayan@google.com> am b9b31f4b: am bd4d3203: Merge "Support an ABI flag for instrumentation."

* commit 'b9b31f4b8eda123e7b544d1a0fa886576064adca':
Support an ABI flag for instrumentation.
1015efb143b51a5d31f2f932528f295cfa1add1f 29-May-2014 Nicolas Prevot <nprevot@google.com> Merge "Making the content resolver work with result intents."
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/ActivityManagerService.java
d5ba868b0df68685193300dba62895d823feaddd 28-May-2014 Amith Yamasani <yamasani@google.com> Merge "Fix singleUser attribute"
4b9d79c30eccb61645d98a4f0d49b7769e8c7ccc 22-May-2014 Amith Yamasani <yamasani@google.com> Fix singleUser attribute

Make it work correctly for singleton content providers.
Relax which apps can export singleton content providers.

Change-Id: I43d315c25ed76a876bfa6d5e0d1351bc19c9bdba
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a64a5fe68ced5ffca58248d76eadd90759ab4164 27-May-2014 Winson Chung <winsonc@google.com> am bff02603: Merge "Updating task description whenever we create a RecentTaskInfo. (Bug. 15195617)" into lmp-preview-dev

* commit 'bff026033d40ee48e9bf8dca17e1fbbee8b41293':
Updating task description whenever we create a RecentTaskInfo. (Bug. 15195617)
8804ce96b1ef3aa260076091e77abcce0b1ea1d9 27-May-2014 Winson Chung <winsonc@google.com> Merge "Updating task description whenever we create a RecentTaskInfo. (Bug. 15195617)" into lmp-preview-dev
9693d9534342c9785877a9f98ec5aff6fd9ac496 27-May-2014 Winson Chung <winsonc@google.com> Updating task description whenever we create a RecentTaskInfo. (Bug. 15195617)

Change-Id: I371ee43296a983782eaed2e661b1febc71c86433
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5122fb6a92d2fa99f2f2cafc138527931c0dc183 27-May-2014 Craig Mautner <cmautner@google.com> am 463f9006: Merge "Only start TaskPersister once." into lmp-preview-dev

* commit '463f9006c56d66b5213edecc150863b450a7e573':
Only start TaskPersister once.
87f851d0bad0183eccbb59b1fb378db9155e4a66 27-May-2014 Craig Mautner <cmautner@google.com> Only start TaskPersister once.

Because ActivityManagerService.systemReady() is reentrant we could
restore tasks and start the TaskPersister more than one time. This
fix limits operations on TaskPersister to one time only.

Fixes bug 15256579.

Change-Id: I6bf2c26b37acdfd9b15a6f277966966b743d03b6
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
deec695253aa5856135be3ffdcd35eaafed9e526 24-May-2014 Craig Mautner <cmautner@google.com> Merge "Add code for persisting tasks and activities to disk"
9b7135645e70e3613f7820ae0a68350a1ff47362 23-May-2014 Dmitriy Ivanov <dimitry@google.com> am 190ed5db: am 2137d6a8: am d5ee4144: Merge "Increase start timeout for wrapped process"

* commit '190ed5db4ac90612c1f6420f87ea462076fbe1a0':
Increase start timeout for wrapped process
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/ActivityManagerService.java
190ed5db4ac90612c1f6420f87ea462076fbe1a0 23-May-2014 Dmitriy Ivanov <dimitry@google.com> am 2137d6a8: am d5ee4144: Merge "Increase start timeout for wrapped process"

* commit '2137d6a843b82996e08f0e03376e48860919d8bc':
Increase start timeout for wrapped process
f0ee5a795a9deada60aaad41ecbbeed69a7b161b 22-May-2014 Nicolas Prevot <nprevot@google.com> Merge "Correcting a bug related to Uri permissions."
dcb27fadcde2c45e14ee1658db4d16cc699ec250 22-May-2014 Nicolas Prevot <nprevot@google.com> Correcting a bug related to Uri permissions.

Change-Id: I70765eb659151ce0c5af06075a844143c09429e8
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
7bd35c7e6f5e8b4085bc8ee708e67872cab9743f 12-May-2014 justinzhang <justinzhang@google.com> Use DeviecPolicyManager to authenticate lock task

Uncomment lines in ActivityManagerService. Before start lock task,
ActivityMangerService calls DevicePolicyManager to see if the
app can go into lock task.

Change-Id: I9ad784d7cc637d45884dcb2623b4c59ff802f93d
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
87be9ba1eaa396c95c5f335c8ba51123d304a7bb 20-May-2014 Jason Monk <jmonk@google.com> Merge "Fix reference to ProxyInfo extra"
a449dc033b79775b8945d9cc5a035a6deb145065 16-May-2014 Winson Chung <winsonc@google.com> Refactoring RecentsActivityValues into TaskDescription, and ensuring they are resolved when set. (Bug 14995928, 14832629)

Change-Id: I582221468e63a96a5dfd132a31b09e72099b170f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
7dab61455c32c0a93711ae977d197202dacb6bb6 15-May-2014 Jason Monk <jmonk@google.com> Fix reference to ProxyInfo extra

Also remove unneeded null check.

Change-Id: Ic25d1087f93632a24755b284ede41d870492e25d
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5d5f19a339bc4a8f10f75b51625d8d50ee0729e0 15-May-2014 Narayan Kamath <narayan@google.com> am 6e2e6868: am 706b1d7e: Merge "Remove "required" prefix from ABI fields."

* commit '6e2e686889037711170ee145f9dfdb442cee85db':
Remove "required" prefix from ABI fields.
1e74c37f8e1acb595f407e0f65744bb6b00c9314 15-May-2014 Narayan Kamath <narayan@google.com> Merge "Remove "required" prefix from ABI fields."
1147c406515bbfbcb7dbd750f81c7a5de928c5c6 14-May-2014 Winson Chung <winsonc@google.com> Adding method for applications to query their own tasks. (Bug 14627210)

Change-Id: I33299bf59784849171b19af4a5be2ab7665581c5
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
7fd239cf0a1ddc0500b51d97e0e6c3539b42639f 14-May-2014 Craig Mautner <cmautner@google.com> Merge "Pass ActivityOptions back from finishing activity."
202259785972be771075dce8d3e43c29b8d8f1f1 13-May-2014 Nicolas Prevot <nprevot@google.com> Merge "Resolving resources across users."
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/ActivityManagerService.java
d85fc72fb810858f7502e7e7f1bad53e1bf03edd 16-Apr-2014 Nicolas Prevot <nprevot@google.com> Resolving resources across users.

When an intent is sent to another profile:
For content uris contained in this intent:
The userId of the source user is added to the userInfo part.
The ActivityManagerService has been modified to resolve resources in the user specified by the uri.
The user id to which the uri belongs to is stored in the UriPermission.

Change-Id: I43dc76895aba692bf148d276253aeaf9c75fce34
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
34f6084bc21b07ae9112be6e7a8f50c49828ac9c 30-Apr-2014 Narayan Kamath <narayan@google.com> Remove "required" prefix from ABI fields.

As per a comment on an earlier code review.

Change-Id: I3ae30f8a7bc90730068644f93b926e0e05a2cdfb
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
83520b95124e0fcaaf3154a7a267f6be0205bc74 09-May-2014 Jason Monk <jmonk@google.com> Switch PacUrl storage from String to Uri

Since the interface for creating/accessing PAC URLs through a
ProxyInfo is Uri based, so should the internal storage and
references.

Change-Id: Ibf15c350f4cc526f81aba3ec463070f26af8f535
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d9ddf2e9d04f8a53d7445a96aa3e192fa86f08d6 09-May-2014 Craig Mautner <cmautner@google.com> Merge "Introduce persistent forms of Activity lifecycle calls."
c241db85c937102714e4cb125c97c79f80bebbec 09-May-2014 Jason Monk <jmonk@google.com> Merge "Fix badness from proxy refactoring."
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/ActivityManagerService.java
5df281a570555ee132a12a4aac9aec96e8618270 09-May-2014 Jason Monk <jmonk@google.com> Fix badness from proxy refactoring.

When no PAC file getPacFileUrl() can return null now, which you
cannot call toString() on.

Change-Id: Ife00f641c2c17fbc1bde17017d9af59d23cb9182
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
e22b3b143240f0f18e3d6d3c06686ad3c23b131b 08-May-2014 Dianne Hackborn <hackbod@google.com> Usage stats!

Start reworking the usage stats service to be able
to have an API we can publish.

The basic information it keeps is still the same, though
that will be changing in the future. The one big addition
here is that we are also now collecting configuration usage
stats.

Also introduce the start of an access model for usage stats,
using app ops. There is an new app op that gives an application
access to usage stats even if it normally wouldn't have it,
disabled by default.

Change-Id: I6ead28e18a7f08eafd057d6ff37dd9cb216358f4
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
8f17b5758279e287e2622a226f74e17c205f88dc 08-May-2014 Winson Chung <winsonc@google.com> Merge "Listening for system changes to active recent tasks. (Bug 14260718)"
63812fd9f20d2a0f96ef0fac69497d3334ae6d97 08-May-2014 Amith Yamasani <yamasani@google.com> Merge "Send boot_completed for users started in the background"
9f49df933f01a32d04bdf92d53c943065aa8ddf7 08-May-2014 Winson Chung <winsonc@google.com> Listening for system changes to active recent tasks. (Bug 14260718)
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6422abef786632e53337c6c298ffa64f7ddf4d90 07-May-2014 Brian Carlstrom <bdc@google.com> resolved conflicts for merge of 3bbef521 to master

Change-Id: I0bbb7c80f6c4f003779da784475d7acbfb898c94
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/ActivityManagerService.java
3bbef521d4b07f86010ba0729a36ff8b73bcb0ac 07-May-2014 Brian Carlstrom <bdc@google.com> resolved conflicts for merge of f2db00fd to klp-modular-dev-plus-aosp

Change-Id: I745164033962f6222832f8f19fa316a2e2634fd0
f2e074604b1ee7e47bcbf82bb9d612b64bbcee93 07-May-2014 Jason Monk <jmonk@google.com> Fix Build

Change-Id: I0035256b41199041bc1bc7d625f2c8f5a6a23e43
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
9d75ccb6a1b3b300c33ce3ceab5eaece0ad55d42 07-May-2014 Jason Monk <jmonk@google.com> Merge "Make proxy API public"
207900c23b26d0df9ab28c709db4a1007d7d7904 25-Apr-2014 Jason Monk <jmonk@google.com> Make proxy API public

Also exposed proxy-related functions that were on the
ConnectivityManager.

Change-Id: I9fb5f1bcc257a6198679ea1d56e18da2ec5a3b33
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3aeaebb6fc2093069a138d0c8562020dfc76ad43 07-May-2014 Winson Chung <winsonc@google.com> Fixing regression in calculating which activities to apply recents values to.
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
03a9baedc9b933bb6a550c0cb84649b1b45b872c 02-May-2014 Winson Chung <winsonc@google.com> Refactoring activity method to update recents values.

Change-Id: Ic525be207714d34abe0c2d26091c3e46abcd9bad
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5d84bce12204072bc7ab296ce0cdea7efb5cf17c 02-May-2014 Dianne Hackborn <hackbod@google.com> Fix issue #14492403: Oom scores appear to be incorrect...

...and causing runtime restarts

Got a little too aggressive with the delete key. *blush*

Change-Id: Icd4637827424211abc2347f7f9407c2d4c95cfad
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
684bf34ee8acc41931fac23762b13e14a22011db 30-Apr-2014 Dianne Hackborn <hackbod@google.com> Switch IProcessObserver to report process state

When IProcessObserver was created, the only information
we had for the state of a process was its "importance".
Now we have the process state, which is much more useful.
Switch to reporting that.

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

Change-Id: Ie6d1e7c3e5dcf721e945c4933c077fa6abb10067
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4553b2d7c881aebb9dfe10407f33bd8d1e9e27d4 25-Apr-2014 Winson Chung <winsonc@google.com> Merge "Updating recent tasks list in response to package events. (Bug 14260718)"
8faa342c8a544229b9fc05378a6b33d18d0f8d6b 24-Apr-2014 Winson Chung <winsonc@google.com> Updating recent tasks list in response to package events. (Bug 14260718)

Change-Id: I7e887256b2d504aebfaedcfebb5ee8a40b05fe24
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
385124d8cee38dee00d4fac31e8fbe46fb30565b 03-Apr-2014 Alexandra Gherghina <alexgherghina@google.com> Modify getUserProfiles to return only enabled profiles:

Add a new enabled state for a managed profile.
Expose that as a new API on DevicePolicyManager.
Set the new state when enabling the profile.
Return only enabled profiles from the user manager.

Bug: 13755441
Bug: 13755091
Change-Id: I2907b182e19b3562592da688b3f68ef5f4088557
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1b244f44a796484866f13e0639420477c3191695 23-Apr-2014 Winson Chung <winsonc@google.com> Merge "Piping through ability for an Activity to remove its own task. (Bug 13735914)"
3b3f464445d1d369c8e87f526deba606ca62f76c 22-Apr-2014 Winson Chung <winsonc@google.com> Piping through ability for an Activity to remove its own task. (Bug 13735914)

Change-Id: Iefcd4fbe68748195de8ee37ee2b6edef55276603
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
21de56a94668e0fda1b8bb4ee4f99a09b40d28fd 06-Apr-2014 Jeff Sharkey <jsharkey@android.com> Add directory selection to DocumentsProvider.

Introduce new ACTION_PICK_DIRECTORY that allows users to grant access
to an entire document subtree. Instead of requiring grants for each
individual document, this leverages new prefix URI permission grants
by defining new "via"-style URIs:

content://com.example/via/12/document/24/

This references document 24 by using a prefix grant given for
document 12. Internally, we use isChildDocument() to enforce that
24 is actually a descendant (child, grandchild, etc) of 12. Since
this is an optional API, providers indicate support with
Root.FLAG_SUPPORTS_DIR_SELECTION.

Extend DocumentsUI to support picking directories. Expose
createDocument() API to work with returned directories.

Offer to canonicalize via-style URIs into direct URIs, generating
exact permission grants along the way. Override openAssetFile()
to pass through CancellationSignal. Move testing code into ApiDemos.

Bug: 10607375
Change-Id: Ifffc1cff878870f8152eb6ca0199c5d014b9cb07
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
846318a3250fa95f47a9decfbffb05a31dbd0006 04-Apr-2014 Jeff Sharkey <jsharkey@android.com> Allow prefix-based Uri permission grants.

Define new FLAG_GRANT_PREFIX_URI_PERMISSION which indicates that a
Uri permission grant should also apply to any other Uris that have
matching scheme, authority, and path segments. For example, a prefix
grant for /foo/ would allow /foo/bar/ but not /foo2/.

Allow persistable and prefix grants to be issued directly through
grantUriPermission(). Relaxing persistable is fine, since it still
requires the receiver to actively take the permission.

Since exact- and prefix-match grants for the same Uri can coexist,
we track them separately using a new UriGrant key. (Consider the
case where an app separately extends READ|PREFIX and WRITE for
the same Uri: we can't let that become READ|WRITE|PREFIX.)

Fix revoke to always take away persisted permissions. Move prefix
matching logic to Uri and add tests. Add new flags to "am" tool, and
various internal uses around Intent and Context. Switch some lagging
users to ArraySet.

Bug: 10607375
Change-Id: Ia8ce2b88421ff9f2fe5a979a27a026fc445d46f1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
7ad27288f1b66733a4fcb2bdcb17dd5db6c6423d 22-Apr-2014 Craig Mautner <cmautner@google.com> am c00c89b1: am f4c909bc: Fix ActivityView lifecycle

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

* commit 'f4c909bcb87d6f103c9f9e8255fa61bd86f4de67':
Fix ActivityView lifecycle
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/ActivityManagerService.java
f148f36d140e995ec8f755e60bbb0b37f33c3da7 10-Apr-2014 Narayan Kamath <narayan@google.com> am 9e289d70: am 1d26a3f1: am 09e13cc5: Merge "System services detect and register app CPU ABIs"

* commit '9e289d70a8baaed0030413b5991653792e2a816d':
System services detect and register app CPU ABIs
9e289d70a8baaed0030413b5991653792e2a816d 10-Apr-2014 Narayan Kamath <narayan@google.com> am 1d26a3f1: am 09e13cc5: Merge "System services detect and register app CPU ABIs"

* commit '1d26a3f1efd0d965e8751e8515608c31789bdbe2':
System services detect and register app CPU ABIs
6fdb5e6df178b3b1062ac67b505b288aa609a66b 10-Apr-2014 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 7289f3ab to klp-modular-dev-plus-aosp

Change-Id: I5bdc8862828b56557410a95e7f9b14def81a0ded
a981e3b01ae6af2b67e582f0d1cbb95560d05626 09-Apr-2014 Narayan Kamath <narayan@google.com> resolved conflicts for merge of 7289f3ab to klp-modular-dev-plus-aosp

Change-Id: I788ca17503e2fd225e205a76d3e7062f71d58316
13014b5fe5967b3c7e232ffaf81581ed178e6df6 08-Apr-2014 Jeff Brown <jeffbrown@google.com> Move certain internal activity manager methods to new class.

This is a little bit of refactoring in preparation for changing how
the power manager notifies system components about changes in power
state.

Deleted the startRunning method since it is no longer useful.

Bug: 13133142
Change-Id: I7f845c61ecc7ee890154ed0cbd90795de609b7ea
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
35fc6a02aeded9578375af5828e14043164028d5 03-Apr-2014 Craig Mautner <cmautner@google.com> Merge "Implement setActivityLabelAndIcon()."
f4824a06884e096beef921646cba4be29d7f36fc 02-Apr-2014 Kenny Guy <kennyguy@google.com> Fix issue with not allowing activities for current user.

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

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

Change-Id: Id5d4f29017b7ca6844632ce643f10331ad733e1d
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
b69bb445585a083b8e4ff8a13a1a1a63e9c22a6a 02-Apr-2014 Narayan Kamath <narayan@google.com> resolved conflicts for merge of 71ab4f4f to master

Change-Id: I888c231f7579523e12fbd68f820f0775019e51e0
71ab4f4f48a9b8b485d80adf18d568ef6265b1e8 02-Apr-2014 Narayan Kamath <narayan@google.com> am ea9e5eca: am 17b1b8fe: Merge "Move zygote startup logic to the frameworks."

* commit 'ea9e5ecac1e5240370f0e3f998b9c8b159ee9320':
Move zygote startup logic to the frameworks.
688b5105d665a56e6f2f040f3ca89ca3006801df 28-Mar-2014 Craig Mautner <cmautner@google.com> Implement setActivityLabelAndIcon().

Replaces Activity.setRecentsLabel and Activity.setRecentsIcon.
Simple top-down traversal to find the highest activity with a
specified label and icon. Adds the Intent of that activity to
RecentTaskInfo as well so that Recents can get the launcher
icon if UX desires it.

Fixes bug 13675322.

Change-Id: I62d7d8f4df4dc81012f451e0cdea8a2943aedeec
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
439cf5b433123970a94388cf9309d9ea4d31b3cb 31-Mar-2014 Narayan Kamath <narayan@google.com> am 56a8f8b4: resolved conflicts for merge of 439145f0 to klp-modular-dev-plus-aosp

* commit '56a8f8b48ff1d0855209307b9076d6e9b348b59b':
Don't make isSafeMode a field on the Zygote class.
56a8f8b48ff1d0855209307b9076d6e9b348b59b 31-Mar-2014 Narayan Kamath <narayan@google.com> resolved conflicts for merge of 439145f0 to klp-modular-dev-plus-aosp

This isn't a straightforward conflict resolution. This code
has changed significantly. mSafeMode is now a flag on the activity
manager service, and is set when SystemServer calls enterSafeMode.

Change-Id: I1e8ff524566c5e44bb6bf3b138cdebb70004aca3
43111e897be9f79ababb0ecf99f155695416d956 24-Mar-2014 Dianne Hackborn <hackbod@google.com> Merge "Battery stats: wake locks, radio active, cleanup."
4590e52f3d0558e01322fe4dd55bb612afdfb079 24-Mar-2014 Dianne Hackborn <hackbod@google.com> Battery stats: wake locks, radio active, cleanup.

- Improve wake lock work source updates to also update the current
history tag, in case the new work source gets recorded in the
history.

- Fix bug in recording radio active time that was not distributing
any time to apps.

- No longer hold a wake lock while dispatching data conn active call,
since it comes with its own timestamp.

- Fix issue where the top app was not being cleared while the screen
was off.

- Remove obsolete STATS_LAST stats type.

- Fix bug that was not clearing the total run time when resetting
the stats.

Change-Id: Iabe17a9edf34f762374ae09fcffb8a819cf72e30
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2fbd7541804f816171849413b095fcfc70e06c1e 21-Mar-2014 Craig Mautner <cmautner@google.com> Add Activity methods for icons and labels.

New Activity methods setRecentsLabel(CharSequence) and
setRecentsIcon(Bitmap) have been added. The topmost
activity with either of these set will be returned in
RecentTaskInfo members activityLabel and activityIcon.

Fixes bug 13562992.

Change-Id: Ic15d1d27b733b892a2a940063b105ac48f1ffee5
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
8fc2eba0f7590122c15290b7ce3389be15394fd4 18-Mar-2014 Dianne Hackborn <hackbod@android.com> am a2a13718: am 7987d84e: am d1d91eca: am 7cb1dfe6: Merge "Insufficient ProcessRecord cleanup when persistent process is killed"

* commit 'a2a13718d00172d224960146e4956de58da5b484':
Insufficient ProcessRecord cleanup when persistent process is killed
7987d84e35fb8d7a20ef33786906968e8b7f2dc2 18-Mar-2014 Dianne Hackborn <hackbod@android.com> am d1d91eca: am 7cb1dfe6: Merge "Insufficient ProcessRecord cleanup when persistent process is killed"

* commit 'd1d91eca3e78f2074b110a0e3530aeff6deef6fe':
Insufficient ProcessRecord cleanup when persistent process is killed
e9ebd60fc4dd32a57784e8d9c7dcb8b599d25f75 18-Mar-2014 Dianne Hackborn <hackbod@google.com> Merge "Treat IME processes as hosting activities"
f0f94d129b6eb3c48624e915898d86d4f2de59ff 18-Mar-2014 Dianne Hackborn <hackbod@google.com> Treat IME processes as hosting activities

When we stop using an IME process, we still treat that
process as if it is hosting activities (in the activity part
of the LRU list), to try to keep it around. This is intended
to help the experience of switching between IMEs, reducing
the chance of your previous IME process being killed and thus
requiring much more time to switch.

Change-Id: Ie5793fd9b40d980fa18f80246326511ed6ae0597
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
82326a98a4507deee89a90654dd0953c459811af 17-Mar-2014 Kenny Guy <kennyguy@google.com> Add flag to allow fetching related users recent tasks.

Fetch related users recent tasks along with requested users
tasks when flag is set
Set flag in requests coming from systemui/recents.

Change-Id: I985e2d9d6b9728603685fc6126e8193af119e172
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
aea74a5977ca9f1054926eb24f247562c3a4a6ba 08-Mar-2014 Craig Mautner <cmautner@google.com> Add Lock Task Mode.

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

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

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

Make ActivityManager and WindowManager understand related users.

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

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

Change-Id: I3bd87b32aec69c3f8d470c8b29b144f4e849c808
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ca35c18a374c143831cc282987c762507c0ffc34 07-Mar-2014 Narayan Kamath <narayan@google.com> am cd4874cf: am d265bcc4: Merge "Inform libcore of time format pref. changes."

* commit 'cd4874cfdc00d17454529b5dca85a487c7c2de77':
Inform libcore of time format pref. changes.
f084e2779b03c261e0fcbfd7d7c6d9960a6358a1 07-Mar-2014 Narayan Kamath <narayan@google.com> Merge "Inform libcore of time format pref. changes."
ccb2a086fe0de77a4e3277454cb4a66f8e7dc57d 19-Dec-2013 Narayan Kamath <narayan@google.com> Inform libcore of time format pref. changes.

- Introduce a boolean extra for intent TIME_CHANGED that
specifies if the user wants a 24 hour format or not.
- Have the ActivityManagerService inform running processes
of changes to this preference.
- Add plumbing in ActivityThread to inform j.t.DateFormat

(cherry-picked from dd491cc756233c088fd26eba4918671fcc9cfc30)

Change-Id: Ib90636bda4bc8332cfa22def831877b524b5c486
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
72f456fc51ecd584c3b82f8f54020edd7b9a0f46 07-Mar-2014 Dianne Hackborn <hackbod@google.com> am a6590837: am 8b776e86: am c71c901a: am 278fa87c: am 430652c1: Merge "Fix issue #13199860: PRE_BOOT_COMPLETED intent is..." into klp-dev

* commit 'a6590837a9d0211b4c44f25e1cbe2cd196aa1a3d':
Fix issue #13199860: PRE_BOOT_COMPLETED intent is...
c71c901ad4d33a373efdad4cf97d12f8ca77e089 07-Mar-2014 Dianne Hackborn <hackbod@google.com> am 278fa87c: am 430652c1: Merge "Fix issue #13199860: PRE_BOOT_COMPLETED intent is..." into klp-dev

* commit '278fa87cc9a5e08d410c5b1e6c75afcffc22a988':
Fix issue #13199860: PRE_BOOT_COMPLETED intent is...
6143a02f96a5c6c7a0a84f5dbe70732998256a72 05-Mar-2014 Kenny Guy <kennyguy@google.com> Start related users on boot and user switch.

Collect related initialized users and start
them on boot and user switch.
Update list users command to show whether a
user is running or not.

Change-Id: Ib3d5debcb01ec55a07d93450b988b0180fc63263
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
264707caa392abd8c92764e0b04b37290c16fb5a 05-Mar-2014 Kenny Guy <kennyguy@google.com> Fix bug with starting users in background.

It shouldn't tell the window manager to lock or freeze the
screen when starting a user in the background.

Change-Id: I24c6c19a20c360ecbed7d28e1d7249c025a463b9
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
08488bf3fe6f4b1fadf59821feaf07b4c2ae52ae 21-Feb-2014 Kenny Guy <kennyguy@google.com> Allow user to be started in background.

Change-Id: I2adeb258cd33765a559c1f952c47088abbc4336c
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a1f1a3c573acd91024fda0ceb3b921c73b186963 25-Feb-2014 Dianne Hackborn <hackbod@google.com> More battery stats.

- Add events for sync.
- Add more descriptive tags for wake events.
- Fix battery reset.
- Fix tracking of wifi data.

Change-Id: Ic07f2a86a5ed33e7da57eb1108c31c777ecd801f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
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/ActivityManagerService.java
cab8617b8ccea3a99b1ee15e15915c512a10c738 11-Feb-2014 Jeff Brown <jeffbrown@google.com> am 25df673b: am 1b51c9cb: Merge "Make SystemService constructor take a Context." into klp-modular-dev

* commit '25df673b849de374cf1de40250dfd8a48b7ac28b':
Make SystemService constructor take a Context.
b880d880c6cd989eacc28c365fc9a41d31900da1 11-Feb-2014 Jeff Brown <jeffbrown@google.com> Make SystemService constructor take a Context.

This change simplifies the process of initializing a SystemService
by folding the onCreate() step back into the constructor. It removes
some ambuiguity about what work should happen in the constructor and
should make it possible for services to retain most of their final
fields after refactoring into the new pattern.

Change-Id: I25f41af0321bc01898658ab44b369f9c5d16800b
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
9358dcca6f3d33d1e3f976a4c3a5f61e103930dc 10-Feb-2014 Dianne Hackborn <hackbod@google.com> Maybe fix issue #12957738: SecurityException in...

...Multiple Processes: uid 10069 does not have
android.permission.UPDATE_DEVICE_STATS.

Change-Id: Ibabb5b09d52412df8bebdc85a584f89e175b1ec5
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
eaf2ac464b1cd741d7d0fe700771b1b7c00ddb29 07-Feb-2014 Dianne Hackborn <hackbod@google.com> Battery stats: more events, fixes.

Add new history events for top application package and
foreground application packages.

Doing this involved a fair amount of improvement to history
events. The event code is now separated out to have "start"
and "finish" identifies, and we use that to now keep track
of which events are active. With that, when resetting the
stats, we can spit out all of the currently active events at
the front of the new history.

Also fixed some problems when I re-arranged the history delta
int bits that were conflicting with the packing of the battery
status bits. These packing structures are changed to work
together correctly.

Change-Id: Ic8b815060dd8a50ff4a0a209efc2e1044215cd88
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
898c13df7b9b12ff10062f3542593e12fbe0c119 29-Jan-2014 Adam Lesinski <adamlesinski@google.com> Check feature bits before loading optional services

At startup, we check with PackageManager whether a system service is
available before attempting to load it. A system service is available
if its associated feature (similar to hardware features) is present.
This does not remove unavailable services from the compiled jar.

Change-Id: I13571805083aa4e65519a74acb52efd17b9fb3d7
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.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/ActivityManagerService.java
39e79006cf22f10eb62ac721238778aa6b7d3473 22-Jan-2014 Dianne Hackborn <hackbod@google.com> Merge "Battery stats improvements."
099bc627c463d9941e23e480f25a78a154429c55 22-Jan-2014 Dianne Hackborn <hackbod@google.com> Battery stats improvements.

- Adjust total power use when there is unaccounted power so that our
percentages don't end up > 100%.
- Fix accounting of isolated uids to be against the owning real app
uids.
- Rework how we put cpu use into the battery stats to no longer need
this uid name cache that can confuse the uid it is associated with.
- Finish implementing events in the history, adding a string pool and
reading/writing/dumping them.
- Add first two events: processes starting and finishing.
- Fix alarm manager reporting of wakeup alarms to be adjusted by the
WorkSource associated with the alarm, so they are blamed on the
correct app.
- New "--history" dump option allows you to perform a checkin of
only the history data.
- Fixed BitDescription bug that would cause incorrect printing of
changes in some states.

Change-Id: Ifbdd0740132ed178033851c58f165adc0d50f716
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
509cc13b705f8c488774e7097ab17471c3dacd2e 18-Jan-2014 Jeff Brown <jeffbrown@google.com> am e2c9cd58: Merge "Refactor display manager service to new pattern." into klp-modular-dev

* commit 'e2c9cd583f4f706b48270b8cbe84df627c69af24':
Refactor display manager service to new pattern.
4ccb823a9f62e57f9d221f83a97e82967e79a9e5 17-Jan-2014 Jeff Brown <jeffbrown@google.com> Refactor display manager service to new pattern.

Transform DisplayManagerService into a SystemService and start cleaning
up other local services that it uses from window manager and input manager.

Clean up service thread initialization.

Remove unnecessary static variables from ActivityManagerService.

It's starting to become clear that we really need a better way to manage
service dependencies. Boot phases don't quite cut it.

Change-Id: If319dbd7cbfbd4812fe55ece969e818d4b20755b
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
09d30981f8e882ffaa336aa4665bfe348557895a 16-Jan-2014 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 6f357d32 to master

Change-Id: I1979e6ed1acddbe656f5010114fd900f10865e75
6f357d3284a833cc50a990e14b39f389b8972254 16-Jan-2014 Jeff Brown <jeffbrown@google.com> Start untangling system server early bootstrapping.

Refactored SystemServer to get rid of a bunch of legacy cruft related
to how the ServerThread used to be started up.

Create system context first when system server starts. This removes
the tangled initialization order dependency that forced us to start
the activity manager service before most anything else.

Moved factory test related constants into the FactoryTest class.

Partially migrated Installer, ActivityManagerService, and
PowerManagerService to the new SystemService pattern. There's more
work to be done here, particularly around the lifecycle of the
power manager.

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

Change-Id: Ib656ac0591b21ad14f2df51021729552e9373515
88bfc6ddc846d714bc15518ef6741e39145a1687 08-Jan-2014 Craig Mautner <cmautner@google.com> Merge "Extend stack management to other displays." into klp-modular-dev
a807dbaeed2a125cea6868f6d51402f8416fddec 06-Jan-2014 Todd Poynor <toddpoynor@google.com> am 91ecb36d: ActivityManagerService use lmkd low memory killer daemon -- DO NOT MERGE

* commit '91ecb36df50be3446809e9da2a8f571d157f7549':
ActivityManagerService use lmkd low memory killer daemon -- DO NOT MERGE
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/ActivityManagerService.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/ActivityManagerService.java