2013-12-12 18:32:02 -08:00
|
|
|
/*
|
2014-03-08 18:01:06 -08:00
|
|
|
* Copyright (C) 2014 The Android Open Source Project
|
2013-12-12 18:32:02 -08:00
|
|
|
*
|
|
|
|
* 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;
|
2013-12-12 18:32:02 -08:00
|
|
|
|
2014-07-11 14:50:13 -07:00
|
|
|
import android.net.Uri;
|
2015-05-27 17:21:45 -07:00
|
|
|
import android.os.Bundle;
|
2014-06-17 19:08:45 -07:00
|
|
|
import android.os.IBinder.DeathRecipient;
|
2014-03-08 18:01:06 -08:00
|
|
|
import android.os.RemoteException;
|
|
|
|
|
2014-09-12 22:16:17 -07:00
|
|
|
import com.android.internal.telecom.IConnectionServiceAdapter;
|
|
|
|
import com.android.internal.telecom.RemoteServiceCallback;
|
2013-12-12 18:32:02 -08:00
|
|
|
|
2014-08-08 16:31:48 -07:00
|
|
|
import java.util.Collections;
|
2014-07-10 18:15:15 -07:00
|
|
|
import java.util.Iterator;
|
2014-05-31 10:31:19 -07:00
|
|
|
import java.util.List;
|
2014-06-17 19:08:45 -07:00
|
|
|
import java.util.Set;
|
2014-08-08 16:31:48 -07:00
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
2014-05-31 10:31:19 -07:00
|
|
|
|
2013-12-12 18:32:02 -08:00
|
|
|
/**
|
2014-07-04 17:21:07 -07:00
|
|
|
* Provides methods for IConnectionService implementations to interact with the system phone app.
|
2014-07-02 21:26:12 -07:00
|
|
|
*
|
|
|
|
* @hide
|
2013-12-12 18:32:02 -08:00
|
|
|
*/
|
2014-07-04 17:21:07 -07:00
|
|
|
final class ConnectionServiceAdapter implements DeathRecipient {
|
2014-08-15 09:23:07 -07:00
|
|
|
/**
|
|
|
|
* ConcurrentHashMap constructor params: 8 is initial table size, 0.9f is
|
|
|
|
* load factor before resizing, 1 means we only expect a single thread to
|
|
|
|
* access the map so make only a single shard
|
|
|
|
*/
|
2014-08-08 16:31:48 -07:00
|
|
|
private final Set<IConnectionServiceAdapter> mAdapters = Collections.newSetFromMap(
|
2014-08-15 09:23:07 -07:00
|
|
|
new ConcurrentHashMap<IConnectionServiceAdapter, Boolean>(8, 0.9f, 1));
|
2014-03-08 18:01:06 -08:00
|
|
|
|
2014-07-04 17:21:07 -07:00
|
|
|
ConnectionServiceAdapter() {
|
2014-06-17 19:08:45 -07:00
|
|
|
}
|
|
|
|
|
2014-07-04 17:21:07 -07:00
|
|
|
void addAdapter(IConnectionServiceAdapter adapter) {
|
2015-07-08 16:52:37 -07:00
|
|
|
for (IConnectionServiceAdapter it : mAdapters) {
|
|
|
|
if (it.asBinder() == adapter.asBinder()) {
|
|
|
|
Log.w(this, "Ignoring duplicate adapter addition.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2014-06-17 19:08:45 -07:00
|
|
|
if (mAdapters.add(adapter)) {
|
|
|
|
try {
|
|
|
|
adapter.asBinder().linkToDeath(this, 0);
|
|
|
|
} catch (RemoteException e) {
|
|
|
|
mAdapters.remove(adapter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-04 17:21:07 -07:00
|
|
|
void removeAdapter(IConnectionServiceAdapter adapter) {
|
2015-07-08 16:52:37 -07:00
|
|
|
if (adapter != null) {
|
|
|
|
for (IConnectionServiceAdapter it : mAdapters) {
|
|
|
|
if (it.asBinder() == adapter.asBinder() && mAdapters.remove(it)) {
|
|
|
|
adapter.asBinder().unlinkToDeath(this, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-06-17 19:08:45 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** ${inheritDoc} */
|
|
|
|
@Override
|
|
|
|
public void binderDied() {
|
2014-07-10 18:15:15 -07:00
|
|
|
Iterator<IConnectionServiceAdapter> it = mAdapters.iterator();
|
|
|
|
while (it.hasNext()) {
|
|
|
|
IConnectionServiceAdapter adapter = it.next();
|
2014-06-17 19:08:45 -07:00
|
|
|
if (!adapter.asBinder().isBinderAlive()) {
|
2014-07-10 18:15:15 -07:00
|
|
|
it.remove();
|
|
|
|
adapter.asBinder().unlinkToDeath(this, 0);
|
2014-06-17 19:08:45 -07:00
|
|
|
}
|
|
|
|
}
|
2014-03-08 18:01:06 -08:00
|
|
|
}
|
2013-12-12 18:32:02 -08:00
|
|
|
|
2014-08-18 09:23:25 -07:00
|
|
|
void handleCreateConnectionComplete(
|
2014-08-07 19:46:01 -07:00
|
|
|
String id,
|
|
|
|
ConnectionRequest request,
|
|
|
|
ParcelableConnection connection) {
|
2014-07-04 17:21:07 -07:00
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-06-17 19:08:45 -07:00
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.handleCreateConnectionComplete(id, request, connection,
|
|
|
|
Log.getExternalSession());
|
2014-06-25 13:35:14 -07:00
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
|
|
|
}
|
2014-03-08 18:01:06 -08:00
|
|
|
}
|
2013-12-12 18:32:02 -08:00
|
|
|
|
2019-12-02 11:57:37 +05:30
|
|
|
void handleCreateConferenceComplete(
|
|
|
|
String id,
|
|
|
|
ConnectionRequest request,
|
|
|
|
ParcelableConference conference) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
|
|
|
adapter.handleCreateConferenceComplete(id, request, conference,
|
|
|
|
Log.getExternalSession());
|
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-12 18:32:02 -08:00
|
|
|
/**
|
|
|
|
* Sets a call's state to active (e.g., an ongoing call where two parties can actively
|
|
|
|
* communicate).
|
2013-12-17 13:30:53 -08:00
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call whose state is changing to active.
|
2013-12-12 18:32:02 -08:00
|
|
|
*/
|
2014-07-04 17:21:07 -07:00
|
|
|
void setActive(String callId) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-06-17 19:08:45 -07:00
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setActive(callId, Log.getExternalSession());
|
2014-06-17 19:08:45 -07:00
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
2014-03-08 18:01:06 -08:00
|
|
|
}
|
|
|
|
}
|
2013-12-12 18:32:02 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets a call's state to ringing (e.g., an inbound ringing call).
|
2013-12-17 13:30:53 -08:00
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call whose state is changing to ringing.
|
2013-12-12 18:32:02 -08:00
|
|
|
*/
|
2014-07-04 17:21:07 -07:00
|
|
|
void setRinging(String callId) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-06-17 19:08:45 -07:00
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setRinging(callId, Log.getExternalSession());
|
2014-06-17 19:08:45 -07:00
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
2014-03-08 18:01:06 -08:00
|
|
|
}
|
|
|
|
}
|
2013-12-12 18:32:02 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets a call's state to dialing (e.g., dialing an outbound call).
|
2013-12-17 13:30:53 -08:00
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call whose state is changing to dialing.
|
2013-12-12 18:32:02 -08:00
|
|
|
*/
|
2014-07-04 17:21:07 -07:00
|
|
|
void setDialing(String callId) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-06-17 19:08:45 -07:00
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setDialing(callId, Log.getExternalSession());
|
2014-06-17 19:08:45 -07:00
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
2014-03-08 18:01:06 -08:00
|
|
|
}
|
|
|
|
}
|
2013-12-12 18:32:02 -08:00
|
|
|
|
2016-07-07 22:53:57 -07:00
|
|
|
/**
|
|
|
|
* Sets a call's state to pulling (e.g. a call with {@link Connection#PROPERTY_IS_EXTERNAL_CALL}
|
|
|
|
* is being pulled to the local device.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call whose state is changing to dialing.
|
|
|
|
*/
|
|
|
|
void setPulling(String callId) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setPulling(callId, Log.getExternalSession());
|
2016-07-07 22:53:57 -07:00
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-12 18:32:02 -08:00
|
|
|
/**
|
|
|
|
* Sets a call's state to disconnected.
|
2013-12-17 13:30:53 -08:00
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call whose state is changing to disconnected.
|
2014-09-11 17:33:16 -07:00
|
|
|
* @param disconnectCause The reason for the disconnection, as described by
|
|
|
|
* {@link android.telecomm.DisconnectCause}.
|
2013-12-12 18:32:02 -08:00
|
|
|
*/
|
2014-09-11 17:33:16 -07:00
|
|
|
void setDisconnected(String callId, DisconnectCause disconnectCause) {
|
2014-07-04 17:21:07 -07:00
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-06-17 19:08:45 -07:00
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setDisconnected(callId, disconnectCause, Log.getExternalSession());
|
2014-06-17 19:08:45 -07:00
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
2014-03-08 18:01:06 -08:00
|
|
|
}
|
|
|
|
}
|
2014-03-12 18:33:19 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets a call's state to be on hold.
|
|
|
|
*
|
|
|
|
* @param callId - The unique ID of the call whose state is changing to be on hold.
|
|
|
|
*/
|
2014-07-04 17:21:07 -07:00
|
|
|
void setOnHold(String callId) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-06-17 19:08:45 -07:00
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setOnHold(callId, Log.getExternalSession());
|
2014-06-17 19:08:45 -07:00
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
2014-03-12 18:33:19 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-28 16:46:42 -07:00
|
|
|
/**
|
2014-09-12 22:16:17 -07:00
|
|
|
* Asks Telecom to start or stop a ringback tone for a call.
|
2014-05-28 16:46:42 -07:00
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call whose ringback is being changed.
|
2014-09-12 22:16:17 -07:00
|
|
|
* @param ringback Whether Telecom should start playing a ringback tone.
|
2014-05-28 16:46:42 -07:00
|
|
|
*/
|
2014-09-08 15:34:24 -07:00
|
|
|
void setRingbackRequested(String callId, boolean ringback) {
|
2014-07-04 17:21:07 -07:00
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-06-17 19:08:45 -07:00
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setRingbackRequested(callId, ringback, Log.getExternalSession());
|
2014-06-17 19:08:45 -07:00
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
2014-05-28 16:46:42 -07:00
|
|
|
}
|
|
|
|
}
|
2014-03-12 18:33:19 -07:00
|
|
|
|
2014-11-12 13:41:16 -08:00
|
|
|
void setConnectionCapabilities(String callId, int capabilities) {
|
2014-07-04 17:21:07 -07:00
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-06-17 19:08:45 -07:00
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setConnectionCapabilities(callId, capabilities, Log.getExternalSession());
|
2014-06-17 19:08:45 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
2014-05-31 10:31:19 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-22 09:02:47 -07:00
|
|
|
void setConnectionProperties(String callId, int properties) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setConnectionProperties(callId, properties, Log.getExternalSession());
|
2016-03-22 09:02:47 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-31 10:31:19 -07:00
|
|
|
/**
|
|
|
|
* Indicates whether or not the specified call is currently conferenced into the specified
|
|
|
|
* conference call.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call being conferenced.
|
2014-06-04 20:20:58 -07:00
|
|
|
* @param conferenceCallId The unique ID of the conference call. Null if call is not
|
2014-06-17 19:08:45 -07:00
|
|
|
* conferenced.
|
2014-05-31 10:31:19 -07:00
|
|
|
*/
|
2014-07-04 17:21:07 -07:00
|
|
|
void setIsConferenced(String callId, String conferenceCallId) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-06-17 19:08:45 -07:00
|
|
|
try {
|
2014-08-21 14:28:11 -07:00
|
|
|
Log.d(this, "sending connection %s with conference %s", callId, conferenceCallId);
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setIsConferenced(callId, conferenceCallId, Log.getExternalSession());
|
2014-06-17 19:08:45 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
2014-05-31 10:31:19 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-24 15:25:29 -07:00
|
|
|
/**
|
|
|
|
* Indicates that the merge request on this call has failed.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call being conferenced.
|
|
|
|
*/
|
|
|
|
void onConferenceMergeFailed(String callId) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
|
|
|
Log.d(this, "merge failed for call %s", callId);
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setConferenceMergeFailed(callId, Log.getExternalSession());
|
2015-04-24 15:25:29 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-04 11:10:37 +08:00
|
|
|
/**
|
|
|
|
* Resets the cdma connection time.
|
|
|
|
*/
|
|
|
|
void resetConnectionTime(String callId) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
|
|
|
adapter.resetConnectionTime(callId, Log.getExternalSession());
|
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-31 10:31:19 -07:00
|
|
|
/**
|
|
|
|
* Indicates that the call no longer exists. Can be used with either a call or a conference
|
|
|
|
* call.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call.
|
|
|
|
*/
|
2014-07-04 17:21:07 -07:00
|
|
|
void removeCall(String callId) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-06-17 19:08:45 -07:00
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.removeCall(callId, Log.getExternalSession());
|
2014-06-17 19:08:45 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
2014-05-31 10:31:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-06-03 14:07:13 -07:00
|
|
|
|
2014-07-04 17:21:07 -07:00
|
|
|
void onPostDialWait(String callId, String remaining) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-06-17 19:08:45 -07:00
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.onPostDialWait(callId, remaining, Log.getExternalSession());
|
2014-06-17 19:08:45 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
2014-06-03 14:07:13 -07:00
|
|
|
}
|
|
|
|
}
|
2014-06-06 10:54:07 -07:00
|
|
|
|
2014-12-15 16:12:50 -08:00
|
|
|
void onPostDialChar(String callId, char nextChar) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.onPostDialChar(callId, nextChar, Log.getExternalSession());
|
2014-12-15 16:12:50 -08:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-04 20:20:58 -07:00
|
|
|
/**
|
|
|
|
* Indicates that a new conference call has been created.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the conference call.
|
|
|
|
*/
|
2014-08-07 18:35:18 -07:00
|
|
|
void addConferenceCall(String callId, ParcelableConference parcelableConference) {
|
2014-07-04 17:21:07 -07:00
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-06-17 19:08:45 -07:00
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.addConferenceCall(callId, parcelableConference, Log.getExternalSession());
|
2014-06-17 19:08:45 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves a list of remote connection services usable to place calls.
|
|
|
|
*/
|
2019-05-17 10:49:16 -07:00
|
|
|
void queryRemoteConnectionServices(RemoteServiceCallback callback, String callingPackage) {
|
2014-06-17 19:08:45 -07:00
|
|
|
// Only supported when there is only one adapter.
|
|
|
|
if (mAdapters.size() == 1) {
|
|
|
|
try {
|
2019-05-17 10:49:16 -07:00
|
|
|
mAdapters.iterator().next().queryRemoteConnectionServices(callback, callingPackage,
|
2016-10-28 12:29:55 -07:00
|
|
|
Log.getExternalSession());
|
2014-06-17 19:08:45 -07:00
|
|
|
} catch (RemoteException e) {
|
|
|
|
Log.e(this, e, "Exception trying to query for remote CSs");
|
|
|
|
}
|
2019-05-30 16:52:28 -07:00
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
// This is not an error condition, so just pass back an empty list.
|
|
|
|
// This happens when querying from a remote connection service, not the connection
|
|
|
|
// manager itself.
|
|
|
|
callback.onResult(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
|
|
|
|
} catch (RemoteException e) {
|
|
|
|
Log.e(this, e, "Exception trying to query for remote CSs");
|
|
|
|
}
|
2014-06-04 20:20:58 -07:00
|
|
|
}
|
|
|
|
}
|
2014-06-20 16:29:33 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the call video provider for a call.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call to set with the given call video provider.
|
2014-08-07 19:46:01 -07:00
|
|
|
* @param videoProvider The call video provider instance to set on the call.
|
2014-06-20 16:29:33 -07:00
|
|
|
*/
|
2014-08-07 19:46:01 -07:00
|
|
|
void setVideoProvider(
|
|
|
|
String callId, Connection.VideoProvider videoProvider) {
|
2014-07-04 17:21:07 -07:00
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-06-20 16:29:33 -07:00
|
|
|
try {
|
2014-08-07 19:46:01 -07:00
|
|
|
adapter.setVideoProvider(
|
2014-07-21 01:28:28 -07:00
|
|
|
callId,
|
2016-10-28 12:29:55 -07:00
|
|
|
videoProvider == null ? null : videoProvider.getInterface(),
|
|
|
|
Log.getExternalSession());
|
2014-06-20 16:29:33 -07:00
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-07-01 11:31:21 -07:00
|
|
|
|
2014-07-07 22:49:44 -07:00
|
|
|
/**
|
|
|
|
* Requests that the framework use VOIP audio mode for this connection.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call to set with the given call video provider.
|
|
|
|
* @param isVoip True if the audio mode is VOIP.
|
|
|
|
*/
|
2014-09-08 15:34:24 -07:00
|
|
|
void setIsVoipAudioMode(String callId, boolean isVoip) {
|
2014-07-07 22:49:44 -07:00
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setIsVoipAudioMode(callId, isVoip, Log.getExternalSession());
|
2014-07-07 22:49:44 -07:00
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-08 21:48:22 -07:00
|
|
|
void setStatusHints(String callId, StatusHints statusHints) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setStatusHints(callId, statusHints, Log.getExternalSession());
|
2014-07-08 21:48:22 -07:00
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-08 15:34:24 -07:00
|
|
|
void setAddress(String callId, Uri address, int presentation) {
|
2014-07-04 17:21:07 -07:00
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
2014-07-01 11:31:21 -07:00
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setAddress(callId, address, presentation, Log.getExternalSession());
|
2014-07-11 14:50:13 -07:00
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void setCallerDisplayName(String callId, String callerDisplayName, int presentation) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setCallerDisplayName(callId, callerDisplayName, presentation,
|
|
|
|
Log.getExternalSession());
|
2014-07-11 14:50:13 -07:00
|
|
|
} catch (RemoteException e) {
|
2014-07-01 11:31:21 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-07-17 07:50:22 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the video state associated with a call.
|
|
|
|
*
|
2015-06-03 10:09:59 -07:00
|
|
|
* Valid values: {@link VideoProfile#STATE_BIDIRECTIONAL},
|
|
|
|
* {@link VideoProfile#STATE_AUDIO_ONLY},
|
|
|
|
* {@link VideoProfile#STATE_TX_ENABLED},
|
|
|
|
* {@link VideoProfile#STATE_RX_ENABLED}.
|
2014-07-17 07:50:22 -07:00
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call to set the video state for.
|
|
|
|
* @param videoState The video state.
|
|
|
|
*/
|
|
|
|
void setVideoState(String callId, int videoState) {
|
|
|
|
Log.v(this, "setVideoState: %d", videoState);
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setVideoState(callId, videoState, Log.getExternalSession());
|
2014-07-17 07:50:22 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-07-18 14:49:18 -07:00
|
|
|
|
2014-07-28 18:15:48 -07:00
|
|
|
void setConferenceableConnections(String callId, List<String> conferenceableCallIds) {
|
|
|
|
Log.v(this, "setConferenceableConnections: %s, %s", callId, conferenceableCallIds);
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.setConferenceableConnections(callId, conferenceableCallIds,
|
|
|
|
Log.getExternalSession());
|
2014-07-28 18:15:48 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-10-30 14:27:48 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Informs telecom of an existing connection which was added by the {@link ConnectionService}.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call being added.
|
|
|
|
* @param connection The connection.
|
|
|
|
*/
|
|
|
|
void addExistingConnection(String callId, ParcelableConnection connection) {
|
|
|
|
Log.v(this, "addExistingConnection: %s", callId);
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.addExistingConnection(callId, connection, Log.getExternalSession());
|
2014-10-30 14:27:48 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-05-27 17:21:45 -07:00
|
|
|
|
|
|
|
/**
|
Expand call/connection extras API.
Currently, connection extras are propagated up to Telecom as an
entire bundle. This is not ideal, as any time a change is made to
the extras, the bundle needs to be fetched, changed, and then re-set on
the connection, where it is parceled to Telecom as a whole.
Using how extras on an Intent as inspiration, this CL adds separate
putExtras, putExtra, and removeExtra methods to allow manipulation of
the extras bundle without operating on it in its entirety.
This Cl also adds support for Calls modifying the extras bundle, with
changes propagated back down to ConnectionServices.
Bug: 27458894
Change-Id: I152340a3bca2dc03f170b06b172a6823410fb961
2016-03-23 16:06:34 -07:00
|
|
|
* Adds some extras associated with a {@code Connection}.
|
2015-05-27 17:21:45 -07:00
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call.
|
Expand call/connection extras API.
Currently, connection extras are propagated up to Telecom as an
entire bundle. This is not ideal, as any time a change is made to
the extras, the bundle needs to be fetched, changed, and then re-set on
the connection, where it is parceled to Telecom as a whole.
Using how extras on an Intent as inspiration, this CL adds separate
putExtras, putExtra, and removeExtra methods to allow manipulation of
the extras bundle without operating on it in its entirety.
This Cl also adds support for Calls modifying the extras bundle, with
changes propagated back down to ConnectionServices.
Bug: 27458894
Change-Id: I152340a3bca2dc03f170b06b172a6823410fb961
2016-03-23 16:06:34 -07:00
|
|
|
* @param extras The extras to add.
|
2015-05-27 17:21:45 -07:00
|
|
|
*/
|
Expand call/connection extras API.
Currently, connection extras are propagated up to Telecom as an
entire bundle. This is not ideal, as any time a change is made to
the extras, the bundle needs to be fetched, changed, and then re-set on
the connection, where it is parceled to Telecom as a whole.
Using how extras on an Intent as inspiration, this CL adds separate
putExtras, putExtra, and removeExtra methods to allow manipulation of
the extras bundle without operating on it in its entirety.
This Cl also adds support for Calls modifying the extras bundle, with
changes propagated back down to ConnectionServices.
Bug: 27458894
Change-Id: I152340a3bca2dc03f170b06b172a6823410fb961
2016-03-23 16:06:34 -07:00
|
|
|
void putExtras(String callId, Bundle extras) {
|
|
|
|
Log.v(this, "putExtras: %s", callId);
|
2015-05-27 17:21:45 -07:00
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.putExtras(callId, extras, Log.getExternalSession());
|
Expand call/connection extras API.
Currently, connection extras are propagated up to Telecom as an
entire bundle. This is not ideal, as any time a change is made to
the extras, the bundle needs to be fetched, changed, and then re-set on
the connection, where it is parceled to Telecom as a whole.
Using how extras on an Intent as inspiration, this CL adds separate
putExtras, putExtra, and removeExtra methods to allow manipulation of
the extras bundle without operating on it in its entirety.
This Cl also adds support for Calls modifying the extras bundle, with
changes propagated back down to ConnectionServices.
Bug: 27458894
Change-Id: I152340a3bca2dc03f170b06b172a6823410fb961
2016-03-23 16:06:34 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds an extra associated with a {@code Connection}.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call.
|
|
|
|
* @param key The extra key.
|
|
|
|
* @param value The extra value.
|
|
|
|
*/
|
|
|
|
void putExtra(String callId, String key, boolean value) {
|
|
|
|
Log.v(this, "putExtra: %s %s=%b", callId, key, value);
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
|
|
|
Bundle bundle = new Bundle();
|
|
|
|
bundle.putBoolean(key, value);
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.putExtras(callId, bundle, Log.getExternalSession());
|
Expand call/connection extras API.
Currently, connection extras are propagated up to Telecom as an
entire bundle. This is not ideal, as any time a change is made to
the extras, the bundle needs to be fetched, changed, and then re-set on
the connection, where it is parceled to Telecom as a whole.
Using how extras on an Intent as inspiration, this CL adds separate
putExtras, putExtra, and removeExtra methods to allow manipulation of
the extras bundle without operating on it in its entirety.
This Cl also adds support for Calls modifying the extras bundle, with
changes propagated back down to ConnectionServices.
Bug: 27458894
Change-Id: I152340a3bca2dc03f170b06b172a6823410fb961
2016-03-23 16:06:34 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds an extra associated with a {@code Connection}.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call.
|
|
|
|
* @param key The extra key.
|
|
|
|
* @param value The extra value.
|
|
|
|
*/
|
|
|
|
void putExtra(String callId, String key, int value) {
|
|
|
|
Log.v(this, "putExtra: %s %s=%d", callId, key, value);
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
|
|
|
Bundle bundle = new Bundle();
|
|
|
|
bundle.putInt(key, value);
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.putExtras(callId, bundle, Log.getExternalSession());
|
Expand call/connection extras API.
Currently, connection extras are propagated up to Telecom as an
entire bundle. This is not ideal, as any time a change is made to
the extras, the bundle needs to be fetched, changed, and then re-set on
the connection, where it is parceled to Telecom as a whole.
Using how extras on an Intent as inspiration, this CL adds separate
putExtras, putExtra, and removeExtra methods to allow manipulation of
the extras bundle without operating on it in its entirety.
This Cl also adds support for Calls modifying the extras bundle, with
changes propagated back down to ConnectionServices.
Bug: 27458894
Change-Id: I152340a3bca2dc03f170b06b172a6823410fb961
2016-03-23 16:06:34 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds an extra associated with a {@code Connection}.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call.
|
|
|
|
* @param key The extra key.
|
|
|
|
* @param value The extra value.
|
|
|
|
*/
|
|
|
|
void putExtra(String callId, String key, String value) {
|
|
|
|
Log.v(this, "putExtra: %s %s=%s", callId, key, value);
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
|
|
|
Bundle bundle = new Bundle();
|
|
|
|
bundle.putString(key, value);
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.putExtras(callId, bundle, Log.getExternalSession());
|
Expand call/connection extras API.
Currently, connection extras are propagated up to Telecom as an
entire bundle. This is not ideal, as any time a change is made to
the extras, the bundle needs to be fetched, changed, and then re-set on
the connection, where it is parceled to Telecom as a whole.
Using how extras on an Intent as inspiration, this CL adds separate
putExtras, putExtra, and removeExtra methods to allow manipulation of
the extras bundle without operating on it in its entirety.
This Cl also adds support for Calls modifying the extras bundle, with
changes propagated back down to ConnectionServices.
Bug: 27458894
Change-Id: I152340a3bca2dc03f170b06b172a6823410fb961
2016-03-23 16:06:34 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes extras associated with a {@code Connection}.
|
|
|
|
* @param callId The unique ID of the call.
|
|
|
|
* @param keys The extra keys to remove.
|
|
|
|
*/
|
|
|
|
void removeExtras(String callId, List<String> keys) {
|
|
|
|
Log.v(this, "removeExtras: %s %s", callId, keys);
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.removeExtras(callId, keys, Log.getExternalSession());
|
2015-05-27 17:21:45 -07:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-02-16 14:36:20 -08:00
|
|
|
|
2017-01-09 09:43:12 -08:00
|
|
|
/**
|
|
|
|
* Sets the audio route associated with a {@link Connection}.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call.
|
|
|
|
* @param audioRoute The new audio route (see {@code CallAudioState#ROUTE_*}).
|
|
|
|
*/
|
2017-11-07 17:59:28 -08:00
|
|
|
void setAudioRoute(String callId, int audioRoute, String bluetoothAddress) {
|
|
|
|
Log.v(this, "setAudioRoute: %s %s %s", callId,
|
|
|
|
CallAudioState.audioRouteToString(audioRoute),
|
|
|
|
bluetoothAddress);
|
2017-01-09 09:43:12 -08:00
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
2017-11-07 17:59:28 -08:00
|
|
|
adapter.setAudioRoute(callId, audioRoute,
|
|
|
|
bluetoothAddress, Log.getExternalSession());
|
2017-01-09 09:43:12 -08:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-16 14:36:20 -08:00
|
|
|
/**
|
|
|
|
* Informs Telecom of a connection level event.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call.
|
|
|
|
* @param event The event.
|
2016-03-14 15:18:07 -07:00
|
|
|
* @param extras Extras associated with the event.
|
2016-02-16 14:36:20 -08:00
|
|
|
*/
|
2016-03-14 15:18:07 -07:00
|
|
|
void onConnectionEvent(String callId, String event, Bundle extras) {
|
2016-02-16 14:36:20 -08:00
|
|
|
Log.v(this, "onConnectionEvent: %s", event);
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
2016-10-28 12:29:55 -07:00
|
|
|
adapter.onConnectionEvent(callId, event, extras, Log.getExternalSession());
|
2016-02-16 14:36:20 -08:00
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-02-06 10:49:48 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notifies Telecom that an RTT session was successfully established.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call.
|
|
|
|
*/
|
|
|
|
void onRttInitiationSuccess(String callId) {
|
|
|
|
Log.v(this, "onRttInitiationSuccess: %s", callId);
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
|
|
|
adapter.onRttInitiationSuccess(callId, Log.getExternalSession());
|
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notifies Telecom that a requested RTT session failed to be established.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call.
|
|
|
|
*/
|
|
|
|
void onRttInitiationFailure(String callId, int reason) {
|
|
|
|
Log.v(this, "onRttInitiationFailure: %s", callId);
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
|
|
|
adapter.onRttInitiationFailure(callId, reason, Log.getExternalSession());
|
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notifies Telecom that an established RTT session was terminated by the remote user on
|
|
|
|
* the call.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call.
|
|
|
|
*/
|
|
|
|
void onRttSessionRemotelyTerminated(String callId) {
|
|
|
|
Log.v(this, "onRttSessionRemotelyTerminated: %s", callId);
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
|
|
|
adapter.onRttSessionRemotelyTerminated(callId, Log.getExternalSession());
|
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notifies Telecom that the remote user on the call has requested an upgrade to an RTT
|
|
|
|
* session for this call.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call.
|
|
|
|
*/
|
|
|
|
void onRemoteRttRequest(String callId) {
|
|
|
|
Log.v(this, "onRemoteRttRequest: %s", callId);
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
|
|
|
adapter.onRemoteRttRequest(callId, Log.getExternalSession());
|
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-05-04 20:58:34 +05:30
|
|
|
|
|
|
|
/**
|
|
|
|
* Notifies Telecom that a call's PhoneAccountHandle has changed.
|
|
|
|
*
|
|
|
|
* @param callId The unique ID of the call.
|
|
|
|
* @param pHandle The new PhoneAccountHandle associated with the call.
|
|
|
|
*/
|
|
|
|
void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle) {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
|
|
|
Log.d(this, "onPhoneAccountChanged %s", callId);
|
|
|
|
adapter.onPhoneAccountChanged(callId, pHandle, Log.getExternalSession());
|
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-11-21 18:01:13 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notifies Telecom that the {@link ConnectionService} has released the call resource.
|
|
|
|
*/
|
|
|
|
void onConnectionServiceFocusReleased() {
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
|
|
|
Log.d(this, "onConnectionServiceFocusReleased");
|
|
|
|
adapter.onConnectionServiceFocusReleased(Log.getExternalSession());
|
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-10-03 15:38:57 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether a conference is treated as a conference or a single party call.
|
|
|
|
* See {@link Conference#setConferenceState(boolean)} for more information.
|
|
|
|
*
|
|
|
|
* @param callId The ID of the telecom call.
|
|
|
|
* @param isConference {@code true} if this call should be treated as a conference,
|
|
|
|
* {@code false} otherwise.
|
|
|
|
*/
|
|
|
|
void setConferenceState(String callId, boolean isConference) {
|
|
|
|
Log.v(this, "setConferenceState: %s %b", callId, isConference);
|
|
|
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
|
|
|
try {
|
|
|
|
adapter.setConferenceState(callId, isConference, Log.getExternalSession());
|
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-08 16:25:12 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the direction of a call. Setting a new direction of an existing call is usually only
|
|
|
|
* applicable during single caller emulation during conferencing, see
|
|
|
|
* {@link Conference#setConferenceState(boolean)} for more information.
|
|
|
|
* @param callId The identifier of the call.
|
|
|
|
* @param direction The new direction of the call.
|
|
|
|
*/
|
|
|
|
void setCallDirection(String callId, @Call.Details.CallDirection int direction) {
|
|
|
|
for (IConnectionServiceAdapter a : mAdapters) {
|
|
|
|
try {
|
|
|
|
a.setCallDirection(callId, direction, Log.getExternalSession());
|
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-12-12 18:32:02 -08:00
|
|
|
}
|