Move process state into runtime
Clean up.
Bug: 27420435
(cherry picked from commit f8484c8b55f4b423048f94dfabbe44110a039a9b)
Change-Id: Ia20781ee36e6a31c88ca41d3866b26813cff434d
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 5284c93..daeb447 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -209,7 +209,9 @@
oat_file_manager_(nullptr),
is_low_memory_mode_(false),
safe_mode_(false),
- pruned_dalvik_cache_(false) {
+ pruned_dalvik_cache_(false),
+ // Initially assume we perceive jank in case the process state is never updated.
+ process_state_(kProcessStateJankPerceptible) {
CheckAsmSupportOffsetsAndSizes();
std::fill(callee_save_methods_, callee_save_methods_ + arraysize(callee_save_methods_), 0u);
interpreter::CheckInterpreterAsmConstants();
@@ -1955,4 +1957,10 @@
return is_low_memory_mode_ ? kLowMemoryMaxLoadFactor : kNormalMaxLoadFactor;
}
+void Runtime::UpdateProcessState(ProcessState process_state) {
+ ProcessState old_process_state = process_state_;
+ process_state_ = process_state;
+ GetHeap()->UpdateProcessState(old_process_state, process_state);
+}
+
} // namespace art