summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Marcin Oczeretko <marcinoc@google.com> 2018-10-02 15:35:44 +0100
committer Marcin Oczeretko <marcinoc@google.com> 2018-10-02 15:38:13 +0100
commit37d41091bf858c36bfce80100bccf915fcac1c94 (patch)
treee1f7865f04828c065379680cd6efdb38a0cf9655
parent52ac7e2d211c056fa7202ea81246a6f975d64df4 (diff)
Make LooperStatsService ignore invalid sampling interval
System Server crashes with ArithmeticException if sampling interval is set to 0. Test: Manual Bug: 113651685 Change-Id: I632c56fc0cddbf426bb8369269cd4990ceee6e58
-rw-r--r--services/core/java/com/android/server/LooperStatsService.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/LooperStatsService.java b/services/core/java/com/android/server/LooperStatsService.java
index 4f0e17055769..96ce6a4ee6a4 100644
--- a/services/core/java/com/android/server/LooperStatsService.java
+++ b/services/core/java/com/android/server/LooperStatsService.java
@@ -129,7 +129,12 @@ public class LooperStatsService extends Binder {
}
private void setSamplingInterval(int samplingInterval) {
- mStats.setSamplingInterval(samplingInterval);
+ if (samplingInterval > 0) {
+ mStats.setSamplingInterval(samplingInterval);
+ } else {
+ Slog.w(TAG, "Ignored invalid sampling interval (value must be positive): "
+ + samplingInterval);
+ }
}
/**