• Home
  • History
  • Annotate
  • only in /frameworks/base/services/java/com/android/server/power/
History log of /frameworks/base/services/java/com/android/server/power/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
356bd4cf2c6db38c61c79e81fd5d9d119d299b8d 27-Oct-2012 Jeff Brown <jeffbrown@google.com> Don't scale screen brightness by electron beam level.

This change removes the modulation of the screen brightness
by the electron beam level. The screen brightness remains
constant while the electron beam animation is playing.

Previously we were multiplying the screen brightness by the
electron beam level so as to animate both at the same time.
The problem is that when the screen brightness is already dim
to begin with, it may not be possible to see the electron beam
animation because the modulated screen brightness rapidly
converges on 0. This may manifest give the appearance of
an abrupt transition or a flash as the screen turns off.

Bug: 7387800
Change-Id: I27b90f0098bbdc3de1d66fad819548d1301405cd
isplayPowerState.java
5244c93176497f7c151f85a46e46b534379603bc 24-Oct-2012 Jeff Brown <jeffbrown@google.com> Dim the screen quickly in response to user activity timeout.

Reverts a previous change that made the screen dim slowly instead.
The quick transition does a better job of attracting the user's
attention to the fact that the screen is about to turn off
unless the user touches the screen.

Bug: 7386034
Change-Id: I81e4d8939f6791b96352004984a9e5b2aab79788
isplayPowerController.java
e941b1e27f6aad8a351c3caa3e0ad5f53dbf3707 23-Oct-2012 Jeff Brown <jeffbrown@google.com> Improve auto-brightness hysteresis.

Reintroduced the stability time heuristic which requires brightness
to remain significantly above or below the currently accepted
ambient brightnes before effecting a brightness change. The
heuristic has the nice property of preventing light sensor noise
from causing oscillations in brightness even when the noise has
a relatively large magnitude (such as in low light environments).

The time bound and filter thresholds are current set so that
brightness increases typically occur within 5 seconds of a change
in the ambient environment. Decreases take somewhat longer and
typically occur within 10 seconds.

Changed the timing for brightness animations when the screen is
being dimmed due to a pending user activity timeout. The screen
now dims slowly but then brightens rapidly when touched.
Previously the screen dimmed quickly and brightened slowly which
felt somewhat unresponsive.

Fixed a problem where a brightness change might not occur because
the light sensor had not reported a new value in a long time.
Now we synthesize measurements when needed to ensure that a
transition will take place if appropriate.

Bug: 7387800
Change-Id: I998df2fec59922042a41a1ba4af97ea52c0bd02a
isplayPowerController.java
32dafe25ac2e06f127f48d6a5826537e11575f52 20-Oct-2012 Jeff Brown <jeffbrown@google.com> Reduce screen on/off latency.

Reduce latency of screen on/off and improve how it is synchronized with
backlight changes. Screen state changes are no longer posted to vsync
which should save time. What's more, the state change occurs on a
separate thread so we no longer run the risk of blocking the Looper
for a long time while waiting for the screen to turn on or off.

Bug: 7382919
Bug: 7139924
Change-Id: I375950d1b07e22fcb94efb82892fd817e2f780dc
isplayPowerController.java
isplayPowerState.java
hotonicModulator.java
owerManagerService.java
ed108f3d125b0a4cc465057e3514caf781cdea19 18-Oct-2012 John Spurlock <jspurlock@google.com> Frameworks base: Promote dream setting defaults to config.

So that:
- the values can be shared (to fix assoc bug)
- the values can be customized in product overlays

Bug:7373284
Change-Id: I37f037082523a3d975f6014f36afa28c60117372
owerManagerService.java
4f0e969eabc336f6dfa31c6218efc1b3dec55139 19-Oct-2012 Jeff Brown <jeffbrown@google.com> Reduce auto-brightness jitter.

Apply additional hysteresis controls to prevent repeated brightness
changes within a short interval.

Bug: 7266090
Change-Id: I73122457f6f3200c80188d3716ce2baf38f6a0a6
isplayPowerController.java
hotonicModulator.java
ec6aa5945408ce97034d24e1ba5d80bed88cebf4 18-Oct-2012 Jeff Brown <jeffbrown@google.com> Dream when user activity times out while docked if appropriate.

If the user has requested that dreams start when docked and a user
activity timeout occurs, then start dreaming assuming all of the
other usual conditions are appropriate for dreaming (the device is
powered, etc.).

Previously dreams only started when the device was initial docked
but not if the device fell asleep while remaining docked.

Bug: 7281240
Change-Id: I72c3f854fd1ae8e6615f4fa6e4c4ecd8de37c84b
owerManagerService.java
016ff14f12900a12499a434b297b2192b62ff2da 16-Oct-2012 Jeff Brown <jeffbrown@google.com> Stop dreaming if the battery not charging effectively.

If the user activity timeout expired and the battery appears
to be draining faster than it is charging then stop dreaming
and go to sleep.

Bug: 7312455
Change-Id: I1b9d89e5b2647c72c455d2792e3778a2fe6a4e34
owerManagerService.java
ab887a09ad1a0e82d848a91c49449538377f075d 16-Oct-2012 Jeff Brown <jeffbrown@google.com> Cleanup some internal documentation.

Bug: 7312455
Change-Id: Idefd71f2e9d1abe1b2671dac9702edf7f5fbc118
owerManagerService.java
78eb122450f127d66d4e8cf7f65cad80ea85d3ac 11-Oct-2012 Jeff Brown <jeffbrown@google.com> Dejank electron beam.

On some devices it can take hundreds of milliseconds to get a
brand new EGL surface performing in tip-top shape. To get it
ready make it do a few pushups before the show begins.

Bug: 7318962
Change-Id: I7ae92ce100c368327042a29ffa65faee9b567c8d
lectronBeam.java
3c584f20ac8fe9378c094ad3b63936bca35954ba 10-Oct-2012 Jeff Brown <jeffbrown@google.com> Use exactly the same timings for the ElectronBeam as JB.

Bug: 7318962
Change-Id: Ic04bac5b07ec64fed84a6381ee1916ddeed01255
isplayPowerController.java
lectronBeam.java
20767b2d1ea7af5539e6d3be5e70ce245da34b42 10-Oct-2012 Jeff Brown <jeffbrown@google.com> Don't consider the boot completed until the animation is over.

This fixes a problem where the screen times out shortly after
boot before the user has had a chance to interact with the device.
Now we wait until the boot animation has completed then set
boot completed, poke user activity and start the countdown.

Bug: 7316397
Change-Id: Ie5a0b1012d265e655d33cc8fba49ca349f48f1de
owerManagerService.java
10428748f98518dbaef8c56cf1ad75aabd75da45 10-Oct-2012 Jeff Brown <jeffbrown@google.com> Prevent full wake lock from keeping device awake while dreaming.

A dream may itself hold a wake lock in order to keep the screen
bright as it runs. However this wake lock also causes the device
to stay awake even when it is not plugged in which is undesirable.

This change makes full wake locks behave differently when napping
or dreaming. The wake lock still keeps the screen bright but
it does not prevent the device from falling asleep. This is
similar to our policy of ignoring full wake locks completely when
the device is manually put to sleep by the user.

Bug: 7295909
Change-Id: Id99e82d2143ae1a81629281d6407d7527efb8137
owerManagerService.java
9e316a1a2a8d734315bbd56a85308f9657a92913 09-Oct-2012 Jeff Brown <jeffbrown@google.com> Blank or unblank all displays as need.

Ensures that both the internal display and HDMI are blanked
or unblanked in tandem.

Bug: 7309812
Change-Id: Ie8b96d393e8bb20d23c92f3320142d9f7cf42aff
isplayBlanker.java
isplayPowerController.java
isplayPowerState.java
owerManagerService.java
252c206984299d7ce91c27536cafe1bb2fb9628d 09-Oct-2012 Jeff Brown <jeffbrown@google.com> Improve the power off fade animation.

Fixes an issue where the dim surface alpha was not actually being
animated like it was supposed to.

Bug: 7224614
Change-Id: Iffd54367ca97ae7fd4b9603807f4e036750442b2
isplayPowerController.java
lectronBeam.java
8b9cf1c8000eb581457713a5c0ce41c59f90c353 07-Oct-2012 Jeff Brown <jeffbrown@google.com> Reduce screen on latency, eliminate flashes.

Always use the ElectronBeam now, even when we are only animating
the backlight so that we will have a black surface remaining
on the screen after the screen turns off.

When turning on the screen, keep the black surface showing until
we unblock screen on then dismiss it as usual.

This change eliminates the flashing of old display content when
the screen is turned on. It also helps to conceal some of the
latency of turning the screen on. We always turn the screen on
immediately (even when screen on has nominally been blocked) and
rely on the black surface to hide the screen contents until the
last moment. Dismissing the black surface is practically
instantaneous compared to turning the screen on.

Bug: 7299370
Bug: 7139924
Change-Id: I57d13287acd05bd0a48811095bb02dc7bc7cbeb6
isplayPowerController.java
isplayPowerRequest.java
isplayPowerState.java
lectronBeam.java
creenOnBlocker.java
b76eebff47653daf0c98119aeb68b57cb9a46f9d 06-Oct-2012 Jeff Brown <jeffbrown@google.com> Allow the dim brightness to be brighter than the minimum.

Defines the lower end of the allowable screen brightness range
as the lesser of the dim level, the user brightness setting
minimum value and the lowest auto-brightness level.

Bug: 7295909
Change-Id: I7a72b4611631f9e51578205ff12898c5bae02b1b
isplayPowerController.java
9fca9e96989bb70c3a5fa9de37681c9228c88ae6 05-Oct-2012 Jeff Brown <jeffbrown@google.com> Ensure that dreams show while docked.

Fixed a race between the UiModeManagerService and PowerManagerService
both of which are trying to wake the device when docked / powered.

Bug: 7281240
Change-Id: Ia41fef48f17f2a2eb56549437d295f9a86c95af2
owerManagerService.java
c38c9be031ddad5cf551b55458889f11e01dc5b2 04-Oct-2012 Jeff Brown <jeffbrown@google.com> Coordinate screen on with the window manager.

Bug: 7267457
Change-Id: Ic2c322253639e1f0b2e4e72a7b145025d0240f93
isplayPowerController.java
isplayPowerRequest.java
otifier.java
owerManagerService.java
creenOnBlocker.java
a52772ff26e41dbb242a78a1f30619e23fb13dd7 05-Oct-2012 Jeff Brown <jeffbrown@google.com> Support animating just the backlight when turning off.

Bug: 7224614
Change-Id: Ic9fa7a9e458c89d347b03bce6829f952bdf3b6a5
isplayPowerController.java
isplayPowerState.java
543083593430208af87e51b94cdbbb51cbe2d7b5 05-Oct-2012 Jeff Brown <jeffbrown@google.com> Ensure we send at least one wakeup/gotosleep transition.

This fixes an issue where the device would not lock immediately
when the user quickly pressed power off / power on even if
configured to do so. We were suppressing the screen off
and wake up broadcast in this case.

Now we make sure to always send at least one broadcast to
indicate the transition. We still collapse back-to-back
full cycle transitions though so as not to end up enqueuing
useless broadcasts.

Bug: 7061116
Change-Id: I7211c5fd963c271c2b0aceb4d2f746063c629079
otifier.java
owerManagerService.java
93cbbb25a56356cd36523809783a277fe92e312e 04-Oct-2012 Jeff Brown <jeffbrown@google.com> Allow phone to go to sleep while in call.

Bug: 7279383
Change-Id: Ia05490218f40a1843507b95ff48fa07910e582d4
isplayPowerController.java
owerManagerService.java
c428aae6429c3fd5e2037c3793af399d9f6e23bf 04-Oct-2012 Dianne Hackborn <hackbod@google.com> Fix issue #7267494, issue #7212347

7267494 Calendar is not syncing
Check for whether a content provider is dead before returning
it. This is kind-of a band-aid, but probably the right thing
to do; I'm just not sure exactly the full details of why this
problem is happening. Hopefully this "fixes" it, though I don't
have a way to repro to tell.

7212347 System power off dialog is only visible to user 0
Make it visible. Also turn on some battery debugging stuff and
clean it up so we can just keep it.

Change-Id: I5add25bf2a763c8dfe1df23bc5c753a9ea5d157a
owerManagerService.java
645832dd2ba63d5328cf934ceaa0ec6339573558 03-Oct-2012 Jeff Brown <jeffbrown@google.com> Ensure dreams can be started when not powered.

Previously dreams could not be started unless plugged in.
Now we allow them to start but they will eventually stop
if a user activity timeout occurs and no screen wakelocks
are held.

Bug: 7253639
Change-Id: I84703e144ca6d4aba1ef9437f04a201c3dde8a49
owerManagerService.java
ff532540f18e3b2181da0550fe55045418a3b84e 03-Oct-2012 Jeff Brown <jeffbrown@google.com> Improve the screen dim duration calculation.

Take into account whether the screen off timeout is very short.
If so, we use a shorter dim timeout. Don't allow the dim
time to be more than 20% of the total screen on time so that
the screen remains bright at least 80% of the time even when
the timeout is short.

Bug: 7273646
Change-Id: Iccea764b90f0d8b1df7009d26160c6bcf6eabe5b
owerManagerService.java
f3fb895269deadcda0cf497d421e4b89e8ee8f8f 03-Oct-2012 Jeff Brown <jeffbrown@google.com> Implement screen on hack for wireless chargers.

We can't accurately detect whether the device is resting
on a wireless charger unless it is actually charging.
So we need to tweak the screen on when plugged / unplugged
policy accordingly to avoid spurious wakeups.

Bug: 7234284
Change-Id: I624b559e2e92b8813b12090bc20eca5f5158997e
owerManagerService.java
a4d8204e3068b9d8d6908d4cf3440e81967867a3 03-Oct-2012 Jeff Brown <jeffbrown@google.com> Fix some synchronization issues in BatteryService.

Some of the BatteryService state was being locked
sometimes and it wasn't at all consistent.

Bug: 7158734
Change-Id: I46e75f66fde92c5a577a80a6bd99c9573066f3c1
owerManagerService.java
9ba8d78186647a3f23606b5ccf9adb97b57278fb 02-Oct-2012 Jeff Brown <jeffbrown@google.com> Fix CTS test failures.

Bug: 7001730
Change-Id: I5649b601c310458de5d64b549a407e251d745b7c
owerManagerService.java
db21284a7fb081065d26137891594bd8495b116f 01-Oct-2012 Jeff Brown <jeffbrown@google.com> Disable use of twilight mode for auto-brightness.

This adjustment is still experimental.

Bug: 7165399
Change-Id: I3fcf361933995d02a5329eeaec80155b39371ba3
isplayPowerController.java
1e3b98d47df596d0c4eadbdf60143709f8465b28 01-Oct-2012 Jeff Brown <jeffbrown@google.com> New internal API to eliminate poke locks.

Added a new WindowManager.LayoutParams inputFeatures flag
to disable automatic user activity behavior when an input
event is sent to a window.

Added a new WindowManager.LayoutParams field userActivityTimeout.

Bug: 7165399
Change-Id: I204eafa37ef26aacc2c52a1ba1ecce1eebb0e0d9
owerManagerService.java
edce6a797878792de2b0bde4360f3171b9e9d9d2 01-Oct-2012 Jeff Brown <jeffbrown@google.com> Remove clearUserActivityTimeout().

This function is not implemented and not needed.

Bug: 7165399
Change-Id: Ib1c50fabad6292ccf670404ba70aeb1242c4614d
owerManagerService.java
7f813202cb08a829b59e17be749ffee4a2f482b8 29-Sep-2012 Jeff Brown <jeffbrown@google.com> Merge "Get rid of preventScreenOn()." into jb-mr1-dev
120664816a9bf325b618d8dd40febae2e3636ec8 29-Sep-2012 Jeff Brown <jeffbrown@google.com> Get rid of preventScreenOn().

Bug: 7165399
Change-Id: I1968265ecd74fff4d85efd2ca03b1983425ea518
owerManagerService.java
be87e2f5885b28145a788fd31d1fb5ae88a71100 29-Sep-2012 Dianne Hackborn <hackbod@google.com> Fix issue #7255954: API Review: rename Dream to DreamService

Change-Id: I89ecf2c3ec4fef09c0495aa68de11576f9cfd872
owerManagerService.java
62c82e4d92cc0b856059f905d81885f7808a0e7d 26-Sep-2012 Jeff Brown <jeffbrown@google.com> Make DreamManagerService more robust.

Clearly isolated the DreamManagerService and DreamController
responsibilities. DreamManagerService contains just enough logic to
manage the global synchronous behaviors. All of the asynchronous
behaviors are in DreamController.

Added a new PowerManager function called nap() to request the device
to start napping. If it is a good time to nap, then the
PowerManagerService will call startDream() on the DreamManagerService
to start dreaming.

Fixed a possible multi-user issue by explicitly tracking for
which user a dream service is being started and stopping dreams
when the current user changes. The user id is also passed to
bindService() to ensure that the dream has the right environment.

Fix interactions with docks and the UI mode manager. It is
important that we always send the ACTION_DOCK_EVENT broadcast
to the system so that it can configure audio routing and the like.
When docked, the UI mode manager starts a dock app if there is
one, otherwise it starts a dream.

This change resolves issues with dreams started for reasons other
than a user activity timeout.

Bug: 7204211
Change-Id: I3193cc8190982c0836319176fa2e9c4dcad9c01f
owerManagerService.java
d49359631bc2642be73dc162a8a73207df1e0baf 25-Sep-2012 Jeff Brown <jeffbrown@google.com> Handle user switched for settings changes.

Move OVERLAY_DISPLAY_DEVICES to Global.

Bug: 7127417
Change-Id: I632648ac5b01408512f59424f3bb55162431bea4
owerManagerService.java
f4f6b4c8b0fcf77d46567f13b409255948fe107b 25-Aug-2012 John Spurlock <jspurlock@google.com> Fire "dreaming started" and "dreaming stopped" broadcasts.

Dream manager now fires broadcast intents when entering + exiting
dreamland (except when testing).

Power manager can now listen for dreams ending, using polling only
as a backstop.

Also:
- Bullet-proof dream-manager/dream against known failure modes
- Add new read/write dream permissions
- Refactor dream-manager to delegate work + state management into
a new DreamController class, via a handler

Bug:6999949
Bug:7152024
Change-Id: I986bb7812209d8c95ae1d660a5eee5998a7b08b1
owerManagerService.java
735f740fe81b7172d0b208d584eecf632533ec4a 16-Sep-2012 Jeff Brown <jeffbrown@google.com> Set backlight brightness in correct order.

Disable backlight before turning off the screen.
Enable backlight after turning on the screen.

Bug: 7016215
Change-Id: Idb763f85f7a40e852483c57e0a0d1b27eb943f08
isplayPowerState.java
hotonicModulator.java
631938f26dbc89e7e9530bb85d9f37706dba59f3 09-Sep-2012 Jeff Brown <jeffbrown@google.com> Enable auto-brightness adjustment feature with system prop.

This feature is experimental and disabled by default.

Change-Id: I183534370da7613557e4d1535f556873f8a763df
isplayPowerController.java
ad7353204152389e88b331991274bad04469ae58 07-Sep-2012 Christopher Tate <ctate@google.com> Refer to STAY_ON_WHILE_PLUGGED_IN in the global namespace

This is the one relevant setting that moved from System to Global,
a move that we do not automatically redirect on writes.

Change-Id: I7b26d0c364695c4a10a7cd477db3dfcfe89d7ef5
owerManagerService.java
4ed8fe75e1dde1a2b9576f3862aecc5a572c56b5 31-Aug-2012 Jeff Brown <jeffbrown@google.com> More improvements to the display manager.

Added more complete support for logical displays with
support for mirroring, rotation and scaling.

Improved the overlay display adapter's touch interactions.

A big change here is that the display manager no longer relies
on a single-threaded model to maintain its synchronization
invariants. Unfortunately we had to change this so as to play
nice with the fact that the window manager wants to own
the surface flinger transaction around display and surface
manipulations. As a result, the display manager has to be able
to update displays from the context of any thread.

It would be nice to make this process more cooperative.
There are already several components competing to perform
surface flinger transactions including the window manager,
display manager, electron beam, overlay display window,
and mouse pointer. They are not manipulating the same surfaces
but they can collide with one another when they make global
changes to the displays.

Change-Id: I04f448594241f2004f6f3d1a81ccd12c566bf296
isplayPowerController.java
5ac72a29593ab9a20337a2225df52bdf4754be02 30-Aug-2012 Dianne Hackborn <hackbod@google.com> Improve multi-user broadcasts.

You can now use ALL and CURRENT when sending broadcasts, to specify
where the broadcast goes.

Sticky broadcasts are now correctly separated per user, and registered
receivers are filtered based on the requested target user.

New Context APIs for more kinds of sending broadcasts as users.

Updating a bunch of system code that sends broadcasts to explicitly
specify which user the broadcast goes to.

Made a single version of the code for interpreting the requested
target user ID that all entries to activity manager (start activity,
send broadcast, start service) use.

Change-Id: Ie29f02dd5242ef8c8fa56c54593a315cd2574e1c
otifier.java
hutdownThread.java
bd6e1500aedc5461e832f69e76341bff0e55fa2b 28-Aug-2012 Jeff Brown <jeffbrown@google.com> Add initial multi-display support.

Split the DisplayManager into two parts. One part is bound
to a Context and takes care of Display compatibility and
caching Display objects on behalf of the Context. The other
part is global and takes care of communicating with the
DisplayManagerService, handling callbacks, and caching
DisplayInfo objects on behalf of the process.

Implemented support for enumerating Displays and getting
callbacks when displays are added, removed or changed.

Elaborated the roles of DisplayManagerService, DisplayAdapter,
and DisplayDevice. We now support having multiple display
adapters registered, each of which can register multiple display
devices and configure them dynamically.

Added an OverlayDisplayAdapter which is used to simulate
secondary displays by means of overlay windows. Different
configurations of overlays can be selected using a new
setting in the Developer Settings panel. The overlays can
be repositioned and resized by the user for convenience.

At the moment, all displays are mirrors of display 0 and
no display transformations are applied. This will be improved
in future patches.

Refactored the way that the window manager creates its threads.
The OverlayDisplayAdapter needs to be able to use hardware
acceleration so it must share the same UI thread as the Keyguard
and window manager policy. We now handle this explicitly as
part of starting up the system server. This puts us in a
better position to consider how we might want to share (or not
share) Loopers among components.

Overlay displays are disabled when in safe mode or in only-core
mode to reduce the number of dependencies started in these modes.

Change-Id: Ic2a661d5448dde01b095ab150697cb6791d69bb5
isplayPowerController.java
c479b55abe059776392af54685b77a825871781e 29-Aug-2012 Craig Mautner <cmautner@google.com> Merge "Check proximity detector before powering off." into jb-mr1-dev
4ccbdd17704e8837f8a8fcc152e8de499b504ff6 29-Aug-2012 Craig Mautner <cmautner@google.com> Check proximity detector before powering off.

Do not automatically power off if the proximity detector wakelock is
active.

Fixes bug 7047455.

Change-Id: I44e30bf388292e5c476dfb5d0de9226d21853e4d
owerManagerService.java
64a55af0ac700baecb0877235eb42caac59a3560 26-Aug-2012 Jeff Brown <jeffbrown@google.com> Add plumbing for new surface flinger display API.

Cleaned up the implementation of Surface and SurfaceSession
to use more consistent naming and structure.

Added JNI for all of the new surface flinger display API calls.

Enforced the requirement that all Surfaces created by
the window manager be named.

Updated the display manager service to use the new methods.

Change-Id: I2a658f1bfd0437e1c6f9d22df8d4ffcce7284ca2
lectronBeam.java
d59db50ab0c3c7a232b2a564e763ca46c6f6ebfa 25-Aug-2012 Jeff Brown <jeffbrown@google.com> Merge "Initialize screen state earlier in the boot process." into jb-mr1-dev
f75724b3d36d84c881d4052cfd4be766d454c98f 25-Aug-2012 Jeff Brown <jeffbrown@google.com> Initialize screen state earlier in the boot process.

The system depends on receiving reliable vsync signals from
surface flinger during the boot process. If it doesn't get them
because the screen is off then a hang may occur.

This isn't a problem when surface flinger manages the screen
blanking itself but it is a problem for devices that still
rely on early-suspend. When early-suspend is involved, the
screen may be off without surface flinger knowing. This is a
problem because surface flinger will only synthesize fake
vsyncs when it knows the screen is off, otherwise relying
on the hardware to generate vsync signals itself. Unfortunately,
the hardware won't generate vsync signals if the screen was
turned off by early-suspend, so we have a problem.

Bug: 6975688
Change-Id: Iaf4527f716bf4ea72cc3e6fdaf060855697b02f2
isplayPowerState.java
owerManagerService.java
a2910d0abbbe18ba1710dfd4a31af45769632255 25-Aug-2012 Jeff Brown <jeffbrown@google.com> Make it easier to create asynchronous Handlers.

There are potentially very many Handlers owned by services
that should not be blocked by barriers introduced by UI traversals
occurring on the same thread (if that ever happens).
Add some convenience constructors to make it easy to switch
these Handlers over to being async.

Bug: 7057752
Change-Id: I64d9bffe81e7c52ada4cfad4e89d4340153f4688
isplayPowerController.java
otifier.java
owerManagerService.java
10fb224623eae3a99a4fc68424eb876eb20c3f90 23-Aug-2012 John Spurlock <jspurlock@google.com> Disable screensavers if below first battery warning level.

Don't activate on sleep if below the threshold, and quit any currently
running dream when the threshold is reached.

Bug:6999949
Change-Id: I961b350d24ee6f95e502228aaa57312b0ffbadc1
owerManagerService.java
21b53df7c3fc7501c9c9e238eb820a6dcf992650 23-Aug-2012 John Spurlock <jspurlock@google.com> Merge "Add framework support for multiple dreams." into jb-mr1-dev
b9b56954ec5a242f7c4945942539106539f98ffb 22-Aug-2012 Craig Mautner <cmautner@google.com> Merge "Eliminate special battery calls by WindowManager" into jb-mr1-dev
1a868b7981ca5f52e893fdf9f8f538c9d5ce241d 22-Aug-2012 John Spurlock <jspurlock@google.com> Add framework support for multiple dreams.

Bug:7028665
Change-Id: I4fba6b8e39dc07af4490c621ac3bc7b3867371b2
owerManagerService.java
5d03a5368119d59e9f58b9121bc4f16391140c73 22-Aug-2012 Jeff Brown <jeffbrown@google.com> Fix auto-brightness adjustment sentinel value.

Change-Id: I1b0da4566eb350333d3c3b09a96266627260baa3
owerManagerService.java
259328c04ce16c554b48a14f68d8af94dc54d7ec 22-Aug-2012 Craig Mautner <cmautner@google.com> Eliminate special battery calls by WindowManager

Previous to this change the WindowManager was notifying the
BatteryDtatsService about windows that keep the screen on. WM used a
custom WakeLock tag to indicate to PowerManagerService that it had
already notified the BatteryStatsService.

This change eliminates WindowManager notifying the BatteryStatsService
and lets PowerManagerService do the job.

Fixes bug 7030326.

Change-Id: I666dc6ef8f094b8d3d109fea6876be058e057b4f
otifier.java
00a8f4ff627584f4d9a8ae0cd83f87786005e16d 22-Aug-2012 Jeff Brown <jeffbrown@google.com> Make the electron beam animation shorter.

Now using about the same duration as it used to have when
it was implemented in Surface Flinger.

Change-Id: I09b28222379f4b6583f1f7b34188cc36c50509e9
isplayPowerController.java
lectronBeam.java
aa202a6dc33d331cbd9e34a1bb5f74db6284dda6 22-Aug-2012 Jeff Brown <jeffbrown@google.com> Add a mechanism to adjust auto-brightness at night.

Uses the twilight service to determine the hours of
sunrise and sunset. Shortly after sunset or before sunrise
gradually start to apply a gamma correction factor to the
auto-brightness calculations to make the screen a little
dimmer at night.

The effect is relatively small and is mostly noticeable
in dark rooms. This is just a first pass at the algorithm,
we can tweak the adjustment later to ensure that it has even less
impact in moderate or bright environments.

Change-Id: Idf89022a5d0bb52975e04779352d53fa63371178
isplayPowerController.java
owerManagerService.java
330560f53bccd06be805fee1b7988162119d1295 22-Aug-2012 Jeff Brown <jeffbrown@google.com> Add support for auto-brightness adjust, but leave it disabled.

Auto-brightness adjustment applies a gamma correction factor
between 1/3 and 3 depending on the setting. This feature
is disabled for now.

Change-Id: I2b300b5c455da545bea56b2bae5bc7903e30f30e
isplayPowerController.java
isplayPowerRequest.java
owerManagerService.java
5356c7dc72e80bbadd0ffbc69cfe3ea333280785 21-Aug-2012 Jeff Brown <jeffbrown@google.com> Disable electron beam on animation.

We want the screen to come back on as soon as possible.

Change-Id: Ifdaa2e88d19590c3da53be985dd886633e5cac59
isplayPowerController.java
5f47ba4db739d0db6feb8ce899764dbf87855901 20-Aug-2012 Jeff Brown <jeffbrown@google.com> Adjust auto-brightness time constants.

Specifically, dim a little more slowly.

Change-Id: I10d66a83ddc3a63f8c93d740a0cb116e6c974d10
isplayPowerController.java
6307a150d374cec7b20f80a68800bbf69f495839 20-Aug-2012 Jeff Brown <jeffbrown@google.com> Fix some proximity sensor bugs.

Forgot to clear waiting for proximity negative flag.
Waiting for proximity negative also shouldn't turn the screen off
if it is currently on.

Change-Id: I9885b2f54b185beb961acda44176bc5f11a9f58b
isplayPowerController.java
98365d7663cbd82979a5700faf0050220b01084d 20-Aug-2012 Jeff Brown <jeffbrown@google.com> Refactor for multi-display support.

Split WindowManagerImpl into two parts, the WindowManager
interface implementation remains where it is but the global
communications with the window manager are now handled by
the WindowManagerGlobal class. This change greatly simplifies
the challenge of having separate WindowManager instances
for each Context.

Removed WindowManagerImpl.getDefault(). This represents the
bulk of this change. Most of the usages of this method were
either to perform global functions (now handled by WindowManagerGlobal)
or to obtain the default display (now handled by DisplayManager).

Explicitly associate each new window with a display and make
the Display object available to the View hierarchy.

Add stubs for some new display manager API features.

Start to split apart the concepts of display id and layer stack.
since they operate at different layers of abstraction.
While it's true that each logical display uniquely corresponds to a
surface flinger layer stack, it is not necessarily the case that
they must use the same ids. Added Display.getLayerStack()
and started using it in places where it was relatively easy to do.

Change-Id: I29ed909114dec86807c4d3a5059c3fa0358bea61
isplayPowerController.java
lectronBeam.java
13c589b66c47aa4d988eecce9a12c39d580939c9 17-Aug-2012 Jeff Brown <jeffbrown@google.com> Animate brightness with electron beam.

Also added an internal flag to control whether the electron beam
on animation is used. It's on for now but we might want to
turn if off if we can't get the HAL to provide the
necessary screen on synchronization on all devices.

Change-Id: Iaa3cfa0fd61de10174e68351e4db890eff2d2918
isplayPowerController.java
isplayPowerState.java
122415f5c813408fe2c7b81e33144f2beff9c3d5 16-Aug-2012 Iliyan Malchev <malchev@google.com> Set the brightness to zero on screen-off

Fixes b/6996990

Ideally, the HWC HAL should turn off the backlight when the display is turned
off. This patch enforces this at the PowerManager, which can guard against
errant HWC implementations.

Change-Id: Ibb826a02871c983f8a68034d010e68abe9c5c1d5
Signed-off-by: Iliyan Malchev <malchev@google.com>
isplayPowerState.java
1a30b55036c2279d72ba69cb1107ec5f6f40d5e9 16-Aug-2012 Jeff Brown <jeffbrown@google.com> Use spline interpolation for auto-brightness.

Strictly speaking, this is a change in behavior for all products.
Instead of using discrete zones, they will all now use spline
interpolation. We could make this behavior configurable
but there seems to be little point to it. The range of brightness
values used will be more or less the same as before, it's just
that what used to be the brightness value for all levels within
a particular zone now becomes the brightness value for the
highest level in that zone and lower values are used for lower
levels within the zone.

Change-Id: I39804ee630ba55f018e1e53c0576b28e7bd27931
isplayPowerController.java
06565b64de1953fc9534f789b2e8b8fd70758979 16-Aug-2012 Jeff Brown <jeffbrown@google.com> Improve auto-brightness debounce.

Change-Id: I045e2a14cb31ff987a22872733c442fc92ebadbf
isplayPowerController.java
9630704ed3b265f008a8f64ec60a33cf9dcd3345 28-Jul-2012 Jeff Brown <jeffbrown@google.com> Power manager rewrite.

The major goal of this rewrite is to make it easier to implement
power management policies correctly. According, the new
implementation primarily uses state-based rather than event-based
triggers for applying changes to the current power state.

For example, when an application requests that the proximity
sensor be used to manage the screen state (by way of a wake lock),
the power manager makes note of the fact that the set of
wake locks changed. Then it executes a common update function
that recalculates the entire state, first looking at wake locks,
then considering user activity, and eventually determining whether
the screen should be turned on or off. At this point it may
make a request to a component called the DisplayPowerController
to asynchronously update the display's powe state. Likewise,
DisplayPowerController makes note of the updated power request
and schedules its own update function to figure out what needs
to be changed.

The big benefit of this approach is that it's easy to mutate
multiple properties of the power state simultaneously then
apply their joint effects together all at once. Transitions
between states are detected and resolved by the update in
a consistent manner.

The new power manager service has is implemented as a set of
loosely coupled components. For the most part, information
only flows one way through these components (by issuing a
request to that component) although some components support
sending a message back to indicate when the work has been
completed. For example, the DisplayPowerController posts
a callback runnable asynchronously to tell the PowerManagerService
when the display is ready. An important feature of this
approach is that each component neatly encapsulates its
state and maintains its own invariants. Moreover, we do
not need to worry about deadlocks or awkward mutual exclusion
semantics because most of the requests are asynchronous.

The benefits of this design are especially apparent in
the implementation of the screen on / off and brightness
control animations which are able to take advantage of
framework features like properties, ObjectAnimator
and Choreographer.

The screen on / off animation is now the responsibility
of the power manager (instead of surface flinger). This change
makes it much easier to ensure that the animation is properly
coordinated with other power state changes and eliminates
the cause of race conditions in the older implementation.

The because of the userActivity() function has been changed
so that it never wakes the device from sleep. This change
removes ambiguity around forcing or disabling user activity
for various purposes. To wake the device, use wakeUp().
To put it to sleep, use goToSleep(). Simple.

The power manager service interface and API has been significantly
simplified and consolidated. Also fixed some inconsistencies
related to how the minimum and maximum screen brightness setting
was presented in brightness control widgets and enforced behind
the scenes.

At present the following features are implemented:

- Wake locks.
- User activity.
- Wake up / go to sleep.
- Power state broadcasts.
- Battery stats and event log notifications.
- Dreams.
- Proximity screen off.
- Animated screen on / off transitions.
- Auto-dimming.
- Auto-brightness control for the screen backlight with
different timeouts for ramping up versus ramping down.
- Auto-on when plugged or unplugged.
- Stay on when plugged.
- Device administration maximum user activity timeout.
- Application controlled brightness via window manager.

The following features are not yet implemented:

- Reduced user activity timeout for the key guard.
- Reduced user activity timeout for the phone application.
- Coordinating screen on barriers with the window manager.
- Preventing auto-rotation during power state changes.
- Auto-brightness adjustment setting (feature was disabled
in previous version of the power manager service pending
an improved UI design so leaving it out for now).
- Interpolated brightness control (a proposed new scheme
for more compactly specifying auto-brightness levels
in config.xml).
- Button / keyboard backlight control.
- Change window manager to associated WorkSource with
KEEP_SCREEN_ON_FLAG wake lock instead of talking
directly to the battery stats service.
- Optionally support animating screen brightness when
turning on/off instead of playing electron beam animation
(config_animateScreenLights).

Change-Id: I1d7a52e98f0449f76d70bf421f6a7f245957d1d7
isplayPowerController.java
isplayPowerRequest.java
isplayPowerState.java
lectronBeam.java
otifier.java
hotonicModulator.java
owerManagerService.java
ampAnimator.java
uspendBlocker.java
b9ba2b6768063b4a4135143bc5b6219fb9b3b22f 09-Aug-2012 John Spurlock <jspurlock@google.com> Fix screen timeout determination for starting dream.

It turns out OFF_BECAUSE_OF_TIMEOUT is not the best indicator
of actual screen timeout.

For example, it is the reason passed down when acquiring a wake lock.
This was causing us to launch Dreams in the wrong situations, and
deadlocking on calls to WindowManager.

This fix simply adds an additional check ensuring the intention is to
turn the screen off.

Change-Id: If8adff446b5b1fcb19424b45878b75bfd0552b90
owerManagerService.java
015b9f45d4cfa1e9764d7fbd6142ee612b2ea628 09-Aug-2012 Daniel Sandler <dsandler@android.com> Fix the dock-insertion Dream entry codepath.

Bug: 6956040
Change-Id: I663e13f8a28db13b94d0f5aa4dbcf0cd64ef22fe
owerManagerService.java
bc632a28e4fba4a659baf39b9fd3d06d10cfda97 31-Jul-2012 John Spurlock <jspurlock@google.com> Re-enable dreams: frameworks/base

Enable feature in config. Expose Dream in public api for unbundled apps.
Unhide package. Add isDreaming() method to service.

Re-arrange the Dream api a bit. (use onStart as hook for subclasses).
Coordinate properly with power manager.

Replace old dock mode (don't fire old intent).

Change-Id: I1318d20cc1613e5d862f2913f2fcdc9719302cf7
Bug: 6921930
owerManagerService.java
b696de5c10ebcc7bf42d8487fc0e56e0e937754d 28-Jul-2012 Jeff Brown <jeffbrown@google.com> Move and rename user activity event type constants.

Change-Id: Ie565808796773b6896e71ddfac6aaaf8031de846
owerManagerService.java
fa25bf5382467b1018bd9af7f1cb30a23d7d59f7 24-Jul-2012 Jeff Brown <jeffbrown@google.com> Add display manager skeleton.

The purpose of this change is to remove direct reliance on
SurfaceFlinger for describing the size and characteristics of
displays.

This patch also starts to make a distinction between logical displays
and physical display devices. Currently, the window manager owns
the concept of a logical display whereas the new display
manager owns the concept of a physical display device.

Change-Id: I7e0761f83f033be6c06fd1041280c21500bcabc0
owerManagerService.java
9631314e3d28b6e96ef0b7cc777f1a7747a0ac39 30-Jun-2012 Matthew Xie <mattx@google.com> Fix merge error, put in tmp workaround for input manager.

Fix merge error, missing enableNoAutoConnect api.
Remove bluetoothF from inputManageF.systemReady call as tmp workaround.
Recover shutdownRadios(MAX_RADIO_WAIT_TIME) call in ShutdownThread

Change-Id: Ice2b5c54267755bdbf56c742feabbb8709b92570
hutdownThread.java
0f42037eb7b5118015c2caca635538324ccf0ccf 12-Apr-2012 fredc <fredc@broadcom.com> Non persistent adapter service

Change-Id: Ib13d5c77416e58161df0e04d7a15ec0dddbde8b5

Conflicts:

core/java/android/bluetooth/BluetoothInputDevice.java

Conflicts:

core/java/com/android/internal/app/ShutdownThread.java
services/java/com/android/server/SystemServer.java

Conflicts:

services/java/com/android/server/SystemServer.java
services/java/com/android/server/pm/ShutdownThread.java
hutdownThread.java
e21a4ac09d2473becaea43a73d19e9e836e7732a 07-Mar-2012 Jaikumar Ganesh <jaikumar@google.com> Add a new version of the disable API.

This allows for the setting to be persisted or not.
Also turn on Bluetooth in System Server if needed.
It won't work currently because the service wouldn't have
started.

Change-Id: I15fa2bff93aa32134c1b565fcbe90ba68614b6a1
hutdownThread.java
1abb1cb3a8fe17f7866150604c2fd73751da787e 26-Jan-2012 Jaikumar Ganesh <jaikumar@google.com> Changes to Bluetooth Service structure.

Changes to make Bluetooth Service part of the system_service.
These changes may be temporary.

Changes to update to the new disable API.

Change-Id: If89dba17e6e6c6daa53c37684221763a2da076e9

Conflicts:

services/java/com/android/server/pm/PackageManagerService.java
hutdownThread.java
2c59c5b6b2ee98322a310fd380eba61be6cb4493 28-Jun-2012 Craig Mautner <cmautner@google.com> am 2dca20e1: am 4fa46485: Merge "Update dumpsys power output." into jb-dev

* commit '2dca20e194778e6ce54709a484442df77f8d11be':
Update dumpsys power output.
5359bc38a2f1a39a059c16cb4e435be0d1100c2f 27-Jun-2012 Dianne Hackborn <hackbod@google.com> am 2e8295ce: am 3bb98aec: Merge "Fix issue #6730064: When turning off Nakasi, it very often..." into jb-dev

* commit '2e8295ce1861d8284f16e0f0f80475db0ec2983f':
Fix issue #6730064: When turning off Nakasi, it very often...
8411df2ffddb7f3c6fec57b3d84b65a427732922 23-Jun-2012 Jeff Brown <jeffbrown@google.com> Merge "Remove dead code in PowerManagerService."
88c997a5abb3b2b2df1fb17fa3af40b34fbdd590 22-Jun-2012 Jeff Brown <jeffbrown@google.com> Remove dead code in PowerManagerService.

Also update some code to match coding conventions.

Change-Id: I70be0e6575a20ad268fecdbc6d59ab83915c0f23
owerManagerService.java
223d224fcb14230a27c0b7d5208ad28ff84abf52 21-Jun-2012 Jeff Brown <jeffbrown@google.com> am 071ed334: am fc32ec9a: Merge "Don\'t reset brightness to 0 on initial boot." into jb-dev

* commit '071ed3348739cb3f2bb9ef169067440c8c61b881':
Don't reset brightness to 0 on initial boot.
4f8ecd80296508a1dc69d3f3a23fd91e962c2784 19-Jun-2012 Jeff Brown <jeffbrown@google.com> Move power manager to a new package.

Change-Id: I5f5a6435e64354b7d6535e8e9a63934ba7a3f448
owerManagerService.java
hutdownThread.java