Commit f6287e44 authored by Michael Thiessen's avatar Michael Thiessen Committed by Commit Bot

Revert "Reland "VR: Use isInVrSession API to keep Chrome in VR until user has left VR""

This reverts commit 2702f2e5.

Reason for revert: Making fixing DLAs on P too difficult. Will reland once P issues are fixed.

Original change's description:
> Reland "VR: Use isInVrSession API to keep Chrome in VR until user has left VR"
> 
> This reverts commit 0e39bd62.
> 
> Original change's description:
> > Revert "VR: Use isInVrSession API to keep Chrome in VR until user has left VR"
> > 
> > This reverts commit dc55fd14.
> > 
> > Reason for revert: Suspected to have broken chrome_public_test_vr_apk on main waterfall
> > https://ci.chromium.org/buildbot/chromium.android/Marshmallow%20Phone%20Tester%20%28rel%29/?limit=200
> > first failing build contains this cl:
> > https://ci.chromium.org/buildbot/chromium.android/Marshmallow%20Phone%20Tester%20%28rel%29/3088
> > 
> > Original change's description:
> > > VR: Use isInVrSession API to keep Chrome in VR until user has left VR
> > > 
> > > This fixes the Daydream Dashboard issues so that if Chrome is simply
> > > stopped/started in VR without any intents, Chrome stays in VR.
> > > 
> > > Also makes resuming Chrome from DD home way faster if Chrome was
> > > already in VR.
> > > 
> > > Bug: 780887
> > > Change-Id: Iab7f713bfc5b85972f908ea141e3b495297d7286
> > > Reviewed-on: https://chromium-review.googlesource.com/944547
> > > Reviewed-by: Yash Malik <ymalik@chromium.org>
> > > Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
> > > Cr-Commit-Position: refs/heads/master@{#540403}
> > 
> > TBR=mthiesse@chromium.org,ymalik@chromium.org
> > 
> > Change-Id: I7ae67f5d23d816796cc7f567792e181900b3012a
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: 780887
> > Reviewed-on: https://chromium-review.googlesource.com/946709
> > Reviewed-by: Benjamin Pastene <bpastene@chromium.org>
> > Commit-Queue: Benjamin Pastene <bpastene@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#540588}
> 
> TBR=mthiesse@chromium.org,ymalik@chromium.org
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Bug: 780887
> Change-Id: I690474b0dd7b8dff7e7a5b2dbd036b0f97eacb52
> Reviewed-on: https://chromium-review.googlesource.com/949083
> Reviewed-by: Michael Thiessen <mthiesse@chromium.org>
> Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#540950}

TBR=mthiesse@chromium.org,ymalik@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 780887
Change-Id: If259e45f972b4ccc24e39304ca2e1a683f295059
Reviewed-on: https://chromium-review.googlesource.com/958020
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542586}
parent 11ae2a99
......@@ -77,12 +77,6 @@ public interface VrDaydreamApi {
*/
Intent setupVrIntent(Intent intent);
/**
* Whether the user is currently in a VR session. Note that this should be treated as heuristic,
* and may at times be wrong.
*/
boolean isInVrSession();
/**
* Closes this DaydreamApi instance.
*/
......
......@@ -135,11 +135,6 @@ public class VrDaydreamApiImpl implements VrDaydreamApi {
return DaydreamApi.setupVrIntent(intent);
}
@Override
public boolean isInVrSession() {
return DaydreamApi.isInVrSession(mContext);
}
@Override
public void launchGvrSettings() {
Activity activity = WindowAndroid.activityFromContext(mContext);
......
......@@ -988,16 +988,16 @@ public class VrShellDelegate
}
private void onVrIntent() {
mNeedsAnimationCancel = true;
mInVrAtChromeLaunch = true;
if (mInVr) return;
mNeedsAnimationCancel = true;
mEnterVrOnStartup = true;
// TODO(mthiesse): Assuming we've gone through DON flow saves ~2 seconds on VR entry. See
// the comments in enterVr(). This may not always be the case in the future, but for now
// it's a reasonable assumption.
mDonSucceeded = true;
mInVrAtChromeLaunch = true;
if (!mPaused) enterVrAfterDon();
}
......@@ -1377,23 +1377,24 @@ public class VrShellDelegate
});
}
mCancellingEntryAnimation = false;
if (mEnterVrOnStartup) {
// This means that Chrome was started with a VR intent, so we should enter VR.
// TODO(crbug.com/776235): VR intents are dispatched to ChromeActivity via a launcher
// which should handle the DON flow to simplify the logic in VrShellDelegate.
assert !mProbablyInDon;
if (DEBUG_LOGS) Log.i(TAG, "onResume: entering VR mode for VR intent");
mCancellingEntryAnimation = false;
if (enterVrInternal() == ENTER_VR_CANCELLED) {
cancelPendingVrEntry();
}
} else if (mDonSucceeded) {
mCancellingEntryAnimation = false;
handleDonFlowSuccess();
} else {
if (mProbablyInDon) {
// This means the user backed out of the DON flow, and we won't be entering VR.
maybeSetPresentResult(false, mDonSucceeded);
shutdownVr(true, false);
}
// If we were resumed at the wrong density, we need to trigger activity recreation.
......@@ -1438,6 +1439,10 @@ public class VrShellDelegate
// are safe.
if (mInVr) mVrShell.pause();
if (mShowingDaydreamDoff || mProbablyInDon) return;
// TODO(mthiesse): When the user resumes Chrome in a 2D context, we don't want to tear down
// VR UI, so for now, exit VR.
shutdownVr(true /* disableVrMode */, false /* stayingInChrome */);
}
protected void onPause() {
......@@ -1448,6 +1453,10 @@ public class VrShellDelegate
unregisterDaydreamIntent(mVrDaydreamApi);
if (mVrSupportLevel == VrSupportLevel.VR_NOT_AVAILABLE) return;
// TODO(ymalik): We should be able to remove this if we handle it for multi-window in
// {@link onMultiWindowModeChanged} since we're calling it in onStop.
if (!mInVr && !mProbablyInDon) cancelPendingVrEntry();
// When the active web page has a vrdisplayactivate event handler,
// mListeningForWebVrActivate should be set to true, which means a vrdisplayactive event
// should be fired once DON flow finished. However, DON flow will pause our activity,
......@@ -1467,12 +1476,12 @@ public class VrShellDelegate
if (maybeCloseVrCct()) return;
mStopped = false;
if (mDonSucceeded) setWindowModeForVr();
if (mInVr && !mVrDaydreamApi.isInVrSession()) shutdownVr(true, false);
}
private void onStop() {
if (DEBUG_LOGS) Log.i(TAG, "onStop");
mStopped = true;
if (!mProbablyInDon) cancelPendingVrEntry();
assert !mCancellingEntryAnimation;
}
......
......@@ -101,11 +101,6 @@ public class MockVrDaydreamApi implements VrDaydreamApi {
mForwardSetupIntent = forward;
}
@Override
public boolean isInVrSession() {
return true;
}
@Override
public void launchGvrSettings() {}
}
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