IVI Connectivity

Android 8.0 creates a more seamless Bluetooth user experience when connecting devices to the in-vehicle infotainment system (IVI). The IVI listens for events, such as unlocking a car door or starting the engine, and automatically scans for in-range Bluetooth devices. It will also simultaneously connect to separate devices so users can make hands-free calls on any device.

Bluetooth connection management

In Android 7.x and earlier, the IVI Bluetooth stack scans for devices only when the Bluetooth adapter is powered on. Users have to connect manually if their device comes into range while the IVI Bluetooth is on. Android 8.0 reduces the need for users to manually connect their devices through the IVI settings app.

While the Bluetooth adapter is on and not connected to a device, customizable trigger events (such as unlocking the door or starting the engine) cause the IVI Bluetooth to scan for in-range devices to pair with on available profiles. The IVI Bluetooth then uses a priority list to determine which device to connect with.

In addition to the trigger events, you can specify the device priority for each profile. In the default implementation, the IVI Bluetooth prioritizes the most recently connected device. There is a separate priority list for each Bluetooth service, so each service profile can be connected to a different device. Each Bluetooth service profile also has a different connection limit.

Service Profile Connection limit
Phone HFP 2
PBAP 2
Message MAP 1
Audio A2DP 1

Implement connection management

To support auto-connect in Android 8.0, the Bluetooth connection management logic moved from the Bluetooth Service to a policy in Car Service. Within a policy, you can customize when the Bluetooth auto-connect should scan for new devices, and which devices it should attempt to connect to first.

The default connection policy can be found in service/src/com/android/car/BluetoothDeviceConnectionPolicy.java. To use a custom phone policy, disable the default phone policy in res/values/config.xml by setting enable_phone_policy to false.

To create a trigger event, register a listener to the respective Car Service. Example of a new sensor event:

  /**
  * Handles events coming in from the {@link CarSensorService}
  * Upon receiving the event that is of interest, initiate a connection attempt by
  * calling the policy {@link BluetoothDeviceConnectionPolicy}
  */
  private class CarSensorEventListener extends ICarSensorEventListener.Stub {
    @Override
    public void onSensorChanged(List<CarSensorEvent> events) throws RemoteException {
      if (events != null & !events.isEmpty()) {
        CarSensorEvent event = events.get(0);
        if (event.sensorType == CarSensorManager.SOME_NEW_SENSOR_EVENT) {
          initiateConnection();
        }
      ...
  }

To configure the device priority for each profile, modify the following methods in BluetoothDeviceConnectionPolicy:

  • updateDeviceConnectionStatus()
  • findDeviceToConnect()

Verify connection management

Verify the behavior of the Bluetooth connection management by toggling Bluetooth on your Android Automotive IVI and see that it automatically connects to the appropriate devices.

You can use the following adb commands to test your IVI with simulated vehicle events:

  • For CarCabinManager.ID_DOOR_LOCK:
    adb shell dumpsys activity service com.android.car inject-event zoned-boolean 0x16200b02 1 false
  • For CarSensorManager.SENSOR_TYPE_IGNITION_STATE:
    adb shell dumpsys activity service com.android.car inject-event global-integer 0x11400409 5

Bluetooth multi-device connectivity

In Android 8.0, the IVI can support multiple devices connected simultaneously over Bluetooth. Multi-device Bluetooth phone services let users connect separate devices, such as a personal phone and a work phone, and make hands-free calls from either device. This feature increases driving safety by reducing distraction and improves in-call experiences by taking advantage of automotive audio systems.

Multi-device connectivity

When a trigger event happens, the Bluetooth Connection Management Policy determines which devices to connect to on each Bluetooth profile. The policy then sends a connect intent to the profile client service. In turn, the profile client service creates a client state machine instance to manage the connection with each device.

Hands-Free Profile

The Bluetooth Hands-Free Profile (HFP) in Android 8.0 lets two devices connect concurrently, and either device can make or receive phone calls. To do this, each connection registers a separate phone account with the Telecom Manager, which advertises the phone accounts to the IVI apps.

When a user makes or receives a phone call from a device, the corresponding phone account creates an HfpClientConnection object. The Dialer app interacts with the HfpClientConnection object to manage call features, such as accepting a call or hanging up. However, the Dialer app does not indicate which device an incoming call is coming from. To make an outgoing call, the app uses the last connected device. Manufacturers can change this behavior by customizing the Dialer app.

Phone Book Access Profile

The Bluetooth Phone Book Access Profile (PBAP) downloads contacts from all connected devices. PBAP maintains an aggregated, searchable list of contacts that is updated by PBAP client state machines. Because each device interacts with a separate PBAP client state machine, contacts are associated with the proper device when making a call. When a PBAP client disconnects, the internal database removes all contacts associated with that phone.

Implement multi-device HFP

Using the default Android Bluetooth stack, an IVI automatically has the ability to connect to multiple devices on HFP. The MAX_STATE_MACHINES_POSSIBLE in the HeadsetClientService defines the maximum number of simultaneous HFP connections.

When implementing multi-device HFP, you should customize your Dialer app UI to let users select which device account to use when making a call. The app then calls telecomManager.placeCall with the correct account.

Verify multi-device HFP

To check that multi-device connectivity works properly over Bluetooth:

  1. Using Bluetooth, connect a device to the IVI and stream audio from the device.
  2. Connect two phones to the IVI over Bluetooth.
  3. Pick one phone. Place an outgoing call directly from the phone, and place an outgoing call using the IVI.
    1. Both times, verify the streamed audio pauses and the phone audio plays over the IVI connected speakers.
  4. Using the same phone, receive an incoming call directly on the phone, and receive an incoming call using the IVI.
    1. Both times, verify the stream audio pauses and the phone audio plays over the IVI connected speakers.
  5. Repeat steps 3 and 4 with the other connected phone.