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
(cherry picked from commit 2097d6a33125fe64556c28e707e67bff3b56662e)
diff --git a/services/core/java/com/android/server/BluetoothService.java b/services/core/java/com/android/server/BluetoothService.java
index 5c5b477..6a6ddc8 100644
--- a/services/core/java/com/android/server/BluetoothService.java
+++ b/services/core/java/com/android/server/BluetoothService.java
@@ -54,8 +54,11 @@
 
     @Override
     public void onSwitchUser(int userHandle) {
-        initialize();
-        mBluetoothManagerService.handleOnSwitchUser(userHandle);
+        if (!mInitialized) {
+            initialize();
+        } else {
+            mBluetoothManagerService.handleOnSwitchUser(userHandle);
+        }
     }
 
     @Override