Closed Bug 1129841 Opened 9 years ago Closed 9 years ago

setNFCFocus(false) won't be called when the app goes to the background

Categories

(Firefox OS Graveyard :: Gaia::System::Window Mgmt, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(blocking-b2g:2.2+, b2g-v2.2 fixed, b2g-master fixed)

RESOLVED FIXED
2.2 S7 (6mar)
blocking-b2g 2.2+
Tracking Status
b2g-v2.2 --- fixed
b2g-master --- fixed

People

(Reporter: allstars.chh, Assigned: alive)

References

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1125023 +++

STR:
1. Enable NFC
2. Launch NFC API Tests -> NFC Read Tag
3. Press Home key to Homescreen
4. Tab an NFC Tag containing URL.

Expected Result:
System app launches Browser showing the URL contained in the tag.

Actual Result:
Nothing happened, launch the app NFC API Tests again, found the content of result is shown in the app.

When the app goes to the background, I observed that setNFCFocus(false) won't be called on the Browser Element of the the NFC API test app, which should be wrong since the app is in foreground now.
I found 2.2 also has this problem
blocking-b2g: --- → 2.2?
(In reply to Yoshi Huang[:allstars.chh] from comment #0)
> +++ This bug was initially created as a clone of Bug #1125023 +++
> 
> STR:
> 1. Enable NFC
> 2. Launch NFC API Tests -> NFC Read Tag
> 3. Press Home key to Homescreen
> 4. Tab an NFC Tag containing URL.
> 
> Expected Result:
> System app launches Browser showing the URL contained in the tag.
> 
> Actual Result:
> Nothing happened, launch the app NFC API Tests again, found the content of
> result is shown in the app.
> 
> When the app goes to the background, I observed that setNFCFocus(false)
> won't be called on the Browser Element of the the NFC API test app, which
> should be wrong since the app is in foreground now.
                                     ^^^^^^^^^^^^^^^^
I mean 'since the app is in the *background* now'
ni? Alive for comments.
Flags: needinfo?(alive)
Assignee: nobody → alive
Flags: needinfo?(alive)
Triage: blocking
blocking-b2g: 2.2? → 2.2+
Is this really a bug? Don't we setNFCFocus(true) to homescreen app while pressing home button? Why is it necessary to setNFCFocus(false) to closing app?
Flags: needinfo?(dlee)
I didn't see setNFCFocus(true) for Homescreen when normal app goes to background.
Flags: needinfo?(dlee)
Attachment #8562135 - Flags: review?(etienne)
Attachment #8562135 - Flags: feedback?(allstars.chh)
Hi Alive,
One question, now gecko make an assumption that when GAIA change focus app to another app(ex, App A to App B),
GAIA will always call App A's setNFCFocus(false) before calling App B's setNFCFocus(true).

Can we make this assumption ? or it is possible that GAIA will call
1.A.setNFCFocus(true)
2.B.setNFCFocus(true)
without calling A.setNFCFocus(false)
Flags: needinfo?(alive)
Comment on attachment 8562135 [details] [review]
[PullReq] alivedise:bugzilla/1129841_master/setNFCFocus-on-setVisible to mozilla-b2g:master

lgtm
Attachment #8562135 - Flags: review?(etienne) → review+
(In reply to Dimi Lee[:dimi][:dlee] from comment #8)
> Hi Alive,
> One question, now gecko make an assumption that when GAIA change focus app
> to another app(ex, App A to App B),
> GAIA will always call App A's setNFCFocus(false) before calling App B's
> setNFCFocus(true).
> 
> Can we make this assumption ? or it is possible that GAIA will call
> 1.A.setNFCFocus(true)
> 2.B.setNFCFocus(true)
> without calling A.setNFCFocus(false)

No, we didn't do this I think. What we do is just trying to tell you when to unfocus the current focused app or focus a new one when there is.
setNFCFocus(true) to A then setNFCFocus(true) to B is possible with setNFCFocus(false) to A happens before/after or even not called.
Flags: needinfo?(alive)
(In reply to Alive Kuo@Paris~2/17 [:alive][NEEDINFO!] from comment #10)
> (In reply to Dimi Lee[:dimi][:dlee] from comment #8)
> > Hi Alive,
> > One question, now gecko make an assumption that when GAIA change focus app
> > to another app(ex, App A to App B),
> > GAIA will always call App A's setNFCFocus(false) before calling App B's
> > setNFCFocus(true).
> > 
> > Can we make this assumption ? or it is possible that GAIA will call
> > 1.A.setNFCFocus(true)
> > 2.B.setNFCFocus(true)
> > without calling A.setNFCFocus(false)
> 
> No, we didn't do this I think. What we do is just trying to tell you when to
> unfocus the current focused app or focus a new one when there is.
> setNFCFocus(true) to A then setNFCFocus(true) to B is possible with
> setNFCFocus(false) to A happens before/after or even not called.

More accurately:
* When an app is setNFCFocus(true): it should be the top most frame at the moment; for gecko that means it should keep this one as focused no matter the previously focused is null or another one.
* When an app is setNFCFocus(false): it should not get focus at the moment; for gecko that means it should forget it as the focused frame.
(In reply to Alive Kuo@Paris~2/17 [:alive][NEEDINFO!] from comment #11)
> (In reply to Alive Kuo@Paris~2/17 [:alive][NEEDINFO!] from comment #10)
> > (In reply to Dimi Lee[:dimi][:dlee] from comment #8)
> > > Hi Alive,
> > > One question, now gecko make an assumption that when GAIA change focus app
> > > to another app(ex, App A to App B),
> > > GAIA will always call App A's setNFCFocus(false) before calling App B's
> > > setNFCFocus(true).
> > > 
> > > Can we make this assumption ? or it is possible that GAIA will call
> > > 1.A.setNFCFocus(true)
> > > 2.B.setNFCFocus(true)
> > > without calling A.setNFCFocus(false)
> > 
> > No, we didn't do this I think. What we do is just trying to tell you when to
> > unfocus the current focused app or focus a new one when there is.
> > setNFCFocus(true) to A then setNFCFocus(true) to B is possible with
> > setNFCFocus(false) to A happens before/after or even not called.
> 
> More accurately:
> * When an app is setNFCFocus(true): it should be the top most frame at the
> moment; for gecko that means it should keep this one as focused no matter
> the previously focused is null or another one.
> * When an app is setNFCFocus(false): it should not get focus at the moment;
> for gecko that means it should forget it as the focused frame.

Thanks for the information, I have created bug 1131964 for that.
Try is green; waiting your guys' confirm to land this.
Hi Alive,
When App A launched, and press home key. It will call setNFCFocus(false) to App A, but it won't call setNFCFocus(true) to homescreen. Is this expected behavior ?
Comment on attachment 8562135 [details] [review]
[PullReq] alivedise:bugzilla/1129841_master/setNFCFocus-on-setVisible to mozilla-b2g:master

Although this PR fixes this bug, but Bug 1125023 will be back again.

Also I didn't see any log for calling setNFCFocus(true) on Homescreen app.
Attachment #8562135 - Flags: feedback?(allstars.chh) → feedback-
Comment on attachment 8562135 [details] [review]
[PullReq] alivedise:bugzilla/1129841_master/setNFCFocus-on-setVisible to mozilla-b2g:master

Let's see if this works
Attachment #8562135 - Flags: feedback- → feedback?(allstars.chh)
Comment on attachment 8562135 [details] [review]
[PullReq] alivedise:bugzilla/1129841_master/setNFCFocus-on-setVisible to mozilla-b2g:master

Happy Chinese New Year \O/
Attachment #8562135 - Flags: feedback?(allstars.chh) → feedback+
Comment on attachment 8562135 [details] [review]
[PullReq] alivedise:bugzilla/1129841_master/setNFCFocus-on-setVisible to mozilla-b2g:master

Re-request review because I changed the logic to prevent regression bug 1125023 - it's because setVisible(false) is called when ShrinkingUI is started. I think this way makes more sense because shouldFocus covers the case of this one and we will not focus something that is not loaded yet according to current app transition controller behavior.
Attachment #8562135 - Flags: review+ → review?(etienne)
Comment on attachment 8562135 [details] [review]
[PullReq] alivedise:bugzilla/1129841_master/setNFCFocus-on-setVisible to mozilla-b2g:master

(In reply to Alive Kuo@Paris~2/17 [:alive][NEEDINFO!] from comment #18)
> I think this way makes more sense because shouldFocus covers the
> case of this one and we will not focus something that is not loaded yet
> according to current app transition controller behavior.

yep :)
Attachment #8562135 - Flags: review?(etienne) → review+
https://github.com/mozilla-b2g/gaia/commit/c357b8877d96e8009f1f98c84704dc0462ce42ce
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Comment on attachment 8562135 [details] [review]
[PullReq] alivedise:bugzilla/1129841_master/setNFCFocus-on-setVisible to mozilla-b2g:master

[Approval Request Comment]
[Bug caused by] (feature/regressing bug #): regression of bug 1125023
[User impact] if declined: NFC cannot be used
[Testing completed]: Yes
[Risk to taking this patch] (and alternatives if risky): riskless
[String changes made]: No
Attachment #8562135 - Flags: approval-gaia-v2.2?
Attachment #8562135 - Flags: approval-gaia-v2.2? → approval-gaia-v2.2+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: