ContextHubService: Keep handles across hub reboot
Previously, when a Context Hub rebooted, this service would reset
all of the "handles" used to identify the nanoapps on the Context
Hub. This caused many issues for Java application code trying to
track nanoapps, and these issues were exacerbated under nanohub,
which reboots every times it loads an app.
We change this so that we keep the same handle across reboot if
the same nanoapp is still running post-reboot. We accomplish
this by never "invalidating" our caches, but rather performing
a query post-reboot and removing stale entries.
Due to b/
30835598, we needed to change our post-load query to
be all apps. Without that change, a race between the two
query responses we would have post nanohub app load (one for
post-load, one for post-reboot) would leave us without knowing
which response we're dealing with. Now, since both requests
are the same, we don't care which response we deal with.
This is all (hopefully) just for the Nougat release. In the
O release, we hope to remove these caches (b/
30835981) and
the idea of the JNI code inventing handles (b/
30810861).
Bug:
30950975
Change-Id: I85a84ba5c1a039d69c1adaaea56609e0a38cce42