summaryrefslogtreecommitdiff
path: root/telecomm/java/android/telecom/ConnectionService.java
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2020-04-17 14:03:35 -0700
committerTyler Gunn <tgunn@google.com>2020-04-17 15:46:29 -0700
commit815576c7d6cf4ea4a80f299a2a03b3f37b7e58ea (patch)
treed80a977f64893a648ea0da7ed8986863e5142a01 /telecomm/java/android/telecom/ConnectionService.java
parentd53e8618cc5be38e006f0949c1423ab572fddcf2 (diff)
Improve remote connection logging.
This CL improves traceability of calls initiated via a remote connection service. For regular incoming/outgoing calls, when initiating a request to create a remote connection in RemoteConnectionService, we set EXTRA_REQUESTING_PACKAGE_NAME in the parcelled request to the package name of the connection manager. In ConnectionService this serves as an indicator that the incoming request is via a connection manager and is used to trigger setting of EXTRA_REMOTE_PHONE_ACCOUNT_HANDLE with the phone account handle the remote connection service uses to place the call. For conferences and existing connections, the initial request is from the remote connection service to the connection manager so we can just set the EXTRA_REMOTE_PHONE_ACCOUNT handle there directly. Also cleaned up logging in the telecom session logging to remove the assumption that the ownerInfo is an incall service. Test: Manual testing with connection manager to verify logging. Fixes: 154353494 Change-Id: Iee1b5cfd3334a5de08d7b04022b7c6d5af6a4b04
Diffstat (limited to 'telecomm/java/android/telecom/ConnectionService.java')
-rwxr-xr-xtelecomm/java/android/telecom/ConnectionService.java44
1 files changed, 42 insertions, 2 deletions
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index 1b60e4820ad0..a716b37f7efd 100755
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -1859,9 +1859,25 @@ public abstract class ConnectionService extends Service {
new DisconnectCause(DisconnectCause.ERROR, "IMPL_RETURNED_NULL_CONFERENCE"),
request.getAccountHandle());
}
- if (conference.getExtras() != null) {
- conference.getExtras().putString(Connection.EXTRA_ORIGINAL_CONNECTION_ID, callId);
+
+ Bundle extras = request.getExtras();
+ Bundle newExtras = new Bundle();
+ newExtras.putString(Connection.EXTRA_ORIGINAL_CONNECTION_ID, callId);
+ if (extras != null) {
+ // If the request originated from a remote connection service, we will add some
+ // tracking information that Telecom can use to keep informed of which package
+ // made the remote request, and which remote connection service was used.
+ if (extras.containsKey(Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME)) {
+ newExtras.putString(
+ Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME,
+ extras.getString(
+ Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME));
+ newExtras.putParcelable(Connection.EXTRA_REMOTE_PHONE_ACCOUNT_HANDLE,
+ request.getAccountHandle());
+ }
}
+ conference.putExtras(newExtras);
+
mConferenceById.put(callId, conference);
mIdByConference.put(conference, callId);
conference.addListener(mConferenceListener);
@@ -1936,6 +1952,30 @@ public abstract class ConnectionService extends Service {
Log.i(this, "createConnection, implementation returned null connection.");
connection = Connection.createFailedConnection(
new DisconnectCause(DisconnectCause.ERROR, "IMPL_RETURNED_NULL_CONNECTION"));
+ } else {
+ try {
+ Bundle extras = request.getExtras();
+ if (extras != null) {
+ // If the request originated from a remote connection service, we will add some
+ // tracking information that Telecom can use to keep informed of which package
+ // made the remote request, and which remote connection service was used.
+ if (extras.containsKey(
+ Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME)) {
+ Bundle newExtras = new Bundle();
+ newExtras.putString(
+ Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME,
+ extras.getString(
+ Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME
+ ));
+ newExtras.putParcelable(Connection.EXTRA_REMOTE_PHONE_ACCOUNT_HANDLE,
+ request.getAccountHandle());
+ connection.putExtras(newExtras);
+ }
+ }
+ } catch (UnsupportedOperationException ose) {
+ // Do nothing; if the ConnectionService reported a failure it will be an instance
+ // of an immutable Connection which we cannot edit, so we're out of luck.
+ }
}
boolean isSelfManaged =