Loading flags/telecom_api_flags.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -27,3 +27,11 @@ flag{ description: "The key is used for dialer apps to mark missed calls as read when it gets the notification on reboot." bug: "292597423" } flag{ name: "set_mute_state" namespace: "telecom" description: "transactional calls need the ability to mute the call audio input" bug: "310669304" } src/com/android/server/telecom/CallsManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -3500,7 +3500,7 @@ public class CallsManager extends Call.ListenerBase } /** Called by the in-call UI to change the mute state. */ void mute(boolean shouldMute) { public void mute(boolean shouldMute) { if (isInEmergencyCall() && shouldMute) { Log.i(this, "Refusing to turn on mute because we're in an emergency call"); shouldMute = false; Loading src/com/android/server/telecom/TransactionalServiceWrapper.java +13 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import com.android.server.telecom.voip.MaybeHoldCallForNewCallTransaction; import com.android.server.telecom.voip.ParallelTransaction; import com.android.server.telecom.voip.RequestNewActiveCallTransaction; import com.android.server.telecom.voip.SerialTransaction; import com.android.server.telecom.voip.SetMuteStateTransaction; import com.android.server.telecom.voip.TransactionManager; import com.android.server.telecom.voip.VoipCallTransaction; import com.android.server.telecom.voip.VoipCallTransactionResult; Loading Loading @@ -224,6 +225,18 @@ public class TransactionalServiceWrapper implements } } @Override public void setMuteState(boolean isMuted, android.os.ResultReceiver callback) throws RemoteException { try { Log.startSession("TSW.sMS"); addTransactionsToManager( new SetMuteStateTransaction(mCallsManager, isMuted), callback); } finally { Log.endSession(); } } @Override public void startCallStreaming(String callId, android.os.ResultReceiver callback) throws RemoteException { Loading src/com/android/server/telecom/voip/SetMuteStateTransaction.java 0 → 100644 +55 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.telecom.voip; import android.util.Log; import com.android.server.telecom.CallsManager; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; /** * This transaction should be used to change the global mute state for transactional * calls. There is currently no way for this transaction to fail. */ public class SetMuteStateTransaction extends VoipCallTransaction { private static final String TAG = SetMuteStateTransaction.class.getSimpleName(); private final CallsManager mCallsManager; private final boolean mIsMuted; public SetMuteStateTransaction(CallsManager callsManager, boolean isMuted) { super(callsManager.getLock()); mCallsManager = callsManager; mIsMuted = isMuted; } @Override public CompletionStage<VoipCallTransactionResult> processTransaction(Void v) { Log.d(TAG, "processTransaction"); CompletableFuture<VoipCallTransactionResult> future = new CompletableFuture<>(); mCallsManager.mute(mIsMuted); future.complete(new VoipCallTransactionResult( VoipCallTransactionResult.RESULT_SUCCEED, "The Mute State was changed successfully")); return future; } } Loading
flags/telecom_api_flags.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -27,3 +27,11 @@ flag{ description: "The key is used for dialer apps to mark missed calls as read when it gets the notification on reboot." bug: "292597423" } flag{ name: "set_mute_state" namespace: "telecom" description: "transactional calls need the ability to mute the call audio input" bug: "310669304" }
src/com/android/server/telecom/CallsManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -3500,7 +3500,7 @@ public class CallsManager extends Call.ListenerBase } /** Called by the in-call UI to change the mute state. */ void mute(boolean shouldMute) { public void mute(boolean shouldMute) { if (isInEmergencyCall() && shouldMute) { Log.i(this, "Refusing to turn on mute because we're in an emergency call"); shouldMute = false; Loading
src/com/android/server/telecom/TransactionalServiceWrapper.java +13 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import com.android.server.telecom.voip.MaybeHoldCallForNewCallTransaction; import com.android.server.telecom.voip.ParallelTransaction; import com.android.server.telecom.voip.RequestNewActiveCallTransaction; import com.android.server.telecom.voip.SerialTransaction; import com.android.server.telecom.voip.SetMuteStateTransaction; import com.android.server.telecom.voip.TransactionManager; import com.android.server.telecom.voip.VoipCallTransaction; import com.android.server.telecom.voip.VoipCallTransactionResult; Loading Loading @@ -224,6 +225,18 @@ public class TransactionalServiceWrapper implements } } @Override public void setMuteState(boolean isMuted, android.os.ResultReceiver callback) throws RemoteException { try { Log.startSession("TSW.sMS"); addTransactionsToManager( new SetMuteStateTransaction(mCallsManager, isMuted), callback); } finally { Log.endSession(); } } @Override public void startCallStreaming(String callId, android.os.ResultReceiver callback) throws RemoteException { Loading
src/com/android/server/telecom/voip/SetMuteStateTransaction.java 0 → 100644 +55 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.telecom.voip; import android.util.Log; import com.android.server.telecom.CallsManager; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; /** * This transaction should be used to change the global mute state for transactional * calls. There is currently no way for this transaction to fail. */ public class SetMuteStateTransaction extends VoipCallTransaction { private static final String TAG = SetMuteStateTransaction.class.getSimpleName(); private final CallsManager mCallsManager; private final boolean mIsMuted; public SetMuteStateTransaction(CallsManager callsManager, boolean isMuted) { super(callsManager.getLock()); mCallsManager = callsManager; mIsMuted = isMuted; } @Override public CompletionStage<VoipCallTransactionResult> processTransaction(Void v) { Log.d(TAG, "processTransaction"); CompletableFuture<VoipCallTransactionResult> future = new CompletableFuture<>(); mCallsManager.mute(mIsMuted); future.complete(new VoipCallTransactionResult( VoipCallTransactionResult.RESULT_SUCCEED, "The Mute State was changed successfully")); return future; } }