History log of /system/bt/bta/gatt/bta_gattc_cache.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0cbe088e231a1ff624c4570773621b272b5b7408 23-Mar-2018 Jakub Pawlowski <jpawlowski@google.com> bta_gattc_sdp_callback move null check above first usage

Bug: 75311714
Test: Test scenario described in bug
Change-Id: Ib2da24134205277ae03cf28394db74758de17e5d
(cherry picked from commit 61dfe5ccf014aa17cbe800b1195afdb7e474a376)
/system/bt/bta/gatt/bta_gattc_cache.cc
0bdae6a1c108f8a699bfeeb362023de848750a65 20-Feb-2018 Yi Kong <yikong@google.com> Remove unreachable code

The conditionals can never be true, as they are outside of the bounds of
their data types. Fixes tautological-constant-compare warning.

Bug: 72331526
Test: m
Change-Id: I74063fe19b319ee32e4c1c8b3a5fc7ed612586e3
/system/bt/bta/gatt/bta_gattc_cache.cc
6ba9058139e52a0410d9f8dc0903f1dc2bb7de3b 31-Jan-2018 Jakub Pawlowski <jpawlowski@google.com> Set pending_discovery when doing GATT over BR/EDR

SDP discovery can return services before LE discovery, or after LE
discovery is already done. In both cases, pending_discover is not a
valid pointer, and must be set before call to bta_gattc_explore_srvc

Test: sl4a GattOverBrEdr
Change-Id: I2b43d2348edfa641c56a8085a92b6367b146030d
/system/bt/bta/gatt/bta_gattc_cache.cc
1eda2929c9a4c1ba66c34253cf7597f56c6e9790 25-Jan-2018 Zach Johnson <zachoverflow@google.com> Don't pack and align GATT structs

Causes BUS_ADRALEN on some architectures.

Change-Id: I50c2e1b4ef81fa8cd223cba09285099da8d7f67d
Fixes: 70571956
Test: 100% repro on bug before change, retest and 0% repro
/system/bt/bta/gatt/bta_gattc_cache.cc
fdae46505f66759b58e7718b4706894020c8b7a5 13-Dec-2017 Jakub Pawlowski <jpawlowski@google.com> Minor GATT logging fixes

Test: compilation
Bug: 70297056
Change-Id: If71bbb19a08abbbb30b5ce5027aed97e03b3baaa
/system/bt/bta/gatt/bta_gattc_cache.cc
93d7ffd15cb5d25e964f64862030020bc6bb7895 13-Dec-2017 Jakub Pawlowski <jpawlowski@google.com> Bump GATT cache file version marker

In commit 819e2ecb84, the type used for UUID in the GATT cache was changed
from tBT_UUID to bluetooth:Uuid. This changed the binary representation of
this field. 18 bytes were used previously, now only 16 bytes are used.
This change made GATT cache file format incompatible between Android
versions, and requires an increment of cache file format version.

Fixes: 70297056
Test: added GattCacheTest
Change-Id: I4bceada300dbe3aab10d14df2aa853e4573c536e
/system/bt/bta/gatt/bta_gattc_cache.cc
6918d40fd9ca8c58c115cf694f165413165e5758 05-Dec-2017 Jakub Pawlowski <jpawlowski@google.com> GATT cache memory corruption fix

When doing GATT discovery, we interleave adding elements to vector,
and storing pointers to them. This can cause memory corruption, because
vector can reallocate the memory when adding element, leaving the pointers
invalid. To fix that, never store pointers to mutable vector elements.

Bug: 70041392
Test: manual, connected to HID device
Change-Id: I6bb3fec61afa742f446b66e3291c5f326738ee17
/system/bt/bta/gatt/bta_gattc_cache.cc
5b790feeeb211c42bf78ca3ae9c26aa30e516765 18-Sep-2017 Jakub Pawlowski <jpawlowski@google.com> Make copyright headers consistent with Google template; remove "(C)"

Test: Comment changes only; still compiles...
Change-Id: Id699a8170112f06e4a2c9f2e0f0834d1817ace4e
/system/bt/bta/gatt/bta_gattc_cache.cc
8a0f7ad094c5b1493e3791ba1db718c1791a5b94 10-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> GATT discovery refactor

Currently, when doing service discovery, we store pending discovery
content into tBTA_GATTC_ATTR_REC structure, and rewrite it into cache,
service after service during discovery.
From now on, we save discovery result directly into pending_discovery,
and at end of discovery we swap it with cache. This remove unncecessary
intermidiate step, and simplify the discovery.

Bug: 67057055
Test: GattReadTest
Change-Id: Id09026b6fb6df04eaf0a0ebefeb6e35b3d175f62
/system/bt/bta/gatt/bta_gattc_cache.cc
fa9074885bea48e7844e2fd14df799df6da4782f 23-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> Use vector instead of list for keeping GATT database content

We don't use any list features, but have to pay extra for it's features.
Replace with vector.

Bug: 67057055
Test: compilation
Change-Id: I4209c24b4f87780ea29e4e0707ce0a2a0d440d6b
/system/bt/bta/gatt/bta_gattc_cache.cc
8e16fd450f60dd263120e1354da7c946bd401da4 20-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> Clarify naming for characteristic value handle

We always reffer to characteristic by it's value handle.

Bug: 67057055
Test: compilation
Change-Id: I41a5d910ed471800c996b44dccfdbab3d7c3bdda
/system/bt/bta/gatt/bta_gattc_cache.cc
da3ebfd175b223b9f070b143e66ffffb8ea58532 17-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> Inline bta_gattc_start_disc_* where possible

Bug: 67057055
Test: compilation
Change-Id: I4b90b6eede46ffb777180caaab7cb073f898ddba
/system/bt/bta/gatt/bta_gattc_cache.cc
66d702c5025212df10a7518fcb5a585a2dada99b 17-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> bta_gattc_explore_srvc minor style fixes

Bug: 67057055
Test: compilation
Change-Id: I37c5a138ccddcb1ddd09e3efb5dfcdaeb5bdad04
/system/bt/bta/gatt/bta_gattc_cache.cc
e03aeaedcac3eb2b2e64c4453c56ed91fa8492ad 17-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> Remove bta_gattc_incl_srvc_disc_cmpl

Bug: 67057055
Test: compilation
Change-Id: I6ff0c0dc203232f9fa2b43ccbacb015106d2b6d1
/system/bt/bta/gatt/bta_gattc_cache.cc
2f228e099ff8466a79b321a41028bf4a871a21dd 14-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> bta_gattc_cache: prepare for type unification

Bug: 67057055
Test: compilation
Change-Id: I46eb07a8f118b61551b3adc404ec306ad6a14b9c
/system/bt/bta/gatt/bta_gattc_cache.cc
48e0c8d8a6891298efba0f375ce6db357cb9b0dd 13-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> BTA GATT cache cleanup bta_gattc_discover_pri_service

Bug: 67057055
Test: compilation test
Change-Id: I23464a61282d60400ae36debc820c66a4f1a1e1a
/system/bt/bta/gatt/bta_gattc_cache.cc
9de0b5cb0aaace12be2a746f7814115843061492 13-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> BTA GATT cache cleanup bta_gattc_srvc_in_list

Bug: 67057055
Test: compilation test
Change-Id: I22e752c1d270128ff0ae4f633d4f3eccf4cb725e
/system/bt/bta/gatt/bta_gattc_cache.cc
0c3eaab266f1892f0c5208eb4b2f18147c69d58e 12-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> BTA GATT cache cleanup add_*_to_list

Bug: 67057055
Test: compilation test
Change-Id: If70cfc4c024434ffe77e53410b5de8f70af6b33e
/system/bt/bta/gatt/bta_gattc_cache.cc
e6389005a7e2f0143b0a8d33f2eea35d7b4cc598 12-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> BTA GATT cache cleanup bta_gattc_disc_res_cback

Bug: 67057055
Test: compilation test
Change-Id: Iccfffe5de654070058ce3f4af3f48fa0975b7cf3
/system/bt/bta/gatt/bta_gattc_cache.cc
98c0494449165f7e10c1f6f589946dd2a7a745c4 11-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> BTA GATT cache cleanup

This patch splits bta_gattc_add_attr_to_cache into two functions:
bta_gattc_add_descr_to_cache and bta_gattc_add_incl_srvc_to_cache

Bug: 67057055
Test: compilation test
Change-Id: I92702495e8631197e56c2cb0ab126b59cf7e90e4
/system/bt/bta/gatt/bta_gattc_cache.cc
2647452211f7beaee19610fe79442828ab2b0ee6 04-Oct-2017 Jakub Pawlowski <jpawlowski@google.com> Use LOG() macros in BTA GATT logging

Test: compilation test
Change-Id: If7676af5bf915df57ab6e876d2f27500ebf5c07d
/system/bt/bta/gatt/bta_gattc_cache.cc
d9ca4100b8a22950a3e560985ca09d885eb22f32 09-Sep-2017 Jakub Pawlowski <jpawlowski@google.com> Use std::list in GATT related code

Bug: 67057055
Test: sl4a Gatt* tests
Change-Id: I8201ebdad5ba4c3d5d0a2fd3d0fe9dc900b51d60
/system/bt/bta/gatt/bta_gattc_cache.cc
e9ef00c3fb2de5077a8ffdb728f1996cc1e9a155 26-Sep-2017 Jakub Pawlowski <jpawlowski@google.com> Remove unnecesary BTA redefinitions for GATT part 2

Test: compilation test
Change-Id: Iaf81188596c33b92f79f163dc95187ed5c6f52a4
/system/bt/bta/gatt/bta_gattc_cache.cc
819e2ecb84a22d6e03ec9ed67b3260c0dd7e8aba 10-Jul-2017 Jakub Pawlowski <jpawlowski@google.com> Use one type for UUID (1/5)

Currently, we have few different representations for UUID in stack:
tBT_UUID, tSDP_UUID, bt_uuid_t, bluetooth:UUID, or uint8_t*.

Additionally, tBT_UUID and bt_uuid_t are used to hold UUID as 128bit
as Little Endian or Big Endian, depending on which part of stack (GATT
or SDP) is using it.

This patch is creating one type, bluetooth::Uuid, that will replace all
other types.

Bug: 66912853
Test: all sl4a tests for GATT and RFCOMM
Merged-In: Ia42d3233146db0488728ed6f878f99b368fe8838
Change-Id: Ia42d3233146db0488728ed6f878f99b368fe8838
/system/bt/bta/gatt/bta_gattc_cache.cc
fae9b2fae0a520b693d52082bd5bc96586d13d0f 14-Sep-2017 Jakub Pawlowski <jpawlowski@google.com> Fix included service parsing (1/3)

Bug: 65637368
Test: sl4a GattIncludedServiceTest
Change-Id: Icb882d411a75a91e3fea050f00c40e76de3539de
/system/bt/bta/gatt/bta_gattc_cache.cc
972c885cc9106520a9feb09de81655c01363dfb8 07-Apr-2017 Scott Bauer <sbauer@plzdonthack.me> Read the correct amount of attributes

bta_gattc_cache_load currently attempts to read 0xFF attributes into an
allocation sized to num_attr attributes, which can be smaller than 0xFF.

There aren't more than num_attr bytes in correct data, but this breaks
with dynamic buffer overflow checking in CopperheadOS for the read
system call since fread ends up calling read, which obtains the size of
the allocation from the malloc implementation and then aborts due to the
(potential) overflow.

This would also fail with the default enabled _FORTIFY_SOURCE=2 feature
in the Android Open Source Project if osi_malloc was marked with the
alloc_size attribute. The way it wraps malloc loses that information so
fortify checks aren't done for calls like this.

Change-Id: I68bd170d5378c9d9d21cbda376083bc0b857e15c
Signed-off-by: Scott Bauer <sbauer@plzdonthack.me>
[migrated to C++ file, added 0xFFFF limit and wrote commit message]
Signed-off-by: Daniel Micay <danielmicay@gmail.com>
/system/bt/bta/gatt/bta_gattc_cache.cc
a484a888196ddf8bcbf1ad3226d6451bc735a94b 25-Jun-2017 Jakub Pawlowski <jpawlowski@google.com> Rename bt_bdaddr_t into RawAddress (3/3)

Test: compilation test
Change-Id: I4571721a0c6165a66450ee157a53d8d15bfc45d0
/system/bt/bta/gatt/bta_gattc_cache.cc
135b7f68e4404872b9c5541146702c079e987877 16-Jun-2017 Jakub Pawlowski <jpawlowski@google.com> Replace BD_ADDR with bt_bdaddr_t in SDP and A2DP related code

Test: compilation test
Change-Id: I59a69d56377d38f349def6b24aa5c7d5a3d4f859
/system/bt/bta/gatt/bta_gattc_cache.cc
c2276b06572ab6fc1f900fbb1f41087e77d47e2a 10-Jun-2017 Jakub Pawlowski <jpawlowski@google.com> Use bt_bdaddr_t instead of BD_ADDR

Test: compilation test, sl4a GattReadTest
Change-Id: I8d1bd6914aec55bb53495b1d0d5e3d37b86865e6
/system/bt/bta/gatt/bta_gattc_cache.cc
bee374a833557329ebb5497e5548c4d06bdcb8e5 19-Apr-2017 Bailey Forrest <bcf@google.com> bta_gattc_cache: Initialize gatt_db_elemement_t permissions to 0

Previously this value was uninitialized. Attribute permissions are not
discovable via the attribute protocol.

Bug: None
Test: Build. permissions are 0.
Change-Id: I5fdac3b90683245a0af0d6e27a2873499ca90e6c
/system/bt/bta/gatt/bta_gattc_cache.cc
8957fdca4f6a1ba963b81983e8a40a82c3b1122d 16-Jan-2017 Jakub Pawlowski <jpawlowski@google.com> Fix NPE when discovering invalid GATT datatbase

When doing a discovery of invalid GATT database, where two services are
added with same start handle, characteristics are added to the first
one, where descriptors are added to the later. This cause NPE when
adding descriptor.

Bug: 34280184
Test: manual test
Change-Id: I27619098df33a641cb089b82cf4d4ffd3c6e6aea
/system/bt/bta/gatt/bta_gattc_cache.cc
9979121f0865e07432215529f9b157792ae3ef21 18-Nov-2016 Myles Watson <mylesgw@google.com> Remove BTA_GATT_INCLUDED

Test: Connect to a BLE Keyboard
Change-Id: I00393e2bf09fb65533e953896563e69aab5a22dc
/system/bt/bta/gatt/bta_gattc_cache.cc
1baaae3f34a667058e7f0c5f778357d98320cf38 09-Nov-2016 Myles Watson <mylesgw@google.com> bta: Fix comment formatting after clang-format

Test: mma -j32
Change-Id: Ic945ac421b1918527105c59674eda89afd3d4126
/system/bt/bta/gatt/bta_gattc_cache.cc
cd1fd07f1306e08fe048682dd5918987e579f937 09-Nov-2016 Myles Watson <mylesgw@google.com> bta: Apply clang-format

clang-format -i --style=file bta/*/*

(twice)

Test: mma -j32
Change-Id: Ib118b1dfb6a34f9a5bfe153d65841e9041165264
/system/bt/bta/gatt/bta_gattc_cache.cc
8af480e24549ba51a3f6858d9d9af504715e0bea 09-Nov-2016 Myles Watson <mylesgw@google.com> bta: Remove double asterisks in comments

Double asterisks at the beginning of the line
sed -i s,"^[*][*]"," *", bta/*/*

Double asterisks after a space
sed -i s,"^ [*][*]\([^*]\)"," *\1", bta/*/*
sed -i s,"^ [*][*]$"," *", bta/*/*

Test: mma -j32
Change-Id: Ib83b802c7000176683b4e7f24d1255b3c2c6c01c
/system/bt/bta/gatt/bta_gattc_cache.cc
d7ffd64accbd50a27289a388856e56244ccbb5da 27-Oct-2016 Myles Watson <mylesgw@google.com> Remove deprecated UNUSED macro (5/5)

Include osi.h for UNUSED_ATTR.

Test: mma -j32

Change-Id: I43260669dc1f54639e46cc9620093d727ee86276
/system/bt/bta/gatt/bta_gattc_cache.cc
d35a648d39710bbc5ac59f8add85166455af5af7 27-Oct-2016 Myles Watson <mylesgw@google.com> Remove deprecated UNUSED macro (1/5)

Generated automatically with coccinelle

/* This rule matches functions with arguments
* that have an UNUSED(arg) in the body.
*/
@r1@
identifier arg;
identifier fn;
type t;
parameter list[n] P;
@@

fn(P, const t arg) { ...
UNUSED(arg);
...
}

/* This rule removes the UNUSED line, and adds
* UNUSED_ATTR to the parameter list.
*/
@depends on r1@
identifier r1.arg;
identifier r1.fn;
type r1.t;
parameter list[r1.n] r1.P;
typedef UNUSED_ATTR;
@@

fn(P,
- const t arg
+ UNUSED_ATTR GETRIDOFTHISCOMMA, const t arg
) { ...
-UNUSED(arg);
...
}

Test: mma -j32

Change-Id: Idcaadd688d669d484e557becd050e69454508f3c
/system/bt/bta/gatt/bta_gattc_cache.cc
80d7f60680f483a71e413f2453ab20013aff5c5c 02-Mar-2016 George Burgess IV <gbiv@google.com> Replace all uses of sprintf() with snprint()

- sprintf() does not limit the length of the character string when writing
to a buffer and may result in buffer overflow
- snprintf() requires the maximum write length as a parameter. When the
maximum length supported is smaller than the reserved buffer length,
the call will not result in buffer overflow

Bug: 31859081
Test: TestTracker/64195/3975
Change-Id: I519f8ef7b9b162fd79094f89148250d783c734c0
/system/bt/bta/gatt/bta_gattc_cache.cc
c695f2578d2d123e8404a2e985250575d9912c6e 14-Jul-2016 Nitin Arora <niarora@codeaurora.org> Bluetooth: Prevent gatt DB copy if server cache is absent

In case the server cache does not exist for a specific
connection, the API used to copy the server DB into the
DB structure needs to return immediately. This change
makes sure of that and prevents dereferencing of a null
block causing the runtime error.

Change-Id: Iec3040a1280ef9d80b1b9c76eca8071dff499411
/system/bt/bta/gatt/bta_gattc_cache.cc
d19e0785e662e640191a075eda07acce61c2aeda 15-Jul-2016 Marie Janssen <jamuraa@google.com> Use standard types, consistent ifdef style everywhere

Remove the typedefs in stack/include/bt_types.h

Use standard types everywhere.
Use standard style for #if statements:
- #if (VAR_NAME == TRUE)
- #if (VAR_NAME1 == TRUE && VAR_NAME2 == TRUE)
Use __func__ instead of __FUNCTION__
Fix some debug statements to use __func__

Update script to be less disruptive to aligned assignment blocks.

Change-Id: I8f8f068e6c26ce74fd3b3707e1e31fd0b919cdd0
/system/bt/bta/gatt/bta_gattc_cache.cc
e9e58ced195ec2c983c7723c9cbdabd45eb0f2fd 17-Jun-2016 Marie Janssen <jamuraa@google.com> bta: use standard types

Use standard types everywhere.
Use standard style for #if statements:
- #if (VAR_NAME == TRUE)
- #if (VAR_NAME1 == TRUE && VAR_NAME2 == TRUE)
Use __func__ instead of __FUNCTION__
Fix some debug statements to use __func__

Change-Id: Ib86de4de9f14529ecaa4f71597260e3b5785360b
/system/bt/bta/gatt/bta_gattc_cache.cc
ec79baaaed83529dae14d492ea2f73aedee9e4d0 28-May-2016 Jakub Pawlowski <jpawlowski@google.com> Vectors as parameters to GATT write/indicate (1/3)

This changes are covered in test cases:
GattReadTest.*
GattWriteTest.*

Bug: 29005882
Bug: 28485365
Change-Id: I1409e6ead22ff691190f9ea4c3ffe2267bd3bf33
/system/bt/bta/gatt/bta_gattc_cache.cc
6c81482c2ddf10ac3c2d948ed3b4f0a58faea55c 14-Jun-2016 Jakub Pawlowski <jpawlowski@google.com> Fix missing GATT Characteristic from last service

GATT Service is contained between start and end handle. If
characteristic definition is at end handle, and it's value definition is
after end handle, it will not be properly discovered. That's because we
use value_handle instead of attribute_handle to identify
characteristics.

As a workaround, increase service boundary if value is defined after
it's definition.

Bug: 29253825
Change-Id: Ib145aea4f5cf38a1fbb977c301136e16f8f900f7
(chery picked from commit 552e630435a68d8f51d458dccf8697c625cf1510)
/system/bt/bta/gatt/bta_gattc_cache.cc
d407e1afcae357412dec57c8f26153ade57fcecb 14-Jun-2016 Jakub Pawlowski <jpawlowski@google.com> Use UINT16 for GATT attribute id field

Id field is equal to attribute handle, so it must be 16bits.
Otherwise only piece of GATT database can be used.

Bug: 29253825
Change-Id: Ia88e3ad3eb96ca8e97349aa5e852e66c57072b49
(cherry picked from commit e6b1cb43525e27f95de85dc43150d7368b9d4c35)
/system/bt/bta/gatt/bta_gattc_cache.cc
0a0a7e96e7092f03a6dc568eb6358c6f4499e56a 27-May-2016 Jakub Pawlowski <jpawlowski@google.com> Linux build fix

Change-Id: Iae3d7d77dda70a288022d81a5f3c8f156b95adc9
/system/bt/bta/gatt/bta_gattc_cache.cc
19117701657073f3b8ba03620c081a8976b318a6 26-May-2016 Jakub Pawlowski <jpawlowski@google.com> Convert GATT related BTA code to C++

Change-Id: I9c36d0ebeb1143395b3b38b3d179d12a9503d28a
/system/bt/bta/gatt/bta_gattc_cache.cc