Closed Bug 1085201 Opened 5 years ago Closed 5 years ago

[Flame][Tako][v2.1][Settings] "Searching device" not hidden as Sony SBH50 BTHS paired via NFC

Categories

(Firefox OS Graveyard :: Gaia::Settings, defect, P1, critical)

ARM
Gonk (Firefox OS)
defect

Tracking

(blocking-b2g:2.0+, b2g-v2.0 fixed, b2g-v2.0M fixed, b2g-v2.1 verified, b2g-v2.2 verified)

VERIFIED FIXED
2.1 S7 (24Oct)
blocking-b2g 2.0+
Tracking Status
b2g-v2.0 --- fixed
b2g-v2.0M --- fixed
b2g-v2.1 --- verified
b2g-v2.2 --- verified

People

(Reporter: whsu, Assigned: iliu)

References

Details

Attachments

(1 file)

+++ This bug was initially created as a clone from a confidential Bug #1076595 +++

User Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36

== Issue Description ==
If to pair Sony SBH50 BTHS with a phone using NFC, the Bluetooth settings window will show "Searching for devices..."
message even when SBH50 status is set as "Connected to phone/media audio"(see the attached screenshot) 

100% reproducible for me in case when NFC paring is done when Bluetooth is switched off. 

== Preconditions ==
 - Bluetooth is switched OFF in the phone 
 - NFC is switched ON 
 - phone screen displaying Bluetooth settings 

== STEPS == 
 1) Perform NFC touch between SBH50 and  phone 
 2) Wait until pairing and connection is done 
 3) Check the "Devices in the area" section of Bluetooth settings 


* Actual results:
  There will be a "searching for devices..." message, however no real search is performed(and needed)


* Expected results:
  "searching for devices" should be hidden, and "Search for devices" button should be enabled.
Alison has helped confirm this bug.

--- Quote Alison's information from Bug #1076595 ---
This issue is also reproduce on 
[Flame v2.0]
Gaia-Rev        9c7dec14e058efef81f2267b724dad0850fc07e4
Gecko-Rev       https://hg.mozilla.org/releases/mozilla-b2g32_v2_0/rev/c17df9fe087d
Build-ID        20141019000201
Version         32.0

[Flame v2.1]
Gaia-Rev        76070c98dd0068324938c79bede50fe6d90bd996
Gecko-Rev       https://hg.mozilla.org/releases/mozilla-b2g34_v2_1/rev/a966f9f6e3ac
Build-ID        20141019001201
Version         34.0
John provided a patch. Please help review it and submit a pull request.
Thanks.

==== == = Quote John's information (Bug #1076595) ==== == = 
bluetooth.js  for reference
----------------------------------------------------------------
    function startDiscovery() {
      if (!bluetooth.enabled || !defaultAdapter ||
          discoverTimeout || document.hidden) {
        return;
      }

      var req = defaultAdapter.startDiscovery();
      req.onsuccess = function bt_discoveryStart() {
        if (!discoverTimeout)
          discoverTimeout = setTimeout(stopDiscovery, discoverTimeoutTime);
      };
      req.onerror = function bt_discoveryFailed() {
        console.error('Can not discover nearby device');
        stopDiscovery(); // Arima.JohnHsu

      };
    }

    function stopDiscoveryWhenLeaveApp() {
      //only stop discovery when Settings app is hidden
      if (!document.hidden)
        return;
      stopDiscovery();
    }

    function stopDiscovery() {
      if (!bluetooth.enabled || !defaultAdapter || !discoverTimeout) {
        searchingItem.hidden = true;     // Arima.JohnHsu
        searchAgainBtn.disabled = false; // Arima.JohnHsu
        return;
      }
Duplicate of this bug: 1076595
[Blocking Requested - why for this release]:
Functional issue, "searching for devices" does not work in this situation.
blocking-b2g: --- → 2.1?
QA Whiteboard: [COM=Bluetooth]
hi Shawn,

would you please kindly comment on this issue?
Flags: needinfo?(shuang)
This is relate to Settings. ni Ian
Flags: needinfo?(shuang) → needinfo?(iliu)
I'm not able to reproduce the issue on 2.2 because there is no confirmation dialog of NFCConnectBTenable.

Build version:

Gaia-Rev        4d7f051cede6544f4c83580253c743c22b0cb279
Gecko-Rev       https://hg.mozilla.org/mozilla-central/rev/4c449dcda453
Build-ID        20141021185231
Version         36.0a1
Device-Name     flame
FW-Release      4.4.2
FW-Incremental  eng.cltbld.20141021.221631
FW-Date         Tue Oct 21 22:16:44 EDT 2014
Bootloader      L1TC10011800

I will try the issue again on v2.1.
(In reply to Ian Liu [:ianliu] from comment #7)
> I'm not able to reproduce the issue on 2.2 because there is no confirmation
> dialog of NFCConnectBTenable.
bug 1086175 is tracking this issue.
Attached file pull request 25396
Arthur, this is a rare case for enabling bluetooth via NFC pairing. The bluetooth panel will start to discovery devices while Bluetooth is enabled. In the same time, the request is failed caused by NFC/Bluetooth pairing process. So that there is no 'ondiscoverystatechanged' event coming. We have to reset search button/description if we request startDiscovery() in failed case. Could you please help to review the pull request? Thanks:)
Flags: needinfo?(iliu)
Attachment #8509338 - Flags: review?(arthur.chen)
Assignee: nobody → iliu
Status: NEW → ASSIGNED
(In reply to William Hsu [:whsu] from comment #2)
> John provided a patch. Please help review it and submit a pull request.
> Thanks.
> 
> ==== == = Quote John's information (Bug #1076595) ==== == = 
> bluetooth.js  for reference
> ----------------------------------------------------------------
Thanks for John's patch. The patch is working fine. But I would like to have a simply fix. Since request startDiscovery() in failed case, it usually means Bluetooth module is not discovering. I have no reason to request stopDiscovery() in this case. Anyway, thanks for investigation.:)
(In reply to William Hsu [:whsu] from comment #2)
> John provided a patch. Please help review it and submit a pull request.
> Thanks.
> 
> ==== == = Quote John's information (Bug #1076595) ==== == = 
> bluetooth.js  for reference
> ----------------------------------------------------------------
Thanks for John's patch. The patch is working fine. But I would like to have a simply fix. Since request startDiscovery() in failed case, it usually means Bluetooth module is not discovering. I have no reason to request stopDiscovery() in this case. Anyway, thanks for investigation.:)
Triage determined blocking+ because broken new feature - these will be first release that NFC APIs are available to non-certified apps.
blocking-b2g: 2.1? → 2.1+
Duplicate of this bug: 1031172
Comment on attachment 8509338 [details] [review]
pull request 25396

Makes sense, r=me.
Attachment #8509338 - Flags: review?(arthur.chen) → review+
Gaia/master:  a080b927ef36056919538e9ad6305948d681165f
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Comment on attachment 8509338 [details] [review]
pull request 25396

[Approval Request Comment]
[Bug caused by] (feature/regressing bug #): Bug 1085201
[User impact] if declined: Cannot trigger to search bluetooth devices via search button. And the status of searching device is wrong.
[Testing completed]: Pass on try-server.
[Risk to taking this patch] (and alternatives if risky): Low
[String changes made]: None.
Attachment #8509338 - Flags: approval-gaia-v2.1?
Comment on attachment 8509338 [details] [review]
pull request 25396

NOTE: Please see https://wiki.mozilla.org/Release_Management/B2G_Landing to better understand the B2G approval process and landings.

[Approval Request Comment]
[Bug caused by] (feature/regressing bug #): Bug 1085201
[User impact] if declined: Cannot trigger to search bluetooth devices via search button. And the status of searching device is wrong.
[Testing completed]: Passed on try-server.
[Risk to taking this patch] (and alternatives if risky): Low
[String changes made]: None.
Attachment #8509338 - Flags: approval-gaia-v2.0?
Comment on attachment 8509338 [details] [review]
pull request 25396

Can QA verify once this lands on 2.1? Setting NI on Allison.
Attachment #8509338 - Flags: approval-gaia-v2.1? → approval-gaia-v2.1+
Flags: needinfo?(ashiue)
Why is this needed on 2.0? Is this a regression caused there and we discovered that we broke it now ? Does it happen with Sony specific Bluetooth headsets only?
Flags: needinfo?(iliu)
Verified on 
[2.1]
Gaia-Rev        c97463d61f45513a2123b19610386ddbfc916819
Gecko-Rev       https://hg.mozilla.org/releases/mozilla-b2g34_v2_1/rev/4f8c0c021128
Build-ID        20141026161201
Version         34.0

[2.2]
Gaia-Rev        e91d99e4d96954f06383c00bb9d79598a697e310
Gecko-Rev       https://hg.mozilla.org/mozilla-central/rev/8230834302c9
Build-ID        20141026160206
Version         36.0a1
Flags: needinfo?(ashiue)
Thanks Alison! :D
(In reply to bhavana bajaj [:bajaj] from comment #19)
> Why is this needed on 2.0? Is this a regression caused there and we
> discovered that we broke it now ? Does it happen with Sony specific
> Bluetooth headsets only?

* The bug is happened while pairing with headset via NFC. I see we support to pair with devices via NFC from v2.0.(https://github.com/mozilla-b2g/gaia/blob/v2.0/apps/system/js/system_nfc_connect_dialog.js)
* This might not a regression because we don't handle the error case of startDiscovery() in the old case base for a long time.
* The issue happens with NFC headset. Not only Sony SBH50 BTHS.
Flags: needinfo?(iliu)
Status: RESOLVED → VERIFIED
blocking-b2g: 2.1+ → 2.0+
Comment on attachment 8509338 [details] [review]
pull request 25396

Please verify once this lands on 2.0
Attachment #8509338 - Flags: approval-gaia-v2.0? → approval-gaia-v2.0+
You need to log in before you can comment on or make changes to this bug.