Closed Bug 1128383 Opened 9 years ago Closed 9 years ago

[Bluetooth] There is no way to cancel incoming pairing request since the API v2 no 'bluetooth-cancel' system message.

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(firefox39 fixed)

RESOLVED FIXED
2.2 S8 (20mar)
Tracking Status
firefox39 --- fixed

People

(Reporter: iliu, Assigned: ben.tian)

References

Details

(Whiteboard: [webbt-api])

Attachments

(1 file, 2 obsolete files)

Since I'm working on implementation of pairing flow, I find out problem to cancel incoming pairing request.

STD:
1. Turn Bluetooth on.
2. Set visible on.
3. Use a remote device to pair with FFOS phone.
4. The pairing dialog shows to wait a user confirmation.
5. Cancel the pairing request from remote device.

Expected:
The pairing dialog should be close.

Actual:
The pairing dialog still waits a user confirmation.
Since we cannot receive 'bluetooth-cancel' system message, we have to find out a way(Gaia/Gecko) to handle this use case here. I file the bug for a note.
Hi Jamin, 

Per offline discussion for this use case before, is Gaia able to reach the cancel message in API version 2? Thanks.
Flags: needinfo?(jaliu)
Hi Ian,
Bluetooth team will provide a new event handler called "BluetoothAdapter.onaborted" to let Gaia layer knows the connected was cancelled. (or aborted)

Thank you.
Assignee: nobody → jaliu
Flags: needinfo?(jaliu)
Good idea with the new event. I file another bug 1128399 for tracking Gaia task.
Whiteboard: [webbt-api]
Attached patch WIP patch (v1) (obsolete) — Splinter Review
Assignee: jaliu → btian
OS: Mac OS X → Gonk (Firefox OS)
Hardware: x86 → ARM
Attachment #8569722 - Attachment is obsolete: true
Comment on attachment 8570343 [details] [diff] [review]
Patch 1 (v2): Add adapter.onpairingaborted event handler

Request for review and feedback first. I'll rebase on bug 1127665 once it's landed.
Attachment #8570343 - Flags: review?(shuang)
Attachment #8570343 - Flags: feedback?(jaliu)
Comment on attachment 8570343 [details] [diff] [review]
Patch 1 (v2): Add adapter.onpairingaborted event handler

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

For dom/base/nsGkAtomList.h, you need to ask dom peers to review.
Comment on attachment 8570343 [details] [diff] [review]
Patch 1 (v2): Add adapter.onpairingaborted event handler

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

Overall, it looks good to me, one comment for error handling. What do you think?

::: dom/base/nsGkAtomList.h
@@ +825,5 @@
>  GK_ATOM(onpagehide, "onpagehide")
>  GK_ATOM(onpageshow, "onpageshow")
>  GK_ATOM(onpaint, "onpaint")
>  GK_ATOM(onpairedstatuschanged, "onpairedstatuschanged")
> +GK_ATOM(onpairingaborted, "onpairingaborted")

Leave this to Dom peer to review.

::: dom/bluetooth2/BluetoothAdapter.cpp
@@ +365,5 @@
>        BluetoothStatusChangedEvent::Constructor(this, aData.name(), init);
>      DispatchTrustedEvent(event);
> +  } else if (aData.name().EqualsLiteral(PAIRING_ABORTED_ID) ||
> +             aData.name().EqualsLiteral(REQUEST_MEDIA_PLAYSTATUS_ID)) {
> +    DispatchEmptyEvent(aData.name());

This seems to me not necessary to extract 6 lines of code to an another new function (and it has only been used here). But if you think the original code is not clear enough, I'm fine with this change.

::: dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp
@@ +1634,4 @@
>      }
> +    case STATUS_BUSY:
> +    case STATUS_AUTH_FAILURE:
> +    case STATUS_RMT_DEV_DOWN:

Followed bug 1128386 (though the case is not the same), can we add case STATUS_FAIL to indicate authentication failure? Although default condition could capture it. stack can send this if there is an internal error.

::: dom/webidl/BluetoothAdapter2.webidl
@@ +80,5 @@
>    [NewObject, AvailableIn=CertifiedApps]
>    Promise<void> disable();
>  
>    [NewObject, AvailableIn=CertifiedApps]
> +  Promise<void> setName(DOMString name);

Good catch!
Attachment #8570343 - Flags: review?(shuang)
(In reply to Shawn Huang [:shawnjohnjr] from comment #10)
> ::: dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp
> @@ +1634,4 @@
> >      }
> > +    case STATUS_BUSY:
> > +    case STATUS_AUTH_FAILURE:
> > +    case STATUS_RMT_DEV_DOWN:
> 
> Followed bug 1128386 (though the case is not the same), can we add case
> STATUS_FAIL to indicate authentication failure? Although default condition
> could capture it. stack can send this if there is an internal error.
 
I follow API1 that sends 'cancel' for these cases. Might STATUS_FAIL be authentication error?
https://dxr.mozilla.org/mozilla-central/source/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp#1577
Flags: needinfo?(shuang)
(In reply to Ben Tian [:btian] from comment #11)
> (In reply to Shawn Huang [:shawnjohnjr] from comment #10)
> > ::: dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp
> > @@ +1634,4 @@
> > >      }
> > > +    case STATUS_BUSY:
> > > +    case STATUS_AUTH_FAILURE:
> > > +    case STATUS_RMT_DEV_DOWN:
> > 
> > Followed bug 1128386 (though the case is not the same), can we add case
> > STATUS_FAIL to indicate authentication failure? Although default condition
> > could capture it. stack can send this if there is an internal error.
>  
> I follow API1 that sends 'cancel' for these cases. Might STATUS_FAIL be
> authentication error?
> https://dxr.mozilla.org/mozilla-central/source/dom/bluetooth/bluedroid/
> BluetoothServiceBluedroid.cpp#1577

This is something we discussed in Bug 1120889 Comment 7 (caused by cgroup change).
During the pairing procedure, we got STATUS_FAIL from stack. It seems to me that anything causes pairing failure and it does not involve actual authentication procedure, the stack returned STATUS_FAIL.
Flags: needinfo?(shuang)
Attachment #8570343 - Attachment is obsolete: true
Attachment #8570343 - Flags: feedback?(jaliu)
Attachment #8573744 - Flags: review?(shuang)
Attachment #8573744 - Flags: feedback?(joliu)
Attachment #8573744 - Flags: feedback?(jaliu)
Comment on attachment 8573744 [details] [diff] [review]
Patch 1 (v3): Add adapter.onpairingaborted event handler, f=jocelyn, f=jaliu, r=shuang

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

LGTM.
Attachment #8573744 - Flags: feedback?(joliu) → feedback+
Comment on attachment 8573744 [details] [diff] [review]
Patch 1 (v3): Add adapter.onpairingaborted event handler, f=jocelyn, f=jaliu, r=shuang

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

LGTM
Attachment #8573744 - Flags: feedback?(jaliu) → feedback+
Comment on attachment 8573744 [details] [diff] [review]
Patch 1 (v3): Add adapter.onpairingaborted event handler, f=jocelyn, f=jaliu, r=shuang

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

Except for  nsGkAtomList.h,  BluetoothAdapter2.webidl, r=me. Please find DOM peer to check.
Attachment #8573744 - Flags: review?(shuang) → review+
Comment on attachment 8573744 [details] [diff] [review]
Patch 1 (v3): Add adapter.onpairingaborted event handler, f=jocelyn, f=jaliu, r=shuang

Hi Boris,

Can you help review BluetoothAdapter2.webidl and nsGkAtomList.h change of the patch? This patch adds an event handler to notify application of bluetooth pairing error/cancellation.
Attachment #8573744 - Attachment description: Patch 1 (v3): Add adapter.onpairingaborted event handler → Patch 1 (v3): Add adapter.onpairingaborted event handler, f=jocelyn, f=jaliu, r=shuang
Attachment #8573744 - Flags: review?(bzbarsky)
Comment on attachment 8573744 [details] [diff] [review]
Patch 1 (v3): Add adapter.onpairingaborted event handler, f=jocelyn, f=jaliu, r=shuang

r=me on the webidl/gkatomlist changes.
Attachment #8573744 - Flags: review?(bzbarsky) → review+
No try since the folder isn't built by default.

https://hg.mozilla.org/integration/b2g-inbound/rev/96351c40afc8
https://hg.mozilla.org/mozilla-central/rev/96351c40afc8
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.2 S8 (20mar)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: