[Telecom] Improve hold capability signal

Add some method to the ConnectionService in order to notify the
connection changed.

Test: manually test and unit test
Bug: 66949982

Change-Id: I077902474f9af70e00a383aa269e1ae6ff9230a9
This commit is contained in:
Pengquan Meng
2017-10-02 18:09:03 -07:00
parent 764e917084
commit 70c9885330
2 changed files with 56 additions and 3 deletions

View File

@@ -1382,7 +1382,7 @@ public abstract class ConnectionService extends Service {
connection.setTelecomCallId(callId);
if (connection.getState() != Connection.STATE_DISCONNECTED) {
addConnection(callId, connection);
addConnection(request.getAccountHandle(), callId, connection);
}
Uri address = connection.getAddress();
@@ -1846,6 +1846,7 @@ public abstract class ConnectionService extends Service {
mAdapter.setIsConferenced(connectionId, id);
}
}
onConferenceAdded(conference);
}
}
@@ -2055,6 +2056,30 @@ public abstract class ConnectionService extends Service {
*/
public void onConference(Connection connection1, Connection connection2) {}
/**
* Called when a connection is added.
* @hide
*/
public void onConnectionAdded(Connection connection) {}
/**
* Called when a connection is removed.
* @hide
*/
public void onConnectionRemoved(Connection connection) {}
/**
* Called when a conference is added.
* @hide
*/
public void onConferenceAdded(Conference conference) {}
/**
* Called when a conference is removed.
* @hide
*/
public void onConferenceRemoved(Conference conference) {}
/**
* Indicates that a remote conference has been created for existing {@link RemoteConnection}s.
* When this method is invoked, this {@link ConnectionService} should create its own
@@ -2122,16 +2147,18 @@ public abstract class ConnectionService extends Service {
// prefix for a unique incremental call ID.
id = handle.getComponentName().getClassName() + "@" + getNextCallId();
}
addConnection(id, connection);
addConnection(handle, id, connection);
return id;
}
private void addConnection(String callId, Connection connection) {
private void addConnection(PhoneAccountHandle handle, String callId, Connection connection) {
connection.setTelecomCallId(callId);
mConnectionById.put(callId, connection);
mIdByConnection.put(connection, callId);
connection.addConnectionListener(mConnectionListener);
connection.setConnectionService(this);
connection.setPhoneAccountHandle(handle);
onConnectionAdded(connection);
}
/** {@hide} */
@@ -2143,6 +2170,7 @@ public abstract class ConnectionService extends Service {
mConnectionById.remove(id);
mIdByConnection.remove(connection);
mAdapter.removeCall(id);
onConnectionRemoved(connection);
}
}
@@ -2179,6 +2207,8 @@ public abstract class ConnectionService extends Service {
mConferenceById.remove(id);
mIdByConference.remove(conference);
mAdapter.removeCall(id);
onConferenceRemoved(conference);
}
}