Fix app compaction bug and add tests.
Fixing b/154317004
App Compaction has a heuristic that ensures the delta in memory between
two full compactions is high enough. The map that keeps track of previous
compactions is missing some entries.
There is a map that keeps entries with previously compacted processes.
When trying to compact again one of those processes, the old entry is
removed and a new one inserted. When a compaction was not made because
of additional conditions / heuristics, the entry is removed but no new
entry is inserted again - as no new compaction occurred. We need to make
sure old entries are kept if the current compaction is not successful and
if it is successful, the map order should reflect it was the most recent
insertion.
Test: atest CachedAppOptimizerTest
Bug: 154317004
Change-Id: I0d4a364928fee162289098c4d4ea0005781bccfd
2 files changed