summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorDongwon Kang <dwkang@google.com>2015-04-29 06:04:43 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-29 06:04:43 +0000
commit13d43ff02a3ea7a942de4f3f69654f5e1a0e2d0a (patch)
treefb2f62e605131cc3c8df3f58558a6cd92ab8727d /media
parentd70088d8110163e712b7cdf15f665178aa7cd8b7 (diff)
parentd3fad391e1ccc79fbd0b9330f2aab60bf5b2075b (diff)
downloadframeworks_base-13d43ff02a3ea7a942de4f3f69654f5e1a0e2d0a.zip
frameworks_base-13d43ff02a3ea7a942de4f3f69654f5e1a0e2d0a.tar.gz
frameworks_base-13d43ff02a3ea7a942de4f3f69654f5e1a0e2d0a.tar.bz2
am d3fad391: am 633a45a0: am 25466e0a: Merge "TIF: throw an exception if an operation takes too long." into mnc-dev
* commit 'd3fad391e1ccc79fbd0b9330f2aab60bf5b2075b': TIF: throw an exception if an operation takes too long.
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/tv/ITvInputSessionWrapper.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/media/java/android/media/tv/ITvInputSessionWrapper.java b/media/java/android/media/tv/ITvInputSessionWrapper.java
index a3442e3..95aaa7f 100644
--- a/media/java/android/media/tv/ITvInputSessionWrapper.java
+++ b/media/java/android/media/tv/ITvInputSessionWrapper.java
@@ -41,8 +41,9 @@ import com.android.internal.os.SomeArgs;
public class ITvInputSessionWrapper extends ITvInputSession.Stub implements HandlerCaller.Callback {
private static final String TAG = "TvInputSessionWrapper";
- private static final int MESSAGE_HANDLING_DURATION_THRESHOLD_MILLIS = 50;
- private static final int MESSAGE_TUNE_DURATION_THRESHOLD_MILLIS = 2000;
+ private static final int EXECUTE_MESSAGE_TIMEOUT_SHORT_MILLIS = 50;
+ private static final int EXECUTE_MESSAGE_TUNE_TIMEOUT_MILLIS = 2000;
+ private static final int EXECUTE_MESSAGE_TIMEOUT_LONG_MILLIS = 5 * 1000;
private static final int DO_RELEASE = 1;
private static final int DO_SET_MAIN = 2;
@@ -184,14 +185,18 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
}
}
long duration = System.currentTimeMillis() - startTime;
- if (duration > MESSAGE_HANDLING_DURATION_THRESHOLD_MILLIS) {
+ if (duration > EXECUTE_MESSAGE_TIMEOUT_SHORT_MILLIS) {
Log.w(TAG, "Handling message (" + msg.what + ") took too long time (duration="
+ duration + "ms)");
- if (msg.what == DO_TUNE && duration > MESSAGE_TUNE_DURATION_THRESHOLD_MILLIS) {
+ if (msg.what == DO_TUNE && duration > EXECUTE_MESSAGE_TUNE_TIMEOUT_MILLIS) {
throw new RuntimeException("Too much time to handle tune request. (" + duration
- + "ms > " + MESSAGE_TUNE_DURATION_THRESHOLD_MILLIS + "ms) "
+ + "ms > " + EXECUTE_MESSAGE_TUNE_TIMEOUT_MILLIS + "ms) "
+ "Consider handling the tune request in a separate thread.");
}
+ if (duration > EXECUTE_MESSAGE_TIMEOUT_LONG_MILLIS) {
+ throw new RuntimeException("Too much time to handle a request. (type=" + msg.what +
+ ", " + duration + "ms > " + EXECUTE_MESSAGE_TIMEOUT_LONG_MILLIS + "ms).");
+ }
}
}