Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99ac9474 authored by Vlad Popa's avatar Vlad Popa
Browse files

Add property for tracking mute caused by client volume

The new mute state property will track whenever a client has muted the
player volume. This information will be used for the playback
notifications.

Test: make
Bug: 235521198
Change-Id: If49ab9607f8419cb3c59cd817ea5eca66413ebac
parent 063f82e8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ enum {
    PLAYER_MUTE_STREAM_VOLUME = (1 << 1),
    PLAYER_MUTE_STREAM_MUTED = (1 << 2),
    PLAYER_MUTE_PLAYBACK_RESTRICTED = (1 << 3),
    PLAYER_MUTE_CLIENT_VOLUME = (1 << 4),
};

struct mute_state_t {
@@ -60,6 +61,8 @@ struct mute_state_t {
    bool muteFromStreamMuted = false;
    /** Flag used when playback is restricted by AppOps manager with OP_PLAY_AUDIO. */
    bool muteFromPlaybackRestricted = false;
    /** Flag used when audio track was muted by client volume. */
    bool muteFromClientVolume = false;

    explicit operator int() const
    {
@@ -67,6 +70,7 @@ struct mute_state_t {
        result |= muteFromStreamVolume * PLAYER_MUTE_STREAM_VOLUME;
        result |= muteFromStreamMuted * PLAYER_MUTE_STREAM_MUTED;
        result |= muteFromPlaybackRestricted * PLAYER_MUTE_PLAYBACK_RESTRICTED;
        result |= muteFromClientVolume * PLAYER_MUTE_CLIENT_VOLUME;
        return result;
    }