History log of /frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e1d47a7bc9236343bafe9d49882d143af2b6d11b 02-Sep-2015 Wale Ogunwale <ogunwale@google.com> Respect DONT_KILL_APP flag when bringing down a disabled service.

Commit 540e123 introduce logic to clean up states when a component is
disabled. For services this included marking the process running the
service as removed so it can be killed later. However, this wasn't
respecting the Intent.EXTRA_DONT_KILL_APP flag where the caller
doesn't want the process of the disabled component to be killed.
This change now takes the flag into account.

Bug: 23491822
Bug: 15804187
Change-Id: I54a6e03cd66164dc8c4606a3c462114fe661ea8e
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
dbafadb3e564e563cde747ce3ebc0c6c57bbf243 30-Aug-2015 Svet Ganov <svetoslavganov@google.com> Fix a NPE when shutting down instrumentation

bug:23657953

Change-Id: I7187c3d911de24abe20a2c462a10352dd741efed
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
cf836079cdea8411564a40740f3123d5e2aacf5a 20-Aug-2015 Dianne Hackborn <hackbod@google.com> Fix issue #23361510: Increase assist timeout from 500ms to 1 second

Actually, timeout is okay, but need to schedule it on UI thread.

Change-Id: I5b4ffa7caa33815a5223e3ddd08d4809bc7cf7b6
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ae498721001c6cdcdb6cce1b2f3ba5abbce36f8a 14-Aug-2015 Dianne Hackborn <hackbod@google.com> Add debugging for issue #23190084: [APPComm][Dev Test] {Unable to share photo...

...from Camera360 to Hangouts }

In the short URI toString, include a small summary of the ClipData (instead
of just saying it has a clip data). This makes it a lot easier to understand
what is happening when you look at the log of activity starts.

Also separate out the activity manager dump of URI permission grants from
its dump of providers, so it is easy to just look at that state.

Change-Id: I68093d9f279944e1aa9a29347075f237f4f55ed3
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
38d30dc547825bdde2756f588692063a28749e8d 07-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Immediately kill a shared user process on a permission revocation." into mnc-dev
aa41add33b8d7d318387cc74c34e3d347d245211 07-Aug-2015 Svetoslav <svetoslavganov@google.com> Immediately kill a shared user process on a permission revocation.

1. When a permission is revoked we kill the app immediately but do
not do an immediate kill for shared uid processes. This fixes it.

2. Remove system APIs that are used only by the package installer.

bug:22984670

Change-Id: I3d4ae52ea8679f894aa7c5972941263903479183
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a0ef49c44f7d845e3465591ea977d0c9996c4e5e 07-Aug-2015 Wale Ogunwale <ogunwale@google.com> Look for recent tasks in live stacks.

It is possible for a tasks not to have been saved to the
persisted recent list yet for various reasons. This causes
some external calls to fail when they are trying to do
an operation on a task with a given id. We now use the
stack supervisor look-up for a task id that checks
everywhere a task might be including live stack. It this
fails then the task truly doesn't exist.

Bug: 22924782
Change-Id: I57c3df41d0b4f3ee3c5ae9b7d01eeb2b352062b4
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d9b0f8435ba9b099512288729af24858a95fd013 04-Aug-2015 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #22860466: viapi security bug - rubber stamping in nested VIs" into mnc-dev
fb81d09d359480f9e43bbf300877b60de05f4816 04-Aug-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22860466: viapi security bug - rubber stamping in nested VIs

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

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

Change-Id: Ie02d2458f16cb0b12af825641bcf8beaf086931b
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
28ec27cbfa157c242fd9330a10c7c2b8ea838694 04-Aug-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22912704: "android.process.acore has stopped" dialog keeps popping up

Slice 'em up!

Change-Id: Ibba3af7ec5b7f92e6d5e55a57aa838a7f7f936e1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6ad2d66072795dd9836350b273dcde52910ab4c3 18-Jul-2015 Billy Lau <billylau@google.com> Bug: 21589105 Rescope WRITE_SETTINGS permission (framework services perm check
changes)

AppOpsManager:
Changed the default operating mode for WRITE_SETTINGS to MODE_DEFAULT from
MODE_ALLOWED.

packages/SettingsProvider:
We no longer do static permission checks for WRITE_SETTINGS in early checks and
defer that to app op when MODE_DEFAULT is returned. For some operations,
checking against WRITE_SECURE_SETTINGS is sufficient.

ActivityManagerService & PowerManagerService:
Incorporated app op checks and handled the MODE_DEFAULT case.

provider/Settings:
Added helper function to do checks on whether app ops protected operations
can be performed by a caller. This includes checks for WRITE_SETTINGS and
SYSTEM_ALERT_WINDOW.
Also added a public API (with javadocs) for apps to query if they can modify
system settings.
Changed the javadocs description for ACTION_MANAGE_WRITE_SETTINGS and
ACTION_MANAGE_OVERLAY_PERMISSION.
Added public API (with javadocs) for apps to query whether they can draw overlays or not,
and also javadocs description on how to use that check.

Change-Id: I7b651fe8af836c2074defdbd6acfec3f32acdbe9
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a73b68fb856aa3563be7423e5f93314eddc7d144 29-Jul-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22802617: APR: spurious wtf when restarting a persistent process

Just don't do a wtf here, it isn't really wrong (though it isn't really
right, but at this point in a release it is right enough!).

Change-Id: Ic38a2e27556224cf8868f1fa18b4810929d67fcc
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
c5dce0169bf1f93ef394215647f63bd48aefc67e 24-Jul-2015 John Reck <jreck@google.com> Use process state to filter >= UI_HIDDEN

Bug: 22701182
Change-Id: Ia192016397c8115a19a0dca409aa70dea154c41e
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6b66a4a8a342b8156f73d83771caa1db2f866529 24-Jul-2015 John Reck <jreck@google.com> use findProcess instead of getProcess

Bug: 22701182
Change-Id: I2ec56c55c49401f2f213bbd318e867fd73b37672
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
7bb48725debf53a1142e959907dae12b729ae531 23-Jul-2015 Svet Ganov <svetoslavganov@google.com> Shut down UiAutomationConnection without a lock held

bug:22599759

Change-Id: I90bca614960522269497127658c16b0bb6ec0476
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
17f693520da8977c4a60f5b4be3be035cba7146c 18-Jul-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22531747: Assist info should declare if user has disabled...

...context and/or screenshot

Added new API to find out what contextual data has been globally disabled.

Also updated various documentation to make it clear what kind of contextual
data you will get (and when it will be null).

Also added a new Activity.showAssist() API because... well, I was already
in there, it was easy to do, it is safe, and maybe people will build cool
things with it.

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

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

Change-Id: Ie6b28807b96fef35ccdff93b0a01066cfd8fa307
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
16f3671620bab310f5ed4f9222d4a36a8dcef562 15-Jul-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22487155: Device unresponsive (deadlock in system_server)

Using my magic potion, Deadlock-B-Gone!

Change-Id: If5c0a2b18134dc95444f3782ab5aa475414b5839
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d4fd8c766da8a70e3359bbc7efbbc79496efe71a 14-Jul-2015 Fyodor Kupolov <fkupolov@google.com> Added sendBroadcastMultiplePermissions method

Added Context.sendBroadcastMultiplePermissions(Intent intent, String[]
receiverPermissions) method, which allows an array of required permissions
to be enforced.

Bug: 21852542
Change-Id: I27c9130e8f004b428452501ebc8a36aabde1f343
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4a817924ecb282eef48b06b92f8e1914edd6cec2 15-Jul-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Revert "Allow array of required permissions in sendBroadcast"" into mnc-dev
e37520b49da8fc2b7b7501c6dbbe1e6ac984dd9f 15-Jul-2015 Fyodor Kupolov <fkupolov@google.com> Revert "Allow array of required permissions in sendBroadcast"

This reverts commit b4e7283c9afd9fb15ebd63f6ce9b75c9c1af658b.

Change-Id: Ie8390964bda5bdfa869cee8f46584043d8e7c664
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d69a82c107cea4aca87eecc3978e21ea9bc23c82 14-Jul-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Allow array of required permissions in sendBroadcast" into mnc-dev
b4e7283c9afd9fb15ebd63f6ce9b75c9c1af658b 14-Jul-2015 Fyodor Kupolov <fkupolov@google.com> Allow array of required permissions in sendBroadcast

Added Context.sendBroadcast(Intent intent, String[] receiverPermissions)
method, which allows an array of required permissions to be enforced.

Bug: 21852542
Change-Id: I3b8ff258fa9f3249c344bb8093b820b24eef00c0
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6ee871e59812fea4525c50231f677c4bd10c74b8 10-Jul-2015 Svet Ganov <svetoslavganov@google.com> Teach storage appops.

For modern apps targeting M SDK and up the external storage state
is deterined by granted permissions. For apps targeting older SDK
the storage access is determined by app ops correspning to the
storage permissions as the latter are always granted.

When app ops change we do not remount as we kill the app process
in both cases enabling and disabling an app op since legacy code
is not prepared for dynamic behavior where an operation that failed
may next succeed. Hence, we remount when we start the app.

For modern apps we don't kill the app process on a permission
grant, therefore we synchronously remount the app storage.

bug:22104923

Change-Id: I601c19c764a74c2d15bea6630d0f5fdc52bf6a5a
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
782d49826862cbdc9d020fc9d85f8a6f64675dcb 09-Jul-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22328792: Fix scalability issues in AssistStructure

We can now stream the AssistStructure across processes, avoiding
IPC size limitations for large structures. There is also a new
API that gets called on the VoiceInteractionSession if there is
a failure retrieving the assist data.

Also fix issue #22351981: Runtime restart due to ANR in system server,
getting rid of a deadlock.

And also tweak object lifecycles to try to avoid keeping around
in an app the previous AssistStructure after we request a new one.

Change-Id: Ifb136a0d31a14e56a8db6b90768d9fc65557a17f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f64cb1803819d0f7f194adc6d1934e73c694d791 09-Jul-2015 Amith Yamasani <yamasani@google.com> Dispatch onUserSwitched callbacks on handler thread

This avoids multiple threads calling beginBroadcast on the observers
list.

Bug: 22339693
Change-Id: I78a154415ccd17c9460b25589d46dadcdb850941
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6dce4964b4d1a13d276d95730b8fb09d6a5a8d04 04-Jul-2015 Jeff Sharkey <jsharkey@android.com> Reconcile private volumes when mounted.

Many things can happen while a private volume is ejected, so we need
to reconcile newly mounted volumes against known state.

First, user IDs can be recycled, so we store the serial number in the
extended attributes of the /data/user/[id] directory inode. Since a
serial number is always unique, we can quickly determine if a user
directory "10" really belongs to the current user "10". When we
detect a mismatched serial number, we destroy all data belonging to
that user. Gracefully handles upgrade case and assumes current serial
number is valid when none is defined.

Second, we destroy apps that we find no record of, either due to
uninstallation while the volume was unmounted, or reinstallation on
another volume.

When mounting a volume, ensure that data directories exist for all
current users. Similarly, create data directories on all mounted
volumes when creating a user. When forgetting a volume, gracefully
uninstall any apps that had been installed on that volume.

Bug: 20674082, 20275572
Change-Id: I4e3448837f7c03daf00d71681ebdc96e3d8b9cc9
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
68ffcf883c15b97d28e36c684d0db3da084727fc 02-Jul-2015 Svet Ganov <svetoslavganov@google.com> Merge "Teach receivers, activities, providers, and services app ops." into mnc-dev
99b6043dad9d215cf15810b885b6b8c215dd5b5a 27-Jun-2015 Svet Ganov <svetoslavganov@google.com> Teach receivers, activities, providers, and services app ops.

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

bug:22199666

Change-Id: Ia22d1c38d58b3cd6aabdc655cb7c7bddd85da7a2
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4e88bcd39918197c78b148afe40a08b6adcace1e 01-Jul-2015 Dianne Hackborn <hackbod@google.com> Fix issue #20672970: Notifications are not dismissed on hot word detection

Add new VoiceInteractionSession.closeSystemDialogs() API that closes
everything except the session itself.

Change-Id: If45f1e120d8ca095b6c8055b6485acb5e710820e
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
b6fb3fe8f4fce5fda82a833247bd99ec435815f1 29-Jun-2015 Benjamin Franz <bfranz@google.com> Merge "Block assist when screenshots are disabled by policy" into mnc-dev
c200f44c46b7d6ddb104c0f09f2a4c679e218d0b 25-Jun-2015 Benjamin Franz <bfranz@google.com> Block assist when screenshots are disabled by policy

When a device or profile owner disables screen capture, we also want to
block context data being collected for the assist structure.

Bug: 21797707
Change-Id: Ib8716c6dd71d538a027c04e1e907c87e2afa0ac8
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
9527b223a9d4a4d149bb005afc77148dbeeff785 25-Jun-2015 Jeff Sharkey <jsharkey@android.com> Let's reinvent storage, yet again!

Now that we're treating storage as a runtime permission, we need to
grant read/write access without killing the app. This is really
tricky, since we had been using GIDs for access control, and they're
set in stone once Zygote drops privileges.

The only thing left that can change dynamically is the filesystem
itself, so let's do that. This means changing the FUSE daemon to
present itself as three different views:

/mnt/runtime_default/foo - view for apps with no access
/mnt/runtime_read/foo - view for apps with read access
/mnt/runtime_write/foo - view for apps with write access

There is still a single location for all the backing files, and
filesystem permissions are derived the same way for each view, but
the file modes are masked off differently for each mountpoint.

During Zygote fork, it wires up the appropriate storage access into
an isolated mount namespace based on the current app permissions. When
the app is granted permissions dynamically at runtime, the system
asks vold to jump into the existing mount namespace and bind mount
the newly granted access model into place.

Bug: 21858077
Change-Id: I62fb25d126dd815aea699b33d580e3afb90f8fd2
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
c30454c10457fe034a861b4bf19fd1fc240bd893 24-Jun-2015 Adam Lesinski <adamlesinski@google.com> Allow callers holding PACKAGE_USAGE_STATS permission to call ActivityManager#getPackageImportance()

Bug:22055550
Change-Id: I1e732e95698daf44bcb223cafde3d3c22746d232
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a825c084f81d9cfca353514ca6a11221e84a7c8a 23-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21753257: Stability: startActivity asks to run as user 0...

...but is calling from user 10

Change-Id: Ia4b8ace6ad140c1727fe944882e0d5b5c650260b
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a77ef4b8b4c11a9fdfdca030462b7b055bf533bc 22-Jun-2015 Yusuke Sato <yusukes@google.com> Merge "Trace Process.killProcessGroup calls in server/am/" into mnc-dev
b94761d0a48522b23c54f786445658bb58258da4 20-Jun-2015 Amith Yamasani <yamasani@google.com> Merge "App Standby : Association between content providers and their sync adapter" into mnc-dev
37a40c24deb02bca3868a8085069afae112f22e4 17-Jun-2015 Amith Yamasani <yamasani@google.com> App Standby : Association between content providers and their sync adapter

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

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

Also cache sync adapters associated with an authority in SyncManager.

Bug: 21785111
Change-Id: Ic2c8cb6a27f005d1a1d0aad21d36b1510160753a
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f32f7a3ffdbb80fb8d635c1aacaf0c7d2c2dde9f 19-Jun-2015 David Srbecky <dsrbecky@google.com> Merge "Replace --include-cfi with --generate-debug-info." into mnc-dev
08741e96ab0ae78e546e9f59e287993717cfc951 19-Jun-2015 Wale Ogunwale <ogunwale@google.com> Reduce log noise.

Bug: 21941219
Change-Id: Ic84719cf1b901c7e6befeca5c73685301e511db8
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
065075e1f993a68579ed7f8034ab09d96ec957a9 28-May-2015 David Srbecky <dsrbecky@google.com> Replace --include-cfi with --generate-debug-info.

This follows a change in dex2oat.

(cherry picked from commit f39477b592e6e17fe41ace2e18602a69b2dd1619)

Bug: 21924613
Change-Id: I46b61298ca00bee2e83080456b180d63efd95b8f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
00fac63575349df5ed8c399b83f1f9c7199ff070 19-Jun-2015 Adam Lesinski <adamlesinski@google.com> Merge "BatteryStats: Fix regression in wakelock power distribution" into mnc-dev
69810483c770e99b65f4fd01ad1973885969062c 18-Jun-2015 Todd Kennedy <toddke@google.com> Add getPackageImportance() system API

Callers must have the permission GET_PACKAGE_IMPORTANCE

Bug: 20642684
Change-Id: I6f3ef2ec810c884e0dee239e5909bcb314957302
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
72478f053f403e29223dba6cc7be9e5bf115f670 18-Jun-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Fix regression in wakelock power distribution

We used to give 50% of the cpu time of each app to any app holding a wakelock
while the screen is off.
Since we switched to the new kernel module for measuring app's cpu time, this distribution
was lost.

Bug:21876567
Change-Id: I42c294547f63d150d9929271ca0e27fedaaa9d77
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
cf4b2542fae9d6c5d3788c6a935824094fb1c1ea 17-Jun-2015 Yusuke Sato <yusukes@google.com> Trace Process.killProcessGroup calls in server/am/

to make it easier to find boot time regressions like 21813611
and 21861473.

Process.killProcessGroup is a blocking call and usually takes
about 50ms to finish on a recent device even when the process
group contains only one process. Since Process.killProcessGroup
tends to be called in a loop, the function can be a bottleneck.

Bug: 21813611
Change-Id: I9c1727c0c0b321a30c96321198cc02f438496ded
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a750a63d639f6936af456df904fa6b9ba941885e 17-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21814207 and issue #21814212 (alarm manager)

Issue #21814207: AlarmManager.setAndAllowWhileIdle should also allow wake locks.

Introduce a whole new infrastructure for providing options when
sending broadcasts, much like ActivityOptions. There is a single
option right now, asking the activity manager to apply a tempory
whitelist to each receiver of the broadcast.

Issue #21814212: Need to allow configuration of alarm manager parameters

The various alarm manager timing configurations are not modifiable
through settings, much like DeviceIdleController. Also did a few
tweaks in the existing DeviceIdleController impl.

Change-Id: Ifd01013185acc4de668617b1e46e78e30ebed041
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
505d62dd05fab80e5833e90954f832bcfaf535ef 16-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix to only do pre boot receivers on upgrade.

I mistakenly checked in a change that forced us to run
pre boot receivers during every boot, which was intended to
just be temporary for testing.

Change-Id: I7890432f2d42deccef934c1503c3af4b55f59494
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
9cc842f0ee491aa7b4fcea02823c3aa273465ac1 16-Jun-2015 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #21816660 (app standby), work on issue #20882522 (voice interact)" into mnc-dev
fa24bd8ab65ac34cc3393ab9a8aa0e24747c4072 16-Jun-2015 Makoto Onuki <omakoto@google.com> Allow killApplicationWithAppId() on secondary users

Bug 20949609

Change-Id: If0e766aeb3e8b4aa6aebed3b75bcedd75251e382
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
b8004ff3d4be75f2d57ac757cd0b983eed4ae9c0 15-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21816660 (app standby), work on issue #20882522 (voice interact)

Issue #21816660: More app standby abuse prevention

We now apply the same rules for deciding when an app has counted
as active when the screen is on as when the screen is off; the only
change this really means is that we don't immediately count foreground
services as making an app active both screen on as well as the
existing behavior for screen off.

Also small fix to how we switch into voice interaction mode that
guarantees we immediately switch to the screen on state.

Issue #20882522 VI: voice interactor service not restarted

This fixes some problems in the framework, allowing it to be
correctly restarted (and rolled by to the default voice interactor
if appropriate). There are still some problems in system UI that
leave things broken in some cases.

Also small fix to how we switch into voice interaction mode that
guarantees we immediately switch to the screen on state.

Change-Id: Ie4fd098a2f5174a2c94f36d30427fb2a9db3d835
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
17de4b2a73996366ff3d7759793a6809654caebe 12-Jun-2015 Chris Wren <cwren@android.com> Merge "remove usage of deprecated method setLatestEventInfo" into mnc-dev
1ce4b6d3c6cb5b2eb9c9d00472be12245db92427 11-Jun-2015 Chris Wren <cwren@android.com> remove usage of deprecated method setLatestEventInfo

Bug: 18510449
Change-Id: I56a77991c729990e501f402e007dfa79ee57621e
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ece0f4f5198e9e9cb60e96f036baf22c73411bec 11-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix APIs.

Issue #21039494: API Review: android.os.PowerManager.isDeviceIdleMode()
Issue #21347000: API Review: android.content.IntentFilter
Issue #20654534: API Review: android.app.assist

Also allow use of ActivityManager.setWatchHeapLimit on any platform
build as long as the calling app is debuggable.

Change-Id: Ic597e596fa772fcdf2553b64f444b3d9269e8b92
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2e49bfa6f02a4ab831a43453231888aa6d9c4ce1 12-Jun-2015 Adam Lesinski <adamlesinski@google.com> Merge "UsageStats: Change INTERACTION to SYSTEM_INTERACTION" into mnc-dev
c8e8729244d75584ce71a74d29c452fe538a22c5 11-Jun-2015 Adam Lesinski <adamlesinski@google.com> UsageStats: Change INTERACTION to SYSTEM_INTERACTION

SYSTEM_INTERACTION events are signals to the system for a package's
implicit actions (service bound, etc).

These should not affect the API visible stats like lastTimeUsed, etc.
USER_INTERACTION is for user initiated actions (notification interaction, etc).

Bug:21761781
Change-Id: I4585cf35fbb158612a3c737710108bec34e89183
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
42892ec6417e9acd14efb3e30d6dfe0baf0cbc2d 11-Jun-2015 Wale Ogunwale <ogunwale@google.com> Merge "Prevent system uid component from running in an app process" into mnc-dev
44368567f840e3469b5fd2c9399ed444b6f46ebf 11-Jun-2015 Wale Ogunwale <ogunwale@google.com> Prevent system uid component from running in an app process

Bug: 21669445
Change-Id: I11d0bc5301d7e2a64972221f54f3cbd611f8e404
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d168d184c02c33863b4eda56fae431437f609e2c 11-Jun-2015 Benjamin Franz <bfranz@google.com> Merge "Align the behaviour of different lock task modes" into mnc-dev
a3acdb33df7c7be7ff3d9f376ff833e4b0c1d897 09-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21621920: VI: need mechanism to get current request

Add new APIs to associate a Request with a name, get all active
requests, and get active request by name.

Also add a new Activity.onProvideReferrer() which will allow
applications to propagate referrer information to the assistant
(and other apps they launch) in a consistent way.

Change-Id: I4ef74b5ed07447da9303a74a1bdf42e4966df363
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ea7438e4a698945b3e3a7786cff726c337291a68 09-Jun-2015 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #21571700: Need to be smarter about how foreground..." into mnc-dev
cedd53adc3875fe1b4275afa35ec5c3ede7b6c39 09-Jun-2015 Julia Reynolds <juliacr@google.com> Remove the ability to set a preferred setup activity.

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

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

Bug: 21608206
Change-Id: I841abf1103855e2d7218a4a8ca9b43c105630dc9
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ab4bb9d1fec685dab0fce9232c9a3477fab356b3 06-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21571700: Need to be smarter about how foreground...

...services get out of app idle

Introduce a new process state to even better distinguish foreground
services from other states. Rework the INTERACTION reporting to
usage stats to do it less when the screen is off -- require that
an app sit in the foreground service or top activity state for
at least 30 minutes before we consider it an interaction.

Also eradicate a bunch of logging in package manager.

Change-Id: I94249e67f9a9c62e9a92ae104710e6747b16327e
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
7fa228f4eaa774df9e925e0c037f0fa78caafafc 08-Jun-2015 Wale Ogunwale <ogunwale@google.com> Merge "Release voice wake lock at end of voice interaction session" into mnc-dev
4a922d470089bde49c2ca50b258973828a665aba 08-Jun-2015 Wale Ogunwale <ogunwale@google.com> Release voice wake lock at end of voice interaction session

Bug: 21615776
Bug: 21615761
Change-Id: I75d568474d4df5f21ea5b616887c6187e54f69e7
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
aac4c5c28f6699ddcbbc25638e73e5ab42b8360e 08-Jun-2015 Wale Ogunwale <ogunwale@google.com> Merge "Hold service lock when AMS.setProcessMemoryTrimLevel() is called" into mnc-dev
159f558a39d200e08e06245d64ec1df9a08e7d93 08-Jun-2015 Tim Kilbourn <tkilbourn@google.com> Merge "Pass an args bundle to launchAssistAction." into mnc-dev
e9408f3157a9af3b3a896278343341c4e18f6502 08-Jun-2015 Wale Ogunwale <ogunwale@google.com> Hold service lock when AMS.setProcessMemoryTrimLevel() is called

Bug: 21633189
Change-Id: I7203807466593ced6ec3dd328c1a03532caf3a31
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
c3b9156e284b689845e65880b60be2efc9fa4127 06-Jun-2015 Justin Harrison <astyrrian@google.com> am 6715ef75: am 4f2927d2: am 0eeb3bb8: am 33aa55b1: am 127d0b80: Merge "Revert "Revert "During early boot, send LOCALE_CHANGED only to registered receivers""" into lmp-mr1-dev

* commit '6715ef754a72fdc2477257051e539c38aae6afcd':
Revert "Revert "During early boot, send LOCALE_CHANGED only to registered receivers""
9445df6f0b2c6e623e9773bb8a5a1f51cc75ff76 06-Jun-2015 Justin Harrison <astyrrian@google.com> am 95be178d: am c4d7c826: am f8c2ffef: am c8fd50b1: am 29b98884: Merge "Revert "During early boot, send LOCALE_CHANGED only to registered receivers"" into lmp-mr1-dev

* commit '95be178dafd0dfefcae060f65df296cb523f82a4':
Revert "During early boot, send LOCALE_CHANGED only to registered receivers"
5c6c06bf187e6e96d9db1398108d613f86f5a912 06-Jun-2015 Stefan Kuhne <skuhne@google.com> Merge "Adding am send-trim-memory command" into mnc-dev
16045c24fe10cc92329ede099923f1223f49b17d 05-Jun-2015 Stefan Kuhne <skuhne@google.com> Adding am send-trim-memory command

This patch adds a send-trim-memory command to the ActivityManager to allow
for better debugging&testing.

The command is
adb shell am send-trim-memory [--user <USER_ID>] <PROCESS> <LEVEL>
whereas LEVEL can be one of the following:
[HIDDEN|RUNNING_MODERATE|BACKGROUND|RUNNING_LOW|MODERATE|
RUNNING_CRITICAL|COMPLETE]

Bug: 21633189
Change-Id: I7a41ce02c3c9043ffd3e5aaa791f7b7306a9de49
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
0e5f110fc915a9b044eb04cd07ae7ac588eacc8f 06-Jun-2015 Tim Kilbourn <tkilbourn@google.com> Pass an args bundle to launchAssistAction.

In order to track the input device that was used to trigger assist, the
input device id is sent as an extra in the assist intent whenever it is
available. This is particularly useful on TVs, when an app may want to
know whether the input device has a microphone.

Bug: 21666123
Change-Id: I0f8c09e2f617606bef481bdff924cb6b9b47dd12
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6715ef754a72fdc2477257051e539c38aae6afcd 04-Jun-2015 Justin Harrison <astyrrian@google.com> am 4f2927d2: am 0eeb3bb8: am 33aa55b1: am 127d0b80: Merge "Revert "Revert "During early boot, send LOCALE_CHANGED only to registered receivers""" into lmp-mr1-dev

* commit '4f2927d22415b9a38f34645ae7909592d574c170':
Revert "Revert "During early boot, send LOCALE_CHANGED only to registered receivers""
95be178dafd0dfefcae060f65df296cb523f82a4 04-Jun-2015 Justin Harrison <astyrrian@google.com> am c4d7c826: am f8c2ffef: am c8fd50b1: am 29b98884: Merge "Revert "During early boot, send LOCALE_CHANGED only to registered receivers"" into lmp-mr1-dev

* commit 'c4d7c826486868e31bacfe2265b96af1ff3115ea':
Revert "During early boot, send LOCALE_CHANGED only to registered receivers"
127d0b8065cb87fafddd0cf65a33e42afac69672 03-Jun-2015 Justin Harrison <astyrrian@google.com> Merge "Revert "Revert "During early boot, send LOCALE_CHANGED only to registered receivers""" into lmp-mr1-dev
aa9a679b00ea62677cb213fcca6af501870e4daf 03-Jun-2015 Justin Harrison <astyrrian@google.com> Revert "Revert "During early boot, send LOCALE_CHANGED only to registered receivers""

This reverts commit c48c31394e7e5dc104d22644d0e4e4a6a607497a.

Change-Id: Ia2b59da5d953a8a692c0e2f5eabb12e952dbdea1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
29b988846721eb870df9813a950ef31a2ecacebd 03-Jun-2015 Justin Harrison <astyrrian@google.com> Merge "Revert "During early boot, send LOCALE_CHANGED only to registered receivers"" into lmp-mr1-dev
c48c31394e7e5dc104d22644d0e4e4a6a607497a 03-Jun-2015 Justin Harrison <astyrrian@google.com> Revert "During early boot, send LOCALE_CHANGED only to registered receivers"

This reverts commit afd883f8a3ee260a5505f83d628c0b789871c837.

Change-Id: Ia4fadbbc7e531d13cd9e9019f0cdb30cc090cb7a
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
69c6adc96eecfde74ceb83cf9177428dc08b6067 02-Jun-2015 Dianne Hackborn <hackbod@google.com> More API changes.

Start moving Assist* stuff to android.app.assist.

Clean up some more of the VoiceInteractionSession APIs.

Clearly document that finish() is not the same as hide(),
always call hide() instead, and fix the finish() path to
also always do a hide to make sure everything is cleaned
up correctly.

Change-Id: I962d4069fcb34fe89547a95d395ae1b9fa3b4148
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2c8c30ac3cbd899cefc9b963669f3a18df08b425 01-Jun-2015 Wale Ogunwale <ogunwale@google.com> Allow app to stop lockTaskMode if started by manifest attribute

It is possible lockTaskMode was started by the system process
because android:lockTaskMode is set to a locking value in the
application's manifest instead of the app calling
startLockTaskMode. In this case TaskRecord.mLockTaskUid will
be 0, so we compare the callingUid to the
TaskRecord.effectiveUid instead so the app can exit lockTaskMode.

Bug: 21464182
Change-Id: Ibca6de8e4b17051d5fcbb05cde9c8aefed7216f2
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
c7cbdd11c322daa3a3c7acbf7e457c3ccf34c4d3 29-May-2015 Wale Ogunwale <ogunwale@google.com> Merge "Don't kill process with active service/receiver when task is removed." into mnc-dev
4573dddcce3f232d2eeb20bfe0e204e15a9416e9 28-May-2015 Dianne Hackborn <hackbod@google.com> Merge "Add new API to set URI on AssistContent." into mnc-dev
09d57fe9b357495b7bc62be39a8befa00d9d7ffb 28-May-2015 Dianne Hackborn <hackbod@google.com> Add new API to set URI on AssistContent.

Also rework how we transfer AssistContent and AssistStructure
to the assistant, so they are delivered as completely separate
objects rather than the kludgy bundling them in the assist
data thing.

Change-Id: Ib40cc3b152bafeb358fd3adec564a7dda3a0dd1d
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f3f53d9e8d1e4ae05f6495ce1828b9a6f61f4632 28-May-2015 Martijn Coenen <maco@google.com> Merge "Trace process launch from ActivityManager." into mnc-dev
843f648c821eef6bd1ade3bc3b8a17f94f85129a 27-May-2015 Julia Reynolds <juliacr@google.com> Fallback to priority activity if preferred activity not available.

Bug: 21434199
Change-Id: I1f268700219dea7f9ed02bda320923f49a5a3457
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
21531bce0e8848311c7f8caceeee3b988c7396f4 27-May-2015 Wale Ogunwale <ogunwale@google.com> am 57141700: am 0f771240: am bf0439a7: am 02f3cf79: am 523a19bf: am c9a0c0b9: Lockdown AM.getRunningAppProcesses API with permission.REAL_GET_TASKS

* commit '5714170091065bb51f33c8f3ce272db07f69a21b':
Lockdown AM.getRunningAppProcesses API with permission.REAL_GET_TASKS
02f3cf79989b202a45753ad74653d48f7d73c73d 27-May-2015 Wale Ogunwale <ogunwale@google.com> am 523a19bf: am c9a0c0b9: Lockdown AM.getRunningAppProcesses API with permission.REAL_GET_TASKS

* commit '523a19bf3df202c58369279fc4e538e9e342c1e7':
Lockdown AM.getRunningAppProcesses API with permission.REAL_GET_TASKS
523a19bf3df202c58369279fc4e538e9e342c1e7 27-May-2015 Wale Ogunwale <ogunwale@google.com> am c9a0c0b9: Lockdown AM.getRunningAppProcesses API with permission.REAL_GET_TASKS

* commit 'c9a0c0b90773fded6c251646300231f67c891b78':
Lockdown AM.getRunningAppProcesses API with permission.REAL_GET_TASKS
5069e675b7da20c4983d4306d3c6c19101d82e4a 27-May-2015 Wale Ogunwale <ogunwale@google.com> Don't kill process with active service/receiver when task is removed.

Bug: 20046621
Change-Id: Ib2e555802f1d3da0c0b78803badd612cab18ce32
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
80ce4ad644af507b20eeac3d2ecf937ef4abd2de 27-May-2015 Svetoslav <svetoslavganov@google.com> Merge "Clear binder id after a permissions check before killing a UID." into mnc-dev
0507d6b850218066d3d4e66f18fb408789c06b5c 26-May-2015 Svetoslav <svetoslavganov@google.com> Clear binder id after a permissions check before killing a UID.

bug:21035702

Change-Id: I2798d28780421720d85c5b49fa28897aa6c76d97
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
2d09122563360b377a1e66ebbdf084af9cb881e8 27-May-2015 Christopher Tate <ctate@google.com> Merge "Gracefully handle races with package uninstall" into mnc-dev
6ce8165bf3f33db2237203c5658098d6c501c624 26-May-2015 Christopher Tate <ctate@google.com> Gracefully handle races with package uninstall

Bug 21417673

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

Bug: 21276405
Change-Id: I90d47b1b28f716e650df7f4377ed7cdd30b46ec8
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
c9a0c0b90773fded6c251646300231f67c891b78 07-Apr-2015 Wale Ogunwale <ogunwale@google.com> Lockdown AM.getRunningAppProcesses API with permission.REAL_GET_TASKS

* Applications must now have ...permission.REAL_GET_TASKS to
be able to get process information for all applications.
* Only the process information for the calling application will be
returned if the app doesn't have the permission.
* Privilages apps will temporarily be able to get process information
for all applications if they don't have the new permission, but have
deprecated ...permission.GET_TASKS.

Bug: 20034603
Change-Id: I67ae9491f65d2280adb6a81593693d499714a216
(cherry picked from commit 9dbaa54f6834e013a63f18bd51ace554de811d80)
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
033c8797bd97dcc04e3fac52024998c97d28073b 20-May-2015 Martijn Coenen <maco@google.com> Trace process launch from ActivityManager.

Change-Id: I13b7695fba2e77428a74c0215f65eea8d07dda07
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
8b20cdb27bc5b4c433c4fc650203be9a25842bbd 22-May-2015 Dianne Hackborn <hackbod@google.com> Merge "Add API to track usage time of apps." into mnc-dev
b5a380d409a1431a38db978864b9d85b689e3cce 21-May-2015 Dianne Hackborn <hackbod@google.com> Add API to track usage time of apps.

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

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

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

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

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

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

Also remove some cruft that accumulated.

Fixes bug 21055376.

Change-Id: Ic1d58129aedbe3624f8a9d12c05c84674687b0a4
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4a3b824b23f13406fdc12d5f3ebb221c32459f31 21-May-2015 Craig Mautner <cmautner@google.com> Add debug for bug 21055376.

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

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

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

Plus additional locktask debug logging.

Fixes bug 21031298.

Change-Id: I756b0d607827d0ec7a123377db04d9377c41776d
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
8e3f29540db56d02a45966344133d6144c81e7c5 19-May-2015 Dianne Hackborn <hackbod@google.com> Merge "Update power manager to track uid state like netstats." into mnc-dev
d23e0d6901935588f9472bd7073fea0009581e9b 16-May-2015 Dianne Hackborn <hackbod@google.com> Update power manager to track uid state like netstats.

To follow the correct semantics for when restricts due to
device idle can be applied, power manager need to know about
uid process states like net policy so that it can allow
wake locks from apps that are in the foreground.

Since this is being added to a second place, I reworked things
so that the activity manager now keeps track of per-uid process
states and allows apps to register to listen to those, rather
than having to track lower-level process states and transform
them into an overall uid state. Both net policy and power
manager use this new facility.

Change-Id: I77359164c40d0f36fe1ef296dd9f9c3062431148
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
63b007e651f7b487b09f42f13fe03e0327edea6f 19-May-2015 Stefan Kuhne <skuhne@google.com> Fixing build breakage

There was a merge conflict due to 2 overlapping CL's.

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

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

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

Bug: 15986349
Bug: 19014377
Bug: 20763296

Change-Id: I06fd35a43036ef0b7260cf4db9c42890df63b95d
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
038959e851603500eb39b52fef33cbe75dbd73e3 15-May-2015 Adam Lesinski <adamlesinski@google.com> Merge "Remove UID from kernel cpu accounting when uninstalled" into mnc-dev
b99e6d69c30056520f7cb793e4be1851b3bd8426 15-May-2015 Adam Lesinski <adamlesinski@google.com> Merge "Parse uid_cputime proc file" into mnc-dev
4f9fd626d32989fe76c29e092d1fc591c6a8e1eb 15-May-2015 Wale Ogunwale <ogunwale@google.com> Merge "Clean-up broadcast receivers when component is disabled." into mnc-dev
ca1c12581a794db7569c7408b3547bf04f9bb3c9 15-May-2015 Wale Ogunwale <ogunwale@google.com> Clean-up broadcast receivers when component is disabled.

Bug: 15804187
Change-Id: Ib672f720bd5c8d81d3846568ef53f7723685f317
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
dbb902d4adffaad1d054e5179552e46d047f7832 13-May-2015 riddle_hsu <riddle_hsu@htc.com> Also restart provider if there is external handle.

e.g. ContentResolver.getType will call
ActivityManagerService.getProviderMimeType
that will not have connection but increase
externalProcessNoHandleCount.

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

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

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

Also more locktask debugging.

Fixes bug 21031298.

Change-Id: I2494af6f2819ca91bc01abc5decb3d1adc088226
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
9e9e2e73c6ec7bece20268196dc89ad0c8bafad4 08-May-2015 Wojciech Staszkiewicz <staszkiewicz@google.com> Pass charset to XmlPullParser.setInput instead of null

Passing null to XmlPullParser.setInput forces it to do additional
work, which can be easily avoided if we know the charset beforehand.

bug: b/20849543

Change-Id: Iaff97be9df2d0f99d7af8f19f65934439c9658e2
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
827e0facfefd0c0033dcfb1747b4fa6f80f9e0e2 07-May-2015 Jorim Jaggi <jjaggi@google.com> Make sure the app can draw a frame before unlocking

- The mechanism to stop windows drawing while window animator was
animating was somehow flaky. It relied on the fact that the client
would call relayout() whenever the animating state changed. This is
mostly the case, but not for lockscreen animations. Instead, we now
use a push model, where window manager tells the app that the state
has changed.
- In addition, it only stopped drawing if that window was animating,
but then only resumed drawing after all windows have finished
animating. Now, we do this per window, so we only stop drawing for
windows that are currently animating.
- We resume the top activity now at the very beginning of the
unlocking sequence. This gives the app a chance to draw a frame
before the user sees anything. If it's to slow, then we just use the
outdated framebuffer.

Bug: 19964562
Change-Id: Ifef8abd189a3146d854b81b9b948861e4d38c155
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
b83ffee5a40bf00e156152ad85bf8cf6bb96e2f1 12-May-2015 Adam Lesinski <adamlesinski@google.com> Remove UID from kernel cpu accounting when uninstalled

Bug:20182139
Change-Id: I77d41570c6aa0efd927b7beb266ef249ed9abff1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
06af1fac166a83507450b6bbb1f98a8dde68d92e 06-May-2015 Adam Lesinski <adamlesinski@google.com> Parse uid_cputime proc file

Instead of using the ProcessCpuTracker as the source of truth, we
periodically poll the new uid_cputime kernel module for stats
on all UID cpu time.

TODO: Need to tell the kernel when to stop tracking UIDs (aka on package
uninstall).

Change-Id: Id1d251aae23ab53f7acc0aba3bca5118bc2c194a
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f931e3c28422a9169e01b2be62ac17c5159a70d0 12-May-2015 Dianne Hackborn <hackbod@google.com> Merge "Always use REGISTERED_ONLY when appropriate." into mnc-dev
e0d90c8221c20409cc8c906942c41d3db04f45a5 12-May-2015 Dianne Hackborn <hackbod@google.com> Always use REGISTERED_ONLY when appropriate.

Previously we would only check mProcessesReady when going
through the public calls to send broadcasts; now handle it
even if the activity manager is calling its internal
implementation.

Change-Id: I702b4cb85b35a7a051ef05c9875a39f5fa03f0f1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
c7374318a69d4341235bd143b9fdae2cabcea3e9 12-May-2015 Christopher Tate <ctate@google.com> am 7a4cfa58: am 960cb481: am 613626b7: am afd883f8: During early boot, send LOCALE_CHANGED only to registered receivers

* commit '7a4cfa58b1421f95266acc4f6a1683804726a0e0':
During early boot, send LOCALE_CHANGED only to registered receivers
7a4cfa58b1421f95266acc4f6a1683804726a0e0 12-May-2015 Christopher Tate <ctate@google.com> am 960cb481: am 613626b7: am afd883f8: During early boot, send LOCALE_CHANGED only to registered receivers

* commit '960cb4816c082eee52a221052a8e4232f0c0fb14':
During early boot, send LOCALE_CHANGED only to registered receivers
bb9d9278aa6fe3ba3d4c21b03d3e3da4543a974c 12-May-2015 Amith Yamasani <yamasani@google.com> Merge "Idle timebase" into mnc-dev
afd883f8a3ee260a5505f83d628c0b789871c837 12-May-2015 Christopher Tate <ctate@google.com> During early boot, send LOCALE_CHANGED only to registered receivers

Bug 20855725
Bug 19060618

Change-Id: I368660ecc6ee97a0c2a2f627fa1b09288bc92bd1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
06bf824628c118fbd5ad6756913d7fd63a6f4ce5 09-May-2015 Amith Yamasani <yamasani@google.com> Idle timebase

Use screen on time as timebase for idling out apps
that have been inactive.

Store the time when an app was last active as an additional
package state in UsageStats. Compare it to screenOnTime to decide
if it's inactive.

Exclude device idle whitelist from apps that can go inactive.

Bug: 20066058

Change-Id: I709f9f31a9affa7ca6e1ae3e4c5729c5fb221669
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
bcb6c1eb9e762455510645eb47579f7d597d6b78 11-May-2015 Fyodor Kupolov <fkupolov@google.com> Fix errors during user switching

Fix NPE in getHomeActivityForUser. Skip system processes in
killBackgroundUserProcessesWithRecordAudioPermission.

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

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

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

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

Bug: 20346194
Change-Id: Ic942fd565e80d14424230dae612965a8e229c4ef
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f2f37781701407acfc64098370b6db1ee70613a2 09-May-2015 Christopher Tate <ctate@google.com> am e8334254: am 4f35e169: am 4475e7df: am ea2c4033: Mark persistent apps as such when the ProcessRecord is created

* commit 'e83342540b2b7dc7571c12768007697685a6add5':
Mark persistent apps as such when the ProcessRecord is created
b2fa5f3160cfc9b1703c6970649a926370971ea9 09-May-2015 Wale Ogunwale <ogunwale@google.com> Merge "Clean-up component states in AMS when component is disabled" into mnc-dev
e83342540b2b7dc7571c12768007697685a6add5 09-May-2015 Christopher Tate <ctate@google.com> am 4f35e169: am 4475e7df: am ea2c4033: Mark persistent apps as such when the ProcessRecord is created

* commit '4f35e1699a4b62bd71bed27fece85e2c026210d1':
Mark persistent apps as such when the ProcessRecord is created
540e123b14ef71f0bfda325e11773c1c510fb8ba 02-May-2015 Wale Ogunwale <ogunwale@google.com> Clean-up component states in AMS when component is disabled

Bug: 15804187
Change-Id: I2b5856c5a0a012f34698fb64f8596d32924bbd1f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
ea2c403311f741f5a0a9688847cfd17041c81c0d 08-May-2015 Christopher Tate <ctate@google.com> Mark persistent apps as such when the ProcessRecord is created

...rather than only during the OS's "time to start the persistent apps"
boot phase. This closes a window of opportunity during which a
persistent app container may be live without having been properly
noted as such, because it wound up being launched prior to the
[rather late] boot phase at which the persistent apps are directly
enumerated and bookkeeping for them established.

Bug 20855725

Change-Id: I41822b412de4540dbdeab300b38089303678f76c
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
c14b9cf628471f4f3b34d7c91ef193326eff92c6 13-Mar-2015 Richard Uhler <ruhler@google.com> Add 'App Summary' section to meminfo.

The 'App Summary' section is shown by default when other memory
details are shown. This adds a new meminfo flag '-s' to show only the
App Summary section.

Change-Id: I66913673cd3afca873a8b13e45abe071d4c57b82
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
e02b7868c6c8f856a21f36569a77dab7f1cc7c78 05-May-2015 Kenny Guy <kennyguy@google.com> Merge "Call profile changed in cases were focused activity is nulled." into mnc-dev
019d2304998f3ed77c0a608df6cf4bea1138f8dc 04-May-2015 Svet Ganov <svetoslavganov@google.com> Permission UI - legacy apps support

Change-Id: Id3f98c138422d33868363d587dd196898b42a0d4
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
b9d71a6f89b1183f6389b1774652445a420c6cbf 30-Apr-2015 Svet Ganov <svetoslavganov@google.com> Add body sensors app op - framework base

Change-Id: Idd5cd573fab3405e5b2a6e51d2d9d115650826e9
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4c5067ea8e33974c81fb69f3565dd93634bea132 30-Apr-2015 Kenny Guy <kennyguy@google.com> Call profile changed in cases were focused activity is nulled.

Fix case where profile changed listener isn't called as
focused acitivity is set to null due to app crash.

Bug: 20254760
Change-Id: Ifc296682b9f7cb85c05137e8ad6ad74d31bf6eff
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
fcda22b1fe33370922a53d6562aa15366818bd45 30-Apr-2015 Andreas Gampe <agampe@google.com> Merge "am b6d14a00: resolved conflicts for merge of c29791d5 to mnc-dev-plus-aosp" into mnc-dev
e31b820dad4c5f2b19ee10479a675a139ad3c61e 30-Apr-2015 Jeff Sharkey <jsharkey@android.com> New "frozen" state during app move/upgrade.

This replaces mOperationPending, which was in an odd place. It adds
a new PackageSetting.frozen flag that is a last-ditch effort to
prevent ActivityManager from starting an app while it's being moved
or upgraded.

Also provides clearer guarding around all upgrades by freezing,
killing, upgrading, then unfreezing.

Bug: 20275579
Change-Id: I28bb0359a6f4e05080fb336b18dd2a249509d989
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f7b795ca1a552909d333ed3f2d5ec881a8b23144 30-Apr-2015 Dianne Hackborn <hackbod@google.com> Merge "Update use of procstate for services." into mnc-dev
d69e4c1460017062e7c36be55801cb434ad19d97 24-Apr-2015 Dianne Hackborn <hackbod@google.com> Update use of procstate for services.

Now that we have a separate foreground service proc state
(above a sleeping top app), update various system services
to put their bindings into this state when appropriate.

There are two new bind flags for this -- one that just always
makes it a foreground service, another that only does it when
the device is awake (useful for things like the wallpaper).

And with all of that, tweak network policy manager to only
include apps that are at least foreground service state when
in power save and device idle modes. This will allow us to
further reduce the set of apps that have network access
(in particular not giving access to the current top app when
the screen is off), hopefully leading to even better battery
life.

Change-Id: I91d85a5c5ed64e856149e9a5d94a634a7925ec7f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
00758a3b370879ac1f21fc85c291f741f947eca3 29-Apr-2015 Wale Ogunwale <ogunwale@google.com> Merge "Some code clean-up." into mnc-dev
c14624da8e6155fccbe3c0e9a3623ed5385224ff 29-Apr-2015 Wale Ogunwale <ogunwale@google.com> Some code clean-up.

Change-Id: I626c4c40c32dbf43408e0649364dfe8be2bb2321
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
fa5ecdc4ac6d7a8db2bb9e4a6a60a3189025df30 28-Apr-2015 Svet Ganov <svetoslavganov@google.com> Respect the record audio app op - framework

Change-Id: I5696d2ef22738ccffaf8bd7a0ee68cbc3dea3bf1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
27c39f1adeaf1a653fb41a5af64ee815b8048dd6 27-Apr-2015 Andreas Gampe <agampe@google.com> am b6d14a00: resolved conflicts for merge of c29791d5 to mnc-dev-plus-aosp

* commit 'b6d14a009e43a4d61ae2a4f98f6e3b914148d0a9':
Frameworks/base: Add debug.gencfi property

(cherry picked from commit a5b55a017a984608eacdf414bc1cbcd7615f1c13)
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
13c58bacc8f1ff35bb24ba19069bab8a41aabf68 20-Apr-2015 Julia Reynolds <juliacr@google.com> Allow device initializers to set a preferred setup activity.

This activity will launch by default on device reboot or user switch
during user initialization, even if there are higher priority 'home'
activities.

Bug: 20223050
Change-Id: I335aeb010a1ae5db07a4343d26e160c74bd299e1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a298a96af77f0cb638b4e2be2ab762d0183ee813 24-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 3846d3a4: am 6d856bfb: am cf7d2d95: Merge "[ActivityManager] Avoid orphan ContentProviderRecord."

* commit '3846d3a4c5d79a9d7e86e43c64a5c21a29036de0':
[ActivityManager] Avoid orphan ContentProviderRecord.
6d856bfba5b6ae488d49c4909510cd87000cd922 24-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am cf7d2d95: Merge "[ActivityManager] Avoid orphan ContentProviderRecord."

* commit 'cf7d2d95adb358a628c2622b43a999d3ab784406':
[ActivityManager] Avoid orphan ContentProviderRecord.
cf7d2d95adb358a628c2622b43a999d3ab784406 24-Apr-2015 Olawale Ogunwale <ogunwale@google.com> Merge "[ActivityManager] Avoid orphan ContentProviderRecord."
015c5e57b58d26ae53849c02d3aebfcd52d85c3d 23-Apr-2015 Craig Mautner <cmautner@google.com> Disallow data clearing of DeviceOwner.

There are OEM provided apps that are able to clear the data of the
device owner. That creates a security hole that this fixes.

Fixes bug 20107015.

Change-Id: I4ef313b394bd8059d19d20aa6533396305d1357d
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
81786701b61f8295c8f7c9c1861642233910b056 22-Apr-2015 Craig Mautner <cmautner@google.com> Merge "Add API for putting up locktask pinning toast."
d080ef216e9a12339382cea94f07ea20ea217786 22-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 8ac2478b: am f7be8b67: am fa147b5c: Merge "[ActivityManager] Move UI operation to UI handler"

* commit '8ac2478b97ccb3f5e94b4df50c935c8f5cdff99c':
[ActivityManager] Move UI operation to UI handler
bfb8c0bdc2c3f2ba3132ec811b36eea1df90a6c6 22-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 9e6c83ab: am acaa886c: am 0408187e: Merge "[ActivityManager] Avoid unnecessary restart provider process"

* commit '9e6c83abaf59574ed5c1e9934560ea50abe296be':
[ActivityManager] Avoid unnecessary restart provider process
a93311f91730be33c734689c6dfbbcf7fd12d6d7 21-Apr-2015 Jeff Brown <jeffbrown@google.com> Merge "Make activity manager sleep top activity when dreaming."
c21ae9ed221912b61306e075d3f22726ac04013c 15-Apr-2015 Craig Mautner <cmautner@google.com> Add API for putting up locktask pinning toast.

Fixes bug 18993662.

Change-Id: Ic1753285044857f8ea897784485fd1a9580acf25
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f7be8b6739f174919ad01dcd32788b1b67c6820a 21-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am fa147b5c: Merge "[ActivityManager] Move UI operation to UI handler"

* commit 'fa147b5caf7b44f76aee515afecda639fbc52c22':
[ActivityManager] Move UI operation to UI handler
acaa886ce765c58c1e71b440b623a16ae419f5da 21-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 0408187e: Merge "[ActivityManager] Avoid unnecessary restart provider process"

* commit '0408187e7d2e7bdb6d0cb0521f49859a3d9a7396':
[ActivityManager] Avoid unnecessary restart provider process
758f714ca8638cf44041d9e1e6442093e73fd664 15-Apr-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Move UI operation to UI handler

Because ANR will dump cpu usage, stack traces in ActivityManager
thread, if system is busy or in low-end device, it may spend more
than 5s to dump. So when there is UI operation (e.g. pop dialog)
in ActivityManager thread, it may meet key dispatch timeout.

Change-Id: Ie550e31a7cff65bdcfc9af2c32989e9deb5fb2cf
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
061ea99546fbba1da86094518992cf6b7a125278 18-Apr-2015 Jeff Brown <jeffbrown@google.com> Make activity manager sleep top activity when dreaming.

Added the concept of a sleep token to represent a demand to sleep.
We grab this token whenever a dream window is visible.

This change also deletes a special condition in shouldSleepLocked()
which would tend to keep activities running when the lock screen
was shown unless they had previously been sleeping. I believe this
condition is no longer necessary and the policy is much simpler
without it. Let's see if anything breaks.

NOTE: This can currently only be used within the system server process
but it might make sense to move it to IActivityManager (guarded by
DEVICE_POWER permission) so that keyguard can use it. If we added
a callback on release to inform the client that the underlying activity
has finished drawing then we could untangle a bunch of keyguard
specific logic.

Bug: 18866521
Change-Id: I84b2118f5b990a71a1647d1cee536ad3d99f3a24
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6035e0198ba510654b5d1f6b6a265a15b08576f8 15-Apr-2015 Wale Ogunwale <ogunwale@google.com> Return more information when getAppTasks#getTaskInfo is called.

The RecentTaskInfo object returned when getAppTasks#getTaskInfo
is called now contains baseActivity, topActivity, and numActivities.

Bug: 18723935
Change-Id: Ifc0cd68a57ed2c0823c23ac8d27e3b6ea6bc95e2
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
239d17c05a2694d4c415cb48adeb39e4e3dd386d 16-Apr-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Avoid unnecessary restart provider process

Caller C accesses provider P. Both processes of C and P died
before P publishes, P will still be restarted even there is
no connection because P is in mLaunchingProviders.
When device is low memory, the restarting provider process
may be killed easily before publish because no caller to raise
its oom-adj. Then device will busy keeping restart it.

Solution:
If there is no connection to the provider, do not restart it.

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

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

For bug 19995702

Change-Id: I514a144a3a0ff7dbdd4987da5361b94bdfe9a437
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
517daeccb29ce42b1ec4b366e7807088cad3f5ed 15-Apr-2015 Wale Ogunwale <ogunwale@google.com> Moved SystemServer binder thread monitor from AMS to Monitor class.

Since to it applies to more than just the ActivityManagerService.

Bug: 19297165
Change-Id: I3affd50aaf8a49589ca48b845d6d31e4a44efb8f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d7fdd0228e6abdbc079f9cf08b780e4222dfe7c5 14-Apr-2015 Wale Ogunwale <ogunwale@google.com> Added watchdog monitor for Binder threads availability.

The watchdog will trigger if all binder threads in the system_server
are stuck for a long time (1min) preventing the process from
handling additional IPC requests.

Bug: 19297165
Change-Id: I5909a9c230bf23917feaed53f2b54bd50425bf3c
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1e38382b542f5cef9957a89692b02c55a3dd351c 10-Apr-2015 Dianne Hackborn <hackbod@google.com> Fixes to idle alarm scheduling, package importance.

- Add new API to ask the activity manager what the current
importance of a particular package name is (along with a few
new useful importance levels).

- Fix my last alarm manager change to actually execute the
alarms we have now decided should run even while we are idle.

Change-Id: I1f14712b4e390770d53b185c96a1b36f6aadd687
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
e13b15c8101471c2aae1fbdcd55da9b2d7bbf7b1 13-Apr-2015 Kenny Guy <kennyguy@google.com> Merge "Add foreground profile changed to user switch observer."
429796226a8831af63a6303a58329f6b68f7b100 13-Apr-2015 Kenny Guy <kennyguy@google.com> Add foreground profile changed to user switch observer.

Called when the focused activity changes from one profile
to another to allow sys ui to vary display based on the
current profile.
This reverts commit 735a3f90598be31bca5d551d781280a205a5f27f.
Resubmitting with fix for build break in another package.

Bug: 19531782
Change-Id: I98cd2968ade3b1d23feb90d98057f306695d569e
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
48a09a0678752eca242a5379b024da78eb36144f 13-Apr-2015 Kenny Guy <kennyguy@google.com> Merge "Revert "Add foreground profile changed to user switch observer.""
735a3f90598be31bca5d551d781280a205a5f27f 13-Apr-2015 Kenny Guy <kennyguy@google.com> Revert "Add foreground profile changed to user switch observer."

This reverts commit 99b9030a3ececd9b88e5011c98be0a5b9499c776.

Change-Id: If152904f298ecd9e6fd5d038797d061a5c85eec8
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d10bd4852291f1c99d2fc011606a695d631504fe 13-Apr-2015 Kenny Guy <kennyguy@google.com> Merge "Add foreground profile changed to user switch observer."
6036cd51265d31c08eefe0470a9f37e7f757aae8 11-Apr-2015 Jeff Sharkey <jsharkey@android.com> Merge "Support moving apps to expanded storage."
5033c1ef5b097a752593156de3dcf5400e6e2508 10-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 448cb9f9: am 6159f6eb: am 4406568e: Merge "Check caller status precisely when registering receiver."

* commit '448cb9f9ee8c6bd0a53662362f4a71a1fa4bbd5b':
Check caller status precisely when registering receiver.
6159f6eb231028bc6420edf4157fb335e78aca00 10-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 4406568e: Merge "Check caller status precisely when registering receiver."

* commit '4406568ebac6f6bbf627aeb6909b409d948cecf4':
Check caller status precisely when registering receiver.
4406568ebac6f6bbf627aeb6909b409d948cecf4 10-Apr-2015 Olawale Ogunwale <ogunwale@google.com> Merge "Check caller status precisely when registering receiver."
b15506f95e7b00d9a5b89a0c732689fcad2a12ff 04-Feb-2015 riddle_hsu <riddle_hsu@htc.com> Check caller status precisely when registering receiver.

Fine tune commit 9ac9609f.
Because process may reuse same process record to restart.
It is better to check below conditions to skip:
1. Simple dead and has been cleaned.
=> .thread will be null
2.The process has restarted with new pid but has not attached yet.
=> .thread will be null
3.The process has restarted and attached.
=> The IBinder will be different

Change-Id: Ic052f5025558ca93e1a6ab11bca61fe995126bb9
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
99b9030a3ececd9b88e5011c98be0a5b9499c776 01-Apr-2015 Kenny Guy <kennyguy@google.com> Add foreground profile changed to user switch observer.

Called when the focused activity changes from one profile
to another to allow sys ui to vary display based on the
current profile.

Bug: 19531782
Change-Id: I1f98398f4b37ce77077394546906ef4dff06cd47
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
b9f3674c11ed9c89b80a69f728cbc5f540b2ecde 09-Apr-2015 Jeff Sharkey <jsharkey@android.com> Support moving apps to expanded storage.

Start deriving the data path for apps based on the volume UUID where
the app lives. This path is used for all higher-level APIs, giving
us a clean place to switch app storage.

When parsing a package, keep track of the volume UUID where it lives
and update PackageSetting once installed. For now continue treating
moves as installs, but we'll eventually clean this up to avoid the
additional dexopt pass. Wire up move to use the new installd command
to move private data between devices.

Cache LoadedApk only for the current user, since otherwise the data
dir points at the wrong path.

Bug: 19993667
Change-Id: I53336e3b147d5fd3130e6800869af172b628da37
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
56a6d371bd4978bb7dfa7cce8bfbcc0bb13abd93 10-Apr-2015 Mathieu Chartier <mathieuc@google.com> am da164973: Merge "Add dalvik subitems for -d in dumpsys meminfo "Total PSS by category""

* commit 'da164973f35aa32e44d0b9336deef28df5b13544':
Add dalvik subitems for -d in dumpsys meminfo "Total PSS by category"
537691fc2dc880d4b469fab82a4d209f6f67de69 09-Apr-2015 Mathieu Chartier <mathieuc@google.com> Add dalvik subitems for -d in dumpsys meminfo "Total PSS by category"

Example output of "adb shell dumpsys meminfo -d":

Total PSS by category:
193605 kB: Dalvik
87561 kB: .Heap
77863 kB: .LOS
15333 kB: .Zygote
12848 kB: .NonMoving
6770 kB: .GC
2597 kB: .LinearAlloc
1180 kB: .JITCache
1180 kB: .IndirectRef
103936 kB: EGL mtrack
101827 kB: Native

Bug: 17643507

(cherry picked from commit 546edc5a31bb5a843048e11d8afb0b1f6441ddb4)

Change-Id: If34627cf93ba5305b428d2278f350a2649d63d5e
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
b47ba1e7d578338f193a0ca7ec089b6ce382f47e 10-Apr-2015 Mathieu Chartier <mathieuc@google.com> Merge "Add dalvik subitems for -d in dumpsys meminfo "Total PSS by category""
546edc5a31bb5a843048e11d8afb0b1f6441ddb4 09-Apr-2015 Mathieu Chartier <mathieuc@google.com> Add dalvik subitems for -d in dumpsys meminfo "Total PSS by category"

Example output of "adb shell dumpsys meminfo -d":

Total PSS by category:
193605 kB: Dalvik
87561 kB: .Heap
77863 kB: .LOS
15333 kB: .Zygote
12848 kB: .NonMoving
6770 kB: .GC
2597 kB: .LinearAlloc
1180 kB: .JITCache
1180 kB: .IndirectRef
103936 kB: EGL mtrack
101827 kB: Native

Bug: 17643507
Change-Id: Idd3e5560f376157c32094a5fbb84e8b6be4b2843
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4870e9d5eba59fb257a87f97f1adf0b734cf48d3 09-Apr-2015 Dianne Hackborn <hackbod@google.com> More work on device idle mode and other power stuff.

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

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

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

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

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

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

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

Also some other small cleanup here and there.

Change-Id: I7a9808b578bad6f50deb8e1baf919298512a0d3a
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
49208d0b9125f78883ad92fc8d4bdc929bdb9403 09-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Replaced zeros with UserHandle.USER_OWNER"
8b0c61d37818656bcb52fc2d1847b1cc61ec0200 08-Apr-2015 Nick Kralevich <nnk@google.com> heapdump: use appendable file descriptor

For heapdump functionality, there's no need to give apps
readable/writable file descriptors. An append-only file descriptor
is sufficient.

Bug: 20073185
Change-Id: Ib2c42a72b2704db5f1b919c24e33609f7a45e57a
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
30b89849032eb57d1da93de40a6a9bd2a5f55a2e 07-Apr-2015 Craig Mautner <cmautner@google.com> Merge "No longer unlock activity manager to test whitelist"
e56007786ace2fe0615197d95317ccd7be4d1ca6 04-Apr-2015 Craig Mautner <cmautner@google.com> No longer unlock activity manager to test whitelist

In order to check the DevicePolicyManagerService locktask whitelist
the activity manager had to release its lock preserving internal
state. That is undesirable and not scalable now that we need to check
the whitelist at startup for bug 19995702.

This change causes DPMS to update activity manager with the whitelist
whenever it changes so that activity manager can check the whitelist
without releasing the acitivty manager lock.

Change-Id: I3ed6eb5ceae2cd7e7ae3280abd708d5ce43a2851
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
9d1878674c86ab651926e192845d459bfafb6898 07-Apr-2015 Narayan Kamath <narayan@google.com> Merge "Don't set userSetLocale from Configuration.setLocale."
33c375ff9268fda513bebc67ec3e01dcdc56837e 07-Apr-2015 Wale Ogunwale <ogunwale@google.com> Merge "Lockdown AM.getRunningAppProcesses API with permission.REAL_GET_TASKS"
9dbaa54f6834e013a63f18bd51ace554de811d80 07-Apr-2015 Wale Ogunwale <ogunwale@google.com> Lockdown AM.getRunningAppProcesses API with permission.REAL_GET_TASKS

* Applications must now have ...permission.REAL_GET_TASKS to
be able to get process information for all applications.
* Only the process information for the calling application will be
returned if the app doesn't have the permission.
* Privilages apps will temporarily be able to get process information
for all applications if they don't have the new permission, but have
deprecated ...permission.GET_TASKS.

Bug: 20034603
Change-Id: I67ae9491f65d2280adb6a81593693d499714a216
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
516460819541e483321ef9156e4093d19f123ecc 06-Apr-2015 Dianne Hackborn <hackbod@google.com> Merge "Various fixes and improvements..."
12b4a4a7ecb3f24f9bc3f3a763b4c8be4ca45b27 06-Apr-2015 Wale Ogunwale <ogunwale@google.com> resolved conflicts for merge of 60df172f to master

Change-Id: I15f90e041399d2133c041b0449e6d6a95d36595a
adedb407c5cedaba123ea5f44f3d68fd98e8ee55 06-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 655ef081: Merge "[ActivityManager] Examine bad process before clean up application record"

* commit '655ef08144ec0b71a98b6b3a38e50c6b346ae467':
[ActivityManager] Examine bad process before clean up application record
655ef08144ec0b71a98b6b3a38e50c6b346ae467 06-Apr-2015 Olawale Ogunwale <ogunwale@google.com> Merge "[ActivityManager] Examine bad process before clean up application record"
d59a5d59df920d743723521a2afed9de1da3373b 04-Apr-2015 Dianne Hackborn <hackbod@google.com> Various fixes and improvements...

Issue #19912529: VI: VoiceInteractor callback ClassCastException

Fix to use correct argument.

Issue #19912636: VI: Documentation for VoiceInteractionSession.onBackPressed

Added documentation.

Issue #19912703: VI: VoiceInteractionSession NPE on Abort Request

Maybe fix this -- don't crash if there is no active session.

Issue #19953731: VI: Add value index to...
...android.app.VoiceInteractor.PickOptionRequest.Option

There is now an optional index integer that can be associated with
every Option object.

Issue #19912635: VI: Behavior of startActivity when in voice...
...interaction is unexpected

We now forcibly finish the current voice interaction task whenever
another activity takes focus from it.

Issue #20066569: Add API to request heap dumps

New ActivityManager API to set the pss limit to generate heap
dumps.

Also added app ops for assist receiving structure and screenshot
data, so that we can track when it does these things.

Change-Id: I688d4ff8f0bd0b8b9e3390a32375b4bb7875c1a1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
b0ff32245cb6b51e43dd3ee40b86d683c62de2b9 04-Mar-2015 Amith Yamasani <yamasani@google.com> Throttle jobs for idle apps

First pass at delaying jobs from apps that are idle.

TODO: Throttle syncs
TODO: Provide a periodic point at which apps are checked for idleness.

Apps that switch to foreground process state are tracked by UsageStats
as an INTERACTION event that affects the last-used timestamp.

JobScheduler's logic for when an app is ready is trumped by the idleness
of the app, and only if the battery is not charging. When charging state
changes, we update the idle state of all the tracked jobs.

android package is whitelisted.

Bug: 20066058
Change-Id: I0a0acb517b100a5c7b11e3f435f4141375f3451f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
70392818f07f175d4914cef13b12c215ff08f1df 23-Mar-2015 Narayan Kamath <narayan@google.com> Don't set userSetLocale from Configuration.setLocale.

This seems to have been a mistake : userSetLocale controls whether
a locale is persisted and as written it's too easy to make system wide
locale changes without intending to. Third party apps do not have
sufficient permissions to set global locales anyway, so they won't care
whether it's set or not.

Also, set userSetLocale = true in the LocalePicker.updateLocale internal
API, which is what all platform apps use to set the locale.

In addition, this commit fixes a bug where we were not setting RTL
directionality for the default locale loaded by the activity manager
service.

Change-Id: I2e11ad31e012dfa314ab8d78034f986b49ecae60
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
bcfe87f3e05ac65d7ecb7156cd0de580586df5e9 02-Apr-2015 Wale Ogunwale <ogunwale@google.com> resolved conflicts for merge of 65073b91 to master

Change-Id: I65a9d95caa98ec33e41480546b4447ec787c6840
9987b6e867d862c27cd1339d7fa8135b75d565f1 02-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am e4d4e22f: Merge "[ActivityManager] Avoid improper resume top activity."

* commit 'e4d4e22f26bfd36a553fb24232d2fd4ddf4fc907':
[ActivityManager] Avoid improper resume top activity.
558e849a7772cda924ac0617708c439ed05c17ed 02-Apr-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Avoid improper resume top activity.

When there is a process died, only resume top if
it contains visible activity.

This can fix case 1 in
https://android-review.googlesource.com/#/c/120901/

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

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

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

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

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

A NullPointerException for lock task toasts has also been fixed.

Fixes bug 19995702.

Change-Id: Iba6976b1a0cc5a22eb526db66d2e9af66445541f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
29382d29618f9f51fe8cde77d2dfd8e0b6e1071d 31-Mar-2015 Wale Ogunwale <ogunwale@google.com> resolved conflicts for merge of 6abcec1d to master

Change-Id: I28986f8863298a767a8290b02d5418d4d1d42d17
df736de8d8165b1aff675d00581ccdf94a7547aa 31-Mar-2015 Olawale Ogunwale <ogunwale@google.com> am d052a3d3: Merge "[ActivityManager] Fix index out of bounds when updating next pss time."

* commit 'd052a3d37beffff3735716340745ec7c83efc23d':
[ActivityManager] Fix index out of bounds when updating next pss time.
5064fddf81e477a90c81d72f7328aa5887c67511 31-Mar-2015 louis_chang <louis_chang@htc.com> [ActivityManager] Examine bad process before clean up application
record

Symptom:
Unable to launch activity

Root cause:
There are some cases that would start process while pid
assigned or already running. So the previous application
record will be clean up via handleAppDiedLocked(), but it
won't be removed from ActivityManager.mProcessNames since
the process is supposed to be restart later.

However, if the process is started from a background
operation and has named as a bad process, it silently fail
the launch. Then, the process won't ever be request to
start afterward. The process status is app.pid > 0 and
app.thread is null.

The application components are unable to launch since then.

Solution:
Examine bad process before clean up application record

Change-Id: I53dc06e49254094abc06e460c8b8b33f36803601
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6793fc328ab4532202d86f64fe4fdbc3fb047bc4 31-Mar-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Fix index out of bounds when updating next pss time.

Symptom:
System server crash.

Root Cause:
The value curProcState for array index is -1 if the process
has not attached yet.

Solution:
Skip computing for process which is not attached or curProcState
is nonexistent state.

Change-Id: I71aaf45bb78d73097ebe9dfebf76b72f2d243232
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4887789e44cdb16b042a35e8ec03983213e88ac6 18-Mar-2015 Jeff Sharkey <jsharkey@android.com> Progress towards dynamic storage support.

Storage devices are no longer hard-coded, and instead bubble up from
whatever Disk and VolumeBase that vold uncovered, turning into
sibling Java objects in MountService. We now treat vold events as
the source-of-truth for state, and synchronize our state by asking
vold to "reset" whenever we reconnect.

We've now moved to a model where all storage devices are mounted in
the root mount namespace (user boundaries protected with GIDs), so
we no longer need app-to-vold path translation. This also means that
zygote only needs to bind mount the user-specific /mnt/user/n/ path
onto /storage/self/ to make legacy paths like /sdcard work. This
grealy simplifies a lot of system code.

Many parts of the platform depend on a primary storage device always
being present, so we hack together a stub StorageVolume when vold
doesn't have a volume ready yet.

StorageVolume isn't really a volume anymore; it's the user-specific
view onto a volume, so MountService now filters and builds them
based on the calling user. StorageVolume is now immutable, making
it easier to reason about.

Environment now builds all of its paths dynamically based on active
volumes. Adds utility methods to turn int types and flags into
user-readable strings for debugging purposes.

Remove UMS sharing support for now, since no current devices support
it; MTP is the recommended solution going forward because it offers
better multi-user support.

Simplify unmount logic, since vold will now gladly trigger EJECTING
broadcast and kill stubborn processes.

Bug: 19993667
Change-Id: I9842280e61974c91bae15d764e386969aedcd338
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4a7e775100b1eeab5a1f5ec56946642af6044ce1 31-Mar-2015 Fyodor Kupolov <fkupolov@google.com> Replaced zeros with UserHandle.USER_OWNER

Non-functional change. Where applicable, replaced zeros with UserHandle
.USER_OWNER.

Change-Id: I2274166c88cd7109cd6d2650c40b34b35758bdcf
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5670d9a2503557ca583eddcab1702800b5016cd9 31-Mar-2015 Olawale Ogunwale <ogunwale@google.com> am 4af5bd7c: Merge "Add ProcessInfoService to activity manager."

* commit '4af5bd7cdaccdba6001a384a81c258f542e74075':
Add ProcessInfoService to activity manager.
e1e1969c96db98545033456111c0da6ff8a0699f 29-Jan-2015 Ruben Brunk <rubenbrunk@google.com> Add ProcessInfoService to activity manager.

- Adds a new AIDL interface for querying process
information from activity manager.

Bug: 19186859
Change-Id: Ic08858f346d6b66e7bfc9da6faa2c6e38d9b2e82
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
4b6bd8d36b093d36d9ae80b43e95049c259d7319 19-Mar-2015 Adam Lesinski <adamlesinski@google.com> Retrieve WiFi info outside of BatteryStatsImpl

In order to not deadlock the system, we need to retrieve
WiFi energy info outside of the BatteryStats lock. We do this,
then pass that data down to BatteryStatsImpl to process.

b/19729960

Change-Id: Ib8beba1d5ac81d89144d502c4b688d0a88c5b102
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1e725a7ec9eb79bb447d5171839c453d672a895c 25-Mar-2015 Dianne Hackborn <hackbod@google.com> Battery stats: wakeup alarm tracking, general cleanup.

Instead of just tracking the total number of wakeup alarms
per package, track a count for each tag. Note this is only
wakeup alarms, not non-wakeup alarms.

Also tighten up the code a bit by exposing the actual ArrayMap
container through most of the BatteryStats API, so we can more
efficiently iterate over them (which is all we ever want to do
with those containers at that point).

Finally remove all printing of "since unplugged" stats, as
another step towards completely removing that tracking. If
nobody screams, hopefully soon we can go through and just get
rid of all the extra state we are carrying around that is
tracking that data.

Also note that currently the per-tag wakeup alarm data is
being reported in the human-readable stats, but in the checkin
data it is still being rolled up into a single number. To fix
this, I need to completely rework the pkg entry line to have
separate data for services and wakeup alarms (so have three
types -- pkg for the start of a package, wal for a wakeup
alarm, svc for a service).

Change-Id: I8033acca8742935cfe95511cdea730a405b17cab
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
7ebb072ade764507a2a305570feaa4429eed233e 24-Mar-2015 Jeff Sharkey <jsharkey@android.com> Merge "Start apps with per-user GIDs."
51f8f00633221e25c47d18eca01d1a5bb180f5b2 24-Mar-2015 Jeff Sharkey <jsharkey@android.com> Start apps with per-user GIDs.

Bug: 19905213
Change-Id: I053b34f6b80540d4d696e6142d26dd7610bf84e1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
0dbc50acae101e5ec75db32cc4eb220594c60d6b 24-Mar-2015 Olawale Ogunwale <ogunwale@google.com> am 04466d92: am bfd7a123: am f5f70b66: Merge "[ActivityManager] Avoid killing unrelated processes."

* commit '04466d92db4b4a511141d272db045864950b4d7d':
[ActivityManager] Avoid killing unrelated processes.
bfd7a1233411c60692797f9824695b90663061bf 24-Mar-2015 Olawale Ogunwale <ogunwale@google.com> am f5f70b66: Merge "[ActivityManager] Avoid killing unrelated processes."

* commit 'f5f70b66a3f22ca5e23a4d1e6061f2a36dfb4c92':
[ActivityManager] Avoid killing unrelated processes.
f5f70b66a3f22ca5e23a4d1e6061f2a36dfb4c92 24-Mar-2015 Olawale Ogunwale <ogunwale@google.com> Merge "[ActivityManager] Avoid killing unrelated processes."
c6d1c345f41cf817bf2c07c97b97107d94296064 26-Feb-2015 Svetoslav <svetoslavganov@google.com> Runtime permissions: per user permission tracking.

Before all permissions were granted at install time at once, so the user
was persented with an all or nothing choice. In the new runtime permissions
model all dangarous permissions (nomal are always granted and signature
one are granted if signatures match) are not granted at install time and
the app can request them as necessary at runtime.

Before, all granted permission to an app were identical for all users as
granting is performed at install time. However, the new runtime model
allows the same app running under two different users to have different
runtime permission grants. This change refactors the permissions book
keeping in the package manager to enable per user permission tracking.

The change also adds the app facing APIs for requesting runtime permissions.

Change-Id: Icbf2fc2ced15c42ca206c335996206bd1a4a4be5
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
efadd572b93eee88e4b63feb6b2cc0741d900c76 20-Mar-2015 Craig Mautner <cmautner@google.com> Merge "Fix bad nesting count when remote calls fail."
79ec42e6a3c6a6f6a00ef3ad92221a5ad2149aa9 20-Mar-2015 Dianne Hackborn <hackbod@google.com> Merge "First stab at device idle mode."
8ad2af7e5b28f71e7bdfc1bb097937c6c1d22b18 18-Mar-2015 Dianne Hackborn <hackbod@google.com> First stab at device idle mode.

Introduce a new device idle controller service that
monitor's the device state and determines when to go
in to idle mode. When in idle mode, all we do right
now is turn off network access the same as we do for
power save mode. Many more things should come in the
future -- stopping the alarm manager from scheduling
(most) alarms, telling GmsCore for it to stop doing
stuff, etc.

Battery stats now has state tracking for devie idle
mode, as well as events for the reasons we can come
out of idle mode (significant motion or the device
becoming active). Also added new events noting when
packages are installed.

Renamed the "low power" event in battery stats to
"power save" because the former was just way too
confusing.

Finally, fix buffer size reading kernel wake locks.
(Stupidly, just increasing the buffer size. Ideally
we should try to be smarter and grow our buffer to
fit the data available, but I'll leave that for
another time.)

Change-Id: I0be2062466c83ee9d890c6cf5a228d9cc4090eca
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
eef3bcbbe4783a24fb65127390436ae55dd17aae 19-Mar-2015 Alan Viverette <alanv@google.com> Merge "Replace usages of deprecated Resources.getColor() and getColorStateList()"
4a357cd2e55293402d7172766f7f9419815fc1e8 19-Mar-2015 Alan Viverette <alanv@google.com> Replace usages of deprecated Resources.getColor() and getColorStateList()

Change-Id: I8f64fe6c4c44a92ff6d07250223ba590a1d691b0
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
75f1ba5a815ce13caff1faa8e0df7d4ac483507a 19-Mar-2015 Mathieu Chartier <mathieuc@google.com> am f792e016: am 437ac8f8: Merge "Add JIT late override property"

* commit 'f792e01606b988ab84190217529cca53da8db3f5':
Add JIT late override property
f792e01606b988ab84190217529cca53da8db3f5 19-Mar-2015 Mathieu Chartier <mathieuc@google.com> am 437ac8f8: Merge "Add JIT late override property"

* commit '437ac8f8445b078041171eff56ce7ffbd1cf6766':
Add JIT late override property
7a49028aa2f25364042fae031d95f9283844e645 17-Mar-2015 Mathieu Chartier <mathieuc@google.com> Add JIT late override property

Required for JIT debug property since user builds can't restart
the shell.

Bug: 19735273

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

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

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

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

This fix propagates TransactionTooLargeExceptions back to the calling
methods.

Fixes bug 19698308.

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

Change-Id: I02154b0e1c2c64af840848fd6def054342922efa
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
fd5767fa37485952b7291ea701cc84c38c2621fc 17-Mar-2015 Wale Ogunwale <ogunwale@google.com> Merge "Remove duplicate move of home stack that can cause animation jank."
2541306ad56112fad1453566561038c35ae2448a 17-Mar-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Avoid killing unrelated processes.

Kernel will reuse process id, when wrap-around happens,
there may be just after a pid is freed, a new thread/process
uses the pid immediately.

For examples, there may be a process with pid 1234 killed
by lowmemorykiller or itself (app.killed=false).
Before the death recipient enters AMS, a new thread/process
is started with pid 1234, then when appDiedLocked executes,
this new pid 1234 will be killed again.

It is especially easy happens to zygote:
During zygote starting process, it will stop 5 daemons threads.
And restart the 5 threads after fork is called, so it has
larger pid range to hit the resue case.
https://code.google.com/p/android/issues/detail?id=160661

Solution:
If the dead event is from binder, it is not necessary
to call killProcessQuiet again, because it should really
be dead.
Keep no checking for killProcessGroup because zygote does
not have record under /acct/, and also the parameter uid
has restriction that will not kill another application
which reuses the pid.

Change-Id: Iec4a4884ae641c4d036f4d024ce463f7a351a17b
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
3d07c94c393831091958fe6a98811843db8973bd 14-Mar-2015 Dianne Hackborn <hackbod@google.com> Add new voice request for picking from a list.

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

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

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

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

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

Bug: 19692494
Change-Id: Ib4c999c6dfa1af3fda0fced52b58da614b154d00
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
484bc6e5a79af1b7b0a2eb682802006522b274fd 13-Mar-2015 Dianne Hackborn <hackbod@google.com> Merge "More work on collecting assist data."
a83ce1dd2ad3a6b71e90ff4845afc1299fe17b9d 11-Mar-2015 Dianne Hackborn <hackbod@google.com> More work on collecting assist data.

Optimize parceling of AssistData (which is now renamed to
AssistStructure) by pooling duplicated class name strings.

Change text associated with a view node to a CharSequence,
so styling information comes along.

Include global text attributes -- size, colors, etc.

Introduce a new AssistContent structure, which allows us
to propagate information about the intent and data the
activity is looking at. This further allows us to propagate
permission grants, so the assistant can dig in to that data.
The default implementation propagates the base intent of an
activity, so if for example you bring up the assistant while
doing a share the assistant itself has the same information
and access that was given to the share activity (so it could
for example share it in another way if it wanted to).

Did some optimization of loading PersistableBundle from xml,
to avoid duplicating hash maps and such.

Changed how we dispatch ACTION_ASSIST to no longer include
the more detailed AssistStructure (and new AssistContent)
data when launching; now the example code that intercepts
that needs to be sure to ask for assist data when it starts
its session. This is more like it will finally be, and allows
us to get to the UI more quickly.

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

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

Bug: 19552874
Change-Id: Ie9454bbce56591b337f97af40f8c00b8597becdf
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
04f4d6bb8892fe9b6e8f60d18a4f4dd051ab8124 11-Mar-2015 Wale Ogunwale <ogunwale@google.com> Revert "Revert "Remove activity and window stacks when last task is removed.""

This reverts commit 7a7bf5ea48b12f044c591fb03ed3e58acd28ceb7.
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
11cce7989b41be88bb81af072bc9bed7ab829694 11-Mar-2015 Guang Zhu <guangzhu@google.com> Fix build

Change-Id: I530793e9090d780a5cb2581ee185badc51e14902
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
de01b03a855eb482e2264ee31e98fb4d3a42ebab 11-Mar-2015 Wale Ogunwale <ogunwale@google.com> Merge "Converted some AMS log points to use ActivityManagerDebugConfig."
e23149f1555303940d212b742707518b7f9f84ab 07-Mar-2015 Wale Ogunwale <ogunwale@google.com> Converted some AMS log points to use ActivityManagerDebugConfig.

Change-Id: I0563bafd29ae0bbe596ed8c06fcc573b5ead50b7
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
7a7bf5ea48b12f044c591fb03ed3e58acd28ceb7 10-Mar-2015 Wale Ogunwale <ogunwale@google.com> Revert "Remove activity and window stacks when last task is removed."

This reverts commit 0f95e3f0753508344b198c0a76afb892df514f52.

Bug: 19644506
Bug: 19083170
Change-Id: I2eb2a0400be58fe2c5d48a4b68368725e98aaf6f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
62793e4382b4b0b53d7373d92a62dc4e3ccbde05 09-Mar-2015 Dianne Hackborn <hackbod@google.com> Battery stats issues: fix jiffy handling, print scan counts.

Issue #19431959: Framework incorrectly assumes that kernel
clock_ticks are 10ms

We now retrieve the time of a jiffy from the kernel, and all CPU
times are now handled in milliseconds.

Issue #19571810: Add per-app breakdown of number of WiFi scans
in batterystats checkin data

Added to the report (the information was already being tracked).

Change-Id: If1702d6b9bcf851704129f1811471e68ed576a5d
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
b9a5e4ad30c9add140fd13491419ae66e947809d 04-Mar-2015 Dianne Hackborn <hackbod@google.com> Add new debug feature to automatically create heap dumps.

Not yet working, unless you turn off SELinux enforcing.
We need to update SElinux to allow the system process
to give apps access to /data/system/heapdump/javaheap.bin.

Currently watching can only be enabled through the shell,
such as:

adb shell am set-watch-heap com.android.systemui 1024

The last number is the process pss size in bytes, so this is
asking us to warn if it goes about 1K which will be all the
time.

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

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

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

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

Change-Id: I0e4b343da75cb2e539b5ad5f0f79f6bc7af46d7b
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
83a63bac5d303c63c534c10a53d37edcea782d28 04-Mar-2015 Craig Mautner <cmautner@google.com> am 8fa394fa: Merge "Do not make ActivityContainer available to apps. DO NOT MERGE" into lmp-dev

* commit '8fa394fa8c4eb3ca832dac36baf5645a40d449f1':
Do not make ActivityContainer available to apps. DO NOT MERGE
cb82f30186ea0f664cdb880cae1114cecd20ebc6 25-Feb-2015 Wale Ogunwale <ogunwale@google.com> Revert "Revert "Have AMS.setFocusedActivityLocked() move the focus stack to the front""

This reverts commit 3426b72cff7f8eeea4c802f4f0fcae4b995e177a
and fixes bugs 19505341 19507107

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

This reverts commit af0e44885992b0675d7881c391caeff88414695f.

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

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

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

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

Change-Id: Ia13f1e92a7c59ce6543c226533ac8ea623488290
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
822237858ac32e3ea2b6cf16f8d2c855a0247f44 20-Feb-2015 Wale Ogunwale <ogunwale@google.com> Merge "Remove activity and window stacks when last task is removed."
5f83382c40a0785d6fde6b6afb4f33c9ed683fba 20-Feb-2015 Dianne Hackborn <hackbod@google.com> Merge "Add some detailed data as part of battery history."
d1eccbea388fde6a575acb4e797efdd07798344a 18-Feb-2015 Dianne Hackborn <hackbod@google.com> Add some detailed data as part of battery history.

Every time the battery level changes, a new extended
detailed use data structure is written to the history.
This currently only contains delta CPU use since the
last detailed entry (total CPU and to three uids), but
it gives us the infrastructure for adding more detailed
data in the future.

A detail entry for regular history looks like:

Details: cpu=15730u+2307s (u0a57=11312u+502s, 1000=2344u+701s, 0=473u+991s)
/proc/stat=15377 usr, 1797 sys, 197 io, 0 irq, 8 sirq, 23103 idle (42.9% of 6m 44s 820ms)

u is user-space cpu time, s is system/kernel time.

The equivalent check-in output is:

9,h,0,Dcpu=15730:2307/10057:11312:502/1000:2344:701/0:473:991
9,h,0,Dpst=15377,1797,197,0,8,23103

Also add a new "unplug" command to the battery service,
to easily put it into a state where it always considers
the device to be running on battery.

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

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

Bug: 19083170
Change-Id: I4e006f101f9d0f2aebde130ad77afc4d258c6612
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
40f616b1f654822b3ac7c13853212c63d91312d5 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
2007a630d4767b4e90f8ed727acd574424c2183c 18-Feb-2015 Craig Mautner <cmautner@google.com> am 28de8edb: am ab8f60e4: am a94e4297: Merge "Do not make ActivityContainer available to apps. DO NOT MERGE" into lmp-mr1-dev

* commit '28de8edb7d72f938f47d7fdd8ce058c5c8933b8e':
Do not make ActivityContainer available to apps. DO NOT MERGE
ca0653a424f9d0f64ad15236c882af2b8ed2fe00 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
aa7e3ed94772be38a1f08a71551b9babdd625f46 17-Feb-2015 Craig Mautner <cmautner@google.com> Do not make ActivityContainer available to apps.

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
ae6688b09649447e57468b3e7935691bc09ec9b9 12-Feb-2015 Dianne Hackborn <hackbod@google.com> Update voice interaction layer for new UI design.

Can switch from a pure overlay at the top of the screen,
to interactive mode with the voice UI drawing at the bottom
and pushing its target activity up like an IME.

Add mechanism to get assist data to the voice interaction UI.

Add some basic visualization of the assist data, outlining
where on the screen we have text.

Add a test ACTION_ASSIST handler, which can propagate the
assist data it gets to the voice interaction session so
you can see what kind of data we are getting from different
apps.

Change-Id: I18312fe1601d7926d1fb96a817638d60f6263771
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a511eea83b0209729e4b42e219f233f818a6d9e7 13-Feb-2015 Narayan Kamath <narayan@google.com> am aee7f64c: am b4a5c04c: Merge "Remove code that sets user.* system properties."

* commit 'aee7f64c10ffd2135dc98f7a540836ad7a32438b':
Remove code that sets user.* system properties.
5bb57e8543b0da2959a7744ed8aa957d12c635ce 12-Feb-2015 Narayan Kamath <narayan@google.com> Remove code that sets user.* system properties.

This has been disallowed by the SELinux for several years now,
so can safely be removed. Given that saveLocaleLocked is
simplified quite a bit, we can now inline into its only caller.

bug: 18910417

(cherry picked from commit 70e8f6600de8a2b9cbb17cd919b14a4609fc68bd)

Change-Id: Ib2888ea22ffca6f4b402efd5780f89c924cd1570
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
70e8f6600de8a2b9cbb17cd919b14a4609fc68bd 12-Feb-2015 Narayan Kamath <narayan@google.com> Remove code that sets user.* system properties.

This has been disallowed by the SELinux for several years now,
so can safely be removed. Given that saveLocaleLocked is
simplified quite a bit, we can now inline into its only caller.

bug: 18910417

Change-Id: I18251f77e4a25a0e7ecda8e85a9b3fcdc2dc7b05
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
6f609928cf456f8bb5fed2e1905dc08cbcdaa0a7 12-Feb-2015 Narayan Kamath <narayan@google.com> am c7e48719: Merge "Remove references to persist.sys.language/country." automerge: 8be3724
automerge: 00e821a

* commit '00e821a8608efdc19041bdda1e832d3d4b3c29e2':
Remove references to persist.sys.language/country.
00e821a8608efdc19041bdda1e832d3d4b3c29e2 12-Feb-2015 Narayan Kamath <narayan@google.com> am c7e48719: Merge "Remove references to persist.sys.language/country."
automerge: 8be3724

* commit '8be3724a06f7b2d28c6664ca11a03f91f97f0972':
Remove references to persist.sys.language/country.
b61db8229a8f220f23b22b7ccde72e5cf73e0e07 12-Feb-2015 Narayan Kamath <narayan@google.com> Remove references to persist.sys.language/country.

Addresses a couple of TODOs now that all usages have been
removed and fixes a doc that specifies how the emulator locale
can be set.

bug: 17691569

Change-Id: I802ea1e12448a5442840cad1fdc0956d3e2c7a8c
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
83a0068d6546ba4b1f09c9fd6ccb44e784b430a2 11-Feb-2015 Wale Ogunwale <ogunwale@google.com> Merge "Am command to split a stack."
2c5763ae5d04ebd67eae2f86f840e6e68304e821 11-Feb-2015 Wale Ogunwale <ogunwale@google.com> Am command to split a stack.

Change-Id: Idf3a364fc3826f6fe92f55b5c83b16b380d62ff4
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
667d55cf5a06a0e1bd12997fcd494bec52e58ad9 11-Feb-2015 Andres Morales <anmorales@google.com> Merge "check bootloader and baseband version"
a928127a74d6ffe9334774e64a4470aedbe6c28b 07-Feb-2015 Wale Ogunwale <ogunwale@google.com> Set TaskStack config orientation based on dimensions

The TaskStack override configuration is set based on the
stack dimensions so we can load the most acturate resources
for activities in the stack in a multi-window environment.

Also, disabled fixed screen orientation for resizeable
activities.

Bug: 19305402
Change-Id: I7b182554523b12f2ef77f8bbc7b16891231125bf
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
fd282ed2f4649cc77127ab15b9167971abb5f379 07-Feb-2015 Andres Morales <anmorales@google.com> check bootloader and baseband version

Make sure flashed bootloader/radio matches what we
expect statically.

Change-Id: I71dfcc658695ef5542bc968747345efe0936c350
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
35fa2bc2e4debee1434bd784209895472ecd174f 03-Feb-2015 Ruben Brunk <rubenbrunk@google.com> Merge "Add ProcessInfoService to activity manager."
42da895b9061efc6b0abdedc0765deae2ccc2f5e 03-Feb-2015 Craig Mautner <cmautner@google.com> Merge "[ActivityManager] Prevent application holding AMS lock" automerge: 53e8d6f automerge: 6112f63
automerge: e8bd6d7

* commit 'e8bd6d734ccef685c4e25a0ec1735c140b9fe644':
[ActivityManager] Prevent application holding AMS lock
e8bd6d734ccef685c4e25a0ec1735c140b9fe644 03-Feb-2015 Craig Mautner <cmautner@google.com> Merge "[ActivityManager] Prevent application holding AMS lock" automerge: 53e8d6f
automerge: 6112f63

* commit '6112f63369c7ba463c0384c73a4e4c0d45b63918':
[ActivityManager] Prevent application holding AMS lock
53e8d6f934be403b9c7733c190b6052d60dd0658 03-Feb-2015 Craig Mautner <cmautner@google.com> Merge "[ActivityManager] Prevent application holding AMS lock"
338026f59ac7dc8448bcbd5834882af35df03d94 03-Feb-2015 Tony Mantler <nicoya@google.com> Merge "Check NAVIGATION_NONAV in ActivityManagerService"
9d3de4cfb42519fefe9d8b03c38ba440bd6bc886 02-Feb-2015 Wale Ogunwale <ogunwale@google.com> Support for activity to opt-in/out of resizeable/multi-window support.

Bug: 19178148
Change-Id: I5819a71cdc48e0af4add11a6d4a503ec5cbe5d63
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
843ce5b2a2c25026ce8f7f066905689ba4030887 15-Dec-2014 Tony Mantler <nicoya@google.com> Check NAVIGATION_NONAV in ActivityManagerService

b/18733457

Change-Id: I12b4d1da3564129a445882025575d759fc80d6d2
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a27eef432a4aa94c0eb8a5f73a6435afaac160fe 29-Jan-2015 Ruben Brunk <rubenbrunk@google.com> Add ProcessInfoService to activity manager.

- Adds a new AIDL interface for querying process
information from activity manager.

Bug: 19186859
Change-Id: Ic08858f346d6b66e7bfc9da6faa2c6e38d9b2e82
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
bd39d50624ae702009ff6e7e15885de479a52800 30-Jan-2015 Dianne Hackborn <hackbod@google.com> Merge "Record memory data in event log as we collect it for procstats."
0e0b7310a83942f6df67c69344020acf384c2bd4 30-Jan-2015 Winson Chung <winsonc@google.com> Merge "Adding some debug controls to test multi-window."
14dc3c900febb05cca89ffe610ebf7fb970e552b 30-Jan-2015 Todd Kennedy <toddke@google.com> Merge "Don't get extras from the Intent"
aab56dbc1ef5c91afad1e61d633305bb3aa3cb1b 30-Jan-2015 Todd Kennedy <toddke@google.com> Show stacks underneath a resized stack

When a stack is resized, make sure any non-fullscreen stack beneath it
becomes visible. This may mean additional activities are resumed in the
process.

Bug: 19083171
Change-Id: I5e7a3f82d76932ea2b9dbf0324ea183c42ee5496
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
1a5da04902ab47fb499c07ef5948450f2815e09e 24-Jan-2015 Dianne Hackborn <hackbod@google.com> Record memory data in event log as we collect it for procstats.

Change-Id: I37d6d87aac0c400ea402ae20e6174fd851d3c1f9
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
a92cbad2a916b3893311672ae643070f8306f477 30-Jan-2015 Dianne Hackborn <hackbod@google.com> Improve messaging of pre boot apps.

Have the system take care of showing the boot message
as it runs pre boot apps, rather than relying on them
doing this on their own.

Change-Id: Ife6db0691907cf413311dafb4b023e63e8795a79
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d16c565a607de754379fe699a4def21bd0e3de2f 27-Jan-2015 Winson Chung <winsonc@google.com> Adding some debug controls to test multi-window.

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

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

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

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

Change-Id: I1570e633bf0d552a32d7fa9a2e0ebd81953f632b
2322ea558eced3deed94193d9b9d498f69b14a78 26-Jan-2015 Craig Mautner <cmautner@google.com> am 8995e140: Merge "Add reason string for bringing stack to front" into lmp-mr1-dev
automerge: afc6d33

* commit 'afc6d332790166943302f051d32ec0874d9280aa':
Add reason string for bringing stack to front
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
d31c16457a7360bc892d71c308c7ab76cdb45af1 23-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Even more debug for bug 17721767." into lmp-mr1-dev automerge: dbabf37 automerge: 5cb31f2
automerge: b978450

* commit 'b978450b1c91f73eff63669ae3390627c0148dc4':
Even more debug for bug 17721767.
b978450b1c91f73eff63669ae3390627c0148dc4 23-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Even more debug for bug 17721767." into lmp-mr1-dev automerge: dbabf37
automerge: 5cb31f2

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

This time adding events for stack movement and focus change.

Change-Id: Icdff9763ac2daf85c615992fa2c8e418e907908c
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
d2f1511f2896e09db35bd92e0aab02ba89888a04 22-Jan-2015 Todd Kennedy <toddke@google.com> Don't get extras from the Intent

When handling Intents in the system process, we need to be careful
to not cause the extras bundle to be unparcelled. If the extra is
unparcelled, any custom class added to the extras will throw a
ClassCastException during the unparcel. For legacy reasons, we
would get the "seq" extra from the Intent for broadcast debugging.
This violates our requirement to not unparcel extras in the system
server process.

Bug: 19068243
Change-Id: I6cac426a0ef8648a05ded69ee4ac244017d9b5d1
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
56bbefccf27d3c32029121fe23f0b02c01eba338 22-Jan-2015 Narayan Kamath <narayan@google.com> Merge "Add support for persist.sys.locale." automerge: dca2332 automerge: 117f161
automerge: 1194e75

* commit '1194e754a95e1fa5d4eba6d0bca109156dd4df94':
Add support for persist.sys.locale.
1194e754a95e1fa5d4eba6d0bca109156dd4df94 22-Jan-2015 Narayan Kamath <narayan@google.com> Merge "Add support for persist.sys.locale." automerge: dca2332
automerge: 117f161

* commit '117f161fee52dfa200f89282c487d58c29b41d4f':
Add support for persist.sys.locale.
d30dbb8ae12e6e83e3035f12dd291f92e1f22c18 15-Jan-2015 Narayan Kamath <narayan@google.com> Add support for persist.sys.locale.

AndroidRuntime has been changed to read "ro.product.locale" and
"persist.sys.locale" instead of "ro.product.locale.language" etc.
This is passed down as "-Duser.locale" to the runtime.

The system_server has been changed to write out persist.sys.locale
on locale changes.

bug: 17691569

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

* commit 'f5f54dd69122bc07ea0a25b8d98b9048cbe4582f':
Update restored task uid to match the package uid on current device.
f5f54dd69122bc07ea0a25b8d98b9048cbe4582f 20-Jan-2015 Wale Ogunwale <ogunwale@google.com> am 92dd1abe: Update restored task uid to match the package uid on current device.
automerge: 7fd985f

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

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

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

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

Bug: 19001243
Change-Id: I0f04e8f2703bcc706f58e75333869fb35f6b1ee9
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
62ccbb306b2c5d0c1d6cc06725c6ee735c0e36ab 16-Jan-2015 Craig Mautner <cmautner@google.com> am 62e815bf: am 02c7c97a: am ac70b2d1: Merge "More debugging for bug 18201239." into lmp-mr1-dev

* commit '62e815bf7b154fe984e1a2aa8d615a2f04f71785':
More debugging for bug 18201239.
62e815bf7b154fe984e1a2aa8d615a2f04f71785 16-Jan-2015 Craig Mautner <cmautner@google.com> am 02c7c97a: am ac70b2d1: Merge "More debugging for bug 18201239." into lmp-mr1-dev

* commit '02c7c97a62ba9b79e56d1f7e206615e6eaca0689':
More debugging for bug 18201239.
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
0ec9c29fb724eef676d2472f2e15904ff8f52cc0 16-Jan-2015 Jeff Sharkey <jsharkey@android.com> am c2ae6fb9: Merge commit \'605eb79c9519307147fc1795d0eb155638a7f542\' into manualmerge

* commit 'c2ae6fb9ada52e9c990542a6d1cae80085318f31':
Offer to detect non-SSL/TLS network traffic.
c2ae6fb9ada52e9c990542a6d1cae80085318f31 16-Jan-2015 Jeff Sharkey <jsharkey@android.com> Merge commit '605eb79c9519307147fc1795d0eb155638a7f542' into manualmerge

Change-Id: Id6db8cce3a477572478a1d50f624823200848896
8667eff6b82da054f35a0368b00864b2cb97a8f9 16-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Remove unused method moveTaskToBack."
428ecf296694fa8c7214e068d36d47d1c74e5110 15-Jan-2015 Craig Mautner <cmautner@google.com> Remove unused method moveTaskToBack.

Everyone uses moveActivityTaskToBack() instead.

Fixes item #3 of bug 18088522.

Change-Id: I16028335fe1eef8a2aa47804f46536e395a16d8c
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
f24e490058bc59344f8bd10fb6cbbffa792fbc05 16-Jan-2015 Jeff Sharkey <jsharkey@android.com> Merge "Offer to detect non-SSL/TLS network traffic."
605eb79c9519307147fc1795d0eb155638a7f542 04-Nov-2014 Jeff Sharkey <jsharkey@android.com> Offer to detect non-SSL/TLS network traffic.

Introduces new module that provides network-related features for
the StrictMode developer API. The first feature offers to detect
sockets sending data not wrapped inside a layer of SSL/TLS
encryption.

When a developer enables, we ask netd to watch all outgoing traffic
from our UID, and penalize us accordingly if cleartext sockets are
detected. When enabled, netd captures the offending packet and
passes it back to the owning process to aid investigations. When
death penalty is requested, all future traffic on the socket is
blocked, which usually results in a useful stacktrace before the
app is actually killed.

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

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

Change-Id: Id3a32df19a5bb6740cbabcd65897349e9f2f2946
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
7dc8d32fd2fae16c6b1c95a49c864c2041a7a72c 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

(cherry picked from commit c63a16b8e46f2f3ecce6c548663cc3185f011fd6)

Change-Id: I4d714eb1f75afc0a5bf4d53a374df4ed16e328bf
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
eae13642867a5f1e760b81a3e20b04129967b09c 14-Jan-2015 Justin Harrison <astyrrian@google.com> am 4a7b0062: am 82008858: Merge "Fix unexpected language changes on SIM card insertion." into lmp-mr1-dev automerge: 561cf95

* commit '4a7b0062a13faec410a954798ddc091e90e57127':
Fix unexpected language changes on SIM card insertion.
4a7b0062a13faec410a954798ddc091e90e57127 14-Jan-2015 Justin Harrison <astyrrian@google.com> am 82008858: Merge "Fix unexpected language changes on SIM card insertion." into lmp-mr1-dev
automerge: 561cf95

* commit '561cf9595547581e0cc905ed5a05023bf67ca0b8':
Fix unexpected language changes on SIM card insertion.
be37df395eb791d9f877f4ca3c6e5d355a19896e 13-Jan-2015 Olawale Ogunwale <ogunwale@google.com> am 9d293911: am ebdfb6e8: Merge "[ActivityManager] Distinguish FG or BG receiver finished"
automerge: 0f8ecc8

* commit '0f8ecc84c8b86054bfd3275f942c3a705df01fbb':
[ActivityManager] Distinguish FG or BG receiver finished
7dfe83d39619189b4e5aa62d9ac34b68b96da5ab 13-Jan-2015 Olawale Ogunwale <ogunwale@google.com> am a9ae5050: am 8ddd5f4c: Merge "[ActivityManager] Fix process record leakage."
automerge: d07b9ea

* commit 'd07b9ea63dc37eaaf28bdf91b2edae62e2b35ee1':
[ActivityManager] Fix process record leakage.
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
0f8ecc84c8b86054bfd3275f942c3a705df01fbb 12-Jan-2015 Olawale Ogunwale <ogunwale@google.com> am 9d293911: am ebdfb6e8: Merge "[ActivityManager] Distinguish FG or BG receiver finished"

* commit '9d293911221cac930eb8edfef01362ea083eeaab':
[ActivityManager] Distinguish FG or BG receiver finished
d07b9ea63dc37eaaf28bdf91b2edae62e2b35ee1 12-Jan-2015 Olawale Ogunwale <ogunwale@google.com> am a9ae5050: am 8ddd5f4c: Merge "[ActivityManager] Fix process record leakage."

* commit 'a9ae505053585b6c46a6a86475959fd9fe501b09':
[ActivityManager] Fix process record leakage.
ebdfb6e8642e649f7efe877af398eae71cd9b80c 12-Jan-2015 Olawale Ogunwale <ogunwale@google.com> Merge "[ActivityManager] Distinguish FG or BG receiver finished"
1ed82edf1df1b1e86929669c4b9e2cac4a6f9283 09-Jan-2015 Dianne Hackborn <hackbod@google.com> am 2abf1f1c: Merge "Fix issue #18942959: Phone getting stuck then restarts after unplugging from Audi" into lmp-mr1-dev automerge: 54f9b1e automerge: a319aa8

* commit '2abf1f1c212574ea7073584406ee86898f5d3779':
Fix issue #18942959: Phone getting stuck then restarts after unplugging from Audi
2abf1f1c212574ea7073584406ee86898f5d3779 09-Jan-2015 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #18942959: Phone getting stuck then restarts after unplugging from Audi" into lmp-mr1-dev automerge: 54f9b1e
automerge: a319aa8

* commit 'a319aa800df36d40e1de453b64fd1e14573e6d80':
Fix issue #18942959: Phone getting stuck then restarts after unplugging from Audi
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
9c088fc8e71c299507b5ea212e25a00ff49d892f 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 automerge: a7881fd automerge: 30ae442
automerge: 8fa0935

* commit '8fa0935335ec5b9174e01acf861c58972a72aeab':
Add new debug feature to track associations between processes. Also add some debugging for spurious service ANRs.
8fa0935335ec5b9174e01acf861c58972a72aeab 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 automerge: a7881fd
automerge: 30ae442

* commit '30ae442133c55d4aa3636127de556736b2eaa99f':
Add new debug feature to track associations between processes. Also add some debugging for spurious service ANRs.
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
c82f2f5f9cb1bd4f5bcbd39a8ddf0d8da84f7104 09-Dec-2014 Wale Ogunwale <ogunwale@google.com> Add RecentTasks class to house recent tasks functionality.

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

Bug: 18556524
Change-Id: I4c877c9695b63d7fdb1b6b7addb737fd663e86c7
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
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
cab68c789491615841ab2abc84356a40e4f8e72b 07-Jan-2015 Wale Ogunwale <ogunwale@google.com> am 6763058f: am f61bc8a2: Merge "Bring task with root activity to front when launching from recents." into lmp-mr1-dev
automerge: df3d130

* commit 'df3d1307d5141c394b0eb521d6beb7f262fb3e3f':
Bring task with root activity to front when launching from recents.
df3d1307d5141c394b0eb521d6beb7f262fb3e3f 07-Jan-2015 Wale Ogunwale <ogunwale@google.com> am 6763058f: am f61bc8a2: Merge "Bring task with root activity to front when launching from recents." into lmp-mr1-dev

* commit '6763058fe74c31bd44b8c94e2911c72e9db68e97':
Bring task with root activity to front when launching from recents.
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
22242ab29a5be21c5248d0cb366de3d5fcb554e8 12-Dec-2014 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Fix process record leakage.

Symptom:
Remain dead process record in mLruProcesses.

Root cause:
When a process dies and needs to restart immediately.
The process record will not be removed from mLruProcesses
in handleAppDiedLocked (return kept=true).
If the restarting process start timeout, the record in
mLruProcesses will not be removed.

Solution:
Call removeLruProcessLocked in processStartTimedOutLocked.

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

* commit 'b8e51390af6015c1eaff7679546a5a7d2dfa701d':
Don't restore persistent task to a stack until needed.
b8e51390af6015c1eaff7679546a5a7d2dfa701d 05-Jan-2015 Wale Ogunwale <ogunwale@google.com> am 170a678c: am 1d893785: Merge "Don\'t restore persistent task to a stack until needed." into lmp-mr1-dev

* commit '170a678cd2b7073edd061765dabd4a754f562e60':
Don't restore persistent task to a stack until needed.
1f5ac4d322d76ca76fdf5dee40fe9549aad7437e 03-Jan-2015 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Distinguish FG or BG receiver finished

Symptom:
Assume a foreground broadcast FG and a background BG.
If a recevier registers both FG and BG. When sending
BG and FG to the receiver, and the receiver BG receiver
completes first, its finishReceiver will trigger next FG
receiver rather than BG, and also deliver wrong result
code/data to the next.

More detail and sample:
https://code.google.com/p/android/issues/detail?id=92917

Root cause:
Due to BroadcastQueue:getMatchingOrderedReceiver will match
by receiver(IBinder), so the caller ActivityManagerService:
broadcastRecordForReceiverLocked will always match the first
queue(fg) if a receiver is both receiving fg and bg.

Solution:
Add a parameter flags to finishReceiver, then server side
could know the finished receiver should belong to which queue.

Another general solution but with bigger scope:
I60dce4a48e20c1002a61a979e4d78b9b0a8b94a0

Change-Id: I913ca6f101ac8ec6c7a8e42754e6781f80247b7f
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
9ac9609f4d078dc0d7fe7c703fb88d20fd629bfe 23-Dec-2014 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Prevent application holding AMS lock

Symptom:
Watchdog timeout.

Reproduce code:
String action = "lets.deadlock";
Uri baseUri = Uri.parse("content://i.am.bad");
Uri uri = ContentUris.withAppendedId(baseUri, 1);
Intent intent = new Intent(action, uri);
sendStickyBroadcast(intent);

IntentFilter filter = new IntentFilter(action);
filter.addDataScheme(baseUri.getScheme());
filter.addDataAuthority(baseUri.getAuthority(), null);
filter.addDataPath(uri.getPath(), 0);
registerReceiver(null, filter);

In target provider's getType:
Invoke AMS function will result deadlock.
Or sleep a long time will also trigger watchdog timeout.

Root Cause:
If broadcast is sticky with content scheme intent.
Register receiver will trigger access provider when
matching intent with IntentFilter, and it executes
in ActivityManagerService's lock.

Solution:
Obtain necessary data to local to split lock block.

Change-Id: I0fb94472cdc478997e40ba2a60a988c5f53badb2
/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
539db51a7d45d95673f21b579bf9b353e9c19c70 15-Dec-2014 Todd Kennedy <toddke@google.com> propagate reason to finishActivityLocked()

Bug: 18704347
Change-Id: I830ad08f344db5be99760e0112d96729077b29c6
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
06024047258b01ad70f7d88e5773d8dc9b8d59fd 11-Dec-2014 Narayan Kamath <narayan@google.com> am bc59ca4b: am 31462128: Merge "Avoid tearing down process groups twice."

* commit 'bc59ca4bdbd993c1eb5c2a74f9b35857619da285':
Avoid tearing down process groups twice.
15cd63027bc8413659114714068a665869a4b3b2 11-Dec-2014 Narayan Kamath <narayan@google.com> Merge "Avoid tearing down process groups twice." into lmp-mr1-dev
2467188e396503988ea05401011837a18f9a93a1 11-Dec-2014 Amith Yamasani <yamasani@google.com> am a2530e4a: am ee24d848: Merge "Stop guest user on exiting, to conserve resources" into lmp-mr1-dev

* commit 'a2530e4aa4c35787516ffea8368c0ebc35da4df4':
Stop guest user on exiting, to conserve resources
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
f85a91e408a0da3799fe1701f450b71e20b68c80 10-Dec-2014 Dianne Hackborn <hackbod@google.com> am d6372242: Merge "Further work on issue #18640385: Add procstats test mode" into lmp-mr1-dev
automerge: d525891

* commit 'd52589185f57ce7eb633d12dec98e4bbae4e33fd':
Further work on issue #18640385: Add procstats test mode
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
c46f75ef1d479f7b606ab04283b1b0f84849476a 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
f1ffc75c9ec093ff780954f86c72a8a7069ca6cf 10-Dec-2014 Amith Yamasani <yamasani@google.com> Merge "Allow user shutdown broadcasts to be delivered" into lmp-mr1-dev automerge: dad85a6
automerge: 7acd880

* commit '7acd8802d7c14323dfc2a5e68b1d2a82f9d3f5c0':
Allow user shutdown broadcasts to be delivered
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
70acd9b36a9fc0d212b25d64f4edf0fc582331cf 09-Dec-2014 Sebastien Hertz <shertz@google.com> resolved conflicts for merge of beb84982 to lmp-mr1-dev-plus-aosp

Change-Id: Ib420549f3e20c149c15966dfece980b4f150177d
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
0cfdd810ded6f8486a6b0a61044594f58ab5c052 08-Dec-2014 Dianne Hackborn <hackbod@google.com> am e52a2ea0: am 0029f0ac: Merge "Fix issue #17323751: Additional items in aggregated battery stats" into lmp-mr1-dev

* commit 'e52a2ea03bd7b8ed2f3680c5198e00fb7ad5c34c':
Fix issue #17323751: Additional items in aggregated battery stats
34e7003a78005e86326c86345561e986978723c6 08-Dec-2014 Dianne Hackborn <hackbod@google.com> am 3cb6496b: am 25d2c2d6: Merge "Fix issue #18593636: Turn on "kill important processes that..." into lmp-mr1-dev

* commit '3cb6496b6c8bb48d458c46e7a062228f0488307d':
Fix issue #18593636: Turn on "kill important processes that...
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
af3361bb264d9d037f0bd10532a752bbaeaec39c 05-Dec-2014 Wale Ogunwale <ogunwale@google.com> am 9a3f6ac6: am 6b54d38a: Merge "Add support from restoring recent\'s backup." into lmp-mr1-dev

* commit '9a3f6ac63c9c11008b6dbb99d5213b3d3f51fca0':
Add support from restoring recent's backup.
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
2faf91fbb300882afd1092b788aa16295eb3dde8 05-Dec-2014 Amith Yamasani <yamasani@google.com> am 66cbec51: am d234dc1f: Merge "Correct check of is user running"

* commit '66cbec512cf31228f8d86171f57cf4e3bcbbd63e':
Correct check of is user running
d234dc1f20d3a68e0dd9f2c3a5f14282fba79b13 05-Dec-2014 Amith Yamasani <yamasani@google.com> Merge "Correct check of is user running"
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
fee5e3d32a26c3ac2136e37cad15fd9cc41066db 03-Dec-2014 Winson Chung <winsonc@google.com> am 50511096: am de9848c6: Merge "Initial changes to add callback on task stack changes. (Bug 17672056, Bug 18291345)" into lmp-mr1-dev

* commit '50511096998ffff4fa5c001e46b056201fb0b892':
Initial changes to add callback on task stack changes. (Bug 17672056, Bug 18291345)
9edcc7be49aa521ece6b7b5f04530a435211e2b5 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.

Change-Id: I1b51bcdb62bdd0f6dbe05dab4d529d4ad40d0d44
/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
240602f43184b820ecff064d61e99017f849c0cf 02-Dec-2014 Craig Mautner <cmautner@google.com> am 877d8939: am f6be7d17: Merge "[ActivityManager] Fix race condition in pss collection"

* commit '877d89399af77a98dd940c034aa631029ed313cc':
[ActivityManager] Fix race condition in pss collection
f6be7d177a740f86a4ae3b8685cc9e2f31506352 02-Dec-2014 Craig Mautner <cmautner@google.com> Merge "[ActivityManager] Fix race condition in pss collection"
8abe01aa80a0697d21103322ac500dce31058b50 02-Dec-2014 Craig Mautner <cmautner@google.com> am a370d9d1: am f54954f9: Merge "bug fix possible NPE while startProcessLocked()"

* commit 'a370d9d19af04c2a9f9d5c5b5794a6a5cd6fd774':
bug fix possible NPE while startProcessLocked()
f54954f97599f83584ab736d931b1fe1aff8890c 02-Dec-2014 Craig Mautner <cmautner@google.com> Merge "bug fix possible NPE while startProcessLocked()"
62cfde14423922948928c40eddd212d1dc51d591 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
8f6fc8150035c94ba0ece031a9aaa5f6eea4b053 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
bda8e4192a26b5ab137ba3c22ea00b493a1b673e 01-Dec-2014 Craig Mautner <cmautner@google.com> am be342ef0: am c4cf78f4: Merge "[ActivityManager] Ensure provider external access count will be released."

* commit 'be342ef034f05c6864aaa85ab25c009148954552':
[ActivityManager] Ensure provider external access count will be released.
10c40fc01d56ee17068cb61d5c19e6ab68f2ca48 01-Dec-2014 Craig Mautner <cmautner@google.com> am a12ac54c: am 25596374: Merge "[ActivityManager] Prevent provider from been created twice."

* commit 'a12ac54cf69c0c8cfec6fa7c14176b714cae7107':
[ActivityManager] Prevent provider from been created twice.
5a6c1962590979d0722da0547a6ba3ae1a98dd04 01-Dec-2014 Craig Mautner <cmautner@google.com> am 11c67c92: am 7db48ed0: Merge "Reset killedByAm flag at attachApplicationLocked"

* commit '11c67c92de3522a50b9994eb83e34c152902ad18':
Reset killedByAm flag at attachApplicationLocked
c4cf78f4d3154af317e686c9ef702a26cf28f8f2 01-Dec-2014 Craig Mautner <cmautner@google.com> Merge "[ActivityManager] Ensure provider external access count will be released."
255963742982daf46eb665a2934bd61e7ed95c81 01-Dec-2014 Craig Mautner <cmautner@google.com> Merge "[ActivityManager] Prevent provider from been created twice."
105add8d1aebad3904a8863860fa596712151f65 15-Nov-2014 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Prevent provider from been created twice.

Root Cause:
If a process which contains provider is starting but not
from accessing provider, e.g. service/activity/receiver,
its providers' will be created during handleBindApplication.
And before the process complete publish provider to
ActivityManagerService, if there is an access call to
process provider before the process completes publishing
providers to ActivityManagerService, then the providers
will be created again.


Solution:
Don't schedule install provider if the provider record
already exist and will be published later.

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

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
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
343f478241fab49c909b229d6876ff8405e7b0d5 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

(cherry picked from commit 76a748e62f354c799342044f724e1f4b80121837)

Change-Id: I2364c05837ac04d428b5a34ab1802964a11d2df4
/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.
98f1f3400d7c5c3b2c3b22f57f590e1b9e5d484d 15-Nov-2014 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Ensure provider external access count will be released.

Sympton: Oom-adj of provider process will be always 0.

Root Cause: Exception happend in openContentUri
may not call removeContentProviderExternalUnchecked.

Flow:
application [MediaPlayer.setDataSource(Context context, Uri uri)]
uri is invalid, IOException will be caught and below log will appear:
"Couldn't open file on client side, trying server side"
Continue to call setDataSource(String path, Map<String, String> headers)
->mediaserver [MediaPlayerService::Client::setDataSource]
setDataSource(httpService, url, headers) calls openContentProviderFile
->system_server (ActivityManagerService) [openContentUri]
Increase externalProcessNoHandleCount for media provider.
Call [openFile] to media provider.
->android.process.media [check permission for openFile]
enforceReadPermissionInner
->system_server [checkComponentPermission]
Use mediaserver's uid to check READ_EXTERNAL_STORAGE
-> not granted due to it is pure native process, not a known package.
Throw security exception then the flow of openContentUri is broke.
And externalProcessNoHandleCount is unable to decrease.

Application sample code:
String invalidId = "54321";
Uri externalUri = MediaStore.Files.getContentUri("external");
Uri uri = Uri.withAppendedPath(externalUri, invalidId);
mediaPlayer.setDataSource(mContext, uri);

Solution: Move removeContentProviderExternalUnchecked to finally block.

Change-Id: I75eec1f9631e9c6bb18449946d707d51ac21e8a7
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
5ed21bd9aca01f01e2b27e2bfa031d31c775eec7 15-Nov-2014 riddle_hsu <riddle_hsu@htc.com> [ActivityManager] Avoid orphan ContentProviderRecord.

<Symptom>
Binder threads wait forever results ANR/system hang.

<Root cause>
When X is accessing Y's provider.
Before Y publishing its provider to notify X,
someone invokes killBackgroundProcesses to kill Y.
In removeProcessLocked, it will pass restarting=true
and allowRestart=true to handleAppDiedLocked.

When the clean flow going to removeDyingProviderLocked.
The variable will be inLaunching=true always=false.
Then it will not notify the ContentProviderRecord.
And also due to the ContentProviderConnection waiting=true,
it will do nothing and just return true to
cleanUpApplicationRecordLocked to set restart as true.

But due to restarting=true, the restart flow will not execute,
then the waiting ContentProviderRecord for X will be orphan
and keep waiting.

<Reproduce step>
Service X query provider Y when X's oom adj is SERVICE_ADJ,
before Y's publish provider, invoke killBackgroundProcesses
to Y's package.
Then use command "adb shell dumpsys activity prov"
Y will always in "Launching content providers".

<Solution>
For not restarting case, pass restarting=false to
handleAppDiedLocked to let the provider process can be restarted.

A more simple way maybe just change to keep below 2 lines:
app.kill(reason, true);
handleAppDiedLocked(app, callerWillRestart, allowRestart);

Change-Id: I8992cb851fce4dbe6255da71d60390e1a33cb9c7
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
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