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

Commit e27a7f93 authored by Bryce Lee's avatar Bryce Lee Committed by Android (Google) Code Review
Browse files

Merge "Add lock or sleep power button behavior."

parents 495ce3dd 8cc7529a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -261,6 +261,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    static final int SHORT_PRESS_POWER_REALLY_GO_TO_SLEEP_AND_GO_HOME = 3;
    static final int SHORT_PRESS_POWER_GO_HOME = 4;
    static final int SHORT_PRESS_POWER_CLOSE_IME_OR_GO_HOME = 5;
    static final int SHORT_PRESS_POWER_LOCK_OR_SLEEP = 6;

    // must match: config_LongPressOnPowerBehavior in config.xml
    static final int LONG_PRESS_POWER_NOTHING = 0;
@@ -976,6 +977,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    }
                    break;
                }
                case SHORT_PRESS_POWER_LOCK_OR_SLEEP: {
                    if (keyguardOn()) {
                        sleepDefaultDisplayFromPowerButton(eventTime, 0);
                    } else {
                        lockNow(null /*options*/);
                    }
                    break;
                }
            }
        }
    }