- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
54 lines
2.0 KiB
Java
54 lines
2.0 KiB
Java
package androidx.media;
|
|
|
|
import android.media.AudioManager;
|
|
import android.os.Build;
|
|
import androidx.annotation.IntRange;
|
|
import androidx.annotation.NonNull;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class AudioManagerCompat {
|
|
public static final int AUDIOFOCUS_GAIN = 1;
|
|
public static final int AUDIOFOCUS_GAIN_TRANSIENT = 2;
|
|
public static final int AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE = 4;
|
|
public static final int AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK = 3;
|
|
private static final String TAG = "AudioManCompat";
|
|
|
|
public static int requestAudioFocus(@NonNull AudioManager audioManager, @NonNull AudioFocusRequestCompat audioFocusRequestCompat) {
|
|
if (audioManager == null) {
|
|
throw new IllegalArgumentException("AudioManager must not be null");
|
|
}
|
|
if (audioFocusRequestCompat == null) {
|
|
throw new IllegalArgumentException("AudioFocusRequestCompat must not be null");
|
|
}
|
|
return audioManager.requestAudioFocus(audioFocusRequestCompat.getAudioFocusRequest());
|
|
}
|
|
|
|
public static int abandonAudioFocusRequest(@NonNull AudioManager audioManager, @NonNull AudioFocusRequestCompat audioFocusRequestCompat) {
|
|
if (audioManager == null) {
|
|
throw new IllegalArgumentException("AudioManager must not be null");
|
|
}
|
|
if (audioFocusRequestCompat == null) {
|
|
throw new IllegalArgumentException("AudioFocusRequestCompat must not be null");
|
|
}
|
|
return audioManager.abandonAudioFocusRequest(audioFocusRequestCompat.getAudioFocusRequest());
|
|
}
|
|
|
|
@IntRange(from = 0)
|
|
public static int getStreamMaxVolume(@NonNull AudioManager audioManager, int i) {
|
|
return audioManager.getStreamMaxVolume(i);
|
|
}
|
|
|
|
@IntRange(from = 0)
|
|
public static int getStreamMinVolume(@NonNull AudioManager audioManager, int i) {
|
|
int streamMinVolume;
|
|
if (Build.VERSION.SDK_INT < 28) {
|
|
return 0;
|
|
}
|
|
streamMinVolume = audioManager.getStreamMinVolume(i);
|
|
return streamMinVolume;
|
|
}
|
|
|
|
private AudioManagerCompat() {
|
|
}
|
|
}
|