reset tone manager after reaching NULL status
This commit is contained in:
parent
550fbc6d2c
commit
ed4d7bff92
|
@ -20,6 +20,7 @@ class ToneManager {
|
|||
|
||||
private ToneState state = null;
|
||||
private ScheduledFuture<?> currentTone;
|
||||
private ScheduledFuture<?> currentResetFuture;
|
||||
private boolean appRtcAudioManagerHasControl = false;
|
||||
|
||||
ToneManager(final Context context) {
|
||||
|
@ -93,6 +94,13 @@ class ToneManager {
|
|||
case ENDING_CALL:
|
||||
scheduleEnding();
|
||||
break;
|
||||
case NULL:
|
||||
if (noResetScheduled()) {
|
||||
resetAudioManager();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unable to handle transition to "+state);
|
||||
}
|
||||
this.state = state;
|
||||
}
|
||||
|
@ -111,14 +119,14 @@ class ToneManager {
|
|||
this.currentTone = JingleConnectionManager.SCHEDULED_EXECUTOR_SERVICE.schedule(() -> {
|
||||
startTone(ToneGenerator.TONE_CDMA_CALLDROP_LITE, 375);
|
||||
}, 0, TimeUnit.SECONDS);
|
||||
JingleConnectionManager.SCHEDULED_EXECUTOR_SERVICE.schedule(this::resetAudioManager, 375, TimeUnit.MILLISECONDS);
|
||||
this.currentResetFuture = JingleConnectionManager.SCHEDULED_EXECUTOR_SERVICE.schedule(this::resetAudioManager, 375, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
private void scheduleBusy() {
|
||||
this.currentTone = JingleConnectionManager.SCHEDULED_EXECUTOR_SERVICE.schedule(() -> {
|
||||
startTone(ToneGenerator.TONE_CDMA_NETWORK_BUSY, 2500);
|
||||
}, 0, TimeUnit.SECONDS);
|
||||
JingleConnectionManager.SCHEDULED_EXECUTOR_SERVICE.schedule(this::resetAudioManager, 2500, TimeUnit.MILLISECONDS);
|
||||
this.currentResetFuture = JingleConnectionManager.SCHEDULED_EXECUTOR_SERVICE.schedule(this::resetAudioManager, 2500, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
private void scheduleWaitingTone() {
|
||||
|
@ -127,6 +135,10 @@ class ToneManager {
|
|||
}, 0, 3, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private boolean noResetScheduled() {
|
||||
return this.currentResetFuture == null || this.currentResetFuture.isDone();
|
||||
}
|
||||
|
||||
private void cancelCurrentTone() {
|
||||
if (currentTone != null) {
|
||||
currentTone.cancel(true);
|
||||
|
|
Loading…
Reference in New Issue