History log of /frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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/power/PowerManagerService.java
280a64e793d081847c5dcea23ed9be38aa5332d2 13-Jul-2015 Dianne Hackborn <hackbod@google.com> Improve tracking of screen on reasons.

- New screen on app op to record the last time each app has
caused the screen to be turned on.
- New battery stats event that tells us the reason the screen
has been asked to turn on.
- Propagate out power manager API to specify the reason a caller
is asking to have the screen turned on.

Note that currently the window flag to turn the screen on bypasses
much of this because it is being handled in the window manager by
just directly telling the power manager to turn the screen on. To
make this better we need a new API where it can specify who it is
calling the API for.

Change-Id: I667e56cb1f80508d054da004db667efbcc22e971
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.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/power/PowerManagerService.java
63ec93d57094be624f2069d063146ca713574530 26-Jun-2015 Jim Miller <jaggies@google.com> Merge "Have FingerprintService keep the device awake on relevant events." into mnc-dev
c4bd42c1eedefca4f15816e4e00af617dcfc8993 13-Jun-2015 Jeff Brown <jeffbrown@google.com> Fix reporting of wakelocks to battery stats.

Fixed certain wake lock types which were being incorrectly reported to
BatteryStats as WAKE_TYPE_FULL due to incomplete decoding of the wake
lock level.

Bug: 21949905
Change-Id: Ie3abfc9f473ce721ad042d228175592c7b8ede33
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
dca15d22e8f37d4bc2dfb6db4522ea166149525b 17-Jun-2015 Jim Miller <jaggies@google.com> Have FingerprintService keep the device awake on relevant events.

Fixes bug 20732273

Change-Id: I61b827dd7b1bc706a0288571751032301fd5479f
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.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/power/PowerManagerService.java
cb81d183672a3d9858ade10a997990c5d66a1be3 30-May-2015 Jeff Brown <jeffbrown@google.com> Merge "Tell PhoneWindowManager when we start/finish interactive changes." into mnc-dev
416c49c4049f572134273e228d7988904a51b990 27-May-2015 Jeff Brown <jeffbrown@google.com> Tell PhoneWindowManager when we start/finish interactive changes.

Added some new callbacks that can be used to more precisely trigger
certain behaviors that need to happen around the time the device
is put to sleep and locked.

Fixed an issue where the going to sleep signal might be sent too
early on devices that don't support ambient mode due to the extra
wakefulness change between DOZING and ASLEEP. We are now track
the early / late interactive change work separately from the rest.

Bug: 21375811
Change-Id: I95387195e216ae92a6e45485bd1bd362e41aa45a
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
165102f350e08bd186b25b90dd8a42aad8975890 28-May-2015 Tao Bao <tbao@google.com> Merge "Wait for uncrypt to finish before rebooting" into mnc-dev
90237f7beb55dae79cdcba5271f96be778573737 22-May-2015 Tao Bao <tbao@google.com> Wait for uncrypt to finish before rebooting

/system/bin/uncrypt needs to be triggered to prepare the OTA package
before rebooting into the recovery. For larger packages, uncrypt may be
killed before it finishes the work after the timeout. Change to monitor
the uncrypt status and show the progress to user.

Needs matching changes in bootable/recovery/uncrypt, system/core and
external/sepolicy.

Bug: 20012567
Bug: 20949086
Change-Id: I2348a98312c4dae81f618b45a2ee3b4cf6246ff5
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
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/power/PowerManagerService.java
27bbb2d0a1c8a3bb38768511ac840c3388b0fb03 31-Mar-2015 Jason Monk <jmonk@google.com> Add control for double tap to wake setting

Bug: 16875464
Change-Id: Ic1ad910dd38acbc68ef040b2acdf3696ec2c2e4e
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.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/power/PowerManagerService.java
a576b4d3be8687f0a65fc5777424955d551604e4 24-Apr-2015 Jeff Brown <jeffbrown@google.com> Add code to collect data about auto-brightness adjustments.

Write samples of the old and new state to the binary event log whenever
the user modifies the auto-brightness adjustment. We wait a few seconds
before logging to ensure that the user is satisfied with the adjustment.

Bug: 19786916
Change-Id: I41402decd1034d0839aa0f47495bc00907ab9c08
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
a223d658306fea5c0a6d30c9850058d5afadb2d1 25-Mar-2015 Bryce Lee <brycelee@google.com> am 3309be5e: am 21b7e6de: am c831b978: Merge "Add isScreenBrightnessBoosted and a broadcast when underlying value changes." into lmp-mr1-modular-dev

* commit '3309be5e7bc782d89adaf4abca5f1f81649c655f':
Add isScreenBrightnessBoosted and a broadcast when underlying value changes.
c831b978238d5ed200ca329c540eff00faba77e3 25-Mar-2015 Bryce Lee <brycelee@google.com> Merge "Add isScreenBrightnessBoosted and a broadcast when underlying value changes." into lmp-mr1-modular-dev
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/power/PowerManagerService.java
84d6c0fbf6e513d68330234503b809751d0e3564 17-Mar-2015 Bryce Lee <brycelee@google.com> Add isScreenBrightnessBoosted and a broadcast when underlying
value changes.

Bug: 18334219
Change-Id: I20051e97633017711574a063b8061f95c3b616c5
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
9779e128d611f13cdb44d31b0509ff43c62a35f6 14-Mar-2015 Filip Gruszczynski <gruszczy@google.com> Option for going home when going to sleep for devices without physical button.

Bug: 19623388
Change-Id: Iec16f83c64646ded12ec97d4b540510b7f9dfd47
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
c2932a1be3e320679034212698aff376d5104dbe 21-Nov-2014 Jeff Brown <jeffbrown@google.com> Hold a wake lock while dozing when display updates are pending.

When the display state is DOZE or DOZE_SUSPEND, assume this means
that the AP may go to sleep at any time so hold a wake lock for
a little while starting when traversals are scheduled to ensure
that the AP remains awake long enough to draw and post the frame
to the display hardware.

This patch is somewhat approximate but should be good enough for
most devices today.

Note that the implementation uses the window manager to ensure that
the window which wants to draw is actually visible before acquiring
the wake lock. There is a cost to this test (a round-trip) which
should not be significant today since we do not expect apps to draw
more than one frame or two while dozing. However, if we wanted to
support animations in general, we might want to optimize it or
eliminate the check altogether (since we can already account for
the app's use of the wake lock).

Another way to implement this functionality might be for the view
hierarchy to listen for the power manager to report that it has entered
a non-interactive power state before deciding to poke draw locks.
This would be somewhat more accurate than watching the display state.
Also, the draw lock timeout logic could be implemented more directly
instead of using an ordinary timed wake lock.

Bug: 18284212
Change-Id: I84b341c678303e8b7481bd1620e634fe82cc4350
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
01c06dfb076b71cb72c4bff9175bec9d59d2efde 17-Dec-2014 Michael Runge <mrunge@google.com> Increase timeout when uncrypting OTA

Larger OTAs (750 MB tested) are taking 3-4 minutes
to write, due to the O_SYNC needed to ensure that
the data is actually committed to disk prior to
reboot.

Bug: 18750317
Change-Id: Idfab3ffd0276df4548f69a09c72ad6f4a344b6e6
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.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/power/PowerManagerService.java
cb906677fc65fd1b43f6dc3b8e029711ec8e86dc 13-Nov-2014 Jeff Brown <jeffbrown@google.com> am 24c1d664: Merge "Remove an unnecessary condition from previous change." into lmp-sprout-dev

* commit '24c1d664c4f95a8c997bfc4683844e05b788c3db':
Remove an unnecessary condition from previous change.
72f1e3b9c9992bfc3449c5441bc8e50e7b05f083 13-Nov-2014 Jeff Brown <jeffbrown@google.com> am 1cbff0e3: Merge "Improve screen brightness boost behavior." into lmp-sprout-dev

* commit '1cbff0e310b0fba6b25ca1c1e14eaefeabdee0d9':
Improve screen brightness boost behavior.
a191aa99ab67d05bc72e5e20f854bbdd1ea474c1 13-Nov-2014 Jeff Brown <jeffbrown@google.com> Remove an unnecessary condition from previous change.

Change-Id: Ib966fbb373294ad60caf7f1d9cbb7fafd05ded6b
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
7b5be5e2a738859d36e1977cdc756cf83361d72f 13-Nov-2014 Jeff Brown <jeffbrown@google.com> Improve screen brightness boost behavior.

Wake-up when entering brightness boost mode, don't boost in ambient
mode since some display device drivers do strange things in that mode and
boost doesn't work. Waking up feels more natural as well.

Don't flutter the power HAL's interactive mode bit simply due to changes
in display ready state since that may result in visible artifacts
such as display flashes.

Don't stop the auto-brightness sensor while temporarily boosted.

Don't prevent the display from entering the ready state while in brightness
boost since that would unnecessarily delay the transition from DOZING to AWAKE
until boost is finished.

Restart the user activity timeout when brightness boost ends and prevent
the display from dimming while boosted.

The pixel fairies basked in the sunlight.

Bug: 18262044
Bug: 18261782
Change-Id: I8c42a1e6091b0fe1253e90265ac248087ebc24e1
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
5ce1cb240b13db98fbdc21e1ef069b5f9cec8d72 07-Nov-2014 Jeff Brown <jeffbrown@google.com> Move device admin max screen off timeout to internal interface.

The setting was previously exposed in IPowerManager but it
doesn't need to be there.

Bug: 17656076
Change-Id: If3ed0cbe89f67c60aa00376be0c54b1bd9656144
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
e333e674a758c39885d4d9779a1aad387fb0e6aa 28-Oct-2014 Jeff Brown <jeffbrown@google.com> Add a function to boost screen brightness temporarily.

When PowerManager.boostScreenBrightness() is called, the screen
brightness is set to maximum for 5 seconds. This action is
also considered to be user activity.

Bug: 17934954
Change-Id: I1cb4a03a60705c6c1c5cc9ff84b1c5dbd2932fcd
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
584a44517950204a04ef01345be70b33d8ba43f9 22-Oct-2014 Bryce Lee <brycelee@google.com> [Theater Mode] framework implementation through global setting

Bug: 17684570
Change-Id: I64a9c9c0620049cdfcca0150648fa201281f7178
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
c338784bf6bfcce3cd7db40f46b0e6c815e9ed3a 02-Oct-2014 Dianne Hackborn <hackbod@google.com> Merge "More work on issue #17656716: Unhandled exception in Window Manager" into lmp-dev
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/power/PowerManagerService.java
05af6adb8d4fd5ea069c9aead5a877da9085daa8 01-Oct-2014 Jeff Brown <jeffbrown@google.com> Implement auto-sleep functionality.

Added a new SLEEP_TIMEOUT setting which governs how long the device will
remain awake or dreaming without user activity. By default this
value is set to -1 which maintains today's existing behavior.

We basically represent the time we are allowed to be dreaming as a new
kind of user activity summary state called DREAM, similar to BRIGHT
and DIM. When the sleep timeout expires, the state is cleared and
the dream ends.

Bug: 17665809
Change-Id: I59aa7648dcec215f1285464fc1134934a09230e5
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
3ee549ca2404067bb8b2fcbaa741ec118c76bf3e 23-Sep-2014 Jeff Brown <jeffbrown@google.com> Fix window manager policy state when waking from doze.

Once upon a time when the world was fresh and new, the heavens
had an easy rhythm. Day and night. Night and day. In the day,
the pixel fairies would cavort and play in the bright gardens
with narry a mark of shadow or gloom. In the night, they would
rest peacefully, dreaming no dreams and knowing no fear.

Then one night a fairy dreamed the first dream. At first
the dream was peaceful, full of colors and delight, hopes and
memories. Then all at once, jarringly, it awoke in bright
daylight. The pixel fairy knew fear, for the world had changed
and it was unprepared.

Time passed and the pixel fairies grew accustomed to their
fate, day and night, night and day, sometimes dreaming, until
there came a night when a fairy did not sleep. It roamed
the land in a dreamless doze, lost and afraid amid a grim haze
of grey and darkness. The fairy despaired. It wanted no
part of this place. It pretended for a time to be awake but
the bright daylight would not come. It pretended for a time to
be dreaming but the colors and memories would not come.
That is when the fairy wished for oblivion. Then just as
suddenly, it awoke in the daylight. It fell to the ground,
stunned as if it had forgotten how to walk in the too bright
daylight.

Though the world again grew softer and kinder in time, the pixel
fairies were never the same. For the night is dark and full
of terrors.

---

It used to be easy. Screen on and screen off could explain almost
everything about the state of the device but it's different now with
ambient display. We need to be able to wait for all windows to be
drawn even in the case where the device is still nominally asleep.
In truth, the window manager policy which drives a lot of these
interactions is a thicket of outdated assumptions.

Added a new method to tell the window manager policy when the screen
is being turned off so that it can correctly account for changes
to the interactive state (wakeUp and goingToSleep) and screen state
(screenTurningOn and screenTurnedOff). Now we can independently
poke keyguard during interactive state changes and we can apply
screen on blocking during screen state changes.

Moved the code which manages screen on blocking (which is what
ensures the UI has fully drawn before revealing screen contents)
from the power manager to the display manager since the display
manager is in a better position to accurately track the state of
the screen, particularly when the screen is being turned off.

Fixed a bunch of synchronization issues. Previously some work
had been moved to a handler without considering what might
happen if it became reordered relative to other work happening
elsewhere. Documented the desired behavior in the code to
prevent this from happening again.

There's still a bunch of stuff in here that isn't quite right,
particularly the assumption that there's only one screen, but
it's good enough for now. Hopefully there aren't too many bugs.

Bug: 17605802
Change-Id: Ic7319e09948c8a3cda014d7e169c964a3ad86f14
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
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/power/PowerManagerService.java
8d4e6cb06005a2ce994360340a6191f0690db8f4 14-Sep-2014 John Spurlock <jspurlock@google.com> Saver: PowerManager call to set low power mode.

- Add an explicit power manager call to set the low power mode state,
instead of trying manage everything around a single setting.
- When low-power mode is triggered by falling below the configured
threshold, it does not update the setting.
- The "is-enabled" api returns setting || below configured trigger.
- Move the snooze management into the new api call.
- Callers (sysui + settings) updated to use the api instead of the
setting.
- Handles the case where the level does an unpowered leap out of the
low battery level. (Possible if powered in-between while the device
is off)

Bug:17460535
Change-Id: Ic030504c9cad9868a7137abbe837b170da37852b
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
2175e9c366998ed7bd1a4501b94a02f4f49b932c 13-Sep-2014 Jeff Brown <jeffbrown@google.com> Add support for dozing after screen off.

On some devices, we want the screen off transition to complete before
we start dozing. Added a new config.xml attribute config_dozeAfterScreenOff
to configure this behavior.

Defer starting dreams until the display is ready.

Fixed some minor issues in the system UI doze service when setting the
display state.

Bug: 16187655
Change-Id: Ib1bc60de5457166f4b4880732db5df989dda67a4
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
1208e2718daeae538dc89c37198092ccb32798a2 09-Sep-2014 Michael Wright <michaelwr@google.com> Change constant to PowerManager.RELEAES_FLAG_WAIT_FOR_NO_PROXIMITY

Bug: 17290118
Change-Id: Iae3866bf3f7ac24f756ec4c183e848a79d1f779b
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.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/power/PowerManagerService.java
219857b900e2a15464c6254d8d64b68db7d548c0 28-Aug-2014 Michael Wright <michaelwr@google.com> Change constant to PowerManager#FLAG_WAIT_FOR_DISTANT_PROXIMITY

Also add docs to PowerManager.WakeLock#release(int)

Bug: 17290118
Change-Id: Ibcbc4279efdd0f275808042356e6ff843958e23f
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
0a571123544058578b4ef1558c276a4050519652 22-Aug-2014 Jeff Brown <jeffbrown@google.com> Poke interactive hint from userActivity and add @SystemApi.

Previously we only poked the interactive hint for input events that
were dispatched through the regular input system. However, when
using a car dock in projection mode input events are directly
delivered to apps by other system components, bypassing user activity.
So now we poke the interactive hint on all user activity.

Added an @SystemApi version of userActivity.

Added a new signature|system permission called USER_ACTIVITY
to allow system apps to poke userActivity. For now it seems
prudent to keep DEVICE_POWER signature only.

Bug: 17043684
Change-Id: Ia84bd03083065b8938a9853c08901fbf71b2e56b
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
72671fbb2036e13fccb0b8eeb98be606de1819dd 22-Aug-2014 Jeff Brown <jeffbrown@google.com> Require DEVICE_POWER permission for DOZE_WAKE_LOCK.

This wake lock is only intended to be used internally.

Change-Id: I8d109c492605673616cf7f4f31f082a42fb1d912
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
89e4ae2f504b4c55d7823c3f04d4894de0d8e471 18-Aug-2014 Dianne Hackborn <hackbod@google.com> Merge "Work on issue #16629489: Google (Play?) Services eating through battery" into lmp-dev
d953c53d3b04d772bb1b62ede1c2011641ca82b5 17-Aug-2014 Dianne Hackborn <hackbod@google.com> Work on issue #16629489: Google (Play?) Services eating through battery

There is a bug in how we deal with name overflows combined with resetting
the battery stats data. If we do a reset while a wakelock is being
actively held that has been put into the overflow bucket, then we can
end up reducing the number of known wake locks in the list so when after
that it is released we try to release it under its real name rather than
the overflow name.

This means we need to keep track of which wake locks have been placed
in the overflow bucket while they are actively being used, so we can be
sure to properly handle it as part of that bucket until it is eventually
released.

This makes things... somewhat more complicated. So now we have a class
to take care of all these details, and also use it for other places where
we have the same overflow semantics sync and job stats.

Also fix potential deadlock -- BatteryStatsHelper needs to call on to
ConnectivityManager to find out of there is telepohny, however we use
that class when doing a dump while the battery stats lock is held. To
fix this, we check the connectivity state up in the battery stats service
before acquiring the lock and propagate that information through to the
dump code.

Change-Id: Ib452206af5c36f4b0f03cc94d2845d36613d1ba5
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
3edf5272fb2185403dfe64b9722b9fc9b9de80f8 15-Aug-2014 Jeff Brown <jeffbrown@google.com> Add trace tag for power management.

Instrumented the basic power manager state transitions,
calling into the Power HAL, setting the display power mode,
and setting the backlight.

Bug: 17004602
Change-Id: I4e362162ddfd7292a7eea8b5d029ce3f6593c4a9
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
3d69256fdf3f2006d312824386a4b68b4c6f79bd 15-Aug-2014 Ruchi Kandoi <kandoiruchi@google.com> Revert "PowerManager: Adds a call to reduce refresh rate while device is in BatterySaverMode"

This reverts commit d54157e2e92f58e997c4bdb50e026e6a0d0121fd.

Bug: 16654179
Change-Id: Id4f22c0a4e23518881ac58ad969c16c4612306a2
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
c12035cd40d01b032013f515cb509e6c8791cf65 14-Aug-2014 Jeff Brown <jeffbrown@google.com> Log who is calling goToSleep().

Change-Id: Ibae61c90ee115735835e878bb3bf79eedaa0ae44
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.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/power/PowerManagerService.java
1bb480a3a4ce2ce63c5d09fa7f5cc38ec160ebf4 02-Aug-2014 John Spurlock <jspurlock@google.com> Battery saver: new policy changes + SystemUI tweaks.

- Service policy changes: allow the user to turn off (snooze)
saver mode below the auto-trigger level. Plugging in the
device always exits saver mode.
- Default trigger level is now 0 (never) instead of 15.
- SystemUI now also listens to a new POWER_SAVE_MODE_CHANGING,
since waiting for _CHANGED can take seconds.
- Move shared feature description text into the framework so it
can be shared.
- Tweak dialog title + action strings.
- Remove trigger-level from SystemUI, it no longer needs it.
- Add the ability to turn off saver mode directly from the
notification.
- Migrate saver confirmation dialog to common system UI dialog
helper, and add a few convenience methods.
- Fix bug where the status bar area would be orange over the keyguard
in SHADE_LOCKED mode.

Bug:16214395
Change-Id: I3d1ded1eec9e63e7d97469486f6a320e1bebbccd
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
970d4132ea28e748c1010be39450a98bbf7466f3 19-Jul-2014 Jeff Brown <jeffbrown@google.com> Allow dreams to control screen state and brightness.

Added setDozeScreenState() and setDozeScreenBrightness() methods to
DreamService. The values specified here only take effect once
startDozing is called and can be changed while dozing.

This required some significant rework of the display power controller
but the result seems quite nice and better represents the policy
we want to apply.

Changed the test dream a little bit to make it flash the screen
every minute using the new functions.

Bug: 15903322
Change-Id: I83bcc34503f1b87727d2b2b3c0ef08507f9f0808
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
f6d466895b74d620d646abbec1c8911f3a0ce0bb 18-Jul-2014 Jeff Brown <jeffbrown@google.com> Allow dreams to wake up gently.

This change adds a new DreamService.wakeUp() method to allow a
dream to wake itself up gently and perform a transition before
finally finishing. The power manager will ask a dream to wake
up gently in most cases but may force it to happen immediately
when necessary.

If the dream takes too long to finish itself then the dream
controller will douse it with water summarily after 5 seconds.

Change-Id: Ib0564c5650cd5a454e1acc5aa91fe46995eecfa7
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
0d192a9e279133f80a288d34e50c64a5c91c1a5b 16-Jul-2014 Dianne Hackborn <hackbod@google.com> Maybe fix issue #16167054: Wakelock is acquired and released in...

...battery history even though CPU is in suspend

There is a race in the power manager between noting a wake lock
acquire and ensuring the device is staying awake.

Change-Id: I3d76f99d73dca119b09f253f0e31448408c88a3c
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
0fe32ae50bcbf6d2a281bdc407ce56f3d05632c5 11-Jul-2014 Ruchi Kandoi <kandoiruchi@google.com> PowerManager: Adds a call to reduce refresh rate while device is in
BatterySaverMode.

Adds a binder call to the surface flinger to change the refresh rate
while the device is in BatterySaverMode.

Change-Id: I9b5fdcc279757ceb4b9917cb0445643b50133a04
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
ddef7e776b35aba0f7b4eb4978e93361b49c145f 10-Jul-2014 Dianne Hackborn <hackbod@google.com> Get rid of security exception spam during boot.

Change-Id: If7a516e463722280bf597f7dd601e7a0f6e379c8
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
2139276ce8b54aba5faa858ca69ed5f01445c269 14-Jun-2014 Jeff Brown <jeffbrown@google.com> Refactor BatteryService to new pattern.

Apply SystemService pattern to BatteryService.

Change-Id: I4971b2da8d2aed4d14440fb65863a8b916bab03c
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.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/power/PowerManagerService.java
14272302a8b635bd8e9267c1411d0a7ef11bff45 11-Jun-2014 Dianne Hackborn <hackbod@google.com> Implement control of auto power save mode.

Follow the setting for auto power save mode in both
battery service and battery UI. Default level is 15 when
setting is not set; otherwise it is whatever the setting
gives, with 0 meaning auto battery save is off.

Change how we define the "turn off warn" level to be
an adjustment from the warn level, so we can have a good
value for whatever auto setting is set.

Fix power manager to never go in to power save mode when
plugged in, even if the user has manually turned it on.

Add new delete option to settings command, because I needed
it for testing.

Change-Id: I512b691df84399d50b8e751fd50732c6093ebe85
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
eb94fa7975b1e8742f3b00cec6bd4f9d6b329e3a 04-Jun-2014 Dianne Hackborn <hackbod@google.com> Improvements to low power mode.

Add new public API for monitoring low power mode.

BatteryService now puts device in to low power mode when
battery level is low.

Window manager now watches low power mode to turn off
animations.

Modifying the animator scale now gets propagated to all
processes.

Change-Id: I8fa566994764ddd4e1977631e28381ab9409f8ee
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
d862ebb6036a769cb3be371b396e9e33f89ee365 21-May-2014 Narayan Kamath <narayan@google.com> resolved conflicts for merge of fcc4fed3 to master

Change-Id: Icebca982b01debd67a1470c02651ef8936f6e5b0
6d8fd27e51d799cf7418b14092b5e806d9792812 21-May-2014 Jeff Brown <jeffbrown@google.com> Make power button behavior configurable.

Allow power button to be used to either go to sleep as usual,
which may doze, or skip that completely and really go to sleep.
May also really go to sleep and go home all at once.

Bug: 14406056
Change-Id: Ia19e2551b9c2a72271bb2eddd5c0d1749761e019
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
df3bad37d2e3b52a86b18e0d9c84ede4d5098f92 21-May-2014 Jeff Brown <jeffbrown@google.com> am 8f120dd6: am 0702786d: Merge "Allow display timeouts to be set in config.xml." into klp-modular-dev

* commit '8f120dd6d631ac632d3356b81403a53f958021f0':
Allow display timeouts to be set in config.xml.
27736f5c0ada99bf2a7e007a1dec0ad51f65fa52 21-May-2014 Jeff Brown <jeffbrown@google.com> Allow display timeouts to be set in config.xml.

Bug: 13671523
Change-Id: I79fc21999bc62743178d2d22071455a0c11070c9
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
cbefd8dd2befcb768f911a63becc427ec4c13250 14-May-2014 Dianne Hackborn <hackbod@google.com> Battery stats more wake history, power save mode.

Add new option for battery stats to record the full wake
lock history, and recording the current power save mode.

Also add in some additional error constants when generating
Binder error exceptions.

And fix issue #14974572: Avoid repeating wakeup_reason at
the beginning of history

Change-Id: I7c1a2ab9569de216634f63d8ad69f1294ef1d235
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
6dee605c834fe4926cc1ae5c584563bdb2b608a1 14-May-2014 Adrian Roos <roosa@google.com> Fix adaptive auto brightness bugs

Fix update of the light sensor in AutoBrightnessController.
Register observer for Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ.

Change-Id: I5201259c4efc0afa200fea3ad9fe3af2991d8676
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
15aedf5bfceb7267f0c79e0d29e149f193b15b0a 10-May-2014 Ruchi Kandoi <kandoiruchi@google.com> PowerManager: Minor Coding style issues.

Corrects coding style errors caused by
Ibed319e734340dfd5348dbeb8fe20c01b1adaac5

Change-Id: I81eb0a2bcc4fb45804a1f47aef76d94142f6aba7
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
f974cc870635227ae13201480fb2f019d153af22 01-May-2014 Ruchi Kandoi <kandoiruchi@google.com> Display: Brightness: Low power mode scales the brightness to 50 percent.

When the device is in low power mode all changes to brightness will be
scaled to half of the brightness that would be normally set when not in
low power mode.

Change-Id: I03be820ef64c1d5631ded35f7dfc2799e807226b
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
d83a096f299abd9c7fe5e441ef1bb169c314b575 03-May-2014 Dianne Hackborn <hackbod@google.com> Bump up priority of system receiving BOOT_COMPLETED.

Change-Id: I5166f88f11f781914312e867cb653c8ecbefa705
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
62b8a49856cc0822905dcb7a213f082b92fa69e3 18-Apr-2014 Ruchi Kandoi <kandoiruchi@google.com> Adds Content Observer for the Low power mode in developer options.

Change-Id: Ibed319e734340dfd5348dbeb8fe20c01b1adaac5
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
4e5c089ef3e62e7f658e71c0be262d09bd3e399b 11-Apr-2014 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 337e764d to master

Change-Id: I8168dbf42b68c2f7b5ccb300e0080dddc627af26
037c33eae74bee2774897d969d48947f9abe254f 09-Apr-2014 Jeff Brown <jeffbrown@google.com> Plumb display power state through display manager.

Declare a new method, Display.getState() to retrieve the actual
power state of a display.

Improved documentation for Intent.ACTION_SCREEN_ON and
Intent.ACTION_SCREEN_OFF to clarify what they really mean in
terms of the interactive state of the device.

Deprecated PowerManager.isScreenOn() and replaced it with
PowerManager.isInteractive() with a more suggestive name and
better documentation.

Redirect display power state changes to go through the display
manager first and only then head over to the power manager for
legacy compatibility.

Eliminated the bright here and woke here policy flags since they
were unused. Simplified the input dispatch policy somewhat.

Ensure that screen wake locks are respected up until the point
when dozing really begins.

Fixed a regression in DreamService where onDreamingStarted
might be called before onWindowAttached.

Bug: 13133142
Bug: 13472578
Bug: 13929355
Bug: 13760290
Change-Id: Iabef96921dd554ce3768fb18619cefc3230b5fb0
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
131206b8a9d07400d7c98aea50cc45c38769448f 09-Apr-2014 Jeff Brown <jeffbrown@google.com> Move display power controller to display manager service.

This refactoring is in preparation for enabling the display manager
to have more control over the blanking state of individual displays.
There are no functional changes. Some bits will be cleaned up in
a subsequent patch.

Bug: 13133142
Change-Id: I159a060088344d8e6fcdf9208a1f242960f7ab90
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
ad9ef191f50767d8d5b6f0fbd4b59bb1400dcd25 09-Apr-2014 Jeff Brown <jeffbrown@google.com> Move display power controller to display manager service. (DO NOT MERGE)

This refactoring is in preparation for enabling the display manager
to have more control over the blanking state of individual displays.
There are no functional changes. Some bits will be cleaned up in
a subsequent patch.

Bug: 13133142
Change-Id: Ib811835e8757449c7899ac61807029baaf998161
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
f20a5eb279035d462e1f5d9895f4eb66cc152215 02-Apr-2014 Ruchi Kandoi <kandoiruchi@google.com> PowerManager: add powerHint method

Add powerHint method to IPowerManager for passing power hints from other
processes.

Change-Id: Ic596ace2ed1796a6da4cddb2163dcc4536115e55
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
ef640cdfb29caf9d0abf4aba020afbc3eb3e0443 25-Mar-2014 Dianne Hackborn <hackbod@google.com> Don't allow -1 uids for wake locks.

Change-Id: Ia1b412a166f69247be3b047138349e7b4031bd7d
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
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/power/PowerManagerService.java
088a997defe5ac88d10c341af277bceb7c46f479 12-Mar-2014 Jeff Brown <jeffbrown@google.com> am 81cc19cf: am 236e174a: am 0575b185: Merge "Add a temporary hack to report screen on while dozing." into klp-modular-dev

* commit '81cc19cf18dff969319c7d1ded4f285394e37aab':
Add a temporary hack to report screen on while dozing.
141d88916647cada1c90448d5739a927fa508724 12-Mar-2014 Jeff Brown <jeffbrown@google.com> am 578e1938: am 3ce589e5: am 2d8a3908: Fix power manager display wake lock bugs.

* commit '578e19381c2329511187083045d3ad5509428730':
Fix power manager display wake lock bugs.
0575b185c618a79ede771389ed9a78436b5636bd 12-Mar-2014 Jeff Brown <jeffbrown@google.com> Merge "Add a temporary hack to report screen on while dozing." into klp-modular-dev
2d8a3908d2b0a74ccdecd97e86e7bfda1caa218e 12-Mar-2014 Jeff Brown <jeffbrown@google.com> Fix power manager display wake lock bugs.

Under certain circumstances, the power manager might continue to
hold the display wakelock long after the display had been turned
off due to the mDisplayReady flag having an incorrect value.

1. An inverted conditional caused DisplayPowerState to incorrectly
signal the screen on ready state.

2. The DisplayPowerController failed to clear the block screen on
flag in the case where the screen was turned off before it became
unblocked from turning on. This could happen when the display was
rapidly turned on-off-on-off.

Bug: 13248135
Change-Id: I8faa3034695c83c8cd35613d81acccf40d22128d
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
e39ef098963df1c50912cfeb53c01868ad91a48b 12-Mar-2014 Jeff Brown <jeffbrown@google.com> Add a temporary hack to report screen on while dozing.

The window manager and view hierarchy currently disable all drawing
when PowerManager.isScreenOn() returns false so no drawing occurs
while dozing. This will be fixed in a future patch to take the
display blanking state into account correctly.

This patch is a workaround to unblock development in the meantime.

Bug: 13133142
Change-Id: I2dc0b422c77285e657d73adca2606aa68264d987
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
e5167ca61e2c5607aad9041b44158581bc61b4d8 08-Mar-2014 Dianne Hackborn <hackbod@google.com> Reduce wake lock noise in battery history.

When the work source of a wake lock was changed, this would
cause the old wake lock to be released in battery stats before
the new one was acquired (the power manager would correctly
keep holding the associated wake lock). This resulted in a
pointless entry in the battery history showing the last wake
lock being released and a new one acquired.

This change adds a new path in to battery stats to report
when a wake lock has changed, allowing it to acquire the
new wake locks first before the old ones, so it can't drop
down to zero wake locks. This also provides better timing
information, as the same current time can be used for both
operations.

In addition, added a new kind of history entry for the
current time, so you can tell when in actual world clock
time the battery data is happening.

Change-Id: Ibbf2eed83bb93f31f60267889b7bc5b9e71e355f
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
ddb90b65f7a4bc2c7b0d1af01af00bd0358ed361 28-Feb-2014 Jeff Brown <jeffbrown@google.com> am 098bed6f: am bb689496: am 4c7e6900: Make meaning of PowerManager.isScreenOn() more consistent.

* commit '098bed6f27b05c16ecc30f9d39005e5995f14263':
Make meaning of PowerManager.isScreenOn() more consistent.
4c7e6900c8bfd57652fc1ceca724208ca7556196 28-Feb-2014 Jeff Brown <jeffbrown@google.com> Make meaning of PowerManager.isScreenOn() more consistent.

The power manager sends SCREEN_ON and SCREEN_OFF broadcasts
purely based on the current wakefulness state. In particular,
when the system is awake, we consider the screen to be on even
if the screen may actually be off due to the proximity sensor
or some other condition. Likewise when the system is dozing
or asleep, we consider the screen to be off although technically
it may still be on and dozing.

This behavior is maintained for compatibility with applications
that interpret screen on / off as an indicator of user presence.

As it happened, the value of PowerManager.isScreenOn() did not
always match the state indicated by the broadcasts under certain
situations. Instead, it was based on the desired screen state.
These states used to be closely correlated but the addition
of doze mode causes them to diverge in meaning.

One consequence is that wake events from input devices might not
always wake the device from sleep unless the display's power
state was actually DOZING or OFF even if the power manager's
wakefulness was already DOZING or ASLEEP. This is now fixed.

Change-Id: Ie819c6d2c5a9ffaaf3101c5dee93ff72e9bc9f30
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.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/power/PowerManagerService.java
eb1d804246f031889619e9c5466e899f95c249d0 25-Feb-2014 Jeff Brown <jeffbrown@google.com> am 01d63a35: am ae8106ef: am 2326acb5: Merge "Fix typo that causes dreaming on battery." into klp-modular-dev

* commit '01d63a35245ad20cf5251b69777db5c81fc76a84':
Fix typo that causes dreaming on battery.
966604f1599886989c954b9246f157bb47f4a4f8 25-Feb-2014 Jeff Brown <jeffbrown@google.com> Fix typo that causes dreaming on battery.

Bug: 13173012
Change-Id: I611970a5b4c4b0072ce52e3fc6a57dd3a0c075b3
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
10102e4c0e501333a12b38a5cfe709d1558d84dd 21-Feb-2014 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of baaa080b to master

Change-Id: I3ee12321e298f7a2ea577a99f30c49f3bb497fae
2687550272ba061448f5d5b914700dc335299ee7 31-Jan-2014 Jeff Brown <jeffbrown@google.com> Add a new "doze mode" based on Dream components.

When a doze component has been specified in a config.xml resource
overlay, the power manager will try to start a preconfigured dream
whenever it would have otherwise gone to sleep and turned the
screen off. The dream should render whatever it intends to show
then call startDozing() to tell the power manager to put the display
into a low power "doze" state and allow the application processor
to be suspended. The dream may wake up periodically using the
alarm manager or other features to update the contents of the display.

Added several new config.xml resources related to dreams and dozing.
In particular for dozing there are two new resources that pertain to
decoupling auto-suspend mode and interactive mode from the display
state. This is a requirement to enable the application processor
and other components to be suspended while dozing. Most devices
do not support these features today.

Consolidated the power manager's NAPPING and DREAMING states into one
to simplify the logic. The NAPPING state was mostly superfluous
and simply indicated that the power manager should attempt to start
a new dream. This state is now tracked in the mSandmanSummoned field.

Added a new DOZING state which is analoguous to DREAMING. The normal
state transition is now: AWAKE -> DREAMING -> DOZING -> ASLEEP.
The PowerManager.goToSleep() method now enters the DOZING state instead
of immediately going to sleep.

While in the doze state, the screen remains on. However, we actually
tell the rest of the system that the screen is off. This is somewhat
unfortunate but much of the system makes inappropriate assumptions
about what it means for the screen to be on or off. In particular,
screen on is usually taken to indicate an interactive state where
the user is present but that's not at all true for dozing (and is
only sometimes true while dreaming). We will probably need to add
some more precise externally visible states at some point.

The DozeHardware interface encapsulates a generic microcontroller
interface to allow a doze dream for off-loading rendering or other
functions while dozing. If the device possesses an MCU HAL for dozing
then it is exposed to the DreamService here.

Removed a number of catch blocks in DreamService that caught Throwable
and attempted to cause the dream to finish itself. We actually just
want to let the process crash. Cleanup will happen automatically if
needed. Catching these exceptions results in mysterious undefined
behavior and broken dreams.

Bug: 12494706
Change-Id: Ie78336b37dde7250d1ce65b3d367879e3bfb2b8b
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
88aaef71289177644f723d3d0f20f34a6f9b3d2c 14-Feb-2014 Jeff Brown <jeffbrown@google.com> am ce0552f3: am 8a4c2bb1: am 567f7ca4: Refactor dream manager to new pattern.

* commit 'ce0552f360d8c8f0bc45095293be369800ce9c93':
Refactor dream manager to new pattern.
567f7ca424280ae957b04d4f3df690055f2d41df 31-Jan-2014 Jeff Brown <jeffbrown@google.com> Refactor dream manager to new pattern.

Change-Id: I99ab4bd98d56a290368dc4b24e5bb24e0656b522
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.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/power/PowerManagerService.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/power/PowerManagerService.java
3b0218b0ae1fad67f539ff3c10d6d2f3abec1a11 14-Jan-2014 Doug Zongker <dougz@android.com> boot into recovery via the pre-recovery service

Change PowerManagerService to start the pre-recovery service rather
than rebooting directly, when requested to reboot into recovery. Add
a new RECOVERY permission which a caller needs (in addition to REBOOT)
in order to go to recovery.

Bug: 12188746
Change-Id: I39121b701c4724558fe751adfbad79f8567faa43
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
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/power/PowerManagerService.java
02cc684e42b13454ba1a013340b41696323a4c2a 16-Jan-2014 Jeff Brown <jeffbrown@google.com> Delete unused power manager functionality.

timeSinceScreenWasLastOn() was used by Watchdog previously but is no
longer so we can remove it.

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

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

Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java