Notify connections when the ringer is silenced.
This is necessary for connected experiences (such as headset clients) where
another device must be notified of the ringer state.
Bug: 25644529
Change-Id: I89a98a4ad8ed4d94d7bf5eed07b57f353824e338
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 8fe6fc1..714e7fd 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -993,6 +993,19 @@
}
}
+ /**
+ * Silences the ringer.
+ */
+ void silence() {
+ if (mConnectionService == null) {
+ Log.w(this, "silence() request on a call without a connection service.");
+ } else {
+ Log.i(this, "Send silence to connection service for call %s", this);
+ Log.event(this, Log.Events.STOP_DTMF);
+ mConnectionService.silence(this);
+ }
+ }
+
void disconnect() {
disconnect(false);
}
diff --git a/src/com/android/server/telecom/ConnectionServiceWrapper.java b/src/com/android/server/telecom/ConnectionServiceWrapper.java
index b80134e..8e58f22 100644
--- a/src/com/android/server/telecom/ConnectionServiceWrapper.java
+++ b/src/com/android/server/telecom/ConnectionServiceWrapper.java
@@ -709,6 +709,18 @@
removeCall(call, new DisconnectCause(DisconnectCause.LOCAL));
}
+ /** @see IConnectionService#silence(String) */
+ void silence(Call call) {
+ final String callId = mCallIdMapper.getCallId(call);
+ if (callId != null && isServiceValid("silence")) {
+ try {
+ logOutgoing("silence %s", callId);
+ mServiceInterface.silence(callId);
+ } catch (RemoteException e) {
+ }
+ }
+ }
+
/** @see IConnectionService#hold(String) */
void hold(Call call) {
final String callId = mCallIdMapper.getCallId(call);
diff --git a/src/com/android/server/telecom/Ringer.java b/src/com/android/server/telecom/Ringer.java
index 0245859..b57090d 100644
--- a/src/com/android/server/telecom/Ringer.java
+++ b/src/com/android/server/telecom/Ringer.java
@@ -142,6 +142,10 @@
* Silences the ringer for any actively ringing calls.
*/
void silence() {
+ for (Call call : mRingingCalls) {
+ call.silence();
+ }
+
// Remove all calls from the "ringing" set and then update the ringer.
mRingingCalls.clear();
updateRinging(null);
diff --git a/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java b/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
index 903028c..bdcfb5b 100644
--- a/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
+++ b/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
@@ -40,6 +40,7 @@
import android.telecom.PhoneAccountHandle;
import android.telecom.StatusHints;
+import java.lang.Override;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -113,6 +114,9 @@
public void disconnect(String callId) throws RemoteException { }
@Override
+ public void silence(String callId) throws RemoteException { }
+
+ @Override
public void hold(String callId) throws RemoteException { }
@Override