summaryrefslogtreecommitdiff
path: root/telecomm/java/android/telecom/ConnectionService.java
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2017-06-16 20:20:34 -0700
committerTyler Gunn <tgunn@google.com>2017-08-14 16:30:41 +0000
commit9a351ca849b0f74e407fa1b7fb7ce10c63d878d6 (patch)
tree43ed88042540e14e7a3277361c51da44058ec44d /telecomm/java/android/telecom/ConnectionService.java
parent4996a358434e62204a009f3f3c9d6fa261f741b4 (diff)
Ensure CallId is not null when connection creation is complete.
When calling "get" on the mConnectoinById map, a null callId will result in an NPE. In findConnectionForAction, defaulting to returning the "null" connection which is the same behavior as if it isn't found. In notifyCreateConnectionComplete, specifically checking if the callId is null and skipping the onCreateConnectionComplete callback. This scenario is possible if the connection is remove from the ConnectionService before the connection complete callback comes back from Telecom. Test: Manual Fixes: 62588734 Change-Id: Ie610c51155ed417e0f916000fe20e4484bdb6603
Diffstat (limited to 'telecomm/java/android/telecom/ConnectionService.java')
-rw-r--r--telecomm/java/android/telecom/ConnectionService.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index e3b027abdb5d..f78e427663c6 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -1440,6 +1440,12 @@ public abstract class ConnectionService extends Service {
*/
private void notifyCreateConnectionComplete(final String callId) {
Log.i(this, "notifyCreateConnectionComplete %s", callId);
+ if (callId == null) {
+ // This could happen if the connection fails quickly and is removed from the
+ // ConnectionService before Telecom sends the create connection complete callback.
+ Log.w(this, "notifyCreateConnectionComplete: callId is null.");
+ return;
+ }
onCreateConnectionComplete(findConnectionForAction(callId,
"notifyCreateConnectionComplete"));
}
@@ -2166,7 +2172,7 @@ public abstract class ConnectionService extends Service {
}
private Connection findConnectionForAction(String callId, String action) {
- if (mConnectionById.containsKey(callId)) {
+ if (callId != null && mConnectionById.containsKey(callId)) {
return mConnectionById.get(callId);
}
Log.w(this, "%s - Cannot find Connection %s", action, callId);