Samsung / GearVRf

The GearVR framework(GearVRf) is an Open Source VR rendering library for application development on VR-supported Android devices.
http://www.gearvrf.org
Apache License 2.0
407 stars 217 forks source link

Unknown source dispatching touch events for GearVR controller #1356

Closed J0Nreynolds closed 7 years ago

J0Nreynolds commented 7 years ago

Same issue as #1245. Touch/Motion events are being generated by button presses, yet they aren't originating from the GearCursorController. I'm currently working on setting motion events for the GearCursorController, but these aforementioned touch events often interrupt any touch events I generate. To reproduce this error, you can use the code in the previous issue:

@Override
public boolean onTouchEvent(MotionEvent event) {
    Log.d("MyActivity", "onTouchEvent: " + event);
    ...do something...
    return super.onTouchEvent(event);
}

Notice that pressing any of the buttons besides home or back on the GearVR Controller will dispatch a motion event of the form MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=1480.0, y[0]=720.0, toolType[0]=TOOL_TYPE_UNKNOWN ... }

The coordinates will always be (1480, 720), meaning there will always be a touch dispatched at that location.

I appreciate any help anyone can offer.

liaxim commented 7 years ago

This is done by the platform by design. Confirmed also by https://developer.oculus.com/blog/developing-for-the-gear-vr-controller/.

What you could is filter out the touch events based on some criteria. Like tool type of value TOOL_TYPE_UNKNOWN and few other MotionEvent fields that probably identify the events uniquely.

J0Nreynolds commented 7 years ago

Great, thanks for looking into this for me. I'll look into possible ways of ignoring the touch events.