Preload timeout and retry mechanism (1/3)

If the Preload process was stuck due to unknown hardware init failure,
a 8-second ENABLE_TIMEOUT timeout would be eventually expired in Java layer
at AdapterState and attempted to set BT state back to STATE_OFF.
However BluetoothManagerService did not handle this case accordingly and led
to state mis-matching between Java layer and BTIF at the end.

Add a timeout and retry mechanism to manage Preload process.
Clean up native space resource and explicitly report STATE_OFF back to Java
space when Preload did not go through.

bug  7566317

Change-Id: I99a225e524f2b951249618990a2d0a8a39b43ff3
6 files changed