Closed
Bug 782588
Opened 13 years ago
Closed 13 years ago
[b2g-bluetooth] mozBluetooth is not a singleton
Categories
(Core :: DOM: Device Interfaces, defect)
Tracking
()
RESOLVED
FIXED
mozilla18
People
(Reporter: jj.evelyn, Assigned: bent.mozilla)
References
Details
(Whiteboard: [LOE:M])
Attachments
(1 file)
36.25 KB,
patch
|
qdot
:
review+
|
Details | Diff | Splinter Review |
In System app, if we call mozBluetooth.setEnabled(true), mozBluetooth.enabled will be true in nsIDOMDOMRequest onsuccess callback, but mozBluetooth.enabled won't be changed (still false) on Settings app at the moment.
Updated•13 years ago
|
Assignee: nobody → echou
Comment 1•13 years ago
|
||
Currently, system and settings are two applications which have called window.navigator.mozBluetooth.setEnabled() to toggle Bluetooth. However, because they are different 'window' object, so they will create different BluetoothManager object. That's why the value of window.navigator.mozBluetooth.enabled in system is not the same as in settings.
Comment 2•13 years ago
|
||
The problem with "enabled" is that it's the only variable we work with that's not backed by the actual operating system (in this case, bluez/dbus). In every other case, any time we change a property, it's send to the system via a dbus call, and relayed back to us via a dbus signal. Since ALL objects on all windows are registered for the signal, they all get updated.
There's a couple of things we could do here. Easiest would be to stop caching the enabled value and ALWAYS call bluedroid's "isEnabled" function (name may actually be different but you get the idea). We could move to watching another DBus variable for enabled (I'm all for validity via "do we have any adapters available" by checking the DBus Manager object's ListAdapters function, as that also fixes bug 764559).
Comment 3•13 years ago
|
||
I'll implement choice one first, then I'll try to figure out if there's any other solutions for bug 764559.
Updated•13 years ago
|
Blocks: b2g-bluetooth
Updated•13 years ago
|
Whiteboard: [LOE:M]
Comment 5•13 years ago
|
||
(In reply to ben turner [:bent] from comment #4)
> I've got this Eric!
No problem, thanks! :D
Assignee | ||
Comment 7•13 years ago
|
||
Ok, this makes gaia tip work like it's supposed to (in-process). This patch does a few things:
1. Loads the bluetooth service at startup. It reads the settings to see if bluetooth is enabled and then starts the firmware load if it is.
2. Makes the bluetooth service watch for the settings changes to enable or disable bluetooth rather than each individual manager object. Notifies all live managers when the enabled/disabled value changes successfully so that they can fire events.
3. Moves the IsEnabled logic into the service so that managers can't get out of sync.
There's a little cleanup along the way but nothing too egregious (I hope).
Attachment #658761 -
Flags: review?(kyle)
Assignee | ||
Comment 8•13 years ago
|
||
Comment on attachment 658761 [details] [diff] [review]
Patch, v1
Oh, and it fixes some shutdown ordering and safety problems that I found along the way.
Updated•13 years ago
|
Attachment #658761 -
Flags: review?(kyle) → review+
Assignee | ||
Comment 9•13 years ago
|
||
Assignee | ||
Comment 10•13 years ago
|
||
Some kind of build problem: https://hg.mozilla.org/integration/mozilla-inbound/rev/68092493156f
/builds/slave/m-in-ics-armv7a-gecko-dbg/build/dom/bluetooth/BluetoothService.cpp:289: error: 'class nsISettingsService' has no member named 'GetLock'
Hoisted by your own petard! :)
Assignee | ||
Comment 12•13 years ago
|
||
Yeah... It's for the best!
https://hg.mozilla.org/integration/mozilla-inbound/rev/0ee117877c93
Assignee | ||
Comment 13•13 years ago
|
||
Aaaand there was a missing debug-only include in the gonk stuff. Grumble.
https://hg.mozilla.org/integration/mozilla-inbound/rev/de6286cb4539
Comment 14•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/0ee117877c93
https://hg.mozilla.org/mozilla-central/rev/de6286cb4539
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
You need to log in
before you can comment on or make changes to this bug.
Description
•