summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2009-10-28 12:45:38 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2009-10-28 12:45:38 -0700
commite1da9d35834fa9680ab2e23fde42eb0eacb28ac7 (patch)
tree4f3b43d5dedc15b9befba8a3eff4e1dee1e8917e /services
parenta292fefeb77ed8e33afd7451090c3e21761fd266 (diff)
parent7c64d4486ad8704f0b63474e2da0dd89147771ad (diff)
downloadframeworks_base-e1da9d35834fa9680ab2e23fde42eb0eacb28ac7.zip
frameworks_base-e1da9d35834fa9680ab2e23fde42eb0eacb28ac7.tar.gz
frameworks_base-e1da9d35834fa9680ab2e23fde42eb0eacb28ac7.tar.bz2
am 7c64d448: am 8061f64f: Merge change Ib0d3d9d0 into eclair
Merge commit '7c64d4486ad8704f0b63474e2da0dd89147771ad' into eclair-mr2-plus-aosp * commit '7c64d4486ad8704f0b63474e2da0dd89147771ad': PowerManagerService: Clear Binder calling identity around calls to Sensor Manager.
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/PowerManagerService.java36
1 files changed, 27 insertions, 9 deletions
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index aad576f..f3a91e7 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -2273,15 +2273,27 @@ class PowerManagerService extends IPowerManager.Stub
if (mSpew) {
Log.d(TAG, "enableProximityLockLocked");
}
- mSensorManager.registerListener(mProximityListener, mProximitySensor,
- SensorManager.SENSOR_DELAY_NORMAL);
+ // clear calling identity so sensor manager battery stats are accurate
+ long identity = Binder.clearCallingIdentity();
+ try {
+ mSensorManager.registerListener(mProximityListener, mProximitySensor,
+ SensorManager.SENSOR_DELAY_NORMAL);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
}
private void disableProximityLockLocked() {
if (mSpew) {
Log.d(TAG, "disableProximityLockLocked");
}
- mSensorManager.unregisterListener(mProximityListener);
+ // clear calling identity so sensor manager battery stats are accurate
+ long identity = Binder.clearCallingIdentity();
+ try {
+ mSensorManager.unregisterListener(mProximityListener);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
synchronized (mLocks) {
if (mProximitySensorActive) {
mProximitySensorActive = false;
@@ -2296,12 +2308,18 @@ class PowerManagerService extends IPowerManager.Stub
}
if (mSensorManager != null && mLightSensorEnabled != enable) {
mLightSensorEnabled = enable;
- if (enable) {
- mSensorManager.registerListener(mLightListener, mLightSensor,
- SensorManager.SENSOR_DELAY_NORMAL);
- } else {
- mSensorManager.unregisterListener(mLightListener);
- mHandler.removeCallbacks(mAutoBrightnessTask);
+ // clear calling identity so sensor manager battery stats are accurate
+ long identity = Binder.clearCallingIdentity();
+ try {
+ if (enable) {
+ mSensorManager.registerListener(mLightListener, mLightSensor,
+ SensorManager.SENSOR_DELAY_NORMAL);
+ } else {
+ mSensorManager.unregisterListener(mLightListener);
+ mHandler.removeCallbacks(mAutoBrightnessTask);
+ }
+ } finally {
+ Binder.restoreCallingIdentity(identity);
}
}
}