diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-09-10 18:43:00 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-09-13 14:20:48 -0700 |
commit | 7e9f4eb2608148436cef36c9969bf8a599b39e72 (patch) | |
tree | 16351bff3017f948792a6308f4f6698e0a9d769c /cmds/svc | |
parent | cc5494c9996f809e36539b24e8b6b67683383d29 (diff) | |
download | frameworks_base-7e9f4eb2608148436cef36c9969bf8a599b39e72.zip frameworks_base-7e9f4eb2608148436cef36c9969bf8a599b39e72.tar.gz frameworks_base-7e9f4eb2608148436cef36c9969bf8a599b39e72.tar.bz2 |
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
Diffstat (limited to 'cmds/svc')
-rw-r--r-- | cmds/svc/src/com/android/commands/svc/PowerCommand.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmds/svc/src/com/android/commands/svc/PowerCommand.java b/cmds/svc/src/com/android/commands/svc/PowerCommand.java index d3ec3d9..e1d6619 100644 --- a/cmds/svc/src/com/android/commands/svc/PowerCommand.java +++ b/cmds/svc/src/com/android/commands/svc/PowerCommand.java @@ -64,7 +64,7 @@ public class PowerCommand extends Svc.Command { = IPowerManager.Stub.asInterface(ServiceManager.getService(Context.POWER_SERVICE)); try { IBinder lock = new Binder(); - pm.acquireWakeLock(PowerManager.FULL_WAKE_LOCK, lock, "svc power"); + pm.acquireWakeLock(PowerManager.FULL_WAKE_LOCK, lock, "svc power", null); pm.setStayOnSetting(val); pm.releaseWakeLock(lock, 0); } |