1 /*
2  * Copyright 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package androidx.core.telecom.extensions
18 
19 import androidx.core.telecom.CallControlResult
20 import androidx.core.telecom.util.ExperimentalAppActions
21 
22 /**
23  * Interface used to allow the remote surface (automotive, watch, etc...) to know if the connected
24  * calling application supports the local call silence extension.
25  *
26  * Local Call Silence means that the call should be silenced at the application layer (local
27  * silence) instead of the hardware layer (global silence). Using a local call silence over global
28  * silence is advantageous when the application wants to still receive the audio input data while
29  * not transmitting audio input data to remote users.
30  */
31 @ExperimentalAppActions
32 public interface LocalCallSilenceExtensionRemote {
33 
34     /**
35      * Whether or not the local call silence extension is supported by the calling application.
36      *
37      * If `true`, then updates about the local call silence state will be notified. If `false`, then
38      * the remote doesn't support this extension and the global silence
39      * [android.telecom.InCallService.setMuted] should be used instead.
40      *
41      * Note: Must not be queried until after [CallExtensionScope.onConnected] is called.
42      */
43     public val isSupported: Boolean
44 
45     /**
46      * Request the calling application to change the local call silence state.
47      *
48      * Note: A [CallControlResult.Success] result does not mean that the local call silence state of
49      * the user has changed. It only means that the request was received by the remote application
50      * and processed.
51      *
52      * @param isSilenced `true` signals the user wants to locally silence the call.
53      * @return Whether or not the remote application received this event. This does not mean that
54      *   the operation succeeded, but rather the remote received and processed the event
55      *   successfully.
56      */
requestLocalCallSilenceUpdatenull57     public suspend fun requestLocalCallSilenceUpdate(isSilenced: Boolean): CallControlResult
58 }
59