am 99a6c1cb: Merge "[Theater Mode] Add framework support for screen double tapping out of theater mode." into lmp-sprout-dev automerge: abf33e4
* commit '99a6c1cbe83baff199be6fd69234e20b4b14241d': [Theater Mode] Add framework support for screen double tapping out of theater mode.
This commit is contained in:
@@ -4767,18 +4767,39 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
@Override
|
@Override
|
||||||
public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) {
|
public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) {
|
||||||
if ((policyFlags & FLAG_WAKE) != 0) {
|
if ((policyFlags & FLAG_WAKE) != 0) {
|
||||||
wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotion);
|
if (wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotion)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldDispatchInputWhenNonInteractive()) {
|
if (shouldDispatchInputWhenNonInteractive()) {
|
||||||
return ACTION_PASS_TO_USER;
|
return ACTION_PASS_TO_USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldDispatchInputWhenNonInteractive() {
|
private boolean shouldDispatchInputWhenNonInteractive() {
|
||||||
return keyguardIsShowingTq() && mDisplay != null &&
|
// Send events to keyguard while the screen is on.
|
||||||
mDisplay.getState() != Display.STATE_OFF;
|
if (keyguardIsShowingTq() && mDisplay != null && mDisplay.getState() != Display.STATE_OFF) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send events to a dozing dream even if the screen is off since the dream
|
||||||
|
// is in control of the state of the screen.
|
||||||
|
IDreamManager dreamManager = getDreamManager();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (dreamManager != null && dreamManager.isDreaming()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.e(TAG, "RemoteException when checking if dreaming", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, consume events since the user can't see what is being
|
||||||
|
// interacted with.
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatchMediaKeyWithWakeLock(KeyEvent event) {
|
void dispatchMediaKeyWithWakeLock(KeyEvent event) {
|
||||||
@@ -4949,12 +4970,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
wakeUp(eventTime, mAllowTheaterModeWakeFromPowerKey);
|
wakeUp(eventTime, mAllowTheaterModeWakeFromPowerKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void wakeUp(long wakeTime, boolean wakeInTheaterMode) {
|
private boolean wakeUp(long wakeTime, boolean wakeInTheaterMode) {
|
||||||
if (!wakeInTheaterMode && isTheaterModeEnabled()) {
|
if (!wakeInTheaterMode && isTheaterModeEnabled()) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mPowerManager.wakeUp(wakeTime);
|
mPowerManager.wakeUp(wakeTime);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called on the PowerManager's Notifier thread.
|
// Called on the PowerManager's Notifier thread.
|
||||||
|
|||||||
Reference in New Issue
Block a user