summaryrefslogtreecommitdiff
path: root/telecomm/java/android/telecom/Logging/Session.java
diff options
context:
space:
mode:
authorBrad Ebinger <breadley@google.com>2019-11-13 14:12:22 -0800
committerBrad Ebinger <breadley@google.com>2019-11-13 16:51:16 -0800
commitc4044355ebf3727f14b99336dcafd0e8f5f18893 (patch)
treead8ab051ca02915dc1ca4fb1436a4f0a14657586 /telecomm/java/android/telecom/Logging/Session.java
parenta9ee3aaa5faa205662a2150d529349e5f83eca27 (diff)
Fix infinite recursion due to error log message
Bug: 144446106 Test: atest TelecomUnitTests:SessionTest Change-Id: I382f90ad6f91262b06ac8816ecf1ecabfa9f6bb6
Diffstat (limited to 'telecomm/java/android/telecom/Logging/Session.java')
-rw-r--r--telecomm/java/android/telecom/Logging/Session.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/telecomm/java/android/telecom/Logging/Session.java b/telecomm/java/android/telecom/Logging/Session.java
index 95a47e131272..d82e93fac76d 100644
--- a/telecomm/java/android/telecom/Logging/Session.java
+++ b/telecomm/java/android/telecom/Logging/Session.java
@@ -237,7 +237,10 @@ public class Session {
// keep track of calls and bail if we hit the recursion limit
private String getFullSessionId(int parentCount) {
if (parentCount >= SESSION_RECURSION_LIMIT) {
- Log.w(LOG_TAG, "getFullSessionId: Hit recursion limit!");
+ // Don't use Telecom's Log.w here or it will cause infinite recursion because it will
+ // try to add session information to this logging statement, which will cause it to hit
+ // this condition again and so on...
+ android.util.Slog.w(LOG_TAG, "getFullSessionId: Hit recursion limit!");
return TRUNCATE_STRING + mSessionId;
}
// Cache mParentSession locally to prevent a concurrency problem where
@@ -265,7 +268,11 @@ public class Session {
Session topNode = this;
while (topNode.getParentSession() != null) {
if (currParentCount >= SESSION_RECURSION_LIMIT) {
- Log.w(LOG_TAG, "getRootSession: Hit recursion limit from " + callingMethod);
+ // Don't use Telecom's Log.w here or it will cause infinite recursion because it
+ // will try to add session information to this logging statement, which will cause
+ // it to hit this condition again and so on...
+ android.util.Slog.w(LOG_TAG, "getRootSession: Hit recursion limit from "
+ + callingMethod);
break;
}
topNode = topNode.getParentSession();
@@ -289,7 +296,10 @@ public class Session {
private void printSessionTree(int tabI, StringBuilder sb, int currChildCount) {
// Prevent infinite recursion.
if (currChildCount >= SESSION_RECURSION_LIMIT) {
- Log.w(LOG_TAG, "printSessionTree: Hit recursion limit!");
+ // Don't use Telecom's Log.w here or it will cause infinite recursion because it will
+ // try to add session information to this logging statement, which will cause it to hit
+ // this condition again and so on...
+ android.util.Slog.w(LOG_TAG, "printSessionTree: Hit recursion limit!");
sb.append(TRUNCATE_STRING);
return;
}
@@ -315,7 +325,10 @@ public class Session {
private synchronized void getFullMethodPath(StringBuilder sb, boolean truncatePath,
int parentCount) {
if (parentCount >= SESSION_RECURSION_LIMIT) {
- Log.w(LOG_TAG, "getFullMethodPath: Hit recursion limit!");
+ // Don't use Telecom's Log.w here or it will cause infinite recursion because it will
+ // try to add session information to this logging statement, which will cause it to hit
+ // this condition again and so on...
+ android.util.Slog.w(LOG_TAG, "getFullMethodPath: Hit recursion limit!");
sb.append(TRUNCATE_STRING);
return;
}