From 2d3ced758fa42d8a7cf941998355f655ed0bf0b8 Mon Sep 17 00:00:00 2001 From: Sailesh Nepal Date: Sat, 31 Jan 2015 20:17:35 -0800 Subject: 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 --- .../java/android/telecom/RemoteConnectionService.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'telecomm/java/android/telecom/RemoteConnectionService.java') diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java index 43a92cb..a9b725b 100644 --- a/telecomm/java/android/telecom/RemoteConnectionService.java +++ b/telecomm/java/android/telecom/RemoteConnectionService.java @@ -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()); -- cgit v1.1