mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Prevent StreamVolumeManager from being released twice
PiperOrigin-RevId: 307534335
This commit is contained in:
parent
628234fd1f
commit
118f0b3938
1 changed files with 5 additions and 0 deletions
|
|
@ -53,6 +53,7 @@ import com.google.android.exoplayer2.util.Util;
|
||||||
@C.StreamType private int streamType;
|
@C.StreamType private int streamType;
|
||||||
private int volume;
|
private int volume;
|
||||||
private boolean muted;
|
private boolean muted;
|
||||||
|
private boolean released;
|
||||||
|
|
||||||
/** Creates a manager. */
|
/** Creates a manager. */
|
||||||
public StreamVolumeManager(Context context, Handler eventHandler, Listener listener) {
|
public StreamVolumeManager(Context context, Handler eventHandler, Listener listener) {
|
||||||
|
|
@ -158,7 +159,11 @@ import com.google.android.exoplayer2.util.Util;
|
||||||
|
|
||||||
/** Releases the manager. It must be called when the manager is no longer required. */
|
/** Releases the manager. It must be called when the manager is no longer required. */
|
||||||
public void release() {
|
public void release() {
|
||||||
|
if (released) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
applicationContext.unregisterReceiver(receiver);
|
applicationContext.unregisterReceiver(receiver);
|
||||||
|
released = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateVolumeAndNotifyIfChanged() {
|
private void updateVolumeAndNotifyIfChanged() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue