Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c64d448 authored by Mike Lockwood's avatar Mike Lockwood Committed by Android Git Automerger
Browse files

am 8061f64f: Merge change Ib0d3d9d0 into eclair

Merge commit '8061f64f' into eclair-mr2

* commit '8061f64f':
  PowerManagerService: Clear Binder calling identity around calls to Sensor Manager.
parents 4c071f0d 8061f64f
Loading
Loading
Loading
Loading
+27 −9
Original line number Diff line number Diff line
@@ -2273,15 +2273,27 @@ class PowerManagerService extends IPowerManager.Stub
        if (mSpew) {
            Log.d(TAG, "enableProximityLockLocked");
        }
        // 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");
        }
        // 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,6 +2308,9 @@ class PowerManagerService extends IPowerManager.Stub
        }
        if (mSensorManager != null && mLightSensorEnabled != enable) {
            mLightSensorEnabled = enable;
            // 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);
@@ -2303,6 +2318,9 @@ class PowerManagerService extends IPowerManager.Stub
                    mSensorManager.unregisterListener(mLightListener);
                    mHandler.removeCallbacks(mAutoBrightnessTask);
                }
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }
    }