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

Commit 149f6710 authored by Mike Lockwood's avatar Mike Lockwood Committed by Android Git Automerger
Browse files

am 17479ebe: Merge change I1bc566a1 into eclair

Merge commit '17479ebe' into eclair-mr2

* commit '17479ebe':
  Ignore the light sensor if the screen is turning off.
parents ee9f9759 17479ebe
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -1440,6 +1440,8 @@ class PowerManagerService extends IPowerManager.Stub
                        sendNotificationLocked(true, -1);
                    }
                } else {
                    // cancel light sensor task
                    mHandler.removeCallbacks(mAutoBrightnessTask);
                    mScreenOffTime = SystemClock.elapsedRealtime();
                    long identity = Binder.clearCallingIdentity();
                    try {
@@ -1803,6 +1805,10 @@ class PowerManagerService extends IPowerManager.Stub
        }
    }

    private boolean isScreenTurningOffLocked() {
        return (mScreenBrightness.animating && mScreenBrightness.targetValue == 0);
    }

    private void forceUserActivityLocked() {
        // cancel animation so userActivity will succeed
        mScreenBrightness.animating = false;
@@ -1863,7 +1869,7 @@ class PowerManagerService extends IPowerManager.Stub
                        + " force=" + force);
            }
            // ignore user activity if we are in the process of turning off the screen
            if (mScreenBrightness.animating && mScreenBrightness.targetValue == 0) {
            if (isScreenTurningOffLocked()) {
                Log.d(TAG, "ignoring user activity while turning off screen");
                return;
            }
@@ -2441,6 +2447,11 @@ class PowerManagerService extends IPowerManager.Stub
    SensorEventListener mLightListener = new SensorEventListener() {
        public void onSensorChanged(SensorEvent event) {
            synchronized (mLocks) {
                // ignore light sensor while screen is turning off
                if (isScreenTurningOffLocked()) {
                    return;
                }

                int value = (int)event.values[0];
                long milliseconds = event.timestamp / 1000000;
                if (mDebugLightSensor) {