Bluetooth Services

Over Bluetooth, devices can transmit data that can be used for interactive services such as audio, messaging, and telephony. The Bluetooth profiles used for different services can be found in include/hardware/bluetooth.h.

Audio

A Bluetooth connection lets users stream audio on Bluetooth-enabled devices. For most audio use cases, the Android device is the source, and the rendering device, such as a speaker or a headset, is the sink.

Absolute volume control

In Android 6.0 and later, the Android Bluetooth stack lets a source set an absolute volume, giving users accurate control over audio volume. The source device sends un-attenuated audio and volume information to the sink. The sink then amplifies the audio according to the volume information, so users hear accurate playback volume.

The source device can also register volume notifications. When volume changes are made with controls on the sink, the sink sends a notification to the source. This lets the source accurately display volume information on a user interface.

Absolute volume control is on by default. To disable absolute volume control, users can go to Settings > System > Developer options and select the toggle for Disable absolute volume.

Advanced audio codecs

In Android 8.0, devices that use the Advanced Audio Distribution Profile (A2DP) can support additional audio codecs. The Bluetooth stack supports audio codec negotiation for when devices connect to a remote audio sink. This negotiation selects the best codec supported by both the sender and the sink to provide high-quality audio. After selection, all audio is routed through the selected encoder and then sent to the sink.

Implementation

Devices running Android 8.0 that support A2DP automatically gain the additional codec support. Device manufacturers may need to obtain separate licenses and binary blobs for some proprietary audio codecs. In addition to SBC, Android 8.0 supports the following codecs:

  • AAC
  • aptX
  • aptX HD
  • LDAC

Device manufacturers can choose which codecs their devices attempt to use first. Set the codec priorities by changing the following values in res/values/config.xml:

  <!-- Configuring priorities of A2DP source codecs. Larger value means
          higher priority. Value -1 means the codec is disabled.
          Value 0 is reserved and should not be used here. Enabled codecs
          should have priorities in the interval [1, 999999], and each
          priority value should be unique. -->
        <integer name="a2dp_source_codec_priority_sbc">1001</integer>
        <integer name="a2dp_source_codec_priority_aac">2001</integer>
        <integer name="a2dp_source_codec_priority_aptx">3001</integer>
        <integer name="a2dp_source_codec_priority_aptx_hd">4001</integer>
        <integer name="a2dp_source_codec_priority_ldac">5001</integer>
      

LDAC certification

The Android Open Source Project includes an encoder for Sony's LDAC codec, so a separate license or blob from Sony is not needed for it. To integrate the LDAC codec into your device, register with Sony and follow the LDAC certification process.

The LDAC certification website has documentation about LDAC, such as specification and operation handbooks. The LDAC site also provides validation and interoperability tests for mobile and tablet devices. Send passing test results to Sony to complete LDAC certification.

UI features

Along with additional codec support, Android 8.0 provides a user-facing setting to disable high-definition (HD) Bluetooth audio codecs.

  1. Navigate to Settings > Connected devices > Bluetooth.
  2. Tap on the gear icon next to the sink you want to disable codecs for.
  3. Uncheck the HD Audio checkbox.

Device manufacturers that customize Settings should implement a way for users to disable HD codecs.

Messaging

Messaging over Bluetooth lets users read, browse, and compose SMS messages from a remote device. This capability is often used when connecting a phone to an in-vehicle infotainment system.

Telephony

Bluetooth telephony services lets users stream calls and sync contacts from a phone to another Bluetooth device. These features are often used for hands-free calls when driving.

In Android 8.0, Bluetooth supports in-band ringtone. When a phone connected over Bluetooth receives an incoming call, the ringtone will play on the sink. Enable in-band ringtone in Settings > System > Developer options by selecting the toggle for Enable in-band ringing.

Bluetooth features

To implement the Bluetooth services, the Bluetooth stack supports a variety of profiles and features.

Bluetooth profiles

These profiles are available for Bluetooth:

Feature Android version
Name Description 6.0 7.0 7.1 7.1.2 8.0
SAP SIM Access Profile 1.1 1.1 1.1 1.1 1.1
MAP Message Access Profile for SMS 1.2 1.2 1.2 1.2 1.2
OPP Object Push Profile 1.1 1.1 1.1 1.1 1.2
OBEX over L2CAP OBject EXchange over Logical Link Control and Adaptation Protocol Yes Yes Yes Yes Yes
HFP Audio Gateway Hands-Free Profile 1.6 1.6 1.7 1.7 1.7
HSP Headset Profile 1.2 1.2 1.2 1.2 1.2
A2DP Advanced Audio Distribution Profile 1.2 1.2 1.2 1.2 1.2
AVRCP Audio/Video Remote Control Profile 1.3 1.3 1.3 1.3 1.4
HID Human Interface Device Profile 1.0 1.0 1.0 1.0 1.0
PBAP Phone Book Access Profile 1.1.1 1.1.1 1.1.1 1.1.1 1.2
HDP Health Device Profile 1.0 1.0 1.1 1.1 1.1
SPP Serial Port Profile 1.2 1.2 1.2 1.2 1.2
PAN / BNEP Personal Area Networking Profile / Bluetooth Network Encapsulation Protocol 1.0 1.0 1.0 1.0 1.0
DIP Device ID Profile 1.3 1.3 1.3 1.3 1.3
HOGP 1.0 HID over GATT Yes Yes Yes Yes Yes
HD Audio1 See "Advanced audio codecs" above No No No No Yes

1 Implementing HD Audio depends on device capabilities, both on the source and the sink.

Bluetooth Low Energy features

These features are available for BLE:

Feature Android version
Name 6.0 7.0 7.1 7.1.2 8.0
BR/EDR secure connections 4.1 4.1 4.1 4.1 5.0
LE Privacy 4.2 4.2 4.2 4.2 5.0
LE secure connections 4.2 4.2 4.2 4.2 5.0
Data Packet Extensions 4.2 4.2 4.2 4.2 5.0
32-bit UUIDs Yes Yes Yes Yes Yes
Dual Mode LE Central/Peripheral Yes Yes Yes Yes Yes
LE Peripheral Mode Yes Yes Yes Yes Yes
Google HCI Requirements Yes Yes Yes Yes Yes
LE Connection-Oriented Channels No No No No No