1
0
mirror of https://github.com/element-hq/element-x-android.git synced 2026-10-23 18:49:00 +03:00

13 Commits

Author SHA1 Message Date
hayyaksi
2432b0ccc6 Keep playing a voice message when another app plays a short sound (#7454)
* Request media audio focus when playing a voice message

Voice message playback asked for audio focus with
USAGE_VOICE_COMMUNICATION, the same bucket as Element Call and voice
message recording, while the player itself renders on the media stream.
Audio policy layers act on the declared usage, so a car head unit
switches to its call audio context and routes the playback away while
the player keeps running.

Declare USAGE_MEDIA (and STREAM_MUSIC on the legacy path) for playback,
which is what the player actually renders. Recording and Element Call
keep asking for voice communication focus.

* Keep playing a voice message through a short sound from another app

A notification, a navigation prompt or any other app taking focus for a
moment sends AUDIOFOCUS_LOSS_TRANSIENT or AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK,
and DefaultMediaPlayer pauses on it. The voice message stops part way
through and the user has to find it again and restart it.

Recording already ignores those two, because the capture path is not
affected by focus. Give voice message playback the same treatment, moving
the requester test into a named function rather than growing the inline
condition. A permanent AUDIOFOCUS_LOSS, a real phone call, still pauses,
and the media viewer is untouched.
2026-08-20 08:55:03 +02:00
Valere
58bde16b81 enforce selecting the EC preferred device 2026-04-20 11:19:37 +02:00
Gianluca Iavicoli
443802944a Fix voice recording being interrupted by notifications sounds (#6438) 2026-03-24 13:53:42 +01:00
vmfunc
b8099ade7c set willPausedWhenDucked to true for RecordVoiceMessage
per review feedback - need true here so the onFocusLost callback
actually fires on all Android versions

Signed-off-by: vmfunc <celeste@linux.com>
2026-02-12 19:50:11 +01:00
vmfunc
1412dd789e add RecordVoiceMessage audio focus requester for recording
separates recording from playback focus - willPausedWhenDucked is false
for recording so notification sounds don't interrupt mid-recording

Signed-off-by: vmfunc <celeste@linux.com>
2026-02-12 18:39:39 +01:00
Benoit Marty
eb31505dc7 Copyright: Add Element Creations Ltd. copyright 2025-11-10 11:05:05 +01:00
Benoit Marty
f86431e663 Copyright: Add final period 2025-11-10 10:13:41 +01:00
Benoit Marty
263e761907 Remove @Inject, not necessary anymore when class is annotated with @ContributesBinding 2025-10-22 18:52:37 +02:00
Jorge Martín
de8de61b2e Remove dagger and anvil dependencies, try to simplify gradle build scripts a bit 2025-09-04 16:49:21 +02:00
Jorge Martín
4ab62a6a38 Redo DI gradle setup code 2025-09-04 16:49:20 +02:00
Jorge Martín
29a97fc0d9 Fix lint issues and restore commented out code 2025-09-04 16:49:18 +02:00
Jorge Martín
b76a71ebf5 Start migrating Anvil KSP to Metro 2025-09-04 16:48:34 +02:00
Benoit Marty
0255111528 Improve audio focus management (#4707)
* Extract Audio focus management to its own modules.

* Request Audio focus when playing a voice message.

* Add missing dependency.
(and remove a duplicated one)

* Request Audio focus when playing a video/audio in the media viewer.

* Pause audio when audio focus is lost.

* Rename class

* Fix tests

* Fix detekt issue.

* Audio focus: let the system handle automatic ducking when playing media.

* Document and update API

* Remove useless space.
2025-05-13 09:54:58 +00:00