a race condition which can cause potential BT preload timeout.

a race condition which can cause potential BT preload timeout,
When BT startup, bt_hc_worker thread will send BT_EVT_PRELOAD_CMPL
to btu_task. However in bte_main_enable, it first calls
bte_hci_enable(), then creates btu_task. So it may send BT_EVT_PRELOAD_CMPL
before btu_task created. Change creating btu_task before call bte_hci_enable
to make sure btu_task already created successfully before send
BT_EVT_PRELOAD_CMPL.
If this race condition happen, the bluetooth will not be turned on.

bug:12566357
Change-Id: I245d2df90da0f9da324fc31e371dde8539c0926c
1 file changed