2014-07-09 21:52:04 -07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 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.
|
|
|
|
*/
|
|
|
|
|
2014-09-12 22:16:17 -07:00
|
|
|
package android.telecom;
|
2014-07-09 21:52:04 -07:00
|
|
|
|
2014-08-19 14:24:18 -07:00
|
|
|
import android.annotation.SystemApi;
|
2014-07-09 21:52:04 -07:00
|
|
|
import android.net.Uri;
|
2014-08-08 14:00:25 -07:00
|
|
|
import android.os.Bundle;
|
2014-07-09 21:52:04 -07:00
|
|
|
|
2014-07-22 16:41:54 -07:00
|
|
|
import java.lang.String;
|
2014-07-09 21:52:04 -07:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.List;
|
2014-07-28 18:15:48 -07:00
|
|
|
import java.util.Map;
|
2014-07-09 21:52:04 -07:00
|
|
|
import java.util.Objects;
|
2014-08-15 09:23:07 -07:00
|
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
2014-07-09 21:52:04 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents an ongoing phone call that the in-call app should present to the user.
|
2014-08-07 19:46:01 -07:00
|
|
|
*
|
|
|
|
* {@hide}
|
2014-07-09 21:52:04 -07:00
|
|
|
*/
|
2014-08-19 14:24:18 -07:00
|
|
|
@SystemApi
|
2014-07-09 21:52:04 -07:00
|
|
|
public final class Call {
|
|
|
|
/**
|
|
|
|
* The state of a {@code Call} when newly created.
|
|
|
|
*/
|
|
|
|
public static final int STATE_NEW = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The state of an outgoing {@code Call} when dialing the remote number, but not yet connected.
|
|
|
|
*/
|
|
|
|
public static final int STATE_DIALING = 1;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The state of an incoming {@code Call} when ringing locally, but not yet connected.
|
|
|
|
*/
|
|
|
|
public static final int STATE_RINGING = 2;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The state of a {@code Call} when in a holding state.
|
|
|
|
*/
|
|
|
|
public static final int STATE_HOLDING = 3;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The state of a {@code Call} when actively supporting conversation.
|
|
|
|
*/
|
|
|
|
public static final int STATE_ACTIVE = 4;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The state of a {@code Call} when no further voice or other communication is being
|
|
|
|
* transmitted, the remote side has been or will inevitably be informed that the {@code Call}
|
|
|
|
* is no longer active, and the local data transport has or inevitably will release resources
|
|
|
|
* associated with this {@code Call}.
|
|
|
|
*/
|
|
|
|
public static final int STATE_DISCONNECTED = 7;
|
|
|
|
|
2014-07-08 14:16:17 -07:00
|
|
|
/**
|
|
|
|
* The state of an outgoing {@code Call}, but waiting for user input before proceeding.
|
|
|
|
*/
|
|
|
|
public static final int STATE_PRE_DIAL_WAIT = 8;
|
|
|
|
|
2014-08-07 16:17:21 -07:00
|
|
|
/**
|
2014-08-08 14:26:27 -07:00
|
|
|
* The initial state of an outgoing {@code Call}.
|
|
|
|
* Common transitions are to {@link #STATE_DIALING} state for a successful call or
|
|
|
|
* {@link #STATE_DISCONNECTED} if it failed.
|
2014-08-07 16:17:21 -07:00
|
|
|
*/
|
|
|
|
public static final int STATE_CONNECTING = 9;
|
|
|
|
|
2014-10-07 10:14:55 -07:00
|
|
|
/**
|
|
|
|
* The state of a {@code Call} when the user has initiated a disconnection of the call, but the
|
|
|
|
* call has not yet been disconnected by the underlying {@code ConnectionService}. The next
|
|
|
|
* state of the call is (potentially) {@link #STATE_DISCONNECTED}.
|
|
|
|
*/
|
|
|
|
public static final int STATE_DISCONNECTING = 10;
|
|
|
|
|
2014-09-17 14:47:20 -07:00
|
|
|
/**
|
|
|
|
* The key to retrieve the optional {@code PhoneAccount}s Telecom can bundle with its Call
|
|
|
|
* extras. Used to pass the phone accounts to display on the front end to the user in order to
|
|
|
|
* select phone accounts to (for example) place a call.
|
|
|
|
*
|
|
|
|
* @hide
|
|
|
|
*/
|
|
|
|
public static final String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts";
|
|
|
|
|
2014-07-09 21:52:04 -07:00
|
|
|
public static class Details {
|
|
|
|
private final Uri mHandle;
|
|
|
|
private final int mHandlePresentation;
|
|
|
|
private final String mCallerDisplayName;
|
|
|
|
private final int mCallerDisplayNamePresentation;
|
2014-07-20 12:31:00 -07:00
|
|
|
private final PhoneAccountHandle mAccountHandle;
|
2014-07-30 10:07:40 -07:00
|
|
|
private final int mCallCapabilities;
|
2014-08-27 16:33:08 -07:00
|
|
|
private final int mCallProperties;
|
2014-09-11 17:33:16 -07:00
|
|
|
private final DisconnectCause mDisconnectCause;
|
2014-07-09 21:52:04 -07:00
|
|
|
private final long mConnectTimeMillis;
|
|
|
|
private final GatewayInfo mGatewayInfo;
|
2014-07-11 17:22:03 -07:00
|
|
|
private final int mVideoState;
|
2014-07-15 17:03:20 -07:00
|
|
|
private final StatusHints mStatusHints;
|
2014-08-08 14:00:25 -07:00
|
|
|
private final Bundle mExtras;
|
2014-07-09 21:52:04 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return The handle (e.g., phone number) to which the {@code Call} is currently
|
|
|
|
* connected.
|
|
|
|
*/
|
|
|
|
public Uri getHandle() {
|
|
|
|
return mHandle;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return The presentation requirements for the handle. See
|
2014-09-12 22:16:17 -07:00
|
|
|
* {@link TelecomManager} for valid values.
|
2014-07-09 21:52:04 -07:00
|
|
|
*/
|
|
|
|
public int getHandlePresentation() {
|
|
|
|
return mHandlePresentation;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return The display name for the caller.
|
|
|
|
*/
|
|
|
|
public String getCallerDisplayName() {
|
|
|
|
return mCallerDisplayName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return The presentation requirements for the caller display name. See
|
2014-09-12 22:16:17 -07:00
|
|
|
* {@link TelecomManager} for valid values.
|
2014-07-09 21:52:04 -07:00
|
|
|
*/
|
|
|
|
public int getCallerDisplayNamePresentation() {
|
|
|
|
return mCallerDisplayNamePresentation;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-07-19 18:18:19 -07:00
|
|
|
* @return The {@code PhoneAccountHandle} whereby the {@code Call} is currently being
|
|
|
|
* routed.
|
2014-07-09 21:52:04 -07:00
|
|
|
*/
|
2014-07-20 12:31:00 -07:00
|
|
|
public PhoneAccountHandle getAccountHandle() {
|
|
|
|
return mAccountHandle;
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return A bitmask of the capabilities of the {@code Call}, as defined in
|
2014-08-07 19:46:01 -07:00
|
|
|
* {@link PhoneCapabilities}.
|
2014-07-09 21:52:04 -07:00
|
|
|
*/
|
2014-07-30 10:07:40 -07:00
|
|
|
public int getCallCapabilities() {
|
|
|
|
return mCallCapabilities;
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
2014-08-27 16:33:08 -07:00
|
|
|
/**
|
|
|
|
* @return A bitmask of the properties of the {@code Call}, as defined in
|
|
|
|
* {@link CallProperties}.
|
|
|
|
*/
|
|
|
|
public int getCallProperties() {
|
|
|
|
return mCallProperties;
|
|
|
|
}
|
|
|
|
|
2014-07-09 21:52:04 -07:00
|
|
|
/**
|
|
|
|
* @return For a {@link #STATE_DISCONNECTED} {@code Call}, the disconnect cause expressed
|
2014-09-19 10:53:21 -07:00
|
|
|
* by {@link android.telecom.DisconnectCause}.
|
2014-07-09 21:52:04 -07:00
|
|
|
*/
|
2014-09-11 17:33:16 -07:00
|
|
|
public DisconnectCause getDisconnectCause() {
|
|
|
|
return mDisconnectCause;
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return The time the {@code Call} has been connected. This information is updated
|
|
|
|
* periodically, but user interfaces should not rely on this to display any "call time
|
|
|
|
* clock".
|
|
|
|
*/
|
|
|
|
public long getConnectTimeMillis() {
|
|
|
|
return mConnectTimeMillis;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Information about any calling gateway the {@code Call} may be using.
|
|
|
|
*/
|
|
|
|
public GatewayInfo getGatewayInfo() {
|
|
|
|
return mGatewayInfo;
|
|
|
|
}
|
|
|
|
|
2014-07-15 17:05:08 -07:00
|
|
|
/**
|
2014-07-30 10:07:40 -07:00
|
|
|
* @return The video state of the {@code Call}.
|
2014-07-15 17:05:08 -07:00
|
|
|
*/
|
|
|
|
public int getVideoState() {
|
|
|
|
return mVideoState;
|
|
|
|
}
|
|
|
|
|
2014-07-30 10:07:40 -07:00
|
|
|
/**
|
2014-09-12 22:16:17 -07:00
|
|
|
* @return The current {@link android.telecom.StatusHints}, or {@code null} if none
|
2014-07-30 10:07:40 -07:00
|
|
|
* have been set.
|
2014-07-15 17:03:20 -07:00
|
|
|
*/
|
|
|
|
public StatusHints getStatusHints() {
|
|
|
|
return mStatusHints;
|
|
|
|
}
|
|
|
|
|
2014-08-08 14:00:25 -07:00
|
|
|
/**
|
|
|
|
* @return A bundle extras to pass with the call
|
|
|
|
*/
|
|
|
|
public Bundle getExtras() {
|
|
|
|
return mExtras;
|
|
|
|
}
|
|
|
|
|
2014-07-09 21:52:04 -07:00
|
|
|
@Override
|
|
|
|
public boolean equals(Object o) {
|
|
|
|
if (o instanceof Details) {
|
|
|
|
Details d = (Details) o;
|
|
|
|
return
|
|
|
|
Objects.equals(mHandle, d.mHandle) &&
|
|
|
|
Objects.equals(mHandlePresentation, d.mHandlePresentation) &&
|
|
|
|
Objects.equals(mCallerDisplayName, d.mCallerDisplayName) &&
|
|
|
|
Objects.equals(mCallerDisplayNamePresentation,
|
|
|
|
d.mCallerDisplayNamePresentation) &&
|
2014-07-20 12:31:00 -07:00
|
|
|
Objects.equals(mAccountHandle, d.mAccountHandle) &&
|
2014-07-30 10:07:40 -07:00
|
|
|
Objects.equals(mCallCapabilities, d.mCallCapabilities) &&
|
2014-08-27 16:33:08 -07:00
|
|
|
Objects.equals(mCallProperties, d.mCallProperties) &&
|
2014-09-11 17:33:16 -07:00
|
|
|
Objects.equals(mDisconnectCause, d.mDisconnectCause) &&
|
2014-07-09 21:52:04 -07:00
|
|
|
Objects.equals(mConnectTimeMillis, d.mConnectTimeMillis) &&
|
2014-07-11 17:22:03 -07:00
|
|
|
Objects.equals(mGatewayInfo, d.mGatewayInfo) &&
|
2014-07-15 17:03:20 -07:00
|
|
|
Objects.equals(mVideoState, d.mVideoState) &&
|
2014-08-08 14:00:25 -07:00
|
|
|
Objects.equals(mStatusHints, d.mStatusHints) &&
|
|
|
|
Objects.equals(mExtras, d.mExtras);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode() {
|
|
|
|
return
|
|
|
|
Objects.hashCode(mHandle) +
|
|
|
|
Objects.hashCode(mHandlePresentation) +
|
|
|
|
Objects.hashCode(mCallerDisplayName) +
|
|
|
|
Objects.hashCode(mCallerDisplayNamePresentation) +
|
2014-07-20 12:31:00 -07:00
|
|
|
Objects.hashCode(mAccountHandle) +
|
2014-07-30 10:07:40 -07:00
|
|
|
Objects.hashCode(mCallCapabilities) +
|
2014-08-27 16:33:08 -07:00
|
|
|
Objects.hashCode(mCallProperties) +
|
2014-09-11 17:33:16 -07:00
|
|
|
Objects.hashCode(mDisconnectCause) +
|
2014-07-09 21:52:04 -07:00
|
|
|
Objects.hashCode(mConnectTimeMillis) +
|
2014-07-11 17:22:03 -07:00
|
|
|
Objects.hashCode(mGatewayInfo) +
|
2014-07-15 17:03:20 -07:00
|
|
|
Objects.hashCode(mVideoState) +
|
2014-08-08 14:00:25 -07:00
|
|
|
Objects.hashCode(mStatusHints) +
|
|
|
|
Objects.hashCode(mExtras);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/** {@hide} */
|
|
|
|
public Details(
|
|
|
|
Uri handle,
|
|
|
|
int handlePresentation,
|
|
|
|
String callerDisplayName,
|
|
|
|
int callerDisplayNamePresentation,
|
2014-07-20 12:31:00 -07:00
|
|
|
PhoneAccountHandle accountHandle,
|
2014-07-09 21:52:04 -07:00
|
|
|
int capabilities,
|
2014-08-27 16:33:08 -07:00
|
|
|
int properties,
|
2014-09-11 17:33:16 -07:00
|
|
|
DisconnectCause disconnectCause,
|
2014-07-09 21:52:04 -07:00
|
|
|
long connectTimeMillis,
|
2014-07-11 17:22:03 -07:00
|
|
|
GatewayInfo gatewayInfo,
|
2014-07-15 17:03:20 -07:00
|
|
|
int videoState,
|
2014-08-08 14:00:25 -07:00
|
|
|
StatusHints statusHints,
|
|
|
|
Bundle extras) {
|
2014-07-09 21:52:04 -07:00
|
|
|
mHandle = handle;
|
|
|
|
mHandlePresentation = handlePresentation;
|
|
|
|
mCallerDisplayName = callerDisplayName;
|
|
|
|
mCallerDisplayNamePresentation = callerDisplayNamePresentation;
|
2014-07-20 12:31:00 -07:00
|
|
|
mAccountHandle = accountHandle;
|
2014-07-30 10:07:40 -07:00
|
|
|
mCallCapabilities = capabilities;
|
2014-08-27 16:33:08 -07:00
|
|
|
mCallProperties = properties;
|
2014-09-11 17:33:16 -07:00
|
|
|
mDisconnectCause = disconnectCause;
|
2014-07-09 21:52:04 -07:00
|
|
|
mConnectTimeMillis = connectTimeMillis;
|
|
|
|
mGatewayInfo = gatewayInfo;
|
2014-07-11 17:22:03 -07:00
|
|
|
mVideoState = videoState;
|
2014-07-15 17:03:20 -07:00
|
|
|
mStatusHints = statusHints;
|
2014-08-08 14:00:25 -07:00
|
|
|
mExtras = extras;
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static abstract class Listener {
|
|
|
|
/**
|
|
|
|
* Invoked when the state of this {@code Call} has changed. See {@link #getState()}.
|
|
|
|
*
|
|
|
|
* @param call The {@code Call} invoking this method.
|
|
|
|
* @param state The new state of the {@code Call}.
|
|
|
|
*/
|
|
|
|
public void onStateChanged(Call call, int state) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked when the parent of this {@code Call} has changed. See {@link #getParent()}.
|
|
|
|
*
|
|
|
|
* @param call The {@code Call} invoking this method.
|
|
|
|
* @param parent The new parent of the {@code Call}.
|
|
|
|
*/
|
|
|
|
public void onParentChanged(Call call, Call parent) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked when the children of this {@code Call} have changed. See {@link #getChildren()}.
|
|
|
|
*
|
|
|
|
* @param call The {@code Call} invoking this method.
|
|
|
|
* @param children The new children of the {@code Call}.
|
|
|
|
*/
|
|
|
|
public void onChildrenChanged(Call call, List<Call> children) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked when the details of this {@code Call} have changed. See {@link #getDetails()}.
|
|
|
|
*
|
|
|
|
* @param call The {@code Call} invoking this method.
|
|
|
|
* @param details A {@code Details} object describing the {@code Call}.
|
|
|
|
*/
|
|
|
|
public void onDetailsChanged(Call call, Details details) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked when the text messages that can be used as responses to the incoming
|
|
|
|
* {@code Call} are loaded from the relevant database.
|
|
|
|
* See {@link #getCannedTextResponses()}.
|
|
|
|
*
|
|
|
|
* @param call The {@code Call} invoking this method.
|
|
|
|
* @param cannedTextResponses The text messages useable as responses.
|
|
|
|
*/
|
|
|
|
public void onCannedTextResponsesLoaded(Call call, List<String> cannedTextResponses) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked when the post-dial sequence in the outgoing {@code Call} has reached a pause
|
|
|
|
* character. This causes the post-dial signals to stop pending user confirmation. An
|
|
|
|
* implementation should present this choice to the user and invoke
|
|
|
|
* {@link #postDialContinue(boolean)} when the user makes the choice.
|
|
|
|
*
|
|
|
|
* @param call The {@code Call} invoking this method.
|
|
|
|
* @param remainingPostDialSequence The post-dial characters that remain to be sent.
|
|
|
|
*/
|
|
|
|
public void onPostDialWait(Call call, String remainingPostDialSequence) {}
|
|
|
|
|
|
|
|
/**
|
2014-07-22 16:41:54 -07:00
|
|
|
* Invoked when the {@code Call.VideoCall} of the {@code Call} has changed.
|
2014-07-09 21:52:04 -07:00
|
|
|
*
|
|
|
|
* @param call The {@code Call} invoking this method.
|
2014-07-22 16:41:54 -07:00
|
|
|
* @param videoCall The {@code Call.VideoCall} associated with the {@code Call}.
|
2014-08-22 11:33:13 -07:00
|
|
|
* @hide
|
2014-07-09 21:52:04 -07:00
|
|
|
*/
|
2014-07-22 16:41:54 -07:00
|
|
|
public void onVideoCallChanged(Call call, InCallService.VideoCall videoCall) {}
|
2014-07-09 21:52:04 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked when the {@code Call} is destroyed. Clients should refrain from cleaning
|
|
|
|
* up their UI for the {@code Call} in response to state transitions. Specifically,
|
|
|
|
* clients should not assume that a {@link #onStateChanged(Call, int)} with a state of
|
|
|
|
* {@link #STATE_DISCONNECTED} is the final notification the {@code Call} will send. Rather,
|
|
|
|
* clients should wait for this method to be invoked.
|
|
|
|
*
|
|
|
|
* @param call The {@code Call} being destroyed.
|
|
|
|
*/
|
|
|
|
public void onCallDestroyed(Call call) {}
|
2014-07-28 18:15:48 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked upon changes to the set of {@code Call}s with which this {@code Call} can be
|
|
|
|
* conferenced.
|
|
|
|
*
|
|
|
|
* @param call The {@code Call} being updated.
|
|
|
|
* @param conferenceableCalls The {@code Call}s with which this {@code Call} can be
|
|
|
|
* conferenced.
|
|
|
|
*/
|
|
|
|
public void onConferenceableCallsChanged(Call call, List<Call> conferenceableCalls) {}
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
private final Phone mPhone;
|
2014-09-12 22:16:17 -07:00
|
|
|
private final String mTelecomCallId;
|
2014-07-09 21:52:04 -07:00
|
|
|
private final InCallAdapter mInCallAdapter;
|
2014-08-07 18:35:18 -07:00
|
|
|
private final List<String> mChildrenIds = new ArrayList<>();
|
2014-07-09 21:52:04 -07:00
|
|
|
private final List<Call> mChildren = new ArrayList<>();
|
|
|
|
private final List<Call> mUnmodifiableChildren = Collections.unmodifiableList(mChildren);
|
2014-08-15 09:23:07 -07:00
|
|
|
private final List<Listener> mListeners = new CopyOnWriteArrayList<>();
|
2014-07-28 18:15:48 -07:00
|
|
|
private final List<Call> mConferenceableCalls = new ArrayList<>();
|
|
|
|
private final List<Call> mUnmodifiableConferenceableCalls =
|
|
|
|
Collections.unmodifiableList(mConferenceableCalls);
|
|
|
|
|
2014-08-07 18:35:18 -07:00
|
|
|
private boolean mChildrenCached;
|
|
|
|
private String mParentId = null;
|
2014-07-28 18:15:48 -07:00
|
|
|
private int mState;
|
2014-07-09 21:52:04 -07:00
|
|
|
private List<String> mCannedTextResponses = null;
|
|
|
|
private String mRemainingPostDialSequence;
|
2014-07-22 16:41:54 -07:00
|
|
|
private InCallService.VideoCall mVideoCall;
|
2014-07-09 21:52:04 -07:00
|
|
|
private Details mDetails;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtains the post-dial sequence remaining to be emitted by this {@code Call}, if any.
|
|
|
|
*
|
|
|
|
* @return The remaining post-dial sequence, or {@code null} if there is no post-dial sequence
|
|
|
|
* remaining or this {@code Call} is not in a post-dial state.
|
|
|
|
*/
|
|
|
|
public String getRemainingPostDialSequence() {
|
|
|
|
return mRemainingPostDialSequence;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instructs this {@link #STATE_RINGING} {@code Call} to answer.
|
2014-07-16 10:11:42 -07:00
|
|
|
* @param videoState The video state in which to answer the call.
|
2014-07-09 21:52:04 -07:00
|
|
|
*/
|
2014-07-16 10:11:42 -07:00
|
|
|
public void answer(int videoState) {
|
2014-09-12 22:16:17 -07:00
|
|
|
mInCallAdapter.answerCall(mTelecomCallId, videoState);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instructs this {@link #STATE_RINGING} {@code Call} to reject.
|
|
|
|
*
|
|
|
|
* @param rejectWithMessage Whether to reject with a text message.
|
|
|
|
* @param textMessage An optional text message with which to respond.
|
|
|
|
*/
|
|
|
|
public void reject(boolean rejectWithMessage, String textMessage) {
|
2014-09-12 22:16:17 -07:00
|
|
|
mInCallAdapter.rejectCall(mTelecomCallId, rejectWithMessage, textMessage);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instructs this {@code Call} to disconnect.
|
|
|
|
*/
|
|
|
|
public void disconnect() {
|
2014-09-12 22:16:17 -07:00
|
|
|
mInCallAdapter.disconnectCall(mTelecomCallId);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instructs this {@code Call} to go on hold.
|
|
|
|
*/
|
|
|
|
public void hold() {
|
2014-09-12 22:16:17 -07:00
|
|
|
mInCallAdapter.holdCall(mTelecomCallId);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instructs this {@link #STATE_HOLDING} call to release from hold.
|
|
|
|
*/
|
|
|
|
public void unhold() {
|
2014-09-12 22:16:17 -07:00
|
|
|
mInCallAdapter.unholdCall(mTelecomCallId);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instructs this {@code Call} to play a dual-tone multi-frequency signaling (DTMF) tone.
|
|
|
|
*
|
|
|
|
* Any other currently playing DTMF tone in the specified call is immediately stopped.
|
|
|
|
*
|
|
|
|
* @param digit A character representing the DTMF digit for which to play the tone. This
|
|
|
|
* value must be one of {@code '0'} through {@code '9'}, {@code '*'} or {@code '#'}.
|
|
|
|
*/
|
|
|
|
public void playDtmfTone(char digit) {
|
2014-09-12 22:16:17 -07:00
|
|
|
mInCallAdapter.playDtmfTone(mTelecomCallId, digit);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instructs this {@code Call} to stop any dual-tone multi-frequency signaling (DTMF) tone
|
|
|
|
* currently playing.
|
|
|
|
*
|
|
|
|
* DTMF tones are played by calling {@link #playDtmfTone(char)}. If no DTMF tone is
|
|
|
|
* currently playing, this method will do nothing.
|
|
|
|
*/
|
|
|
|
public void stopDtmfTone() {
|
2014-09-12 22:16:17 -07:00
|
|
|
mInCallAdapter.stopDtmfTone(mTelecomCallId);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instructs this {@code Call} to continue playing a post-dial DTMF string.
|
|
|
|
*
|
|
|
|
* A post-dial DTMF string is a string of digits entered after a phone number, when dialed,
|
|
|
|
* that are immediately sent as DTMF tones to the recipient as soon as the connection is made.
|
|
|
|
*
|
2014-09-12 22:16:17 -07:00
|
|
|
* If the DTMF string contains a {@link TelecomManager#DTMF_CHARACTER_PAUSE} symbol, this
|
2014-07-09 21:52:04 -07:00
|
|
|
* {@code Call} will temporarily pause playing the tones for a pre-defined period of time.
|
|
|
|
*
|
2014-09-12 22:16:17 -07:00
|
|
|
* If the DTMF string contains a {@link TelecomManager#DTMF_CHARACTER_WAIT} symbol, this
|
2014-07-09 21:52:04 -07:00
|
|
|
* {@code Call} will pause playing the tones and notify listeners via
|
|
|
|
* {@link Listener#onPostDialWait(Call, String)}. At this point, the in-call app
|
|
|
|
* should display to the user an indication of this state and an affordance to continue
|
|
|
|
* the postdial sequence. When the user decides to continue the postdial sequence, the in-call
|
|
|
|
* app should invoke the {@link #postDialContinue(boolean)} method.
|
|
|
|
*
|
|
|
|
* @param proceed Whether or not to continue with the post-dial sequence.
|
|
|
|
*/
|
|
|
|
public void postDialContinue(boolean proceed) {
|
2014-09-12 22:16:17 -07:00
|
|
|
mInCallAdapter.postDialContinue(mTelecomCallId, proceed);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
2014-07-08 14:16:17 -07:00
|
|
|
/**
|
2014-07-20 12:31:00 -07:00
|
|
|
* Notifies this {@code Call} that an account has been selected and to proceed with placing
|
2014-10-21 18:36:39 -07:00
|
|
|
* an outgoing call. Optionally sets this account as the default account.
|
2014-07-08 14:16:17 -07:00
|
|
|
*/
|
2014-10-21 18:36:39 -07:00
|
|
|
public void phoneAccountSelected(PhoneAccountHandle accountHandle, boolean setDefault) {
|
|
|
|
mInCallAdapter.phoneAccountSelected(mTelecomCallId, accountHandle, setDefault);
|
2014-07-08 14:16:17 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-07-09 21:52:04 -07:00
|
|
|
/**
|
|
|
|
* Instructs this {@code Call} to enter a conference.
|
2014-07-28 18:15:48 -07:00
|
|
|
*
|
|
|
|
* @param callToConferenceWith The other call with which to conference.
|
2014-07-09 21:52:04 -07:00
|
|
|
*/
|
2014-07-28 18:15:48 -07:00
|
|
|
public void conference(Call callToConferenceWith) {
|
|
|
|
if (callToConferenceWith != null) {
|
2014-09-12 22:16:17 -07:00
|
|
|
mInCallAdapter.conference(mTelecomCallId, callToConferenceWith.mTelecomCallId);
|
2014-07-28 18:15:48 -07:00
|
|
|
}
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instructs this {@code Call} to split from any conference call with which it may be
|
|
|
|
* connected.
|
|
|
|
*/
|
|
|
|
public void splitFromConference() {
|
2014-09-12 22:16:17 -07:00
|
|
|
mInCallAdapter.splitFromConference(mTelecomCallId);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
2014-09-04 17:39:22 -07:00
|
|
|
/**
|
|
|
|
* Merges the calls within this conference. See {@link PhoneCapabilities#MERGE_CONFERENCE}.
|
|
|
|
*/
|
|
|
|
public void mergeConference() {
|
2014-09-12 22:16:17 -07:00
|
|
|
mInCallAdapter.mergeConference(mTelecomCallId);
|
2014-09-04 17:39:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Swaps the calls within this conference. See {@link PhoneCapabilities#SWAP_CONFERENCE}.
|
|
|
|
*/
|
|
|
|
public void swapConference() {
|
2014-09-12 22:16:17 -07:00
|
|
|
mInCallAdapter.swapConference(mTelecomCallId);
|
2014-09-04 17:39:22 -07:00
|
|
|
}
|
|
|
|
|
2014-07-09 21:52:04 -07:00
|
|
|
/**
|
|
|
|
* Obtains the parent of this {@code Call} in a conference, if any.
|
|
|
|
*
|
|
|
|
* @return The parent {@code Call}, or {@code null} if this {@code Call} is not a
|
|
|
|
* child of any conference {@code Call}s.
|
|
|
|
*/
|
|
|
|
public Call getParent() {
|
2014-08-07 18:35:18 -07:00
|
|
|
if (mParentId != null) {
|
2014-09-12 22:16:17 -07:00
|
|
|
return mPhone.internalGetCallByTelecomId(mParentId);
|
2014-08-07 18:35:18 -07:00
|
|
|
}
|
|
|
|
return null;
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtains the children of this conference {@code Call}, if any.
|
|
|
|
*
|
|
|
|
* @return The children of this {@code Call} if this {@code Call} is a conference, or an empty
|
|
|
|
* {@code List} otherwise.
|
|
|
|
*/
|
|
|
|
public List<Call> getChildren() {
|
2014-08-07 18:35:18 -07:00
|
|
|
if (!mChildrenCached) {
|
|
|
|
mChildrenCached = true;
|
|
|
|
mChildren.clear();
|
|
|
|
|
|
|
|
for(String id : mChildrenIds) {
|
2014-09-12 22:16:17 -07:00
|
|
|
Call call = mPhone.internalGetCallByTelecomId(id);
|
2014-08-07 18:35:18 -07:00
|
|
|
if (call == null) {
|
|
|
|
// At least one child was still not found, so do not save true for "cached"
|
|
|
|
mChildrenCached = false;
|
|
|
|
} else {
|
|
|
|
mChildren.add(call);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-09 21:52:04 -07:00
|
|
|
return mUnmodifiableChildren;
|
|
|
|
}
|
|
|
|
|
2014-07-28 18:15:48 -07:00
|
|
|
/**
|
|
|
|
* Returns the list of {@code Call}s with which this {@code Call} is allowed to conference.
|
|
|
|
*
|
|
|
|
* @return The list of conferenceable {@code Call}s.
|
|
|
|
*/
|
|
|
|
public List<Call> getConferenceableCalls() {
|
|
|
|
return mUnmodifiableConferenceableCalls;
|
|
|
|
}
|
|
|
|
|
2014-07-09 21:52:04 -07:00
|
|
|
/**
|
|
|
|
* Obtains the state of this {@code Call}.
|
|
|
|
*
|
|
|
|
* @return A state value, chosen from the {@code STATE_*} constants.
|
|
|
|
*/
|
|
|
|
public int getState() {
|
|
|
|
return mState;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtains a list of canned, pre-configured message responses to present to the user as
|
|
|
|
* ways of rejecting this {@code Call} using via a text message.
|
|
|
|
*
|
|
|
|
* @see #reject(boolean, String)
|
|
|
|
*
|
|
|
|
* @return A list of canned text message responses.
|
|
|
|
*/
|
|
|
|
public List<String> getCannedTextResponses() {
|
|
|
|
return mCannedTextResponses;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtains an object that can be used to display video from this {@code Call}.
|
|
|
|
*
|
2014-07-22 16:41:54 -07:00
|
|
|
* @return An {@code Call.VideoCall}.
|
2014-08-22 11:33:13 -07:00
|
|
|
* @hide
|
2014-07-09 21:52:04 -07:00
|
|
|
*/
|
2014-07-22 16:41:54 -07:00
|
|
|
public InCallService.VideoCall getVideoCall() {
|
|
|
|
return mVideoCall;
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtains an object containing call details.
|
|
|
|
*
|
|
|
|
* @return A {@link Details} object. Depending on the state of the {@code Call}, the
|
|
|
|
* result may be {@code null}.
|
|
|
|
*/
|
|
|
|
public Details getDetails() {
|
|
|
|
return mDetails;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a listener to this {@code Call}.
|
|
|
|
*
|
|
|
|
* @param listener A {@code Listener}.
|
|
|
|
*/
|
|
|
|
public void addListener(Listener listener) {
|
|
|
|
mListeners.add(listener);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes a listener from this {@code Call}.
|
|
|
|
*
|
|
|
|
* @param listener A {@code Listener}.
|
|
|
|
*/
|
|
|
|
public void removeListener(Listener listener) {
|
2014-08-15 09:23:07 -07:00
|
|
|
if (listener != null) {
|
|
|
|
mListeners.remove(listener);
|
|
|
|
}
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/** {@hide} */
|
2014-09-12 22:16:17 -07:00
|
|
|
Call(Phone phone, String telecomCallId, InCallAdapter inCallAdapter) {
|
2014-07-09 21:52:04 -07:00
|
|
|
mPhone = phone;
|
2014-09-12 22:16:17 -07:00
|
|
|
mTelecomCallId = telecomCallId;
|
2014-07-09 21:52:04 -07:00
|
|
|
mInCallAdapter = inCallAdapter;
|
|
|
|
mState = STATE_NEW;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** {@hide} */
|
|
|
|
final String internalGetCallId() {
|
2014-09-12 22:16:17 -07:00
|
|
|
return mTelecomCallId;
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/** {@hide} */
|
2014-07-28 18:15:48 -07:00
|
|
|
final void internalUpdate(ParcelableCall parcelableCall, Map<String, Call> callIdMap) {
|
2014-07-09 21:52:04 -07:00
|
|
|
// First, we update the internal state as far as possible before firing any updates.
|
|
|
|
Details details = new Details(
|
2014-07-19 13:10:40 -07:00
|
|
|
parcelableCall.getHandle(),
|
|
|
|
parcelableCall.getHandlePresentation(),
|
|
|
|
parcelableCall.getCallerDisplayName(),
|
|
|
|
parcelableCall.getCallerDisplayNamePresentation(),
|
|
|
|
parcelableCall.getAccountHandle(),
|
|
|
|
parcelableCall.getCapabilities(),
|
2014-08-27 16:33:08 -07:00
|
|
|
parcelableCall.getProperties(),
|
2014-09-11 17:33:16 -07:00
|
|
|
parcelableCall.getDisconnectCause(),
|
2014-07-19 13:10:40 -07:00
|
|
|
parcelableCall.getConnectTimeMillis(),
|
|
|
|
parcelableCall.getGatewayInfo(),
|
|
|
|
parcelableCall.getVideoState(),
|
2014-08-08 14:00:25 -07:00
|
|
|
parcelableCall.getStatusHints(),
|
|
|
|
parcelableCall.getExtras());
|
2014-07-09 21:52:04 -07:00
|
|
|
boolean detailsChanged = !Objects.equals(mDetails, details);
|
|
|
|
if (detailsChanged) {
|
|
|
|
mDetails = details;
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean cannedTextResponsesChanged = false;
|
2014-07-19 13:10:40 -07:00
|
|
|
if (mCannedTextResponses == null && parcelableCall.getCannedSmsResponses() != null
|
|
|
|
&& !parcelableCall.getCannedSmsResponses().isEmpty()) {
|
|
|
|
mCannedTextResponses =
|
|
|
|
Collections.unmodifiableList(parcelableCall.getCannedSmsResponses());
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
2014-07-22 16:41:54 -07:00
|
|
|
boolean videoCallChanged = !Objects.equals(mVideoCall, parcelableCall.getVideoCall());
|
|
|
|
if (videoCallChanged) {
|
|
|
|
mVideoCall = parcelableCall.getVideoCall();
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
2014-07-19 13:10:40 -07:00
|
|
|
int state = stateFromParcelableCallState(parcelableCall.getState());
|
2014-07-09 21:52:04 -07:00
|
|
|
boolean stateChanged = mState != state;
|
|
|
|
if (stateChanged) {
|
|
|
|
mState = state;
|
|
|
|
}
|
|
|
|
|
2014-08-07 18:35:18 -07:00
|
|
|
String parentId = parcelableCall.getParentCallId();
|
|
|
|
boolean parentChanged = !Objects.equals(mParentId, parentId);
|
|
|
|
if (parentChanged) {
|
|
|
|
mParentId = parentId;
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
2014-08-07 18:35:18 -07:00
|
|
|
List<String> childCallIds = parcelableCall.getChildCallIds();
|
|
|
|
boolean childrenChanged = !Objects.equals(childCallIds, mChildrenIds);
|
|
|
|
if (childrenChanged) {
|
|
|
|
mChildrenIds.clear();
|
|
|
|
mChildrenIds.addAll(parcelableCall.getChildCallIds());
|
|
|
|
mChildrenCached = false;
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
|
2014-07-28 18:15:48 -07:00
|
|
|
List<String> conferenceableCallIds = parcelableCall.getConferenceableCallIds();
|
|
|
|
List<Call> conferenceableCalls = new ArrayList<Call>(conferenceableCallIds.size());
|
|
|
|
for (String otherId : conferenceableCallIds) {
|
|
|
|
if (callIdMap.containsKey(otherId)) {
|
|
|
|
conferenceableCalls.add(callIdMap.get(otherId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Objects.equals(mConferenceableCalls, conferenceableCalls)) {
|
|
|
|
mConferenceableCalls.clear();
|
|
|
|
mConferenceableCalls.addAll(conferenceableCalls);
|
|
|
|
fireConferenceableCallsChanged();
|
|
|
|
}
|
|
|
|
|
2014-07-09 21:52:04 -07:00
|
|
|
// Now we fire updates, ensuring that any client who listens to any of these notifications
|
|
|
|
// gets the most up-to-date state.
|
|
|
|
|
|
|
|
if (stateChanged) {
|
|
|
|
fireStateChanged(mState);
|
|
|
|
}
|
|
|
|
if (detailsChanged) {
|
|
|
|
fireDetailsChanged(mDetails);
|
|
|
|
}
|
|
|
|
if (cannedTextResponsesChanged) {
|
|
|
|
fireCannedTextResponsesLoaded(mCannedTextResponses);
|
|
|
|
}
|
2014-07-22 16:41:54 -07:00
|
|
|
if (videoCallChanged) {
|
|
|
|
fireVideoCallChanged(mVideoCall);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
2014-08-07 18:35:18 -07:00
|
|
|
if (parentChanged) {
|
|
|
|
fireParentChanged(getParent());
|
|
|
|
}
|
|
|
|
if (childrenChanged) {
|
|
|
|
fireChildrenChanged(getChildren());
|
|
|
|
}
|
2014-07-09 21:52:04 -07:00
|
|
|
|
|
|
|
// If we have transitioned to DISCONNECTED, that means we need to notify clients and
|
|
|
|
// remove ourselves from the Phone. Note that we do this after completing all state updates
|
|
|
|
// so a client can cleanly transition all their UI to the state appropriate for a
|
|
|
|
// DISCONNECTED Call while still relying on the existence of that Call in the Phone's list.
|
|
|
|
if (mState == STATE_DISCONNECTED) {
|
|
|
|
fireCallDestroyed();
|
|
|
|
mPhone.internalRemoveCall(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** {@hide} */
|
|
|
|
final void internalSetPostDialWait(String remaining) {
|
|
|
|
mRemainingPostDialSequence = remaining;
|
|
|
|
firePostDialWait(mRemainingPostDialSequence);
|
|
|
|
}
|
|
|
|
|
2014-08-26 09:54:33 -07:00
|
|
|
/** {@hide} */
|
|
|
|
final void internalSetDisconnected() {
|
|
|
|
if (mState != Call.STATE_DISCONNECTED) {
|
|
|
|
mState = Call.STATE_DISCONNECTED;
|
|
|
|
fireStateChanged(mState);
|
|
|
|
fireCallDestroyed();
|
|
|
|
mPhone.internalRemoveCall(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-09 21:52:04 -07:00
|
|
|
private void fireStateChanged(int newState) {
|
2014-08-15 09:23:07 -07:00
|
|
|
for (Listener listener : mListeners) {
|
|
|
|
listener.onStateChanged(this, newState);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void fireParentChanged(Call newParent) {
|
2014-08-15 09:23:07 -07:00
|
|
|
for (Listener listener : mListeners) {
|
|
|
|
listener.onParentChanged(this, newParent);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void fireChildrenChanged(List<Call> children) {
|
2014-08-15 09:23:07 -07:00
|
|
|
for (Listener listener : mListeners) {
|
|
|
|
listener.onChildrenChanged(this, children);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void fireDetailsChanged(Details details) {
|
2014-08-15 09:23:07 -07:00
|
|
|
for (Listener listener : mListeners) {
|
|
|
|
listener.onDetailsChanged(this, details);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void fireCannedTextResponsesLoaded(List<String> cannedTextResponses) {
|
2014-08-15 09:23:07 -07:00
|
|
|
for (Listener listener : mListeners) {
|
|
|
|
listener.onCannedTextResponsesLoaded(this, cannedTextResponses);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-22 16:41:54 -07:00
|
|
|
private void fireVideoCallChanged(InCallService.VideoCall videoCall) {
|
2014-08-15 09:23:07 -07:00
|
|
|
for (Listener listener : mListeners) {
|
|
|
|
listener.onVideoCallChanged(this, videoCall);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void firePostDialWait(String remainingPostDialSequence) {
|
2014-08-15 09:23:07 -07:00
|
|
|
for (Listener listener : mListeners) {
|
|
|
|
listener.onPostDialWait(this, remainingPostDialSequence);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void fireCallDestroyed() {
|
2014-08-15 09:23:07 -07:00
|
|
|
for (Listener listener : mListeners) {
|
|
|
|
listener.onCallDestroyed(this);
|
2014-07-09 21:52:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-28 18:15:48 -07:00
|
|
|
private void fireConferenceableCallsChanged() {
|
2014-08-15 09:23:07 -07:00
|
|
|
for (Listener listener : mListeners) {
|
|
|
|
listener.onConferenceableCallsChanged(this, mUnmodifiableConferenceableCalls);
|
2014-07-28 18:15:48 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-07 19:46:01 -07:00
|
|
|
private int stateFromParcelableCallState(int parcelableCallState) {
|
2014-07-19 13:10:40 -07:00
|
|
|
switch (parcelableCallState) {
|
2014-08-07 19:46:01 -07:00
|
|
|
case CallState.NEW:
|
2014-07-09 21:52:04 -07:00
|
|
|
return STATE_NEW;
|
2014-08-07 19:46:01 -07:00
|
|
|
case CallState.CONNECTING:
|
2014-08-07 16:17:21 -07:00
|
|
|
return STATE_CONNECTING;
|
2014-08-07 19:46:01 -07:00
|
|
|
case CallState.PRE_DIAL_WAIT:
|
2014-07-08 14:16:17 -07:00
|
|
|
return STATE_PRE_DIAL_WAIT;
|
2014-08-07 19:46:01 -07:00
|
|
|
case CallState.DIALING:
|
2014-07-09 21:52:04 -07:00
|
|
|
return STATE_DIALING;
|
2014-08-07 19:46:01 -07:00
|
|
|
case CallState.RINGING:
|
2014-07-09 21:52:04 -07:00
|
|
|
return STATE_RINGING;
|
2014-08-07 19:46:01 -07:00
|
|
|
case CallState.ACTIVE:
|
2014-07-09 21:52:04 -07:00
|
|
|
return STATE_ACTIVE;
|
2014-08-07 19:46:01 -07:00
|
|
|
case CallState.ON_HOLD:
|
2014-07-09 21:52:04 -07:00
|
|
|
return STATE_HOLDING;
|
2014-08-07 19:46:01 -07:00
|
|
|
case CallState.DISCONNECTED:
|
2014-07-09 21:52:04 -07:00
|
|
|
return STATE_DISCONNECTED;
|
2014-08-07 19:46:01 -07:00
|
|
|
case CallState.ABORTED:
|
2014-07-09 21:52:04 -07:00
|
|
|
return STATE_DISCONNECTED;
|
2014-10-07 10:14:55 -07:00
|
|
|
case CallState.DISCONNECTING:
|
|
|
|
return STATE_DISCONNECTING;
|
2014-07-09 21:52:04 -07:00
|
|
|
default:
|
2014-07-19 13:10:40 -07:00
|
|
|
Log.wtf(this, "Unrecognized CallState %s", parcelableCallState);
|
2014-07-09 21:52:04 -07:00
|
|
|
return STATE_NEW;
|
|
|
|
}
|
|
|
|
}
|
2014-07-28 18:15:48 -07:00
|
|
|
}
|