Merge "Handle the client volume mute events"

This commit is contained in:
Vlad Popa
2022-08-09 08:13:42 +00:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 2 deletions

View File

@@ -243,12 +243,17 @@ public final class AudioPlaybackConfiguration implements Parcelable {
* Flag used when playback is restricted by AppOps manager with OP_PLAY_AUDIO.
*/
public static final int PLAYER_MUTE_PLAYBACK_RESTRICTED = (1 << 3);
/**
* @hide
* Flag used when muted by client volume.
*/
public static final int PLAYER_MUTE_CLIENT_VOLUME = (1 << 4);
/** @hide */
@IntDef(
flag = true,
value = {PLAYER_MUTE_MASTER, PLAYER_MUTE_STREAM_VOLUME, PLAYER_MUTE_STREAM_MUTED,
PLAYER_MUTE_PLAYBACK_RESTRICTED})
PLAYER_MUTE_PLAYBACK_RESTRICTED, PLAYER_MUTE_CLIENT_VOLUME})
@Retention(RetentionPolicy.SOURCE)
public @interface PlayerMuteEvent {
}
@@ -678,7 +683,8 @@ public final class AudioPlaybackConfiguration implements Parcelable {
+ " muteFromStreamVolume=" + ((mMutedState & PLAYER_MUTE_STREAM_VOLUME) != 0)
+ " muteFromStreamMuted=" + ((mMutedState & PLAYER_MUTE_STREAM_MUTED) != 0)
+ " muteFromPlaybackRestricted=" + ((mMutedState & PLAYER_MUTE_PLAYBACK_RESTRICTED)
!= 0);
!= 0)
+ " muteFromClientVolume=" + ((mMutedState & PLAYER_MUTE_CLIENT_VOLUME) != 0);
}
//=====================================================================

View File

@@ -17,6 +17,7 @@
package com.android.server.audio;
import static android.media.AudioPlaybackConfiguration.EXTRA_PLAYER_EVENT_MUTE;
import static android.media.AudioPlaybackConfiguration.PLAYER_MUTE_CLIENT_VOLUME;
import static android.media.AudioPlaybackConfiguration.PLAYER_MUTE_MASTER;
import static android.media.AudioPlaybackConfiguration.PLAYER_MUTE_PLAYBACK_RESTRICTED;
import static android.media.AudioPlaybackConfiguration.PLAYER_MUTE_STREAM_MUTED;
@@ -1145,6 +1146,8 @@ public final class PlaybackActivityMonitor
(mEventValue & PLAYER_MUTE_STREAM_MUTED) != 0);
builder.append(" muteFromPlaybackRestricted:").append(
(mEventValue & PLAYER_MUTE_PLAYBACK_RESTRICTED) != 0);
builder.append(" muteFromClientVolume:").append(
(mEventValue & PLAYER_MUTE_CLIENT_VOLUME) != 0);
return builder.toString();
default:
return builder.toString();