OSDN Git Service

Serialize stack shutdown, state change callback and cleanup
authorGurpreet Ghai <gghai@codeaurora.org>
Mon, 12 Sep 2016 12:06:53 +0000 (17:36 +0530)
committerAndre Eisenbach <eisenbach@google.com>
Mon, 24 Oct 2016 17:14:30 +0000 (17:14 +0000)
commit16e112b1861d8f1147325372608c905627e00e88
tree5ac0e56016c55fc396c995198216cd215acc9d33
parent40cde56d28ab9751ba76bded0b7ac5974c750a97
Serialize stack shutdown, state change callback and cleanup

Use Case: Bluetooth On/Off scenario, User switch

Steps:
1. Turn ON Bluetooth
2. Switch user
Also observed on occurrence of enable/disable timeout during On/Off testing.

Failure: Crash while sending state change HAL callback.

Root Cause: In the event when stack cleanup is queued to stack manager
thread when stack shutdown is being processed, stack cleanup starts
execution as soon as stack shutdown is finished.
If the function event_signal_stack_down posted to btif thread at the
end of stack shutdown is executed after stack cleanup crash occurs.

Fix: Serialized the execution of stack shutdown, state change callback
execution and stack cleanup to happen in same order.

Test: code compilation.

Change-Id: Ic96205b5c304acb44eab53f4e2cb150726643bda
btif/src/stack_manager.cc