Merge "Suppress pausing activities when screen off due to proximity." into mnc-dev

This commit is contained in:
Jeff Brown
2015-06-23 02:35:13 +00:00
committed by Android (Google) Code Review

View File

@@ -231,6 +231,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
// The elapsed real time when the screen on was blocked. // The elapsed real time when the screen on was blocked.
private long mScreenOnBlockStartRealTime; private long mScreenOnBlockStartRealTime;
// True if we told the window manager policy that the screen was off.
private boolean mReportedScreenOffToPolicy;
// Remembers whether certain kinds of brightness adjustments // Remembers whether certain kinds of brightness adjustments
// were recently applied so that we can decide how to transition. // were recently applied so that we can decide how to transition.
private boolean mAppliedAutoBrightness; private boolean mAppliedAutoBrightness;
@@ -764,16 +767,21 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
} catch (RemoteException ex) { } catch (RemoteException ex) {
// same process // same process
} }
}
// Tell the window manager what's happening. // Tell the window manager policy when the screen is turned off or on unless it's due
// Temporarily block turning the screen on until the window manager is ready // to the proximity sensor. We temporarily block turning the screen on until the
// by leaving a black surface covering the screen. This surface is essentially // window manager is ready by leaving a black surface covering the screen.
// the final state of the color fade animation. // This surface is essentially the final state of the color fade animation and
boolean isOn = (state != Display.STATE_OFF); // it is only removed once the window manager tells us that the activity has
if (wasOn && !isOn) { // finished drawing underneath.
final boolean isOff = (state == Display.STATE_OFF);
if (isOff && !mReportedScreenOffToPolicy && !mScreenOffBecauseOfProximity) {
mReportedScreenOffToPolicy = true;
unblockScreenOn(); unblockScreenOn();
mWindowManagerPolicy.screenTurnedOff(); mWindowManagerPolicy.screenTurnedOff();
} else if (!wasOn && isOn) { } else if (!isOff && mReportedScreenOffToPolicy) {
mReportedScreenOffToPolicy = false;
if (mPowerState.getColorFadeLevel() == 0.0f) { if (mPowerState.getColorFadeLevel() == 0.0f) {
blockScreenOn(); blockScreenOn();
} else { } else {
@@ -781,7 +789,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
} }
mWindowManagerPolicy.screenTurningOn(mPendingScreenOnUnblocker); mWindowManagerPolicy.screenTurningOn(mPendingScreenOnUnblocker);
} }
}
// Return true if the screen isn't blocked.
return mPendingScreenOnUnblocker == null; return mPendingScreenOnUnblocker == null;
} }
@@ -1086,6 +1095,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
pw.println(" mAppliedLowPower=" + mAppliedLowPower); pw.println(" mAppliedLowPower=" + mAppliedLowPower);
pw.println(" mPendingScreenOnUnblocker=" + mPendingScreenOnUnblocker); pw.println(" mPendingScreenOnUnblocker=" + mPendingScreenOnUnblocker);
pw.println(" mPendingScreenOff=" + mPendingScreenOff); pw.println(" mPendingScreenOff=" + mPendingScreenOff);
pw.println(" mReportedScreenOffToPolicy=" + mReportedScreenOffToPolicy);
pw.println(" mScreenBrightnessRampAnimator.isAnimating()=" + pw.println(" mScreenBrightnessRampAnimator.isAnimating()=" +
mScreenBrightnessRampAnimator.isAnimating()); mScreenBrightnessRampAnimator.isAnimating());