Commit 0a8d63a4 authored by Michael Thiessen's avatar Michael Thiessen Committed by Commit Bot

VR: Toggle VR mode based on Window Focus.

This helps prevent us from getting into a state where we have a 2D popup
window open but VR mode is on.

Bug: 841814
Change-Id: I280954eb575cf489e10b9307d50e9a862b2b236c
Reviewed-on: https://chromium-review.googlesource.com/1054209
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Reviewed-by: default avatarAmirhossein Simjour <asimjour@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557608}
parent 94e9a605
...@@ -577,7 +577,14 @@ public class VrShellImpl ...@@ -577,7 +577,14 @@ public class VrShellImpl
public void onWindowFocusChanged(boolean focused) { public void onWindowFocusChanged(boolean focused) {
// This handles the case where we open 2D popups in 2D-in-VR. We lose window focus, but stay // This handles the case where we open 2D popups in 2D-in-VR. We lose window focus, but stay
// resumed, so we have to listen for focus gain to know when the popup was closed. // resumed, so we have to listen for focus gain to know when the popup was closed.
if (focused) VrShellDelegate.setVrModeEnabled(mActivity, true); // This also handles the case where we're launched via intent and turn VR mode on with
// a popup open. We'll lose window focus when the popup 'gets shown' and know to turn VR
// mode off.
// TODO(asimjour): Focus is a bad signal. We should listen for windows being created and
// destroyed if possible.
if (VrShellDelegate.getVrClassesWrapper().bootsToVr()) {
VrShellDelegate.setVrModeEnabled(mActivity, focused);
}
} }
@CalledByNative @CalledByNative
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment