Merge "Add tests for NewOutgoingCallIntentBroadcaster"
diff --git a/src/com/android/server/telecom/Log.java b/src/com/android/server/telecom/Log.java
index 075f4bb..06a6243 100644
--- a/src/com/android/server/telecom/Log.java
+++ b/src/com/android/server/telecom/Log.java
@@ -305,6 +305,8 @@
}
}
+ public static final long DEFAULT_SESSION_TIMEOUT_MS = 30000L; // 30 seconds
+
@VisibleForTesting
public static void setTag(String tag) {
TAG = tag;
@@ -319,12 +321,16 @@
public interface ISessionCleanupTimeoutMs {
long get();
}
-
@VisibleForTesting
public static ISessionCleanupTimeoutMs sSessionCleanupTimeoutMs =
new ISessionCleanupTimeoutMs() {
@Override
public long get() {
+ // mContext will be null if Log is called from another process
+ // (UserCallActivity, for example). For these cases, use the default value.
+ if(mContext == null) {
+ return DEFAULT_SESSION_TIMEOUT_MS;
+ }
return Timeouts.getStaleSessionCleanupTimeoutMillis(
mContext.getContentResolver());
}
diff --git a/src/com/android/server/telecom/Timeouts.java b/src/com/android/server/telecom/Timeouts.java
index ba16990..cd1b9af 100644
--- a/src/com/android/server/telecom/Timeouts.java
+++ b/src/com/android/server/telecom/Timeouts.java
@@ -113,6 +113,7 @@
* perform a sweep to check and make sure that the session is still not incomplete (stale).
*/
public static long getStaleSessionCleanupTimeoutMillis(ContentResolver contentResolver) {
- return get(contentResolver, "stale_session_cleanup_timeout_millis", 30000L);
+ return get(contentResolver, "stale_session_cleanup_timeout_millis",
+ Log.DEFAULT_SESSION_TIMEOUT_MS);
}
}
diff --git a/tests/src/com/android/server/telecom/tests/LogTest.java b/tests/src/com/android/server/telecom/tests/LogTest.java
index 673582a..98f4237 100644
--- a/tests/src/com/android/server/telecom/tests/LogTest.java
+++ b/tests/src/com/android/server/telecom/tests/LogTest.java
@@ -200,7 +200,7 @@
// Set to the default value of Timeouts.getStaleSessionCleanupTimeoutMillis without
// needing to query.
public long get() {
- return 30000;
+ return Log.DEFAULT_SESSION_TIMEOUT_MS;
}
};
}