Bluetooth: Thread-safe state machine's cleaning-up.

* The AdapterService object might be null when the state machine
  thread is still in working state, and it has been set to null
  in main thread, which is called in AdapterService's cleanup.
* AdapterState and BondStateMachine both have this defect.
* We should do part cleanup work in onQuitting method of StateMachine.

Bug: 65132355

Test: Make bluetooth turn on/off stress test, passed.

Change-Id: I86bb6176ef75ff95b293f0ed73ce35db62b7add1
Signed-off-by: xutianguo <xutianguo@xiaomi.com>
3 files changed