Commit 147ec4df authored by Michael Thiessen's avatar Michael Thiessen Committed by Commit Bot

VR: Fix wrong Activity being resumed sometimes when cancelling animation

Android task stacks are a confusing mess. For some reason starting the
animation cancel activity in its own task stack is leading to a less-
recent CTA instance being resumed instead of the CCT that invoked the
animation cancel.

We can fix this by not starting the animation cancel in a new task
stack.

Bug: 817476, 817503
Change-Id: I99fe4583c02c9c5c2333697166e6e4081ad4f818
Reviewed-on: https://chromium-review.googlesource.com/941912Reviewed-by: default avatarYash Malik <ymalik@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539984}
parent 6eaeb55f
...@@ -1286,9 +1286,12 @@ public class VrShellDelegate ...@@ -1286,9 +1286,12 @@ public class VrShellDelegate
if (DEBUG_LOGS) Log.e(TAG, "canceling startup animation"); if (DEBUG_LOGS) Log.e(TAG, "canceling startup animation");
mCancellingEntryAnimation = true; mCancellingEntryAnimation = true;
Bundle options = ActivityOptions.makeCustomAnimation(mActivity, 0, 0).toBundle(); Bundle options = ActivityOptions.makeCustomAnimation(mActivity, 0, 0).toBundle();
mActivity.startActivity(mVrDaydreamApi.setupVrIntent( Intent intent = mVrDaydreamApi.setupVrIntent(
new Intent(mActivity, VrCancelAnimationActivity.class)), new Intent(mActivity, VrCancelAnimationActivity.class));
options); // We don't want this to run in a new task stack, or we may end up resuming the wrong
// Activity when the VrCancelAnimationActivity finishes.
intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK);
mActivity.startActivity(intent, options);
mNeedsAnimationCancel = false; mNeedsAnimationCancel = false;
return true; return true;
} }
......
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