History log of /frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
7ab4025474d3ce80b00fbc96962a585f918a0be1 16-Jun-2016 Dianne Hackborn <hackbod@google.com> Fix issue #29371078: Foreground jobs should not count...

...as active for idle maintenance

Nor jobs of whitelisted apps.

Now they don't.

Also remove the no longer used "active download" tracking code.

Change-Id: I553197801f6eabaf15716f3201dd65257a0d4e94
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
a1b79bfd7a15006a93da933695359765e0fee495 24-May-2016 Felipe Leme <felipeal@google.com> Allow apps to bypass Power Save restrictions when launched from a Notification's PendingIntent.

This scenario typically happens when the device is on Doze Mode and a
notification action is triggered from a Wear device.

In a nutshell, the workflow is:

- ProcessRecord has a flag telling whether a process has "whitelist
management" privileges.
- When NotificationManager binds a new NotificationListenerService, it
sets the BIND_ALLOW_WHITELIST_MANAGEMENT flag.
- On bind(), ActiveService asserts that only system apps can set that
flag.
- On computeOomAdjLocked(), ActivityManagerService sets the
ProcessRecord flag if necessary.
- Upon creating a notification, NotificationManager calls AM to mark its
PendingIntents as coming from a notification.
- When PendingIntentRecord sends it to the target, it checks if it's
from a notification and if so calls AM to do the temp whitelist.
- On unbind(), ActiveService removes the ProcessRecord flag if necessary.

Fixes: 28818704

Change-Id: I00d46036a2cbb73f7f733fd35bf0b743a02807a1
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
4cb96ca45f3334f49ebe23359001b7a636a1973b 17-May-2016 Dianne Hackborn <hackbod@google.com> Fix issue #28817455: [NYC] [BullHead] Fatal Exception in CNEService

Deadlock between DeviceIdleController and NetworkPolicyManagerService
because DeviceIdleController was calling out to ConnectivityService
with its lock held.

Change-Id: I21195c2dfd5f50d0264e5e32819f8fc1f35a23a9
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
ac59f75e80ee06a302d268620d634de014ee0e38 05-May-2016 Amith Yamasani <yamasani@google.com> Fix a regression in registering for package_removed

Change-Id: I5d8bcc682f482d965cc9b76b5598a6521539272f
Fixes: 28616418 App is not removed from power whitelist when uninstalled
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
ef3aa6ee53c5e4f1c50dd5a9b5821c54e449d4b3 30-Apr-2016 Dianne Hackborn <hackbod@google.com> Fix issue #28477006: Add small event log to job scheduler

Added. Also fixed dumpsys output when filtering, to apply the
filter to (almost) all of the output.

Change-Id: Iafb446599ad8fddbe8a766784deff618a6cfdbb7
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
88c4135d88eb59320fe93801088bcd6c47e50efb 08-Apr-2016 Dianne Hackborn <hackbod@google.com> Fix issue #26879170: Adjust doze maintenance windows...

...based on network availability

There is a new light maintenance state "waiting for network"
that we go in to after idle if the network is not currently
available. We will stay in this state the same duration as idle,
so if we are continually without network access this effectively
doubles the light doze idle durations.

Get rid of some wrongly copy/pasted code to allow doze light
to still work even if we don't have an SMD. It doesn't need
one.

Also a bunch of improvements to the shell commands to make it
easier to test / debug.

Change-Id: Iad024840661479dbfd54b5b3db6ab96fefe59bc0
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
92f15e65d93dc15a55e756fb8f545e7c4f652457 05-Apr-2016 Kevin Gabayan <gabayan@google.com> SENSING_TIMEOUT goes to STATE_INACTIVE.
Bug: 27821977

Change-Id: I920581f57a1467ad13ab32efdf86a8f68960d84c
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
945c9c9f8f65556dd93218df724be25c634f6db3 30-Mar-2016 Dianne Hackborn <hackbod@google.com> Fix issue #27920133: Need to ensure activity starts in idle maintenance

We now hold a wake lock while going in to idle maintenance, since
we really want to make sure everyone has a chance to respond. And
since we are doing that, we can move to just using a delayed message
to make sure we don't leave maintenance until the time expires, getting
rid of the separate timeout alarm.

Also improve the initial transition to light idle mode so that if
we currently have work going on, we will wait for up to 15 minutes
more before actually going idle and forcing it to stop.

Change-Id: I6045da57ab4165f80a651126e99371c029ced23d
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
953fc94599698f4b8690fb69aec70d377a468af8 30-Mar-2016 Dianne Hackborn <hackbod@google.com> Work on issue #26879170: Adjust doze maintenance windows...

...based on network availability

But first, make the light idle timing more dynamic, with this
pattern:

1. Screen off for 5 minutes.
2. Light idle for 5 minutes.
3. Idle maintenance.
4. Light idle for 10 minutes.
5. Idle maintenance.
6. Light idle for 15 minutes.
7. Idle maintenance.
...

Also fix issue #27793980: Log message about unrecognized alarm listener

Change-Id: I42012f8085afbd5becaecdadf93a777370ca34be
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
0c5d3e95c7c4e5cf9714c2c1ff2d5df87fb18e2a 24-Mar-2016 Joe LaPenna <jlapenna@google.com> Reduce idle, idle_after_inactive timeouts to 15m

BUG: 25678232
BUG: 25678232

Change-Id: Ie39f1e2ac245b50826a01b3286ded0c67736b6fa
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
f33b5bffeeca2ec56a9edda71d4401a9b96153c5 23-Mar-2016 Joe LaPenna <jlapenna@google.com> Allow setting doze timeouts based on system feature

BUG: 25678232
Change-Id: Ic9c8e5001a9202242308effb38de879b5f30bd36
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
cb926fcec46b111d69059874d63c4cbebb5903c4 15-Mar-2016 Amith Yamasani <yamasani@google.com> Move device idle logic into a job StateController

Move most of device idle (doze) logic from JobSchedulerService
to DeviceIdleJobsController.

Allow whitelisted apps to run during device idle by adding
a new constraint DEVICE_NOT_DOZING. Using the word DOZE to
disambiguate from IDLE because the latter is used to mean
that the job wants to run in idle-maintenance period.

Bug: 26851107

Change-Id: I97f5286bd4d5ca18fbc46c2037c310fd369e18bf
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
2fefbcf0d1b91f37684387971721c90112a9ac89 18-Mar-2016 Dianne Hackborn <hackbod@google.com> Fix issue #27653326: Sync doesn't work in doze maintenance

Add a (configurable) delay between when we start a maintenance
window until the minimum time we will end it.

Also switch to using the alarm manager callback API. (Yay!)

Also fix a little printing problem in the alarm manager dump
so we put the package name and not some class hash in the
summary string of an alarm entry.

Change-Id: I4281e5c80bc8b26ebc1fb6f603ec33ec0e379daa
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
262ae5c8eb1579bccaa0f6953b39e6fd65ff2288 11-Feb-2016 Dianne Hackborn <hackbod@google.com> DO NOT MERGE: Add separate information about user whitelist.

Use this in the alarm manager to allow user whitelisted apps
to have free access to scheduling alarms.

Coming next: lifting sync/job restrictions.

Bug #26851107: Allow user whitelist apps more freedom

(Cherry-picked to nyc since it got lost in the branch from master.)

Change-Id: I4dc9f07514627ebdb6b6eff7c7a749f2c51a3797
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
b6843657c451dcd290b52a879a2dac50d5b429b8 22-Feb-2016 Dianne Hackborn <hackbod@google.com> Add ability to separately disable light and deep idle.

(Previously called "full" idle is now referred to as "deep" idle.)

We now keep separate enabled states for light and full idle
modes, and shell commands dealing with them now include an
argument to specify which they should impact.

Change-Id: Idf6d3d4bd85f800ebc034d97f57863351138fb4a
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
f8a462319fc8229778c0644ed423dc32ca09a560 10-Feb-2016 Felipe Leme <felipeal@google.com> Added option to check if an app is whitelisted for deviceidle.

Currently, there are only options to get the whole list:

adb shell dumpsys deviceidle whitelist

Or to add/remove an app:

adb shell dumpsys deviceidle whitelist +my.app
adb shell dumpsys deviceidle whitelist -my.app

This change add an option to get the status of an app, so it can be used
on CTS tests:

adb shell dumpsys deviceidle whitelist =my.app

BUG: 27127112
Change-Id: Ife4b8e2efa51e4ba5e1e2263e59884e5054f1e0a
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
4c3a774ec8446a9405a6f6b342135b63952b7f2a 04-Feb-2016 Amith Yamasani <yamasani@google.com> Merge "Transit to correct state after alarm is fired" am: f3c432059c
am: 510a2c5aeb

* commit '510a2c5aeb88c5128737593e314e63265bc5d308':
Transit to correct state after alarm is fired
27b33306e69052f17b63c5de3dee7688fec2606e 16-Dec-2015 Koji Fukui <koji.fukui@sonymobile.com> Transit to correct state after alarm is fired

Symptom:
When AlarmClock fires in IDLE, state is changed to ACTIVE.
But the ACTIVE state continues under some conditions.

Root cause:
Transition from IDLE state to ACTIVE state when AlarmClock fires
1. Send ACTION_STEP_IDLE_STATE intent
2. Calles onReceive() in BroadcastReceiver
3. Calles stepIdleStateLocked()
4. Calles becomeActiveLocked() 

Check point (1) to change from ACTIVE state to INACTIVE
(Display On -> Off)
1. onDisplayChanged()
2. updateDisplayLocked()
3. becomeInactiveIfAppropriateLocked()

Check point (2) to change from ACTIVE state to INACTIVE
(charging -> not charging)
1. ACTION_BATTERY_CHANGED
2. updateChargingLocked()
3. becomeInactiveIfAppropriateLocked()

There are only two check points to change from ACTIVE to INACTIVE.
If state transition, from IDLE to ACTIVE,
happened by AlarmClock when display is off and not charging,
ACTIVE state will be kept and never changes to INACTIVE state.

Change-Id: I93398366307f529b9c0074ac58b19ad6e4695790
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
c9b2cd1ccc38f1f87b1fd68625bb58497462ffc9 20-Jan-2016 Dianne Hackborn <hackbod@google.com> Fix issue #26434415: APR: SecurityException in android.process.media

Change-Id: Id8c8932428ffb154b38b5dc75bca1f9d3a1cf7e6
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
9941ab3cbb91bffe3b06d3a77a68bb97bcaba381 15-Jan-2016 Yao Chen <yaochen@google.com> Merge "Changes in DeviceIdlecontroller and JobScheduler to support Auto GarageMode."
ca5edbb6b5300e07a5f7bfbec36f08df65d8f6e7 13-Jan-2016 Yao Chen <yaochen@google.com> Changes in DeviceIdlecontroller and JobScheduler to support Auto GarageMode.

Changes made in the cl:
1. Let DeviceIdleController take listeners on whether background
maintanence services are active. This currently includes JobScheduler,
SyncManager, DownloadService. Note this is the last known
states reported by these services.

2. In JobScheduler, make the idle threshold and alarm window configurable.
So in the car case, we don't need to wait 71 mins after screen off
to kick off any jobs that require device idle.

-------------------------------------------------------------------

* We are not going to suppress JobScheduler, DownloadService, SyncManager
entirely while user is driving. Because apps may not be working properly if
these services are suspended.

* The jobs that we don't allow to run while driving are the
jobs submitted to JobScheduler that require device idle.
And this is already taken care of, because
screen is ON and JobScheduler will not consider the device to be idle
while driving (unless user turns off the head unit).

* We will need to give the JobScheduler a chance to run the device idle
jobs when car is turned off. This is the scope of GarageMode. If
DownloadService and SyncManager want to run, we will allow them to run
too.

* The headunit is treated as wall power device, so it's always charging.
The charging state will not toggle.

Change-Id: I55b92cf92efd61c48dd6c9b8197c2b68078a4439
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
c5967e9862489024c932b0c7fcb84ed0af2a7fd7 08-Jan-2016 Jeff Sharkey <jsharkey@android.com> More progress on triaging PackageManager callers.

Catch a bunch of simple cases where the PackageManager flags are
obvious. Add the ability to use the MATCH_SYSTEM_ONLY flag on
PackageInfo and ApplicationInfo queries.

Re-examine recent tasks after a user is unlocked, since some of the
activities may now be available and runnable.

Bug: 26471205, 26253870
Change-Id: I989d9f8409070e5cae13202b47e2c7de85bf4a5b
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
e06b4d1d9f718b9fe02980fea794a36831a16db2 06-Jan-2016 Jeff Sharkey <jsharkey@android.com> Consistent naming for PackageManager methods.

When hidden PackageManager methods take a userId argument, they
should be named explicitly with the "AsUser" suffix. This fixes
several lagging examples so that we can pave the way to safely
start passing flags to new methods without scary overloading.

Also fix spacing issues in various logging statements.

Change-Id: I1e42f7f66427410275df713bea04f6e0445fba28
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
8ed2b97b9e8b8aa34026aa5e9e614494af3d12f6 18-Nov-2015 Dianne Hackborn <hackbod@google.com> Implement flexible light idle maintenance windows.

For light idle mode, our maintenance window is pretty short (1 minute).
Usually we have nothing to do in it... but sometimes we may want to
do a sync or download that takes more than a minute, and it would be
nice to not take the overhead of breaking that up in to multiple
windows.

So now we have a flexibile window, from 1 minute to 5 minutes. We
start out with 1 minute, and any window that uses less than 1
minute increases the available window by that amount for later use.
If we later use more than 1 minute, we correspondingly decrease
the next available window.

Change-Id: Ie273dbd5843b3aa4a3d5d9b2e420cda75517340f
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
627dfa1ddafc96b912ae938677a48a16f7ab255c 12-Nov-2015 Dianne Hackborn <hackbod@google.com> Be smarter about determining when we can stop idle maintenance.

The device idle service now knows when the system is actively
doing significant things (syncs, jobs, alarms, downloads). It
uses this, when in an idle maintenance window, to determine when
it can end that window early -- when such work is no longer
happening.

For now this just allows us to shorten the windows. In the future
we should use this to allow us to expand the windows to a longer
potential time, adjusting future windows to shorter durations if
earlier ones use more time. This will allow us to batch occasional
long operations (such as downloads) into one window, making up
for that with much shorter later windows.

Change-Id: Ie482abd50bc43be9a8917a769a5175851eee4ec4
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
18acb55de526e479f59b3f8d1f3b348cad126cbb 26-Oct-2015 Dianne Hackborn <hackbod@google.com> Bring back the sensing alarm. We need it!

Change-Id: I9f42dc19b99b7550189449d0a5100caa140810c1
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
9161871f8374a3d3ec184dd1c716d117e06381c6 23-Oct-2015 Dianne Hackborn <hackbod@google.com> Merge "DO NOT MERGE Fix issue #24118803: The screen doesn\'t turn off..." into mnc-dr-dev
am: b32e020d23

* commit 'b32e020d237cfd94cdfe8c589900a899dc14413a':
DO NOT MERGE Fix issue #24118803: The screen doesn't turn off...
7730cd2740a68ecd58fa2c0d2daf45b500d50fa1 23-Oct-2015 Dianne Hackborn <hackbod@google.com> DO NOT MERGE Fix issue #24118803: The screen doesn't turn off...

...after more than 60 minutes left

The sensing timeout alarm was being cancelled immediately after it
was scheduled it. Now only cancel it when we are done sensing or
have reset activity.

Change-Id: Id0440cda7dd1b81bf871f16dfb015df6284cf6af
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
08c47a5dece977a55d250d98bda9e2a8df8b6ed0 15-Oct-2015 Dianne Hackborn <hackbod@google.com> Initial implementation of light-weight idle mode.

This mode turns on after the screen has been off for 15 minutes,
and then cycles through 15 minutes of idle and 1 minute of
maintenance, ragardless of whether the device is moving around.

It currently only impacts network access and sync/job scheduling.
It does not remove access to wake locks or alarms for any apps.
It also doesn't report in the public API that the device is in
idle mode (since it isn't modifying the behavior of the power
manager) -- this is probably what we desire, since we don't want
stuff like GCM to be reporting these frequent changes.

We'll probably at least want to have the alarm manager do some
kind of more aggressive batching of alarms in this most (not allowing
more than one wakeup every minute?). That's for the future.

Also updated batterystats to include this new information, which
means the format of some of the data has changed -- device_idle
is no longer a flag, but an enum of (off, light, full), and there
is no information about time spent in light modes.

Also added new data about the maximum duration spent in both light
and full idle modes, to get a better understanding of how those
are behaving.

And did a little cleanup of DeviceIdleController, removing the
sensing alarm which was redundant with the regular alarm.

Change-Id: Ibeea6659577dc02deff58f048f97fcd9b0223307
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
9ba60c949f37a1694532095572f35cfcf953f591 13-Oct-2015 Dianne Hackborn <hackbod@google.com> am a7d5cc54: am ff71f26f: am 51591b91: am 6cc3735a: Merge "Fix issue #23581553: Ignore Battery Optimization not work for re-install app" into mnc-dr-dev

* commit 'a7d5cc547dd277f10670998be6cafede3a9648e7':
Fix issue #23581553: Ignore Battery Optimization not work for re-install app
51591b91a35f1227996121c2803990a62b328475 12-Oct-2015 Dianne Hackborn <hackbod@google.com> am 6cc3735a: Merge "Fix issue #23581553: Ignore Battery Optimization not work for re-install app" into mnc-dr-dev

* commit '6cc3735a492abd1c17f15a46287de70e62bf116d':
Fix issue #23581553: Ignore Battery Optimization not work for re-install app
1b79ad74ef392540ee6ba39348d041716f027be7 12-Oct-2015 Dianne Hackborn <hackbod@google.com> Fix issue #23581553: Ignore Battery Optimization not work for re-install app

Remove from whitelist as appropriate. Also be sure we can find whitelisted
apps even if they are not installed in the primary user.

Change-Id: I3ed13dca99b3ba177af8f7bd26a75258df9b6949
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
9461b6f91f37fd32207da1bd734d9ea9629eb8e5 08-Oct-2015 Dianne Hackborn <hackbod@google.com> Add new "shell command" feature to Binder objects.

IBinder has a new common interface for sending shell commands
to it. This can be implemented by system services to provide
a shell interface to the service, without needing to have separate
shell java code.

This includes changes to DeviceIdleController to implement the
shell interface for all of the commands it has been providing
through dumpsys.

Change-Id: I76518ea6719d1d08a8ad8722a059c7f5fd86813a
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
30c767afbfb67914e6caeb78af8c8c91759d4671 27-Sep-2015 Nick Vaccaro <nvaccaro@google.com> am 09746d89: am 5eccf896: am faf3f370: Merge "Fix sensor usage model" into cw-e-dev

* commit '09746d898099332a079af5349278e7c284fc2cbe':
Fix sensor usage model
faf3f3706140c3b90c805e77c3c72c0978b0d61a 25-Sep-2015 Nick Vaccaro <nvaccaro@google.com> Merge "Fix sensor usage model" into cw-e-dev
20feaea1aac4d96794f24daa8be9c0f09c37aaba 18-Sep-2015 Nick Vaccaro <nvaccaro@google.com> Fix sensor usage model

Changed to use the correct API based on the reporting type of the
chosen sensor. The code was incorrectly treating the WRIST TILT
sensor as a one-shot sensor instead of a special-reporting sensor.

Bug: 11661021
Change-Id: Ib8b7ef5bad9642773f4c0e22e218fbec8c34439b
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
818c37978200772e898f381e2dc4bb80b40bc32b 25-Sep-2015 Joe LaPenna <jlapenna@google.com> Disable debugging for device idle in wear branch DO NOT MERGE ANYWHERE

BUG: 23753686

Change-Id: Ia75046df38ebb8630e1b5ea1709bfe63eb8f177e
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
e4de5a0d3b6e0c897c1cea0912b58e11db962365 23-Sep-2015 Xiaohui Chen <xiaohuic@google.com> Cleanup OWNER references.

Bug: 19913735
Change-Id: I2150c6baaab80fe11312e4401394a2a8da52e595
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
7c69636c9a406265e1da368f3edfd8fb9651132c 16-Sep-2015 Xiaohui Chen <xiaohuic@google.com> Cleanup USER_OWNER in various services

Bug: 19913735
Change-Id: I980370bab18e1b9ccf4043eed2b9fd721a940f72
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
93e6673856a0b851ca5074ae11e6f0635fb3eba9 02-Sep-2015 Joe LaPenna <jlapenna@google.com> Enable debugging for device idle in wear branch DO NOT MERGE ANYWHERE

BUG: 23753686

Change-Id: Ie28631a3abc68001a82a8324054c4480508d930f
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
23d681bb90a4c70d47da895c883b1fdc0854d49a 28-Aug-2015 Joe LaPenna <jlapenna@google.com> Device Idle: Android wear support

- Provide config param: autoPowerModeThresholdAngle allowing us to
adjust the tilt threshold on a per-device basis.
- Provide config param: autoPowerModePrefetchLocation allowing us to
skip location prefectching on a per-device basis.
- Provide config param: autoPowerModeAnyMotionSensor allowing us to
use a device-specific sensor on to detect additional types of movement
that would trigger exiting device idle.
- PRovide config param: autoPowerModePreferWristTilt allows us to use
the wrist tilt detector in lieu of the SMD if an anymotion sensor
isn't specified.
- Allow DeviceIdleController to use wrist tilt sensors if the device provides
one.
- Use wrist tilt or SMD when an "any motion" sensor isn't available.
- Fix bugs where DeviceIdleController would crash on devices that did
not have a location and/or gps provider (some android wear devices).

BUG: 22661021

Change-Id: Ib9f7cdf8f16483ba8f466b7b5c97bdf0494ba228
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
42df4fbe10b5a537fa93ea83f12716300ba0bcdc 15-Aug-2015 Dianne Hackborn <hackbod@google.com> Fix issue #23214751: Get a GPS fix before going in to doze

This introduces a new phase of device idle mode, immediately
before going idle (once we are sure the device is not moving),
try to collect a location for the device so that any later
requests for it will have a good chance of having an accurate
value.

We do this with two location requests: one a single-shot as
accurate as possible location, and a second longer-running
attempt to get an accurate location from the GPS. There is
a limit on how long we will try to collect the location (default
is 30 seconds), and we stop collection once we reach a desired
accuracy (default is 20 meters).

Also cleanup various transition paths out of the normal state
flow to clean up any active state we may have running.

Change-Id: Ibd3d2e9a720fbfd9640755baf5547180dd409f6a
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
4a503b1ece485d44c15eb02ec2bcd464b46e6f7f 07-Aug-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22989030: Separate battery whitelists

We now have a new whitelist you can put apps in, which
opts them out of the old battery saver mode and new app idle,
but doesn't keep them from going in to doze. This is for a few
special cases that we had previously whitelisted for battery saver,
and inherited to the new modes... ultimately we should figure out
how to get these apps out of the whitelist completely, but this
will help for now.

Apps in this new whitelist are not shown in the UI, because they
are still significantly restricted by not being able to operate
normally in doze. This also means they are still visible in the
list of all apps for the user to be able to put them on/off the
complete whitelist if that is what they really want.

In the course of doing this, I needed to clean up code in the
network policy manager to better separate management of the
two firewall rules that now have different whitelists applied
to them. This also hopefully just generally simplifies and cleans
up that code. Hopefully!

Change-Id: I92e15f2f85899571dd8b049b5e3eb1354f55f353
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
451c3468b9186790d5381334a736a35f9b1dab36 22-Jul-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22612630: Ensure SMS/Call delivery during Doze

Add whitelist timeout for SMS.

Change-Id: I3392093000ad177a93b6ef36fb18f0398a671423
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
0b6134b511e0aae7b834fd30198d464f1e13a6fa 15-Jul-2015 Dianne Hackborn <hackbod@google.com> Bump mms whitelist time up to 1 minute.

Change-Id: I09074c440430580fcfb2581275defe61c63c8ae8
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
fd854ee58c5d56f84047007ead9f88a767ae956f 14-Jul-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21626564: MMS should be receivied while Dozing

We now place whoever is receiving the MMS on the temporary
whitelist while doing so, so they can get network access to
download it.

There was also an issue that needed to be fixed where we
were no longer updating the list of allowed uids while
dozing based on their proc states... we now do that.

Also did a bit of optimization of the temp white list update
path do the network policy manager, instead of going through
a broadcast we now directly call in to the network policy
manager. This also allows us to have a synchronous version
of updating the list, so we can know the app has network access
before we tell it to do anything.

Finally added battery stats events for things going on and off
the whitelist so we can diagnose the behavior there.

Change-Id: Ic7fe010af680034d9f8cb014bb135b2addef7455
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
1b1396870793574c651553e11b68337a7c128a09 07-Jul-2015 Dianne Hackborn <hackbod@google.com> Add easy way to get device idle whitelist.

Change-Id: I28b0df69e7fb16b5d7542b1eae626bbfdd9a4c1c
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
3b16cf4f47142a845bf0ede54ef8ef956506c6c3 02-Jul-2015 Dianne Hackborn <hackbod@google.com> Device idle fixes: issue #22209630 and issue #22225665

Issue #22209630: Only allow whitelisted apps to put apps on the temp whitelist

We now check whether the calling app is a system uid or in the whitelist
and, if not, throw an exception.

Issue #22225665: Alarm still goes off in idle mode (doze)

Fix a bug where we were not clearing the calling identity when coming
through the dump command to the service, and as a result when we would
eventually call out to the alarm manager it wouldn't do what we want.
This was only broken when being controlled by the shell.

Also adjust the network policy manager service's handling of device
idle transitions to only toggle the device idle state, which gets rid
of the long delay we have coming out of idle mode. And add in a bit
of logging around going in/out of idle mode to try to understand where
things may be slow in the future.

Change-Id: I4a41f790e9b0bb31330314b94111557d479f2ba5
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
92617036fcc9b25378c8448c923d6346a012346b 20-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21930140: Add config to turn off auto power features

Doze and app standby are now off in the default platform config.
The Google overlay turns them on. Other people can do that as
well, if they are feeling like it.

Change-Id: Ic8a87f696df94f2d8354fe0772d03b672f464e32
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
b6683c428698105f715985a96066192aa62e9f53 19-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #20494208: Go out of device idle when headset button is pressed

Rework how we record active transitions in battery stats to be
more general, and add an API that others can call in to
DeviceIdleController to request that we go out of idle mode.
use this for VOICE_SEARCH_HANDS_FREE.

Change-Id: Ie58de60e63036a4142881283835961fbcceec892
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.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/DeviceIdleController.java
1958e5e7870579337f1d1d3e6c6fae096ba3abb9 13-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21813831: Need API for asking to be added to power whitelist

Add the API. Clean up a few related things.

Change-Id: I190adad1812f36f6095b98a1001fedb94874e8b5
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
31c05d13612205f6a48460d23135695b267e506c 10-Jun-2015 Adam Lesinski <adamlesinski@google.com> Doze: Use Settings.Global.DEVICE_IDLE_CONSTANTS instead of hardcoded constants

This will allow gservices to tweak the settings and experiment
with different values for various doze constants.

The values are encoded in a string as a key=value list. Ex:

inactive_to=5000,idle_factor=0.01

Bug:21640379
Change-Id: Ie98a0e4893f9b46a64d961d6c5c5169b8b8ad742
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
89ecf82f8ecfe328ef5b7ebf140580c8cad868ba 18-May-2015 Kevin Gabayan <gabayan@google.com> simple AnyMotionDetector

Change-Id: I9d49aab83a47c0667a1a059fcb8c7cfddedeb896
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
af575b9f8e1b59be9c8862b6a65c0dcb88145a23 30-May-2015 Amith Yamasani <yamasani@google.com> Temporarily whitelist an app for network during doze

API to allow an app to be whitelisted for network and wakelock
access for a short period. So even if the device is in idle
mode, such apps can be given a chance to download the payload
related to a high priority cloud-to-device message.

This API is meant for system apps only.

A new permission CHANGE_DEVICE_IDLE_TEMP_WHITELIST is required
to make this call.

Bug: 21525864
Change-Id: Id7a761a664f21af5d7ff55aa56e8df98d15511ca
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.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/DeviceIdleController.java
520d8f2ac6ad2c3cd244e1f710103b3a43a41725 09-May-2015 Amith Yamasani <yamasani@google.com> Allow exemption to idle apps at periodic intervals

Triggers are device idle mode changing as well as
internal delayed message handlers.

Bug: 20066058
Change-Id: I0627cfbcc16cfc2b8ac7d298fd2c681a5a6571dd
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
bb9d9278aa6fe3ba3d4c21b03d3e3da4543a974c 12-May-2015 Amith Yamasani <yamasani@google.com> Merge "Idle timebase" into mnc-dev
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/DeviceIdleController.java
8d66b3fbf5d8036e25d64a8472bcd2b6b7892a1a 09-May-2015 Dianne Hackborn <hackbod@google.com> Implement device idle in power manager.

When in device idle mode, we now prevent most apps
from being able to hold partial wake locks. The
device idle controller now pushes its white list of
app uids into the power manager, so it can apply this
policy correctly to only apps that are not whitelisted.

The implementation adds a new "disabled" flag to a wake
lock which is set when we want to apply this policy. When
set, we ensure that we tell battery stats that the wake lock
is not being held and ignore that wake lock when computing
the power state summary.

Also add new SDK APIs to schedule alarms that are allowed
to execute while in idle mode.

Finally add new dumpsys commands to the device idle controller
to completely disable and re-enable its operation, to use
for testing.

Change-Id: I1f16672c6ac06d03bb538f9854d5843db9aa6f27
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
0b4daca9ba54b7252ea8c159218391380eb00c8a 27-Apr-2015 Dianne Hackborn <hackbod@google.com> Implement user-settable power save whitelist.

The whitelist is now maintained by DeviceIdleController,
which is moving out into its own independent system service.
Network stats now queries it for the whitelist, instead of
collecting that itself.

Also did a few improvements in alarm manager -- made the
code for moving alarms out of the pending list more robust,
and fixed the debug output to always print the contents of
the pending list even if we aren't in a pending state. (That
would have helped me identify the problem much earlier.)

Change-Id: I0f7119d4c553c3af4d77b2f71246fa6e2c13c561
/frameworks/base/services/core/java/com/android/server/DeviceIdleController.java
88e98dfa59e68a860d8c3b462ec03bc0b06d6b5c 23-Mar-2015 Dianne Hackborn <hackbod@google.com> More work on device idle mode.

- There is now an API for people to find out about
its state.
- Moved DeviceIdleController to be closer to the
power manager implementation, since they are
closely related.
- Job scheduler now knows about idle state and doesn't
run jobs while the device is idle.
- Battery stats now keeps track of "idling" vs "idle mode".
Idling is when we consider the device to be idle,
independent of whether we are actually in deep idle mode.
This allows us to keep track of longer-term changes
independently of cycling in and out of idle mode.
- Battery stats also now keeps track of package changes in
its daily stats.
- Small optimization to network policy manager service to
not touch uids that do not have the NETWORK permission.

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