1 /* 2 * Copyright (C) 2016 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 com.android.internal.telephony.imsphone; 18 19 import android.compat.annotation.UnsupportedAppUsage; 20 import android.os.Build; 21 import android.telephony.ims.ImsExternalCallState; 22 23 import com.android.internal.telephony.Call; 24 import com.android.internal.telephony.CallStateException; 25 import com.android.internal.telephony.Phone; 26 27 /** 28 * Companion class for {@link ImsExternalConnection}; represents an external call which was 29 * received via {@link ImsExternalCallState} info. 30 */ 31 public class ImsExternalCall extends Call { 32 33 private Phone mPhone; 34 35 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) ImsExternalCall(Phone phone, ImsExternalConnection connection)36 public ImsExternalCall(Phone phone, ImsExternalConnection connection) { 37 mPhone = phone; 38 addConnection(connection); 39 } 40 41 @Override getPhone()42 public Phone getPhone() { 43 return mPhone; 44 } 45 46 @Override isMultiparty()47 public boolean isMultiparty() { 48 return false; 49 } 50 51 @Override hangup()52 public void hangup() throws CallStateException { 53 54 } 55 56 @Override hangup(@ndroid.telecom.Call.RejectReason int rejectReason)57 public void hangup(@android.telecom.Call.RejectReason int rejectReason) 58 throws CallStateException { 59 // tumbleweed 60 } 61 62 /** 63 * Sets the call state to active. 64 */ setActive()65 public void setActive() { 66 setState(State.ACTIVE); 67 } 68 69 /** 70 * Sets the call state to terminated. 71 */ setTerminated()72 public void setTerminated() { 73 setState(State.DISCONNECTED); 74 } 75 } 76