shared: Check HCI packet type before sending it to btdev
avdtp: Remove not used pending_auth from struct avdtp
avdtp: Remove not used includes
avdtp: Remove unused STREAM_TIMEOUT define
doc: Label Profile1.Release() method as no reply

The current implementation does not expect a reply, nor would it make
sense for BlueZ to wait for one from the agent.  So explicitly label
this method as noreply.
doc: Remove Profile1.Cancel() method

There does not seem to be any actual need for this method.

The current implementation calls Cancel when a pending
NewConnection() or RequestDisconnection() method call fails.
Additionally it calls Cancel() when the remote client has disconnected.
In either case BlueZ calls shutdown on the file descriptor associated
with the agent and issues a Cancel() method call.

The closing of the file descriptor will trigger a HUP on the agent side,
which will trigger normal cleanup procedures.  The received Cancel()
method call is redundant in both cases.
profile: Remove support for Cancel method
monitor: Add missing include

Bionic library requires explicit include for data types used in ioctl
call. This fix following build error with bionic:

target  C: btmon <= external/bluetooth/bluez/monitor/display.c
external/bluetooth/bluez/monitor/display.c: In function 'num_columns':
external/bluetooth/bluez/monitor/display.c:59:18: error: storage size
    of 'ws' isn't known
unit: Add gdbus/client_proxy_removed

This tests if watches created using g_dbus_proxy_set_removed_watch works
when the interface is removed.
unit: Add gdbus/client_force_disconnect

This tests if watches created using g_dbus_proxy_set_removed_watch works
when the service disconnects from the bus.
gdbus/watch: Fix crash when g_dbus_remove_watch is called from connect callback

 at 0x40570C: update_service (watch.c:601)
 by 0x40584B: service_reply (watch.c:627)
 by 0x3B0700C511: ??? (in /usr/lib64/libdbus-1.so.3.7.4)
 by 0x3B0700F740: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.4)
 by 0x405167: message_dispatch (mainloop.c:76)
 by 0x3B03C48962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
 by 0x3B03C47E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
 by 0x3B03C48157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
 by 0x3B03C48559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
Address 0x4c58a30 is 32 bytes inside a block of size 56 free'd
 at 0x4A074C4: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
 by 0x3B03C4D9AE: g_free (in /usr/lib64/libglib-2.0.so.0.3600.3)
 by 0x406102: filter_data_remove_callback (watch.c:378)
 by 0x405FC0: g_dbus_remove_watch (watch.c:798)
 by 0x40A22B: g_dbus_client_unref (client.c:1227)
 by 0x40570B: update_service (watch.c:599)
 by 0x40584B: service_reply (watch.c:627)
gdbus/watch: Fix aborting when removing D-Bus filter

In case of filter_data having a watch to a service name it may call
dbus_connection_remove_filter twice causing libdbus to abort:

process 24723: Attempt to remove filter function 0x4063e0 user data (nil), but no such filter has been added

To fix this the code will now only attempt to call
dbus_connection_remove_filter once in filter_data_free which is the
counterpart of filter_data_get where dbus_connection_add_filter is called.
gdbus/watch: Fix crash when disconnecting from D-Bus

When disconnecting from D-Bus a message could be recieved with no sender:
Invalid read of size 1
   at 0x4A09EE1: strcmp (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x3B03C386B8: g_str_equal (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x4065D6: message_filter (watch.c:529)
   by 0x3B0700F9E5: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.4)
   by 0x4052E7: message_dispatch (mainloop.c:76)
   by 0x3B03C48962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3B03C47E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3B03C48157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3B03C48559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x4038C5: client_proxy_removed (test-gdbus-client.c:902)
   by 0x3B03C6B566: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
   by 0x3B03C6B6E5: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
 Address 0x0 is not stack'd, malloc'd or (recently) free'd
gdbus/client: Use g_dbus_add_service_watch to track services

This make the handling much simpler and avoids duplicates of the same
match rule.
gdbus/client: Use g_dbus_add_signal_watch to track signals

This make the handling much simpler and avoids duplicates of the same
match rule.
gdbus/client: Use g_dbus_add_properties_watch to track properties

This make the handling much simpler and avoids duplicates of the same
match rule.
attrib: Modify gatt_cb_t signature

The boolean return value will have the same semantics as GLib watches:
returning "true" will keep the GATT procedure going; returning "false"
will interrupt it (either due to an error or because the desired
information was found.)

This "early interruption" of GATT procedures is allowed by the spec and
avoids unnecessary data transfers, specially on large attribute
databases and when using small MTU values.

Other changes are to use standard C types instead of GLib ones (which
are unnecessary here) and move the "status" parameter to the first
position, so it is consistent with other callbacks.
core: Refactor memory allocation for GATT service discovery

Prior to implementing partial primary service discovery, it is necessary
to move allocation of struct included_search, so the list of found
services (search->services) can be created incrementally.

Note that this list is also used later to collect (secondary) included
services and only then the full list of found services is used for
registering new services and detecting added/removed profiles.
core: Do not pass around memory allocated internally by GATT API

Instead, do a "deep copy" of the list of GATT services. While this
generates extra heap allocations, it also allows proper cleanup in case
of ATT or link errors. In other words, memory allocated by GATT API will
be freed by GATT API after callback returns.
attrib: Run callback with the partial result of service discovery

Callbacks should check for status equal to ATT_ECODE_ATTR_NOT_FOUND to
ensure that the service discovery has finished.