Merge "logd: per UID less aggressive 12.5% threshold"
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp
index 83a6b1d..1dced11 100644
--- a/logd/LogBuffer.cpp
+++ b/logd/LogBuffer.cpp
@@ -365,9 +365,16 @@
if (sorted.get()) {
if (sorted[0] && sorted[1]) {
- worst = sorted[0]->getKey();
worst_sizes = sorted[0]->getSizes();
- second_worst_sizes = sorted[1]->getSizes();
+ // Calculate threshold as 12.5% of available storage
+ size_t threshold = log_buffer_size(id) / 8;
+ if (worst_sizes > threshold) {
+ worst = sorted[0]->getKey();
+ second_worst_sizes = sorted[1]->getSizes();
+ if (second_worst_sizes < threshold) {
+ second_worst_sizes = threshold;
+ }
+ }
}
}
}