Closed Bug 1173489 Opened 4 years ago Closed 4 years ago

[Spark] Unable to forward touch events to some apps


(Firefox OS Graveyard :: Gaia::Customizer, defect, P1)



(blocking-b2g:2.5+, b2g-master fixed)

2.2 S14 (12june)
blocking-b2g 2.5+
Tracking Status
b2g-master --- fixed


(Reporter: justindarc, Assigned: justindarc)



(Whiteboard: [spark])


(1 file)

The gesture to open the Customizer is a 2-finger swipe upwards from the bottom of the screen. Because the Aries device has a software home button, the System app will steal the touch events for the gesture if you begin the gesture off the bottom of the screen. Therefore, we inject code into the System app to forward touch events to the active window using `iframe.sendTouchEvent(...)`:

For some reason, the forwarded touch events are being received in some apps but not others.

WORKS: Homescreen, Hackerplace, Studio

BROKE: Phone, Messages, Contacts

Also, I tried adding some logging to Gecko in the following places to see if the events were being properly passed around. They seemed to be making it through all of the following calls for both the working and broken apps:

- TabParent::InjectTouchEvent()
- TabChild::RecvRealTouchEvent()
- APZCCallbackHelper::DispatchWidgetEvent()

1. Flash Aries device to latest nightly ENG build --
2. Run this script to ensure dev-mode is enabled --
3. Perform the Customizer gesture in any of the working apps (e.g. Studio)
4. Perform the Customizer gesture in any of the broken apps (e.g. Messages)
[Blocking Requested - why for this release]: This makes it difficult and inconsistent to perform the Customizer gesture.

Flagging :kats for NI? to look at when Aries device is received.
blocking-b2g: --- → spark?
Flags: needinfo?(bugmail.mozilla)
Priority: -- → P1
Whiteboard: [spark]
blocking-b2g: spark? → spark+
Based on my investigation so far I believe this is happening because in some apps the content extends into the space behind the SHB bar and in others it does not. For example in the studio app there is a div id="edit-color" which has a tranalateY that puts it just out of view at the bottom of the screen. This means it sits behind the SHB and so when touch events are forwarded to the studio app they hit that div (actually they hit something inside that div) and therefore trigger touch listeners on the window. In the messages app, there is no content behind the SHB and so the forwarded event hits nothing and is discarded. I assume something similar goes for the other apps where this isn't working.
Flags: needinfo?(bugmail.mozilla)
Making the height of the body element in the messages app 110% instead of 100% (via WebIDE) fixes the problem by putting content behind the SHB.

Based on this I don't think this is a platform bug per se, the touches are just arriving outside the content bounds for the app. One way to hack around it is to modify the forwarder to clamp the y values of the forwarded events so that they land just above the SHB rather than behind. That might have not-so-good side effects but considering the forwarder only activates once two fingers are down it should be acceptable.
I like that suggestion, and I think we should go with that.

One alternative is to make the Customizer stub add a |position: absolute| element underneath the SHB. The downsides of this are that: 1) its style wouldn't be sandboxed, so the app could override it and mess that up, 2) if the SHB isn't being displayed, it could potentially mess with app usage and visuals.
Component: Panning and Zooming → Gaia::Customizer
Product: Core → Firefox OS
Version: Trunk → unspecified
Justin, I assume you're working on this based on our discussions so far.
Assignee: nobody → jdarcangelo
Attached file pull-request (master)
This works! Thank you so much :kats for looking into this!
Attachment #8621332 - Flags: review?(drs)
Attachment #8621332 - Flags: review?(drs) → review+
Closed: 4 years ago
Resolution: --- → FIXED
blocking-b2g: spark+ → 2.5+
Target Milestone: --- → 2.2 S14 (12june)
I was looking into verifying this issue, but it seems that Customizer app does not work at all on latest builds. I can't make the editor thingy to show up on anywhere.

Is this app supposed to not work on latest?

Device: Aries 2.6 Master
BuildID: 20151113123209
Gaia: e8c15ae4e5324a210000ee0a869a962aa542009f
Gecko: faf815a0fa9b052a38bce00c0c2aa1e2c9610936
Gonk: a19052e4389c3ae2d8fc3e7a74a475401baacc56
Version: 45.0a1 (2.6) 
Firmware Version: D5803_23.1.A.1.28_NCB.ftf
User Agent: Mozilla/5.0 (Mobile; rv:45.0) Gecko/45.0 Firefox/45.0
Flags: needinfo?(jdarcangelo)
Flags: needinfo?(jdarcangelo)
You need to log in before you can comment on or make changes to this bug.