| Index: ash/wm/power_button_controller.cc
|
| diff --git a/ash/wm/power_button_controller.cc b/ash/wm/power_button_controller.cc
|
| index 22fd150455e8d82f59c3c64fc03d6577d81dfed4..19052194a337d62791e8e78046eef0381f9f152c 100644
|
| --- a/ash/wm/power_button_controller.cc
|
| +++ b/ash/wm/power_button_controller.cc
|
| @@ -285,6 +285,7 @@ PowerButtonController::PowerButtonController()
|
| unlocked_login_status_(user::LOGGED_IN_NONE),
|
| power_button_down_(false),
|
| lock_button_down_(false),
|
| + screen_is_off_(false),
|
| shutting_down_(false),
|
| has_legacy_power_button_(
|
| CommandLine::ForCurrentProcess()->HasSwitch(
|
| @@ -345,6 +346,10 @@ void PowerButtonController::OnLockStateChanged(bool locked) {
|
| }
|
| }
|
|
|
| +void PowerButtonController::OnScreenBrightnessChanged(double percent) {
|
| + screen_is_off_ = percent <= 0.001;
|
| +}
|
| +
|
| void PowerButtonController::OnStartingLock() {
|
| if (shutting_down_ || login_status_ == user::LOGGED_IN_LOCKED)
|
| return;
|
| @@ -368,6 +373,11 @@ void PowerButtonController::OnPowerButtonEvent(
|
| if (shutting_down_)
|
| return;
|
|
|
| + // Avoid starting the lock/shutdown sequence if the power button is pressed
|
| + // while the screen is off (http://crbug.com/128451).
|
| + if (screen_is_off_)
|
| + return;
|
| +
|
| if (has_legacy_power_button_) {
|
| // If power button releases won't get reported correctly because we're not
|
| // running on official hardware, just lock the screen or shut down
|
|
|