New issue
Advanced search Search tips

Issue 780673 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug
Proj-VR
Proj-XR
Proj-XR-VR

Blocking:
issue 752200



Sign in to add a comment

VR intent received twice on Android O

Project Member Reported by ymalik@chromium.org, Nov 2 2017

Issue description

Certain intents can cause Chrome to enter VR mode upon startup. We have a VR launcher called VrMainActivity, which is essentially a wrapper around ChromeLauncherActiviy. It contains the necessary AndroidManifest entries to correctly transition Chrome into VR. 

This was added in this patch: https://chromium-review.googlesource.com/c/chromium/src/+/722456

Though, there is a bug on Android O. The intent is received twice by VrMainActivity for some reason. 

Here is a stack trace printed from LaunchIntentDispatcher#dispatch
First call:
java.lang.Exception
  at org.chromium.chrome.browser.LaunchIntentDispatcher.dispatch(LaunchIntentDispatcher.java:235)
  at org.chromium.chrome.browser.LaunchIntentDispatcher.dispatch(LaunchIntentDispatcher.java:110)
  at org.chromium.chrome.browser.document.ChromeLauncherActivity.onCreate(ChromeLauncherActivity.java:29)
  at android.app.Activity.performCreate(Activity.java:7013)
  at android.app.Activity.performCreate(Activity.java:7004)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
  at android.app.ActivityThread.-wrap11(Unknown Source:0)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
  at android.os.Handler.dispatchMessage(Handler.java:106)
  at android.os.Looper.loop(Looper.java:164)
  at android.app.ActivityThread.main(ActivityThread.java:6494)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Second call:
java.lang.Exception
  at org.chromium.chrome.browser.LaunchIntentDispatcher.dispatch(LaunchIntentDispatcher.java:235)
  at org.chromium.chrome.browser.LaunchIntentDispatcher.dispatch(LaunchIntentDispatcher.java:110)
  at org.chromium.chrome.browser.document.ChromeLauncherActivity.onCreate(ChromeLauncherActivity.java:29)
  at android.app.Activity.performCreate(Activity.java:7013)
  at android.app.Activity.performCreate(Activity.java:7004)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
  at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4699)
  at android.app.ActivityThread.-wrap18(Unknown Source:0)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595)
  at android.os.Handler.dispatchMessage(Handler.java:106)
  at android.os.Looper.loop(Looper.java:164)
  at android.app.ActivityThread.main(ActivityThread.java:6494)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

This can be tested by sending an intent via command line:
 adb shell am start -a android.intent.action.VIEW -n "org.chromium.chrome/org.chromium.chrome.browser.vr.VrMainActivity" --ez android.intent.extra.VR_LAUNCH true -d www.google.com

Stack trace can be printed using: Log.e(TAG, Log.getStackTraceString(new Exception()))

Either there's something wrong with the way VrMainActivity is declared (in the Manifest?), or there is some serious Android O bug.

I verified that this doesn't happen for intents sent to ChromeLauncherActivity directly. 
 
Can you override onCreate in VrMainActivity and add the Log there as well?  I'd like to see if it's going through VrMainActivity both times or if there is something that is causing the intent to go to VrMainActivity and then be dispatched to ChromeLauncherActivity.

Capturing the full logcat can be useful as it will show what intents are dispatched.

You can also try looking at:
adb shell dumpsys activity
to see if there is any signals there.

Otherwise, you can start overriding our various startActivity calls in ChromeLauncherActivity, AsyncInitActivity, ChromeApplication to see if/where it might be retriggered within Chrome.  I don't know of any obvious thing in the manifest that could cause this either, but I won't remove it as a possibility.

Comment 2 by ericde@google.com, Jan 8 2018

Labels: -M-64 M-65
Owner: mthiesse@chromium.org
Status: Assigned (was: Available)
Status: Started (was: Assigned)
Project Member

Comment 4 by bugdroid1@chromium.org, Jan 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5fa3e281fd5d48b801155d5aa8e328b3d8cfe1f2

commit 5fa3e281fd5d48b801155d5aa8e328b3d8cfe1f2
Author: Michael Thiessen <mthiesse@chromium.org>
Date: Tue Jan 23 17:33:19 2018

VR: Prevent launcher recreation when handling VR intents.

The launcher activities were getting recreated when handling VR intents
as we set the VR mode as early as possible to avoid screen flickers.

It's safe to handle density/vrmode config changes for the launcher
activities as they're NoDisplay activities.

Bug:  780673 
Change-Id: I0456795f40099a4ec606262f37177f1950b733ad
Reviewed-on: https://chromium-review.googlesource.com/868913
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531269}
[modify] https://crrev.com/5fa3e281fd5d48b801155d5aa8e328b3d8cfe1f2/chrome/android/java/AndroidManifest.xml
[modify] https://crrev.com/5fa3e281fd5d48b801155d5aa8e328b3d8cfe1f2/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java

Labels: -M-65 M-66
Status: Fixed (was: Started)
Labels: Test-Complete

Comment 7 Deleted

Sign in to add a comment