[b2g-bluetooth] Failed to connect from a headset again after turn off and turn on the headset

RESOLVED FIXED in Firefox 18

Status

()

defect
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: gyeh, Assigned: gyeh)

Tracking

unspecified
mozilla19
ARM
Gonk (Firefox OS)
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(blocking-basecamp:+, firefox18 fixed, firefox19 fixed)

Details

Attachments

(2 attachments, 4 obsolete attachments)

Assignee

Description

7 years ago
When we connect with a bluetooth headset, Sco will be created while there's a phone call, and user can initiate audio transfer to close Sco socket. At this time, the audio route should be set back to headphone.

However, during the phone call, if user want to make the audio transfer again (which means set audio route to back Sco), we don't have listen socket and we can't accomplish the request.

Repro:
- Connect with a bluetooth headset
- Turn off the headset (and the socket will be closed)
- Turn on the headset again (some devices will automatically try to connect with the device connected with it last time, pressing button will trigger this, too)

Expected Behaviour:
- Have a socket and listen for connection requests
- The headset successfully connects to a B2G phone

Actual Behaviour:
- No socket listen for connection requests
- Failed to connect from a headset again, but we can connect with it from our B2G
Assignee

Updated

7 years ago
Blocks: 803475
Assignee

Updated

7 years ago
Blocks: b2g-bluetooth
No longer blocks: 803475
Assignee

Updated

7 years ago
Assignee: kyle → gyeh
Assignee

Comment 1

7 years ago
SocketType::LISTENING means having a server socket and waiting for connection request from headsets.

SocketType::CONNECTING means having a connection with remotes. When it is disconnected, we should notify settings app and restart listening socket.
Attachment #674574 - Flags: review?(kyle)
Comment on attachment 674574 [details] [diff] [review]
Patch 1(v1): Call Listen() in OnDisconnect()

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

Ok, I get what you were looking for now, and I don't think this version of it is correct. I just need to add a SOCKET_LISTENING status to SocketConnectionTypes, and then you can store off the previous socket connection type locally. There's no reason for you to make your own enum when you're provided one from UnixSocket. I'll add my patch for UnixSocket here, then you can update to just store off SocketConnectionType.

::: dom/bluetooth/BluetoothHfpManager.cpp
@@ +85,5 @@
> +enum SocketType {
> +  UNKNOWN = 0,
> +  CONNECTING = 1,
> +  LISTENING = 2
> +};

Unneeded, I'll just add SOCKET_LISTENING to SocketConnectionStatus

@@ +226,5 @@
>  
>  BluetoothHfpManager::BluetoothHfpManager()
>    : mCurrentVgs(-1)
>    , mCurrentCallIndex(0)
> +  , mSocketType(SocketType::UNKNOWN)

Unneeded, mConnectionStatus handles this.

::: dom/bluetooth/BluetoothHfpManager.h
@@ +52,5 @@
>  
>    int mCurrentVgs;
>    int mCurrentCallIndex;
>    int mCurrentCallState;
> +  int mSocketType;

Just use SocketConnectionType. And give this a better name, we already have a socket type for bluetooth (RFCOMM/L2CAP/etc...), so this is confusing. After I get Listening status in, we'll want this to be a store of the PREVIOUS state, since we'll be checking it in the callbacks, which fire after the internals of UnixSocket change.
Attachment #674574 - Flags: review?(kyle) → review-
Assignee

Comment 4

7 years ago
Comment on attachment 674907 [details] [diff] [review]
Patch 0 (v1) - Add listening status to UnixSocket

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

Looks good. I can also simplify my implementation in BluetoothHfpManager.
Attachment #674907 - Flags: review?(gyeh) → review+
Assignee

Comment 5

7 years ago
Attachment #674574 - Attachment is obsolete: true
Attachment #674972 - Flags: review?(kyle)
Comment on attachment 674972 [details] [diff] [review]
Patch 1(v2): Call Listen() in OnDisconnect()

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

r=me with nits picked.

::: dom/bluetooth/BluetoothHfpManager.h
@@ +52,5 @@
>  
>    int mCurrentVgs;
>    int mCurrentCallIndex;
>    int mCurrentCallState;
> +  int mSocketStatus;

Nit: That's a SocketConnectionStatus, not an int. :)
Attachment #674972 - Flags: review?(kyle) → review+
Assignee

Comment 7

7 years ago
Attachment #674907 - Attachment is obsolete: true
Attachment #674972 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/56209d235ff5
https://hg.mozilla.org/mozilla-central/rev/3bd24121c80d
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in before you can comment on or make changes to this bug.