| Grace Jia | ef5a4cc | 2022-12-13 11:08:55 -0800 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2022 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 android.telecom; | 
|  | 18 |  | 
|  | 19 | import android.os.RemoteException; | 
|  | 20 |  | 
|  | 21 | import com.android.internal.telecom.IStreamingCallAdapter; | 
|  | 22 |  | 
|  | 23 | /** | 
|  | 24 | * Receives commands from {@link CallStreamingService} implementations which should be executed by | 
|  | 25 | * Telecom. When Telecom binds to a {@link CallStreamingService}, an instance of this class is given | 
|  | 26 | * to the general streaming app through which it can manipulate the streaming calls. Whe the general | 
|  | 27 | * streaming app is notified of new ongoing streaming calls, it can execute | 
|  | 28 | * {@link StreamingCall#setStreamingState(int)} for the ongoing streaming calls the user on the | 
|  | 29 | * receiver side would like to hold, unhold and disconnect. | 
|  | 30 | * | 
|  | 31 | * @hide | 
|  | 32 | */ | 
|  | 33 | public final class StreamingCallAdapter { | 
|  | 34 | private final IStreamingCallAdapter mAdapter; | 
|  | 35 |  | 
|  | 36 | /** | 
|  | 37 | * {@hide} | 
|  | 38 | */ | 
|  | 39 | public StreamingCallAdapter(IStreamingCallAdapter adapter) { | 
|  | 40 | mAdapter = adapter; | 
|  | 41 | } | 
|  | 42 |  | 
|  | 43 | /** | 
|  | 44 | * Instruct telecom to change the state of the streaming call. | 
|  | 45 | * | 
|  | 46 | * @param state The streaming state to set | 
|  | 47 | */ | 
|  | 48 | public void setStreamingState(@StreamingCall.StreamingCallState int state) { | 
|  | 49 | try { | 
|  | 50 | mAdapter.setStreamingState(state); | 
|  | 51 | } catch (RemoteException e) { | 
|  | 52 | } | 
|  | 53 | } | 
|  | 54 | } |