Rich audio-haptic feedback support

In Android 17 QPR2, apps can deliver multisensory audio-haptic feedback compliant with the Multisensory Design System (MSDS), a tokenized component library designed for consistent, high-quality audio and haptics across Android devices.

Apps can enrich user interactions following MSDS guidelines by playing MSDS feedback using the playToken(int) method from the MultisensoryManager system service.

Device-first approach

To make the most of your device's hardware, the MultisensoryManager system service follows a device-first approach. When an app requests feedback, the service maps integer tokens to haptic and audio effects:

  • Device-specific player: If an OEM custom player is installed, playback requests are delegated directly to the custom player. This gives OEMs the opportunity to showcase the best of their hardware by playing audio and haptics in tight synchrony with minimal latency.
  • AOSP fallback: If no custom player is installed, feedback is seamlessly delivered using standard AOSP SoundPool and Vibrator frameworks as a baseline.

Player contract and integration

You can define a custom player by implementing the IMultisensoryPlayer.aidl interface. When implemented, you can register the player with the MultisensoryService using the setPlayer method.

To support synchronized audio-haptic feedback, custom players must implement the following essential methods:

  • setPlayerId(long)
  • load(int, VibrationEffect, String, IMultisensoryPlayerLoadCallback)
  • play(int, VibrationAttributes, AudioAttributes)
  • cancel

Permissions

To install a custom player, the installing service or process must include the REMOTE_MULTISENSORY_PLAYBACK permission in its manifest.

Loading and playback lifecycle

Custom players follow this lifecycle to load resources and play synchronized feedback:

  1. Loading resources: When installed, the custom player receives load requests for audio and haptic resources associated with each token.
  2. Reporting status: Upon completing a load operation for a token, the player reports results back using the IMultisensoryPlayerLoadCallback interface so the system service knows the player is ready to play that token.
  3. Synchronized playback: When an app requests playback for a token, the system service delegates the request to the installed player, enabling your device to deliver synchronized audio and haptics with optimal timing.

If a custom player is ever disconnected or lost, the MultisensoryService falls back to playing feedback through standard AOSP SoundPool and Vibrator classes.