/** {@inheritDoc} */
@Override
public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) {
if ((policyFlags & FLAG_WAKE) != 0) {
if (wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotion,
"android.policy:MOTION")) {
return 0;
}
}
if (shouldDispatchInputWhenNonInteractive()) {
return ACTION_PASS_TO_USER;
}
// If we have not passed the action up and we are in theater mode without dreaming,
// there will be no dream to intercept the touch and wake into ambient. The device should
// wake up in this case.
if (isTheaterModeEnabled() && (policyFlags & FLAG_WAKE) != 0) {
wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotionWhenNotDreaming,
"android.policy:MOTION");
}