| Thomas Stuart | 9bfb243 | 2022-09-27 15:02:07 -0700 | [diff] [blame] | 1 | /* |
| Thomas Stuart | 6e418b3 | 2023-02-06 08:22:08 -0800 | [diff] [blame] | 2 | * Copyright (C) 2023 The Android Open Source Project |
| Thomas Stuart | 9bfb243 | 2022-09-27 15:02:07 -0700 | [diff] [blame] | 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 android.telecom; |
| 18 | |
| Thomas Stuart | 26b9bc7 | 2024-01-04 15:14:15 -0800 | [diff] [blame] | 19 | import android.annotation.FlaggedApi; |
| Thomas Stuart | 9bfb243 | 2022-09-27 15:02:07 -0700 | [diff] [blame] | 20 | import android.annotation.NonNull; |
| Thomas Stuart | 9ace339 | 2023-02-15 15:01:09 -0800 | [diff] [blame] | 21 | import android.os.Bundle; |
| Thomas Stuart | 9bfb243 | 2022-09-27 15:02:07 -0700 | [diff] [blame] | 22 | |
| Thomas Stuart | 26b9bc7 | 2024-01-04 15:14:15 -0800 | [diff] [blame] | 23 | import com.android.server.telecom.flags.Flags; |
| 24 | |
| Thomas Stuart | 7aeccde | 2022-12-21 14:47:21 -0800 | [diff] [blame] | 25 | import java.util.List; |
| Thomas Stuart | 9bfb243 | 2022-09-27 15:02:07 -0700 | [diff] [blame] | 26 | |
| 27 | /** |
| Thomas Stuart | 6e418b3 | 2023-02-06 08:22:08 -0800 | [diff] [blame] | 28 | * CallEventCallback relays call updates (that do not require any action) from the Telecom framework |
| 29 | * out to the application. This can include operations which the app must implement on a Call due to |
| 30 | * the presence of other calls on the device, requests relayed from a Bluetooth device, |
| 31 | * or from another calling surface. |
| Thomas Stuart | 9bfb243 | 2022-09-27 15:02:07 -0700 | [diff] [blame] | 32 | */ |
| 33 | public interface CallEventCallback { |
| 34 | /** |
| Thomas Stuart | 7aeccde | 2022-12-21 14:47:21 -0800 | [diff] [blame] | 35 | * Telecom is informing the client the current {@link CallEndpoint} changed. |
| 36 | * |
| 37 | * @param newCallEndpoint The new {@link CallEndpoint} through which call media flows |
| Thomas Stuart | 6e418b3 | 2023-02-06 08:22:08 -0800 | [diff] [blame] | 38 | * (i.e. speaker, bluetooth, etc.). |
| Thomas Stuart | 7aeccde | 2022-12-21 14:47:21 -0800 | [diff] [blame] | 39 | */ |
| 40 | void onCallEndpointChanged(@NonNull CallEndpoint newCallEndpoint); |
| 41 | |
| 42 | /** |
| 43 | * Telecom is informing the client that the available {@link CallEndpoint}s have changed. |
| 44 | * |
| 45 | * @param availableEndpoints The set of available {@link CallEndpoint}s reported by Telecom. |
| 46 | */ |
| 47 | void onAvailableCallEndpointsChanged(@NonNull List<CallEndpoint> availableEndpoints); |
| 48 | |
| 49 | /** |
| 50 | * Called when the mute state changes. |
| 51 | * |
| 52 | * @param isMuted The current mute state. |
| 53 | */ |
| 54 | void onMuteStateChanged(boolean isMuted); |
| Thomas Stuart | 6e418b3 | 2023-02-06 08:22:08 -0800 | [diff] [blame] | 55 | |
| 56 | /** |
| Thomas Stuart | 26b9bc7 | 2024-01-04 15:14:15 -0800 | [diff] [blame] | 57 | * Called when the video state changes. |
| 58 | * |
| 59 | * @param videoState The current video state. |
| 60 | */ |
| 61 | @FlaggedApi(Flags.FLAG_TRANSACTIONAL_VIDEO_STATE) |
| 62 | default void onVideoStateChanged(@CallAttributes.CallType int videoState) {} |
| 63 | |
| 64 | /** |
| Thomas Stuart | 6e418b3 | 2023-02-06 08:22:08 -0800 | [diff] [blame] | 65 | * Telecom is informing the client user requested call streaming but the stream can't be |
| 66 | * started. |
| 67 | * |
| 68 | * @param reason Code to indicate the reason of this failure |
| 69 | */ |
| 70 | void onCallStreamingFailed(@CallStreamingService.StreamingFailedReason int reason); |
| Thomas Stuart | 9ace339 | 2023-02-15 15:01:09 -0800 | [diff] [blame] | 71 | |
| 72 | /** |
| 73 | * Informs this {@link android.telecom.CallEventCallback} on events raised from a |
| Thomas Stuart | ef58429 | 2023-03-02 13:24:46 -0800 | [diff] [blame] | 74 | * {@link android.telecom.InCallService} presenting this call. These events and the |
| 75 | * associated extra keys for the {@code Bundle} parameter are mutually defined by a VoIP |
| 76 | * application and {@link android.telecom.InCallService}. This enables alternative calling |
| 77 | * surfaces, such as an automotive UI, to relay requests to perform other non-standard call |
| 78 | * actions to the app. For example, an automotive calling solution may offer the ability for |
| 79 | * the user to raise their hand during a meeting. |
| Thomas Stuart | 9ace339 | 2023-02-15 15:01:09 -0800 | [diff] [blame] | 80 | * |
| Thomas Stuart | ef58429 | 2023-03-02 13:24:46 -0800 | [diff] [blame] | 81 | * @param event a string event identifier agreed upon between a VoIP application and an |
| 82 | * {@link android.telecom.InCallService} |
| 83 | * @param extras a {@link android.os.Bundle} containing information about the event, as agreed |
| 84 | * upon between a VoIP application and {@link android.telecom.InCallService}. |
| Thomas Stuart | 9ace339 | 2023-02-15 15:01:09 -0800 | [diff] [blame] | 85 | */ |
| 86 | void onEvent(@NonNull String event, @NonNull Bundle extras); |
| Thomas Stuart | 9bfb243 | 2022-09-27 15:02:07 -0700 | [diff] [blame] | 87 | } |