Fix Handling of user switching for headless user 0 model.

For headless user 0 models we don't start Bluetooth Service in user 0.
We wait for the first user switch to start - call
BluetoothManagerService.handleBootPhase().  However, we also call
BluetoothManagerService.handleOnUserSwitch() which ends up restarting
the service that was started in handleBootPhase().  This leads to the
Bluetooth service not being available due to the extra restart.

Changing the loigc to
1. Handle boot phase on User switch if not done before.
2. Handle on switch user otherwise.

This saves 6-7 seconds of the time it takes for something like BLE to be
available in the automotive builds.

Bug: 137289703
Test: Make sure Bluetooth comes up only once with no restarts on boot up
and also ensure Bluetooth is restarted when manually switching to
another user.

Change-Id: I30179f4c2a3f81940258c70045a6ba8b32f315e1
1 file changed
tree: 48bcdafe51c7145573547f1c02f4e68d74aa81f1
  1. framework/
  2. service/