Build AppsFilter cache in background

This change attempts to update the apps filter cache in the background
and without holding the package manager lock. It makes a local copy of
the package settings and gets the hashcode of each setting's package
object. After building the cache, it checks that all of the packages are
the same as before the cache was built. If there was a change, the cache
is discarded and rebuilt while holding the package lock.

Before change:
MakePackageManagerServiceReady took to complete: ~30ms
MakeDisplayManagerServiceReady took to complete: ~180ms

After change:
MakePackageManagerServiceReady took to complete: ~110ms
MakeDisplayManagerServiceReady took to complete: ~1ms

Test: atest AppEnumerationTests
Fixes: 167169644
Fixes: 161214066
Bug: 161250592
Bug: 162347084

This reverts commit 6d90fa3d504b8bfc9e226f1431a1f0c2c18adc48.
Merged-In: I910d73f4d3b4cb1fe54d667752d40445b1c56906
Merged-In: Iafa85e838d7f753eaf74037c85f86ee1feeb17aa
Merged-In: Iac2948fb2ad66e45161627f637f039a5f4faf88c
Change-Id: I68a46b1a6463a6d76907d4b2c507d5de3d418891
2 files changed