Reduce the flickering of injected items when package is changed

Root cause:
Settings listens to four package-related broadcasts in order to refresh
injected items because UI data may change. However, when the system is
updating apps on the first boot, it triggers a burst of broadcasts. For
each broadcast Settings will reload and then redraw all injected items,
which leads to the flickering.

Solution:
1. When Settings recieves a broadcast, check if there are already two
reloading tasks to avoid redundant updates.
2. In the reloading task, check if any injected item is changed, added,
or removed to notify categories changed.
3. Only refresh the UI when any of the changed items belongs to the
current page.

Bug: 166785977
Bug: 168309941
Test: manual, robotest
Change-Id: I77745b60f84510554bff1870a5bb7a8013eab528
Merged-In: I77745b60f84510554bff1870a5bb7a8013eab528
(cherry picked from commit 20df25e6b91fac0c10ce358210fbd37d7bdb754a)
3 files changed