Fix : Bluetooth disabled event is sent twice 92/184592/1
authorSeungyoun Ju <sy39.ju@samsung.com>
Tue, 19 Sep 2017 13:40:24 +0000 (22:40 +0900)
committerSeungyoun Ju <sy39.ju@samsung.com>
Thu, 19 Jul 2018 05:50:49 +0000 (14:50 +0900)
commitb2b638622b4024a8c8f5341fcc3e74b8be81afa3
treee43c07c88cebc7c11fb3c3c441de9588b698cf32
parente5d518480623d03451558b7a8bb8cdbbc46900f5
Fix : Bluetooth disabled event is sent twice

[Problem] Bluetooth disabled event is sent twice when it is turned off
 by entering flight mode. It causes applications malfunction.
 For example, normally disabled event is received by weconnd after all GATT
 services have been removed. But in problem situation, the first
 disabled event happens too early so bluetooth resources (GATT services)
 remain at that time. It makes weconnd enter to strange condition (BT off but
 there are some GATT services). And after bluetooth resources are
 cleared, the second disabled event happens again. But this event is not
 processed by weconnd because it is same state to previous one.

[Cause & Measure] The first event was sent in wrong context (at Powered
 property change). This patch makes the event happen only when
 bluetoothd is terminated. So that, only one disabled event is sent
 after all bluetooth resources are cleared.

[Checking Method] Check disabled event when entering to flight mode.
 This patch is tested under below situation also.
 1. BT on / off
 2. Flight mode on -> Flight mode off
 3. Flight mode on -> BT on -> Flight mode off
 4. Recovery (TxTimeout or Hardware error by sending dbus signal)

Change-Id: Ief9dff1b4074143e1cab41b688cc960f0c73760e
bt-service/bt-service-event-receiver.c