diff options
author | 2023-01-20 16:32:14 +0000 | |
---|---|---|
committer | 2023-01-20 16:37:40 +0000 | |
commit | 2171298cfa05435ddec2853ba13cc9f990faa578 (patch) | |
tree | 6ffdd7850b00b41a2a33c2d673ccfc5976107e17 | |
parent | 1cd2e8b3829a0f32041ecaab7037fbb5c1e799dc (diff) |
Revert "Terminate ICS (for BT) after the disconnect tone finishe..."
Revert submission 20919444-btDisconnectTelecom
Reason for revert: Causes regression in Telecom CTS tests (b/266021486, b/266041214)
Reverted changes: /q/submissionid:20919444-btDisconnectTelecom
Change-Id: Ie6c471c4d1f11b11a721ac610a98784b8c854953
-rw-r--r-- | telecomm/java/android/telecom/Phone.java | 50 |
1 files changed, 2 insertions, 48 deletions
diff --git a/telecomm/java/android/telecom/Phone.java b/telecomm/java/android/telecom/Phone.java index fd2907c69d7a..95a8e16ace3d 100644 --- a/telecomm/java/android/telecom/Phone.java +++ b/telecomm/java/android/telecom/Phone.java @@ -32,10 +32,8 @@ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.Executor; -import java.util.concurrent.TimeUnit; /** * A unified virtual device providing a means of voice (and other) communication on a device. @@ -150,14 +148,6 @@ public final class Phone { private final Object mLock = new Object(); - // Future used to delay terminating the InCallService before the call disconnect tone - // finishes playing. - private static Map<String, CompletableFuture<Void>> sDisconnectedToneFutures = new ArrayMap<>(); - - // Timeout value to be used to ensure future completion for sDisconnectedToneFutures. This is - // set to 4 seconds to account for the exceptional case (TONE_CONGESTION). - private static final int DISCONNECTED_TONE_TIMEOUT = 4000; - Phone(InCallAdapter adapter, String callingPackage, int targetSdkVersion) { mInCallAdapter = adapter; mCallingPackage = callingPackage; @@ -466,45 +456,9 @@ public final class Phone { } private void fireCallRemoved(Call call) { - String callId = call.internalGetCallId(); - CompletableFuture<Void> disconnectedToneFuture = initializeDisconnectedToneFuture(callId); - // delay the InCallService termination until after the disconnect tone finishes playing - disconnectedToneFuture.thenRunAsync(() -> { - for (Listener listener : mListeners) { - listener.onCallRemoved(this, call); - } - // clean up the future after - sDisconnectedToneFutures.remove(callId); - }); - } - - /** - * Initialize disconnect tone future to be used in delaying ICS termination. - * - * @return CompletableFuture to delay InCallService termination until after the disconnect tone - * finishes playing. A timeout of 4s is used to handle the use case when we play - * TONE_CONGESTION and to ensure completion so that we don't block the removal of the service. - */ - private CompletableFuture<Void> initializeDisconnectedToneFuture(String callId) { - // create the future and map (sDisconnectedToneFutures) it to the corresponding call id - CompletableFuture<Void> disconnectedToneFuture = new CompletableFuture<Void>() - .completeOnTimeout(null, DISCONNECTED_TONE_TIMEOUT, TimeUnit.MILLISECONDS); - // we should not encounter duplicate insertions since call ids are unique - sDisconnectedToneFutures.put(callId, disconnectedToneFuture); - return disconnectedToneFuture; - } - - /** - * Completes disconnected tone future with passed in result. - * @hide - * @return true if future was completed, false otherwise - */ - public static boolean completeDisconnectedToneFuture(String callId) { - if (sDisconnectedToneFutures.containsKey(callId)) { - sDisconnectedToneFutures.get(callId).complete(null); - return true; + for (Listener listener : mListeners) { + listener.onCallRemoved(this, call); } - return false; } private void fireCallAudioStateChanged(CallAudioState audioState) { |