Fix getting CONTEXTHUB_SERVICE throws ServiceNotFoundException
The CONTEXTHUB_SERVICE may not be published if the
FEATURE_CONTEXT_HUB feature is not present. So getting the ContextHub
serivce with "context.getSystemService(ContextHubManager.class)"
will throw ServiceNotFoundException.
This commit fixes this issue by checking the CONTEXTHUB_SERVICE
before creating the ContextHubManager instance.
Test: verified with cuttlefish that it won't throw from NearbyService
Bug: 299388818
Change-Id: Icd51a0f88c10259f4a912f5dd82bad49b70562e3
2 files changed