Fitbit / bitgatt

The FitbitGatt API is designed to provide a strong state machine around all Android gatt operations with the aim of making Android BLE development across Android vendors as straightforward and side-effect free as possible.
Mozilla Public License 2.0
57 stars 17 forks source link

bitgatt thread optimization #56

Closed cristian-ich closed 3 years ago

cristian-ich commented 3 years ago

Fixes #

description

Reduce the number of handler.post calls to only one per operation.

changes

We are calling too often handler.post. This proved to be a problem before when was used in onCharacteristicChanged. Also FitbitGatt.getInstance() calls should be reduced. The instance is volatile and every time it is called it has to be read from memory bypassing any cache mechanism from os.

how tested

unit tests plus loki test

google-cla[bot] commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

cristian-ich commented 3 years ago

@googlebot I signed it!