Index: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java |
index aff70783ec833767b94a72b89916cdf694855b6e..98f9dcb5b269da59ecc00d5b59c096649471fbf2 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java |
@@ -230,7 +230,13 @@ public class VrShellImpl |
public boolean onTouch(View v, MotionEvent event) { |
if (!CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV) |
mthiesse
2017/05/16 00:44:37
I think you can remove the switch checks. onTouch
|
&& event.getActionMasked() == MotionEvent.ACTION_DOWN) { |
- nativeOnTriggerEvent(mNativeVrShell); |
+ nativeOnTriggerEvent(mNativeVrShell, true); |
+ return true; |
+ } |
+ if (!CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV) |
+ && (event.getActionMasked() == MotionEvent.ACTION_UP |
+ || event.getActionMasked() == MotionEvent.ACTION_CANCEL)) { |
+ nativeOnTriggerEvent(mNativeVrShell, false); |
return true; |
} |
return false; |
@@ -405,8 +411,12 @@ public class VrShellImpl |
boolean cardboardTriggered = false; |
if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV) |
&& event.getActionMasked() == MotionEvent.ACTION_DOWN) { |
- nativeOnTriggerEvent(mNativeVrShell); |
+ nativeOnTriggerEvent(mNativeVrShell, true); |
cardboardTriggered = true; |
+ } else if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV) |
+ && (event.getActionMasked() == MotionEvent.ACTION_UP |
+ || event.getActionMasked() == MotionEvent.ACTION_CANCEL)) { |
+ nativeOnTriggerEvent(mNativeVrShell, false); |
} |
boolean parentConsumed = super.dispatchTouchEvent(event); |
if (mOnDispatchTouchEventForTesting != null) { |
@@ -605,7 +615,7 @@ public class VrShellImpl |
private native void nativeSwapContents( |
long nativeVrShell, WebContents webContents, MotionEventSynthesizer eventSynthesizer); |
private native void nativeDestroy(long nativeVrShell); |
- private native void nativeOnTriggerEvent(long nativeVrShell); |
+ private native void nativeOnTriggerEvent(long nativeVrShell, boolean touched); |
private native void nativeOnPause(long nativeVrShell); |
private native void nativeOnResume(long nativeVrShell); |
private native void nativeOnLoadProgressChanged(long nativeVrShell, double progress); |