am 41be2ecc: am 2c2c1e07: am b3e396c2: Additional changes for Conference.
* commit '41be2eccfe606d890ab6d8ad5e336bef6969089a': Additional changes for Conference.
This commit is contained in:
@@ -163,6 +163,7 @@ public abstract class Conference {
|
||||
* @return True if the connection was successfully removed.
|
||||
*/
|
||||
public void removeConnection(Connection connection) {
|
||||
Log.d(this, "removing %s from %s", connection, mChildConnections);
|
||||
if (connection != null && mChildConnections.remove(connection)) {
|
||||
connection.resetConference();
|
||||
for (Listener l : mListeners) {
|
||||
@@ -177,7 +178,7 @@ public abstract class Conference {
|
||||
public void destroy() {
|
||||
Log.d(this, "destroying conference : %s", this);
|
||||
// Tear down the children.
|
||||
for (Connection connection : new ArrayList<>(mChildConnections)) {
|
||||
for (Connection connection : mChildConnections) {
|
||||
Log.d(this, "removing connection %s", connection);
|
||||
removeConnection(connection);
|
||||
}
|
||||
|
||||
@@ -914,10 +914,11 @@ public abstract class Connection {
|
||||
*/
|
||||
public final boolean setConference(Conference conference) {
|
||||
// We check to see if it is already part of another conference.
|
||||
if (mConference == null && mConnectionService != null &&
|
||||
mConnectionService.containsConference(conference)) {
|
||||
if (mConference == null) {
|
||||
mConference = conference;
|
||||
fireConferenceChanged();
|
||||
if (mConnectionService != null && mConnectionService.containsConference(conference)) {
|
||||
fireConferenceChanged();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -929,6 +930,7 @@ public abstract class Connection {
|
||||
*/
|
||||
public final void resetConference() {
|
||||
if (mConference != null) {
|
||||
Log.d(this, "Conference reset");
|
||||
mConference = null;
|
||||
fireConferenceChanged();
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ public abstract class ConnectionService extends Service {
|
||||
private final ConnectionServiceAdapter mAdapter = new ConnectionServiceAdapter();
|
||||
|
||||
private boolean mAreAccountsInitialized = false;
|
||||
private Conference sNullConference;
|
||||
|
||||
private final IBinder mBinder = new IConnectionService.Stub() {
|
||||
@Override
|
||||
@@ -561,17 +562,29 @@ public abstract class ConnectionService extends Service {
|
||||
|
||||
private void disconnect(String callId) {
|
||||
Log.d(this, "disconnect %s", callId);
|
||||
findConnectionForAction(callId, "disconnect").onDisconnect();
|
||||
if (mConnectionById.containsKey(callId)) {
|
||||
findConnectionForAction(callId, "disconnect").onDisconnect();
|
||||
} else {
|
||||
findConferenceForAction(callId, "disconnect").onDisconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private void hold(String callId) {
|
||||
Log.d(this, "hold %s", callId);
|
||||
findConnectionForAction(callId, "hold").onHold();
|
||||
if (mConnectionById.containsKey(callId)) {
|
||||
findConnectionForAction(callId, "hold").onHold();
|
||||
} else {
|
||||
findConferenceForAction(callId, "hold").onHold();
|
||||
}
|
||||
}
|
||||
|
||||
private void unhold(String callId) {
|
||||
Log.d(this, "unhold %s", callId);
|
||||
findConnectionForAction(callId, "unhold").onUnhold();
|
||||
if (mConnectionById.containsKey(callId)) {
|
||||
findConnectionForAction(callId, "unhold").onUnhold();
|
||||
} else {
|
||||
findConferenceForAction(callId, "unhold").onUnhold();
|
||||
}
|
||||
}
|
||||
|
||||
private void onAudioStateChanged(String callId, AudioState audioState) {
|
||||
@@ -616,7 +629,10 @@ public abstract class ConnectionService extends Service {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Find existing conference call and invoke split(connection).
|
||||
Conference conference = connection.getConference();
|
||||
if (conference != null) {
|
||||
conference.onSeparate(connection);
|
||||
}
|
||||
}
|
||||
|
||||
private void onPostDialContinue(String callId, boolean proceed) {
|
||||
@@ -885,4 +901,19 @@ public abstract class ConnectionService extends Service {
|
||||
}
|
||||
return sNullConnection;
|
||||
}
|
||||
|
||||
private Conference findConferenceForAction(String conferenceId, String action) {
|
||||
if (mConferenceById.containsKey(conferenceId)) {
|
||||
return mConferenceById.get(conferenceId);
|
||||
}
|
||||
Log.w(this, "%s - Cannot find conference %s", action, conferenceId);
|
||||
return getNullConference();
|
||||
}
|
||||
|
||||
private Conference getNullConference() {
|
||||
if (sNullConference == null) {
|
||||
sNullConference = new Conference(null) {};
|
||||
}
|
||||
return sNullConference;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ final class ConnectionServiceAdapter implements DeathRecipient {
|
||||
void setIsConferenced(String callId, String conferenceCallId) {
|
||||
for (IConnectionServiceAdapter adapter : mAdapters) {
|
||||
try {
|
||||
Log.d(this, "sending connection %s with conference %s", callId, conferenceCallId);
|
||||
adapter.setIsConferenced(callId, conferenceCallId);
|
||||
} catch (RemoteException ignored) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user