| Index: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
|
| index 57117f02ca44088aa58bbf4dab692bd716c8c088..a6b95d0bbad074ebf4f62a7a6f8777136179223b 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
|
| @@ -140,8 +140,15 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
|
| ChromeActivity activity = mTargetActivity.get();
|
| if (activity == null) return;
|
| getInstance(activity).mDonSucceeded = true;
|
| - ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE))
|
| - .moveTaskToFront(activity.getTaskId(), 0);
|
| + if (sInstance.mPaused) {
|
| + ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE))
|
| + .moveTaskToFront(activity.getTaskId(), 0);
|
| + } else {
|
| + // If a WebVR app calls requestPresent in response to the displayactivate event
|
| + // after the DON flow completes, the DON flow is skipped, meaning our app won't be
|
| + // paused when daydream fires our BroadcastReceiver, so onResume won't be called.
|
| + sInstance.handleDonFlowSuccess();
|
| + }
|
| }
|
|
|
| /**
|
| @@ -610,12 +617,7 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
|
| }
|
|
|
| if (mDonSucceeded) {
|
| - mDonSucceeded = false;
|
| - // If we fail to enter VR when we should have entered VR, return to the home screen.
|
| - if (!enterVrAfterDon()) {
|
| - maybeSetPresentResult(false);
|
| - mVrDaydreamApi.launchVrHomescreen();
|
| - }
|
| + handleDonFlowSuccess();
|
| } else if (mRestoreOrientation != null) {
|
| // This means the user backed out of the DON flow, and we won't be entering VR.
|
| maybeSetPresentResult(false);
|
| @@ -623,6 +625,15 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
|
| }
|
| }
|
|
|
| + private void handleDonFlowSuccess() {
|
| + mDonSucceeded = false;
|
| + // If we fail to enter VR when we should have entered VR, return to the home screen.
|
| + if (!enterVrAfterDon()) {
|
| + maybeSetPresentResult(false);
|
| + mVrDaydreamApi.launchVrHomescreen();
|
| + }
|
| + }
|
| +
|
| private void pauseVr() {
|
| mPaused = true;
|
| if (mVrSupportLevel == VR_NOT_AVAILABLE) return;
|
|
|