Merge "Turn on TV when pressing power or wake key during boot"
This commit is contained in:
committed by
Android (Google) Code Review
commit
ab03253dc2
@@ -3479,13 +3479,23 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
if (!mSystemBooted) {
|
||||
// If we have not yet booted, don't let key events do anything.
|
||||
// Exception: Wake and power key events are forwarded to PowerManager to allow it to
|
||||
// wake from quiescent mode during boot.
|
||||
// wake from quiescent mode during boot. On these key events we also explicitly turn on
|
||||
// the connected TV and switch HDMI input if we're a HDMI playback device.
|
||||
boolean shouldTurnOnTv = false;
|
||||
if (down && (keyCode == KeyEvent.KEYCODE_POWER
|
||||
|| keyCode == KeyEvent.KEYCODE_TV_POWER)) {
|
||||
wakeUpFromPowerKey(event.getDownTime());
|
||||
shouldTurnOnTv = true;
|
||||
} else if (down && (isWakeKey || keyCode == KeyEvent.KEYCODE_WAKEUP)
|
||||
&& isWakeKeyWhenScreenOff(keyCode)) {
|
||||
wakeUpFromWakeKey(event);
|
||||
shouldTurnOnTv = true;
|
||||
}
|
||||
if (shouldTurnOnTv) {
|
||||
final HdmiControl hdmiControl = getHdmiControl();
|
||||
if (hdmiControl != null) {
|
||||
hdmiControl.turnOnTv();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user