Add a couple of guards to make sure crash doesn't happen

This adds two guards, first checking when the provider
list is generated to stop and flag an warning, second
to have PackageMonitor use a handler so callbacks should
only happen on the thread that the fragment is running
on and if that is no longer available it won't do
anything.

Test: ondevice
Bug: 296164461
Change-Id: Iab03f8a10e667694e2e23da7574831f9ea5c38e2
1 file changed