History log of /frameworks/base/core/java/android/os/PowerManager.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6edb6db512198aa0eef66341d163926b3531bca3 21-Nov-2012 Craig Mautner <cmautner@google.com> Ignore invalid combination of PowerManager flags.

ACQUIRE_CAUSES_WAKEUP is supposed to be ignored if combined with
PARTIAL_WAKE_LOCK. Instead it was being carried out for any values
of the WakeLock level.

This change reverts behavior to closely match
previous releases of the framework by only honoring
ACQUIRE_CAUSES_WAKEUP for screen wake lock levels. The only
difference being that in previous releases ACQUIRE_ could have been
combined with PROXIMITY_SCREEN_OFF_WAKE_LOCK (it never was) and
now such a combination will ignore the ACQUIRE_ flag.

Bug 7532258 fixed.

Change-Id: I46e848d8fd1b57e54c63141bf3d4f353986b5bdf
/frameworks/base/core/java/android/os/PowerManager.java
7b9a28892b1821a657bc9de5245528557d15a154 28-Oct-2012 Dirk Dougherty <ddougherty@google.com> Doc change: fix some table formatting.

Change-Id: I1533be695347697f5afd5c8d2719a0ff0b07abaa
/frameworks/base/core/java/android/os/PowerManager.java
93cbbb25a56356cd36523809783a277fe92e312e 04-Oct-2012 Jeff Brown <jeffbrown@google.com> Allow phone to go to sleep while in call.

Bug: 7279383
Change-Id: Ia05490218f40a1843507b95ff48fa07910e582d4
/frameworks/base/core/java/android/os/PowerManager.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
/frameworks/base/core/java/android/os/PowerManager.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
/frameworks/base/core/java/android/os/PowerManager.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
/frameworks/base/core/java/android/os/PowerManager.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
/frameworks/base/core/java/android/os/PowerManager.java
b9b56954ec5a242f7c4945942539106539f98ffb 22-Aug-2012 Craig Mautner <cmautner@google.com> Merge "Eliminate special battery calls by WindowManager" into jb-mr1-dev
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
/frameworks/base/core/java/android/os/PowerManager.java
f9bba13692c10ff99a52f79d6d0f04c96117ff57 22-Aug-2012 Jeff Brown <jeffbrown@google.com> Make the screen brightness setting limits configurable.

Change-Id: Ica84951c482edef6b7faebe1af22c609a1b9e8be
/frameworks/base/core/java/android/os/PowerManager.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
/frameworks/base/core/java/android/os/PowerManager.java
b696de5c10ebcc7bf42d8487fc0e56e0e937754d 28-Jul-2012 Jeff Brown <jeffbrown@google.com> Move and rename user activity event type constants.

Change-Id: Ie565808796773b6896e71ddfac6aaaf8031de846
/frameworks/base/core/java/android/os/PowerManager.java
155fc70252fd9ccee1f05da4e6966a99ec86d499 27-Jul-2012 Jeff Brown <jeffbrown@google.com> Flatten power manager wake lock constants.

We only support a few basic kinds of wake locks. Rather than
pretend that we could support other weird combinations of features,
just get rid of the feature bits.

Deprecated other wake lock types. We really want to encourage
developers to use FLAG_KEEP_SCREEN_ON instead of managing
their own wake locks, even though its behavior is not
exactly equivalent.

Change-Id: Idfeb0bc6efff0ef2736e47f72a06e69e5a16996e
/frameworks/base/core/java/android/os/PowerManager.java
ff1baef86c3b34fe2aec33a22bc2d06112af4c03 20-Jul-2012 Jeff Brown <jeffbrown@google.com> Fix keyguard wake-up issue.

Bug: 6835809
Change-Id: I7a23b50286592b4c4b104b0b6429f2d05fb5e01b
/frameworks/base/core/java/android/os/PowerManager.java
1244cdaedd5bb4518fc75c9a25b834190ea31877 20-Jun-2012 Jeff Brown <jeffbrown@google.com> Clean up PowerManager API.

Mostly just moved the code around and improved the docs.

Fixed a minor inefficiency in WakeLock.setWorkSource() where
we would tell the power manager that the work source was changed
even when the old work source and new work source were both null.

Fixed a bug in WakeLock.setWorkSource() where we would not
notify the power manager that the work source was changed if
there was no work source previously specified.

Added synchronized to WakeLock.setReferenceCounted.

Added a checked in WakeLock.acquireLocked() and WakeLock.release()
to check whether the wake lock is actually not held / held
before performing the corresponding operation. This change avoids
making redundant calls into the power manager service in the
case where the wake lock is not reference counted and acquire()
or release() have been called multiple times.

Made the PowerManager and WakeLock classes final. They are not
directly instantiable by applications so this change does not
break the API.

Removed a little dead code (one private constructor and an
unused constant).

Change-Id: I4e10cf893506115938a35756136c101256dccf30
/frameworks/base/core/java/android/os/PowerManager.java
7304c343821309dd15f769b18f1de2fa43751573 12-May-2012 Jeff Brown <jeffbrown@google.com> Move power HAL interactions to PowerManagerService.

This refactoring sets the stage for a follow-on change that
will make use additional functions of the power HAL.

Moved functionality from android.os.Power into PowerManagerService.
None of these functions make sense being called outside of the
system server. Moving them to the PowerManagerService makes it
easier to ensure that the power HAL is initialized exactly once.

Similarly, moved ShutdownThread out of the policy package and into
the services package where it can tie into the PowerManagerService
as needed.

Bug: 6435382
Change-Id: I958241bb124fb4410d96f5d5eb00ed68d60b29e5
/frameworks/base/core/java/android/os/PowerManager.java
b5962e73e841455b8e2a4e2d5c0ef0a19d62a803 16-Jun-2011 Jake Hamby <jhamby@google.com> Fix race condition in WakeLocks.

A previous fix to PowerManager.WakeLock introduced a new bug. When
a reference counted wakelock (such as SMSDispatcher) is acquired
multiple times in quick succession with a timeout, the first timeout
would remove the second callback from the handler, decrement the
reference count, but then the wakelock never gets released because
the second callback has been removed.

Bug: 4535237
Change-Id: I4f1240189bf3ed3396c86200c687282597b107d6
/frameworks/base/core/java/android/os/PowerManager.java
d7350e3a56daa44e2d2c6e5175e6430492cf0dc9 05-May-2011 Joe Onorato <joeo@google.com> Fix race conditions in WakeLocks.

Bug: 3439332
Change-Id: I70c583e6a73960df8faad69675947b87642c6228
/frameworks/base/core/java/android/os/PowerManager.java
9567a66a5e6f49dd8495fb5f6e2efb9f32e84b35 20-Apr-2011 Dianne Hackborn <hackbod@google.com> Deprecate a bunch of APIs.

And clean up some documentation.

Change-Id: I7882183b3daf883b7ac6098d19f88dc7cfbcdf61
/frameworks/base/core/java/android/os/PowerManager.java
d710fb500c121b3f9563ccfbe488f7c9d3ec4985 16-Mar-2011 Kenny Root <kroot@google.com> Update WakeLock-related docs to mention permissions

android.permission.WAKE_LOCK permission is required to use WakeLock or
WifiLock, but nowhere is it mentioned that you must declare that
permission to use it.

Change-Id: Ib5f5294d37e39169fe5678743f380d95c4e5a842
/frameworks/base/core/java/android/os/PowerManager.java
36e52dce7f63881dd8061b6d4a6bed7c0721911e 13-Dec-2010 Mike Lockwood <lockwood@android.com> PowerManager: remove unused import

Change-Id: I0cfd48bd7ec0af3be7721994ab31d6f00634a4e0
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/core/java/android/os/PowerManager.java
8310b42fbc086b0f05fc8ef45ac34c7e099c485e 23-Sep-2010 Joe Onorato <joeo@android.com> Add javadoc saying that wake locks are ref counted by default.

Bug: 3012561
Change-Id: I441a42fdb12ba6d87d6f5a49463d6ddcc300acb7
/frameworks/base/core/java/android/os/PowerManager.java
7e9f4eb2608148436cef36c9969bf8a599b39e72 11-Sep-2010 Dianne Hackborn <hackbod@google.com> Track client requests through location manager.

This fixes a problem where applications could ask the location
manager to do very heavy-weight things (like... say... update
location every minute), which would get accounted against the
system instead of the application because ultimately it is the
system making the heavy calls (wake locks, etc).

To solve this, we introduce a new class WorkSource representing
the source of some work. Wake locks and Wifi locks allow you
to set the source to use (but only if you are system code and thus
can get the permission to do so), which is what will be reported
to the battery stats until the actual caller.

For the initial implementation, the location manager keeps track
of all clients requesting periodic updates, and tells its providers
about them as a WorkSource param when setting their min update time.
The network location provider uses this to set the source on the
wake and wifi locks it acquires, when doing work because of the
update period.

This should also be used elsewhere, such as in the GPS provider,
but this is a good start.

Change-Id: I2b6ffafad9e90ecf15d7c502e2db675fd52ae3cf
/frameworks/base/core/java/android/os/PowerManager.java
f5bd092b5099cf43f031c3f53ad01592dda57f4b 22-Mar-2010 Mike Lockwood <lockwood@android.com> Improve wakelock debugging:

Throw NullPointerException if tag is null in PowerManager.newWakelock()
Print wakelock owner's uid and pid in dumpsys power output.

BUG: 2522675

Change-Id: I462c7f8c49f9896b2f58cef5a678ebd2c062a8f7
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/core/java/android/os/PowerManager.java
60d8762413e8daba5f73559786312a9ec5e3b827 17-Dec-2009 Dan Egnor <egnor@google.com> DropBox logging of app & system server crashes.

The crashes are also reported to the event log (and of course the
main logcat, like they always have been). Ordinary Log.e(t,m,e) isn't dropboxed
but there's a new Log.wtf() which always is. (Still @pending in this change.)

Add a hook to IPowerManager to crash the system server on demand
(only for apps with REBOOT permission, since it's basically a restart).
This is not exposed in PowerManager, must be invoked directly -- mostly
this is there so "Bad Behavior" in dev tools can do it.
/frameworks/base/core/java/android/os/PowerManager.java
6fd4e76ca1866772d125089e8f2e3f1d54fcae08 20-Nov-2009 Doug Zongker <dougz@android.com> fix bad link in javadoc that's breaking SDK build
/frameworks/base/core/java/android/os/PowerManager.java
50a21f4d3b70360b36acad20e234c380654fd59f 19-Nov-2009 Doug Zongker <dougz@android.com> add reboot() method to PowerManager

In order to unbundle System Update, we need some to expose in the SDK
some way to reboot the device into recovery. Add a reboot() method to
PowerManager, protected by the android.permission.REBOOT permission.
/frameworks/base/core/java/android/os/PowerManager.java
0e39ea83c5578e0d55e120c91ff7cfeeb0c1cb2f 18-Nov-2009 Mike Lockwood <lockwood@android.com> Fixes for proximity sensor behavior:

Add optional flag to Wakelock.release() to specify whether we should wait for proximity sensor to go negative before turning on the screen.
Clear the "waiting for proximity sensor to go negative" state when the power key is pressed.

Part of the fix for b/2243198 (Black screen lockup after ending call)

Change-Id: I813fdb7aa4192cd3384a25be9e59d7d4b90da53a
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/core/java/android/os/PowerManager.java
322591cb4b158dc2edbc3d95cd02e44f132feb5f 29-Oct-2009 Charles Mendis <cmendis@google.com> Expose PowerManager.isScreenOn in the public api.

Change-Id: I6ccd2ebcbf3f8ad9ffa4b86a9c037cb0c25a7b78
/frameworks/base/core/java/android/os/PowerManager.java
237a29923a05663a2195bf93b392768dbaf31ebf 15-Sep-2009 Mike Lockwood <lockwood@android.com> Move backlight brightness from HardwareService to PowerManager

to prevent apps from changing the hardware behind its back.
Fixes b/2041941 Lock screen flashes the screen very bright before dimming

Change-Id: Ice757f7ae87902bdfb3634471cf44f020ebfaae4
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/core/java/android/os/PowerManager.java
bc706a03a25f0dfe2cb0ecd1f6e4f7be905592a7 27-Jul-2009 Mike Lockwood <lockwood@android.com> PowerManager: Add proximity sensor support.

Add new wakelock flag PROXIMITY_SCREEN_OFF_WAKE_LOCK.
If you create a wakelock with this flag, while the wakelock is acquired,
the screen will turn off automatically when the sensor detects an object close to the screen.
Removing the object will cause the screen to wake up again.

Added PowerManager.getSupportedWakeLockFlags(), which can be used to determine
if proximity screen off wakelocks are supported by the hardware.

Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/core/java/android/os/PowerManager.java
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/os/PowerManager.java
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/os/PowerManager.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/java/android/os/PowerManager.java