diff options
author | Tyler Gunn <tgunn@google.com> | 2020-05-04 15:01:59 -0700 |
---|---|---|
committer | Tyler Gunn <tgunn@google.com> | 2020-05-05 09:34:07 -0700 |
commit | ffbcd894530ccfa548df74178495a46a0058504e (patch) | |
tree | ea5c9d4f813ab0e8c232b01f22d873f4cb98784f /telecomm/java/android/telecom/Logging/Session.java | |
parent | 31d3998a0584300f78e4c709ceeaf81bfa8af70c (diff) |
Improve connection manager logging.
1. In ConnectionService, upping the incoming log level to info from
debug; this ensures we can better trace whether methods are actually
called.
2. Added the ability in the logging class to get a new external session
which supplies the owner info which will be passed in to the recipient of
the external session. This allows Telecom or a connection manager to
pass in a package abbreviation which will form the calling owner info
when the receiver continues the external session.
3. Add owner info to the Session.Info class so it can be passed about.
4. Ensure owner info is copied when getting Session.Info; subsessions were
not showing the owner info in the past; this corrects that.
5. When retrieving the external session info, creating a "package call
stack" with the owner info. This lets us see the hierarchy of where calls
originated.
Example: cad/cast/ccme
Shows that com.android.dialer send a message to com.android.server.telecom
which relayed a message to com.connection.manager.example.
6. Start sessions in RemoteConnection API methods and pass along external
session info. This bridges session tracing across a connection manager so
we can now trace a method call all the way from dialer, through telecom,
through the connection manager, and finally into telephony.
Test: Manual call testing with connection manager to verify log behavior.
Bug: 153899641
Change-Id: I4518a50550203818374b4e0b52eccb84ffd561dc
Diffstat (limited to 'telecomm/java/android/telecom/Logging/Session.java')
-rw-r--r-- | telecomm/java/android/telecom/Logging/Session.java | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/telecomm/java/android/telecom/Logging/Session.java b/telecomm/java/android/telecom/Logging/Session.java index 8d3f4e1df8bc..4aa3614fa004 100644 --- a/telecomm/java/android/telecom/Logging/Session.java +++ b/telecomm/java/android/telecom/Logging/Session.java @@ -17,6 +17,7 @@ package android.telecom.Logging; import android.annotation.NonNull; +import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; import android.telecom.Log; @@ -59,10 +60,12 @@ public class Session { public static class Info implements Parcelable { public final String sessionId; public final String methodPath; + public final String ownerInfo; - private Info(String id, String path) { + private Info(String id, String path, String owner) { sessionId = id; methodPath = path; + ownerInfo = owner; } public static Info getInfo (Session s) { @@ -70,7 +73,28 @@ public class Session { // not get multiple stacking external sessions (unless we have DEBUG level logging or // lower). return new Info(s.getFullSessionId(), s.getFullMethodPath( - !Log.DEBUG && s.isSessionExternal())); + !Log.DEBUG && s.isSessionExternal()), s.getOwnerInfo()); + } + + public static Info getExternalInfo(Session s, @Nullable String ownerInfo) { + // When creating session information for an existing session, the caller may pass in a + // context to be passed along to the recipient of the external session info. + // So, for example, if telecom has an active session with owner 'cad', and Telecom is + // calling into Telephony and providing external session info, it would pass in 'cast' + // as the owner info. This would result in Telephony seeing owner info 'cad/cast', + // which would make it very clear in the Telephony logs the chain of package calls which + // ultimately resulted in the logs. + String newInfo = ownerInfo != null && s.getOwnerInfo() != null + // If we've got both, concatenate them. + ? s.getOwnerInfo() + "/" + ownerInfo + // Otherwise use whichever is present. + : ownerInfo != null ? ownerInfo : s.getOwnerInfo(); + + // Create Info based on the truncated method path if the session is external, so we do + // not get multiple stacking external sessions (unless we have DEBUG level logging or + // lower). + return new Info(s.getFullSessionId(), s.getFullMethodPath( + !Log.DEBUG && s.isSessionExternal()), newInfo); } /** Responsible for creating Info objects for deserialized Parcels. */ @@ -80,7 +104,8 @@ public class Session { public Info createFromParcel(Parcel source) { String id = source.readString(); String methodName = source.readString(); - return new Info(id, methodName); + String ownerInfo = source.readString(); + return new Info(id, methodName, ownerInfo); } @Override @@ -100,6 +125,7 @@ public class Session { public void writeToParcel(Parcel destination, int flags) { destination.writeString(sessionId); destination.writeString(methodPath); + destination.writeString(ownerInfo); } } @@ -206,6 +232,14 @@ public class Session { return Info.getInfo(this); } + public Info getExternalInfo(@Nullable String ownerInfo) { + return Info.getExternalInfo(this, ownerInfo); + } + + public String getOwnerInfo() { + return mOwnerInfo; + } + @VisibleForTesting public String getSessionId() { return mSessionId; |