Move process state into runtime
Clean up.
Bug: 27420435
(cherry picked from commit f8484c8b55f4b423048f94dfabbe44110a039a9b)
Change-Id: Ia20781ee36e6a31c88ca41d3866b26813cff434d
diff --git a/runtime/gc/collector/mark_sweep.cc b/runtime/gc/collector/mark_sweep.cc
index 6073fc8..894ceba 100644
--- a/runtime/gc/collector/mark_sweep.cc
+++ b/runtime/gc/collector/mark_sweep.cc
@@ -845,7 +845,9 @@
};
size_t MarkSweep::GetThreadCount(bool paused) const {
- if (heap_->GetThreadPool() == nullptr || !heap_->CareAboutPauseTimes()) {
+ // Use less threads if we are in a background state (non jank perceptible) since we want to leave
+ // more CPU time for the foreground apps.
+ if (heap_->GetThreadPool() == nullptr || !Runtime::Current()->InJankPerceptibleProcessState()) {
return 1;
}
return (paused ? heap_->GetParallelGCThreadCount() : heap_->GetConcGCThreadCount()) + 1;