Closed Bug 1214139 Opened 4 years ago Closed 4 years ago

[Bluetooth] Could not auto connect NFC headset

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set

Tracking

(blocking-b2g:2.5+, firefox44 fixed, b2g-v2.1 unaffected, b2g-v2.2 unaffected, b2g-master affected)

VERIFIED FIXED
FxOS-S10 (30Oct)
blocking-b2g 2.5+
Tracking Status
firefox44 --- fixed
b2g-v2.1 --- unaffected
b2g-v2.2 --- unaffected
b2g-master --- affected

People

(Reporter: ashiue, Assigned: ben.tian)

References

()

Details

(Keywords: regression)

Attachments

(2 files, 1 obsolete file)

STR:
1. Enable NFC on device
2. Tap NFC-headset on device
3. When BT connect dialog pop-up, press "Yes" to connect to the NFC-headset

Expect result:
NFC headset has been paired and auto connected

Actual result:
NFC headset has been paired but did not auto connect

Build info:
[Flame]
Build ID               20151012150203
Gaia Revision          0b934d06c04adff2cd9bdd0bc204f974a18b710f
Gaia Date              2015-10-12 12:15:30
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/f4215b484d529e01f0f84ff4005e3321ee98b727
Gecko Version          44.0a1
Device Name            flame
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.cltbld.20151012.183433
Firmware Date          Mon Oct 12 18:34:45 EDT 2015
Bootloader             L1TC000118D0

[Aries]
Build ID               20151012230518
Gaia Revision          0b934d06c04adff2cd9bdd0bc204f974a18b710f
Gaia Date              2015-10-12 12:15:30
Gecko Revision         https://hg.mozilla.org/integration/b2g-inbound/rev/11ff0ccb7d59311df4c190d331c8b58c6e35a0c8
Gecko Version          44.0a1
Device Name            aries
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.worker.20151012.224830
Firmware Date          Mon Oct 12 22:48:38 UTC 2015
Bootloader             s1
[Blocking Requested - why for this release]:
Regression issue, might caused by the new API.

Hi Ben, 

Could you please check this issue or dispatch it to suitable person? Thank you.
blocking-b2g: --- → 2.5?
QA Whiteboard: [COM=NFC]
Flags: needinfo?(btian)
Flags: needinfo?(btian)
Restore my ni?
Flags: needinfo?(btian)
QA Contact: mmurrell
QA Contact: mmurrell
Flags: needinfo?(btian)
See Also: → 1141899
Device doesn't connect to headset since there's no profile to connect with incorrect cod. The cod update doesn't propagate before the device is created. I'll try to revise the flow.

===
GeckoBluetooth: RemoteDevicePropertiesNotification: 240408   <== got cod update but device isn't created
GeckoBluetooth: BondStateChangedNotification: Bond state: 2 status: 0   <== paired to headset
GeckoBluetooth: ToUint32: major service 1 major device 1f minor device 0
GeckoBluetooth: ConnectDisconnect: aCod 3f00    <== connect gets incorrect (default) cod
GeckoBluetooth: SetupProfiles: cod 3f00: audio 0 rendering 0 peripheral 0 remotecontrol 0 keyboard 0 pointing 0 invalid 0
GeckoBluetooth: StartSession: No queued profile.   <== no profile to connect based on incorrect cod
GeckoBluetooth: EndSession: mSuccess 0
Assignee: nobody → btian
See Also: 11418991181827
Initial Regression Window: nightly/mozilla-central-flame-kk-eng/

Last working (gaia hes problem that unable to show paired devices for this build, but all works after apply gaia of build 20150427010202: Gaia Revision-b4c949cdc780893897c9b45c1adea46e2eb694ff)
Build ID               20150616010205
Gaia Revision          62ba52866f4e5ca9120dad5bfe62fc5df981dc39
Gaia Date              2015-06-15 19:09:24
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/ce863f9d8864
Gecko Version          41.0a1
Device Name            flame
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.cltbld.20150616.060924
Firmware Date          Tue Jun 16 06:09:36 EDT 2015
Bootloader             L1TC000118D0

First Broken
Build ID               20150616160206
Gaia Revision          9d42e94446f2dc01b519172b6d75d81d4d435bdc
Gaia Date              2015-06-16 16:16:47
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/27caa5299f9f
Gecko Version          41.0a1
Device Name            flame
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.cltbld.20150616.194325
Firmware Date          Tue Jun 16 19:43:36 EDT 2015
Bootloader             L1TC000118D0

Problem might occur between: 
http://hg.mozilla.org/integration/b2g-inbound/pushloghtml?fromchange=ce863f9d8864&tochange=27caa5299f9f

I unable to narrow down more since tinderbox-builds no longer exist builds which created in 2015 June.
(In reply to Ben Tian [:btian] from comment #3)
> Device doesn't connect to headset since there's no profile to connect with
> incorrect cod. The cod update doesn't propagate before the device is
> created. I'll try to revise the flow.
> 
> ===
> GeckoBluetooth: RemoteDevicePropertiesNotification: 240408   <== got cod
> update but device isn't created
> GeckoBluetooth: BondStateChangedNotification: Bond state: 2 status: 0   <==
> paired to headset
> GeckoBluetooth: ToUint32: major service 1 major device 1f minor device 0
> GeckoBluetooth: ConnectDisconnect: aCod 3f00    <== connect gets incorrect
> (default) cod
> GeckoBluetooth: SetupProfiles: cod 3f00: audio 0 rendering 0 peripheral 0
> remotecontrol 0 keyboard 0 pointing 0 invalid 0
> GeckoBluetooth: StartSession: No queued profile.   <== no profile to connect
> based on incorrect cod
> GeckoBluetooth: EndSession: mSuccess 0

It looks like v2 implementation removed that invalid CoD check (which do can do failback).
BluetoothServiceBluedroid::RemoteDevicePropertiesNotification(
...
...
 } else { 
   // If Cod is invalid, fallback to check UUIDs. It usually happens due to
   // NFC directly trigger pairing. bluedroid sends wrong CoD due to missing
   // EIR query records.                                                   
   isCodInvalid = true; 
...

   } else if (p.mType == PROPERTY_UUIDS) {  
       // Restore CoD value                                                    
          if (isCodInvalid) {                                                     
            if (serviceClass == BluetoothServiceClass::HANDSFREE ||               
                serviceClass == BluetoothServiceClass::HEADSET) {                 
              BT_LOGD("Restore Class Of Device to Audio bit");                    
              SET_AUDIO_BIT(cod);                                                 
            } else if (serviceClass == BluetoothServiceClass::A2DP_SINK) {        
              BT_LOGD("Restore Class of Device to Rendering bit");                
              SET_RENDERING_BIT(cod);                                             
            }                                                                     
          }       
     if (isCodInvalid) {                                                       
          AppendNamedValue(props, "Class", cod);                                  
          // 'audio-card' refers to 'Audio' device                                
          AppendNamedValue(props, "Icon", NS_LITERAL_STRING("audio-card"));       
        }                                                                         
        AppendNamedValue(props, "UUIDS", uuidsArray);
...
Jamin did invalid Cod check for L in [1], but it differs from comment 6.

[1] https://hg.mozilla.org/mozilla-central/rev/670b9db2b898
Set 2.5 blocker for regression bug.
blocking-b2g: 2.5? → 2.5+
Keywords: regression
Attached patch WIP patch 1 (obsolete) — Splinter Review
WIP patch that stores device properties in hash table. Need more tests on basic functions.
The patch fixes this bug in a different way:
It revises default CoD value as 0x1f00 (COD_UNCLASSIFIED), the same as bluedroid default value, and treats 0x1f00 as invalid CoD in profile controller.
Also it connects to HFP, A2DP, and AVRCP when CoD is invalid.

For SONY MBH10 headset, CoD received during NFC-triggered direct pairing is COD_UNCLASSIFIED for no EIR query records; for Parrot Zik headset, the problem mentioned in comment 3 results in default CoD value = 0x1f00. For both headsets profile controller gets invalid CoD = 0x1f00 and connects to HFP, A2DP, and AVRCP accordingly.
Attachment #8676610 - Attachment is obsolete: true
Attachment #8677448 - Flags: review?(shuang)
Comment on attachment 8677448 [details] [diff] [review]
Patch 1 (v1): Connect to HFP, A2DP, and AVRCP if CoD is invalid

Review of attachment 8677448 [details] [diff] [review]:
-----------------------------------------------------------------

Hi Ben,
Thanks for finding the bluedroid default CoD major class value is 0x1f00.
This is something i did not figure out. I think this solution is better and reasonable.
Attachment #8677448 - Flags: review?(shuang) → review+
(In reply to Shawn Huang [:shawnjohnjr] from comment #11)
> Hi Ben,
> Thanks for finding the bluedroid default CoD major class value is 0x1f00.
> This is something i did not figure out. I think this solution is better and
> reasonable.

The constant wasn't defined until JB 4.2 [1]. Probably the prior B2G releases were not on post-JB 4.2 then.
[1] http://androidxref.com/4.2_r1/search?q=COD_UNCLASSIFIED&defs=&refs=&path=&hist=&project=external
https://hg.mozilla.org/mozilla-central/rev/e2781d2c4598
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S10 (30Oct)
Verified on

[Flame]
Build ID               20151025150204
Gaia Revision          1c6628ed1e40575e5ec3669ab6ef389d4ebeea65
Gaia Date              2015-10-23 17:01:43
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/d53a52b39a95dced722cca90ac74529b66dd5253
Gecko Version          44.0a1
Device Name            flame
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.cltbld.20151025.201952
Firmware Date          Sun Oct 25 20:20:05 EDT 2015
Bootloader             L1TC000118D0

[Aries]
Build ID               20151025085903
Gaia Revision          1c6628ed1e40575e5ec3669ab6ef389d4ebeea65
Gaia Date              2015-10-23 17:01:43
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/d53a52b39a95dced722cca90ac74529b66dd5253
Gecko Version          44.0a1
Device Name            aries
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.worker.20151025.081846
Firmware Date          Sun Oct 25 08:18:54 UTC 2015
Bootloader             s1
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.