Merge "Add ability to add existing connection AND set parent at the same time." into oc-dev
This commit is contained in:
@@ -522,6 +522,26 @@ public abstract class Connection extends Conferenceable {
|
|||||||
*/
|
*/
|
||||||
public static final String EVENT_CALL_MERGE_FAILED = "android.telecom.event.CALL_MERGE_FAILED";
|
public static final String EVENT_CALL_MERGE_FAILED = "android.telecom.event.CALL_MERGE_FAILED";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connection event used to inform {@link InCallService}s when the process of merging a
|
||||||
|
* Connection into a conference has begun.
|
||||||
|
* <p>
|
||||||
|
* Sent via {@link #sendConnectionEvent(String, Bundle)}. The {@link Bundle} parameter is
|
||||||
|
* expected to be null when this connection event is used.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String EVENT_MERGE_START = "android.telecom.event.MERGE_START";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connection event used to inform {@link InCallService}s when the process of merging a
|
||||||
|
* Connection into a conference has completed.
|
||||||
|
* <p>
|
||||||
|
* Sent via {@link #sendConnectionEvent(String, Bundle)}. The {@link Bundle} parameter is
|
||||||
|
* expected to be null when this connection event is used.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String EVENT_MERGE_COMPLETE = "android.telecom.event.MERGE_COMPLETE";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connection event used to inform {@link InCallService}s when a call has been put on hold by
|
* Connection event used to inform {@link InCallService}s when a call has been put on hold by
|
||||||
* the remote party.
|
* the remote party.
|
||||||
|
|||||||
@@ -1823,10 +1823,28 @@ public abstract class ConnectionService extends Service {
|
|||||||
*/
|
*/
|
||||||
public final void addExistingConnection(PhoneAccountHandle phoneAccountHandle,
|
public final void addExistingConnection(PhoneAccountHandle phoneAccountHandle,
|
||||||
Connection connection) {
|
Connection connection) {
|
||||||
|
addExistingConnection(phoneAccountHandle, connection, null /* conference */);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a connection created by the {@link ConnectionService} and informs telecom of the new
|
||||||
|
* connection.
|
||||||
|
*
|
||||||
|
* @param phoneAccountHandle The phone account handle for the connection.
|
||||||
|
* @param connection The connection to add.
|
||||||
|
* @param conference The parent conference of the new connection.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public final void addExistingConnection(PhoneAccountHandle phoneAccountHandle,
|
||||||
|
Connection connection, Conference conference) {
|
||||||
|
|
||||||
String id = addExistingConnectionInternal(phoneAccountHandle, connection);
|
String id = addExistingConnectionInternal(phoneAccountHandle, connection);
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
List<String> emptyList = new ArrayList<>(0);
|
List<String> emptyList = new ArrayList<>(0);
|
||||||
|
String conferenceId = null;
|
||||||
|
if (conference != null) {
|
||||||
|
conferenceId = mIdByConference.get(conference);
|
||||||
|
}
|
||||||
|
|
||||||
ParcelableConnection parcelableConnection = new ParcelableConnection(
|
ParcelableConnection parcelableConnection = new ParcelableConnection(
|
||||||
phoneAccountHandle,
|
phoneAccountHandle,
|
||||||
@@ -1847,7 +1865,8 @@ public abstract class ConnectionService extends Service {
|
|||||||
connection.getStatusHints(),
|
connection.getStatusHints(),
|
||||||
connection.getDisconnectCause(),
|
connection.getDisconnectCause(),
|
||||||
emptyList,
|
emptyList,
|
||||||
connection.getExtras());
|
connection.getExtras(),
|
||||||
|
conferenceId);
|
||||||
mAdapter.addExistingConnection(id, parcelableConnection);
|
mAdapter.addExistingConnection(id, parcelableConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,35 @@ public final class ParcelableConnection implements Parcelable {
|
|||||||
private final DisconnectCause mDisconnectCause;
|
private final DisconnectCause mDisconnectCause;
|
||||||
private final List<String> mConferenceableConnectionIds;
|
private final List<String> mConferenceableConnectionIds;
|
||||||
private final Bundle mExtras;
|
private final Bundle mExtras;
|
||||||
|
private String mParentCallId;
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public ParcelableConnection(
|
||||||
|
PhoneAccountHandle phoneAccount,
|
||||||
|
int state,
|
||||||
|
int capabilities,
|
||||||
|
int properties,
|
||||||
|
int supportedAudioRoutes,
|
||||||
|
Uri address,
|
||||||
|
int addressPresentation,
|
||||||
|
String callerDisplayName,
|
||||||
|
int callerDisplayNamePresentation,
|
||||||
|
IVideoProvider videoProvider,
|
||||||
|
int videoState,
|
||||||
|
boolean ringbackRequested,
|
||||||
|
boolean isVoipAudioMode,
|
||||||
|
long connectTimeMillis,
|
||||||
|
StatusHints statusHints,
|
||||||
|
DisconnectCause disconnectCause,
|
||||||
|
List<String> conferenceableConnectionIds,
|
||||||
|
Bundle extras,
|
||||||
|
String parentCallId) {
|
||||||
|
this(phoneAccount, state, capabilities, properties, supportedAudioRoutes, address,
|
||||||
|
addressPresentation, callerDisplayName, callerDisplayNamePresentation,
|
||||||
|
videoProvider, videoState, ringbackRequested, isVoipAudioMode, connectTimeMillis,
|
||||||
|
statusHints, disconnectCause, conferenceableConnectionIds, extras);
|
||||||
|
mParentCallId = parentCallId;
|
||||||
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public ParcelableConnection(
|
public ParcelableConnection(
|
||||||
@@ -90,6 +119,7 @@ public final class ParcelableConnection implements Parcelable {
|
|||||||
mDisconnectCause = disconnectCause;
|
mDisconnectCause = disconnectCause;
|
||||||
mConferenceableConnectionIds = conferenceableConnectionIds;
|
mConferenceableConnectionIds = conferenceableConnectionIds;
|
||||||
mExtras = extras;
|
mExtras = extras;
|
||||||
|
mParentCallId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhoneAccountHandle getPhoneAccount() {
|
public PhoneAccountHandle getPhoneAccount() {
|
||||||
@@ -176,6 +206,10 @@ public final class ParcelableConnection implements Parcelable {
|
|||||||
return mExtras;
|
return mExtras;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final String getParentCallId() {
|
||||||
|
return mParentCallId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new StringBuilder()
|
return new StringBuilder()
|
||||||
@@ -189,6 +223,8 @@ public final class ParcelableConnection implements Parcelable {
|
|||||||
.append(Connection.propertiesToString(mConnectionProperties))
|
.append(Connection.propertiesToString(mConnectionProperties))
|
||||||
.append(", extras:")
|
.append(", extras:")
|
||||||
.append(mExtras)
|
.append(mExtras)
|
||||||
|
.append(", parent:")
|
||||||
|
.append(mParentCallId)
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,6 +254,7 @@ public final class ParcelableConnection implements Parcelable {
|
|||||||
Bundle extras = Bundle.setDefusable(source.readBundle(classLoader), true);
|
Bundle extras = Bundle.setDefusable(source.readBundle(classLoader), true);
|
||||||
int properties = source.readInt();
|
int properties = source.readInt();
|
||||||
int supportedAudioRoutes = source.readInt();
|
int supportedAudioRoutes = source.readInt();
|
||||||
|
String parentCallId = source.readString();
|
||||||
|
|
||||||
return new ParcelableConnection(
|
return new ParcelableConnection(
|
||||||
phoneAccount,
|
phoneAccount,
|
||||||
@@ -237,7 +274,8 @@ public final class ParcelableConnection implements Parcelable {
|
|||||||
statusHints,
|
statusHints,
|
||||||
disconnectCause,
|
disconnectCause,
|
||||||
conferenceableConnectionIds,
|
conferenceableConnectionIds,
|
||||||
extras);
|
extras,
|
||||||
|
parentCallId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -274,5 +312,6 @@ public final class ParcelableConnection implements Parcelable {
|
|||||||
destination.writeBundle(mExtras);
|
destination.writeBundle(mExtras);
|
||||||
destination.writeInt(mConnectionProperties);
|
destination.writeInt(mConnectionProperties);
|
||||||
destination.writeInt(mSupportedAudioRoutes);
|
destination.writeInt(mSupportedAudioRoutes);
|
||||||
|
destination.writeString(mParentCallId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user