Commit Graph

751 Commits

Author SHA1 Message Date
Gregor Wagner
acecad8f82 Bug 1267577 - Move nsRunnable to mozilla::Runnable. r=gsvelto 2016-04-27 12:05:40 +02:00
Gregor Wagner
2c3b158272 Merge 2016-04-04 12:08:53 +02:00
James Cheng
c43f377eb6 Bug 1249518 - Make DaemonSocketPDU able to send multiple file descriptors in single unit. r=tzimmermann 2016-03-30 14:58:13 +08:00
Thomas Zimmermann
c08b1e935a Bug 1252841: Convert Bluetooth module to |UniquePtr<>|, r=btian 2016-03-22 11:26:45 +01:00
Thomas Zimmermann
e4de812e2e Bug 1252841: Convert Bluetooth daemon interfaces to |UniquePtr<>|, r=brsun 2016-03-22 11:26:45 +01:00
Louis Chang
c9dae63d07 Bug 1248836 - HID Features Implementation, r=jocelyn 2016-02-04 18:40:32 +08:00
Bruce Sun
fb2d868a4e Bug 1250694: Use functions to return static const BluetoothAddress and BluetoothUuid; r=tzimmermann 2016-03-04 18:54:18 +08:00
Bruce Sun
0e6586272e Backed out changeset ef9e220beb2d (bug 1250694) 2016-03-04 18:54:26 +08:00
Bruce Sun
7f34ab2c75 Bug 1250694: Use functions to return static const BluetoothAddress and BluetoothUuid; r=tzimmermann 2016-03-03 17:28:23 +08:00
Louis Chang
73c9a25e36 Bug 1223729 - HID Connection Implementation, r=jocelyn, sr=mrbkap
--HG--
rename : dom/bluetooth/common/BluetoothHidManager.cpp => dom/bluetooth/bluez/BluetoothHidManager.cpp
rename : dom/bluetooth/common/BluetoothHidManager.h => dom/bluetooth/bluez/BluetoothHidManager.h
2015-12-04 11:58:55 +08:00
Thomas Zimmermann
0fc8c3e5a1 Bug 1251541: Replace |nsAutoArrayPtr<>| with |UniquePtr<[]>| in Bluetooth interfaces, r=shuang
This patch replaces all instances of |nsAutoArrayPtr<>| in the Bluetooth
interfaces with |UniquePtr<[]>|.

In contrast to |nsAutoArrayPtr<>|, |UniquePtr<[]>| doesn't convert to the
underlying pointer type implicitly. This is a problem for the daemon-socket
runnable, which depend on this feature when calling their operations. To
solve this issue, the patch adds |ConvertArg| for each arguemnt, which does
the conversion explicitly.
2016-02-29 12:15:08 +01:00
Thomas Zimmermann
83da4d603d Bug 1251541: Pass arguments to AVRCP passthrough command as uint8_t, r=shuang
The AVRCP passthough-command notification doesn't require |int| type
arguments. Using |uint8_t| is sufficient. This change is required to
prepare replacing |nsAutoArrayPtr<>| with |UniquePtr<[]>|.
2016-02-29 12:15:08 +01:00
Thomas Zimmermann
d8cb801b6f Bug 1251541: Replace |nsAutoArrayPtr<>| with |UniquePtr<[]>| in Bluetooth managers, r=shuang 2016-02-29 12:15:08 +01:00
Thomas Zimmermann
2805ccddb1 Bug 1239979: Get pointers to Bluetooth managers during each shutdown, r=shuang
|BluetoothServiceBluedroid::StopInternal| stores pointers to Bluetooth
managers in a static array. This is only filled on the first call, but
pointers change when re-enabling Bluetooth.

This patch changes the code to use a non-static array, so pointers to
Bluetooth managers are looked-up on each call to the method.
2016-01-21 12:30:00 +01:00
Thomas Zimmermann
2b40f0b741 Bug 1239979: Cleanup |BluetoothSocket|'s internals when connections close, r=btian
With this patch, |BluetoothSocket| cleans up its internal state
whenever a connection gets closed, either intentionally or from
an error. The socket can then be reused for a new connection.

If we try to destruct an open Bluetooth socket, we'd probably
leak the file descriptor or transition into an undefined state.
The destructor now asserts that the socket is closed.
2016-01-21 12:30:00 +01:00
Thomas Zimmermann
fb93218ad4 Bug 1239979: Store pointer to Bluetooth socket interface in |BluetoothSocket|, r=btian
|BluetoothSocket| currently stores the pointer to the socket interface
in a global static location. This pointer can become invalid if the
Bluetooth module get's disabled. Enabling Bluetooth again and calling
the socket interface would execute on undefined state. The current
implementation of the Bluedroid backend keeps the interface pointers
valid, so this problem doesn't happen in practice. It's still a bug,
though.

This patch changes |BluetoothSocket| to store the socket-interface
pointer internally. So it will acquire a new pointer for each socket.
2016-01-21 12:30:00 +01:00
Thomas Zimmermann
857bbd0291 Bug 1239979: Add |BluetoothSocket::Accept| method, r=btian
The new method |Accept| of |BluetoothSocket| encapsulates the code
for accepting from a passive socket. Having this method will allow
for storing the socket interface in |BluetoothSocket| itself.
2016-01-21 12:30:00 +01:00
Thomas Zimmermann
a88bdd194f Bug 1239979: Close sockets when deinitializing Bluetooth profile managers, r=btian 2016-01-21 12:30:00 +01:00
Thomas Zimmermann
3db34e3133 Bug 1239979: Uninitialized Bluetooth profile managers explictly to release refs, r=shuang
The current Bluetooth profile managers remove themselves from a number
of observer lists in their destructors. But |nsIObserverService| keeps
it's own reference to the managers, so the destructors never run. Con-
sequently the Bluetooth module nevers cleans up correctly.

This patch adds an explicit uninit method to each profile manager. It
removes the manager from the observer lists.
2016-01-21 12:30:00 +01:00
Thomas Zimmermann
0163bc2474 Bug 1239979: Init and uninit all Bluetooth profile managers, r=shuang
The use is init and deinit methods is currently inconsistent among
Bluetooth profile managers. This patch unifies all these methods and
integrates them into the Bluetooth service. Instances of the manager
classes are now unref'ed during Bluetooth shutdown.
2016-01-21 12:30:00 +01:00
Jocelyn Liu
c6da2ff1c4 Bug 1228546 - Implement peripheral mode support for GATT API. r=brsun, r=mrbkap 2016-01-15 09:50:54 +08:00
Thomas Zimmermann
e0a6a77e8f Bug 1238991: Don't connect Bluetooth OPP manager before service channel is known, r=btian
The Bluetooth Opp manager requires the service channel of the remote
service to connect successfully. If the service channel isn't known,
it sends an SDP update request to get the value from the remote device.

The current code will still try to connect with an invalid service
channel. This patch fixes the issue by returning early after sending
the SDP update request.
2016-01-14 14:55:49 +01:00
Carsten "Tomcat" Book
c2a8d865ec merge mozilla-inbound to mozilla-central a=merge 2016-01-12 11:54:38 +01:00
Ben Tian
5e2ce42994 Bug 1229697 - Cancel bond when user inputs empty pincode for pairing, r=shuang 2016-01-11 16:47:20 +08:00
Nathan Froyd
a9051dc287 Bug 1236561 - part 2 - remove ObexHeaderSet::GetAuthChallenge; r=btian
We don't need to copy data in this case, and making this change enables
us to remove this use of nsAutoArrayPtr.
2015-12-06 10:28:04 -05:00
Nathan Froyd
3dfc3842bc Bug 1236561 - part 1 - convert easy cases of nsAutoArrayPtr<T> to UniquePtr<T[]> in dom/bluetooth/; r=btian 2015-12-06 10:23:59 -05:00
Thomas Zimmermann
1025acb217 Bug 1223722: Transfer arrays of Bluetooth UUIDs in |BluetoothValue|, r=brsun
Bluetooth's UUID arrays are sorted and stripped from duplicates. This code is
now executed in the client process. This reduces the amount of privilegued
code and accounts the required computation time to the process that actually
uses it.

The change also makes the IPDL interface a bit less fragile, as the client
does not expect sorted arrays from the chrome process. It's a detail of the
client's implementation that manifested itself in the interface.
2016-01-05 12:01:33 +01:00
Thomas Zimmermann
388ee1f523 Bug 1223722: Transfer Bluetooth remote names in |BluetoothValue|, r=brsun 2016-01-05 12:01:33 +01:00
Thomas Zimmermann
30f1560836 Bug 1223722: Transfer Bluetooth addresses in |BluetoothValue|, r=brsun 2016-01-05 12:01:33 +01:00
Thomas Zimmermann
708b1d38ca Bug 1232687: Start bluetoothd with HAL service interface, r=shuang
This patch replaces Bluetooth's internal implmentation for starting
bluetoothd with the portable one provided by the HAL module. Gonk-
specific workarounds are preserved within HAL.
2016-01-04 16:08:21 +01:00
Tom Tung
42f7e0fe4e Bug 1232941 - Register Observer and listen to NS_XPCOM_SHUTDOWN_OBSERVER_ID for GATT, r=shuang
--HG--
extra : rebase_source : 98094772547ab8c92498175d2dcef36c715a9ee8
2015-12-17 09:36:43 +08:00
Thomas Zimmermann
989aaf55fc Bug 1232670: Prepare Bluetooth PDU for sending after checking connection status, r=shuang
The PDU contains a pointer to the operation's result handler. If sending
fails, the result handler is supposed to handle an error. But the PDU
will go out of scope first and release the handler. The error delivery
then fails with a segmentation fault.
2015-12-16 13:27:47 +01:00
Ben Tian
e6557e5b56 Bug 1230066 - Add missing STATUS_AUTH_REJECTED into enum BluetoothStatus,r=tzimmermann 2015-12-03 18:25:03 +08:00
Louis_Chang
9843bbdf08 Bug 1217778 - Ensure sBluetoothGattService is not null before accessing GattInterface in GattManager. r=jocelyn 2015-12-02 09:31:45 +08:00
Wes Kocher
50e8f21d5b Merge inbound to central, a=merge
--HG--
extra : commitid : 9WZlbf1Q29D
2015-12-01 15:43:33 -08:00
Jocelyn Liu
fa7b21647d Bug 1229290 - Pack/unpack UUIDs in a reverse order when adding characteristics and descriptors in GATT server API. r=brsun 2015-12-01 18:54:55 +08:00
Shawn Huang
fb992c848d Bug 1186840 - [MAP] Implement MessageUpdate function, r=btian 2015-12-01 15:55:41 +08:00
Ben Tian
2b918d0fd2 Bug 1228471 - use Endian.h to write filename and handleId into OBEX packet, r=shuang 2015-12-01 10:36:43 +08:00
Jocelyn Liu
963cd9f23f Bug 1228519 - Fix RequestReadNotification for GATT Server API. r=brsun 2015-11-30 20:24:07 +08:00
Jocelyn Liu
a84e009ffd Bug 1228521 - Fix PDU packing in |ServerSendResponseCmd| for GATT Server API. r=brsun 2015-11-30 20:23:04 +08:00
Jocelyn Liu
f692ee9ee4 Bug 1228909 - Fix PDU packing in |ClientSetAdvDataCmd| for GATT API. r=brsun 2015-11-30 20:21:52 +08:00
Thomas Zimmermann
63fd9969ce Bug 1228946: Remove '#if 0' block from Bluetooth module, r=joliu
This is a cleanup patch for removing an '#if 0' that was landed in
the Bluetooth code.
2015-11-30 12:46:09 +01:00
Ben Tian
cdd3762041 Bug 1227440 - Reject pin reply by cancelling bond to trigger BondStateChangedNotification, in order to inform gaia setting app, r=shuang 2015-11-26 16:31:42 +08:00
Nathan Froyd
199217336c Bug 1224240 - fix memory leak in Bluetooth*Manager::CompareHeaderTarget; r=btian
ObexHeaderSet::GetTarget copies the data associated with the
ObexHeaderId::Target id into a newly-allocated buffer.  All callers of
this function, however, fail to free the buffer once they are done with it.

Instead of simply freeing the buffer in the caller, however, let's add
an API to ObexHeaderSet that gives direct access to the desired header.
Doing this means that we have direct access to the data--no copying
necessary--and we also make the caller slightly faster, since it no
longer has to verify that the appropriate header is there, followed by
re-searching for the header it already knows is there.
2015-11-04 10:42:01 -05:00
Ben Tian
5397ef7325 Bug 1225340 - Refine nullity check macros in BluetoothServiceBluedroid, r=tzimmermann 2015-11-23 10:09:47 +08:00
Bruce Sun
4492d3aae8 Bug 1225787: Fix wrong arguments of BluetoothGattInterface::AddCharacteristic; r=jocelyn 2015-11-19 14:26:58 +08:00
Bruce Sun
ab7cea57cc Bug 1225785: Fix WriteRequested mismatch; r=jocelyn 2015-11-19 14:26:23 +08:00
Wes Kocher
f2a69ef549 Merge b2ginbound to central, a=merge
--HG--
extra : commitid : DJ1BP2VTWLm
2015-11-19 13:36:16 -08:00
Nathan Froyd
1ad1a76ff4 Bug 1226063 - take advantage of UniquePtr in BluetoothMapSmsManager::SendMasObexData; r=btian
Now that UnixSocketRawData can assume ownership of UniquePtrs, we can
enhance SendMasObexData to accept UniquePtrs where possible.
2015-11-18 17:14:07 -05:00
Thomas Zimmermann
764c23b828 Bug 1223806: Convert Bluetooth to |BluetoothCoreInterface|, r=btian 2015-11-19 11:21:03 +01:00