Fix broken runtime SetStatsEnabled logic
Previously, Runtime::SetStatsEnabled wouldn't take stats_enabled_
into account when deciding whether or not to increment / decrement
teh stats enabled counter. This resulted in counter underflows and
other errors which caused some CTS tests to fail.
Also added some locking to prevent race conditions.
Bug: 17360878
Change-Id: I779237d55dda4f35054a4d27fb2c660a38750fc0
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 96924ec..4bf78a2 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -385,7 +385,8 @@
void ResetStats(int kinds);
- void SetStatsEnabled(bool new_state, bool suspended);
+ void SetStatsEnabled(bool new_state) LOCKS_EXCLUDED(Locks::instrument_entrypoints_lock_,
+ Locks::mutator_lock_);
enum class NativeBridgeAction { // private
kUnload,