Fix heap trimmer daemon sleeping.

Problem:
Heap trimmer daemon sleeping caused app launch occasionally to take a
while due stopping the heap trimming thread taking a long time.

The heap trimmer thread now never sleeps, we prevent issues caused
by frequent back and forth process state changes by only
transitioning to background if it has been kCollectorTransitionWait
time since the last transition to background. Similar logic for heap
trimming.

(cherry picked from commit 698b44634396e8111e96e1116586fde89a838347)

Change-Id: I5b2894e92eb79351eec35078d49c8457d2fd67a8
2 files changed