Improve cleanup of file caches.

This rewrites installd's code for deleting cache files to be better:

- Isn't really stupid about just deleting directories in the order
  they are found on the filesytem; now collects all cache files and
  sorts them by mod time to determine which to delete.
- Also deletes cache files in /data/media and for all users.

This also tweaks DeviceStorageMonitor to be a little smarter about
deciding when to flush cache files, having upper and lower limits
that it allows memory to get down to and then flash files to reach
the higher free storage limit.  This should reduce the amount that
we perform flushing when starting to reach the storage limit.

Finally add a new pm command to force a cache flush.

Change-Id: I02229038e1ad553d1168393e5cb6d5025933271d
6 files changed