bluetooth: Don't call OnBluetoothStateChanged if the state doesn't change
AdapterPoweredChanged gets called right after AdapterPresentChanged when an adapter is added or removed. This causes us to call Observer::OnBluetoothStateChanged() a second time without the state actually changing. To avoid this, we cache the state whenever AdapterPresentChanged and AdapterPoweredChanged get called and only notify if the new state is different than the cached state. Bug: 908879 Change-Id: I7ca48b20678b5336346955fd2254bc68f2a09b75 Reviewed-on: https://chromium-review.googlesource.com/c/1352123 Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org> Reviewed-by:Tetsui Ohkubo <tetsui@chromium.org> Cr-Commit-Position: refs/heads/master@{#611911}
Showing
Please register or sign in to comment