Don't set address for failed remote connections

We created failed connections we no address attached.
When the connection is sent to RemoteConnectionService
the null address is translated to a setAddress() call.

This causes all failed connections to show up as "unknown".
Fix is to only call setAddress if creating the connection
succeeded.

BUG: 18830726
Change-Id: I680e2fa4c69157a9fdbfa348c6af1f2f87aafd48
This commit is contained in:
Sailesh Nepal
2015-01-31 20:17:35 -08:00
parent 16bce33af6
commit 2d3ced758f

View File

@@ -60,11 +60,16 @@ final class RemoteConnectionService {
mPendingConnections.remove(connection);
// Unconditionally initialize the connection ...
connection.setConnectionCapabilities(parcel.getConnectionCapabilities());
connection.setAddress(
parcel.getHandle(), parcel.getHandlePresentation());
connection.setCallerDisplayName(
parcel.getCallerDisplayName(),
parcel.getCallerDisplayNamePresentation());
if (parcel.getHandle() != null
|| parcel.getState() != Connection.STATE_DISCONNECTED) {
connection.setAddress(parcel.getHandle(), parcel.getHandlePresentation());
}
if (parcel.getCallerDisplayName() != null
|| parcel.getState() != Connection.STATE_DISCONNECTED) {
connection.setCallerDisplayName(
parcel.getCallerDisplayName(),
parcel.getCallerDisplayNamePresentation());
}
// Set state after handle so that the client can identify the connection.
if (parcel.getState() == Connection.STATE_DISCONNECTED) {
connection.setDisconnected(parcel.getDisconnectCause());