Merge "Add lock or sleep power button behavior."
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user