SilentMode

Revision 3 as of 2013-08-06 10:24:05

Clear message

blueprint

Context and goals

For Ubuntu Touch, we'd like to implement a "silent mode" which would essentially disable almost all sounds from getting out of the phone/device. But we need an exception mechanism as to allow e.g. alarms to fire.

This silent mode would be enabled/disabled in the settings app, and possibly via other mechanisms (e.g. hardware button or sound indicator).

User experience

Silent mode is a per-stream flag, and apps may have audio output streams that get muted or don't get muted when silent mode is enabled.

Specifically, these behaviors should be implemented in silent-mode:

  • incoming phone rings are muted
  • incoming message notifications are muted
  • background music playback is paused
    • TODO: what happens if the user presses play while in silent mode?
  • (SDK components implementing) video playback keep playing with audio turned on
  • vibrator/haptic-feedback for incoming calls is disabled

Implementation and audio stack changes

We need to provide support for silent mode to all apps, that is provide both a C API and a QML/Qt API.

The natural place in the stack to keep a "bypass-silent" flag and to enforce silent mode seems to be our sound (multiplexing) server: PulseAudio. A new policy module could be added to PulseAudio to handle such a flag.

TODO: how would the C API look like? Extension to Pulse API?

Concerning Qt/QML apps, this could possibly be hooked to QAudioOutput::setCategory(). Another option would be to lock the volume of QAudioOutput or QAudio objects to zero when in silent mode, with some separate API to control silent mode. If neither is possible, it would make sense to discuss an extension of the qtmultimedia APIs with Qt upstream.

TODO: SDK team input on the above would help a lot.

It would also be nice to have a notification of silent mode for apps as to e.g. pause sound playback rather when entering silent mode rather than continuing muted. This could be implemented by e.g. listening to the read-only system setting controlling silent-mode.