diff options
| author | 2024-11-18 07:15:25 +0000 | |
|---|---|---|
| committer | 2024-11-18 07:51:47 +0000 | |
| commit | 175884b684156498b3942ac6fb0a43b795d5e9a9 (patch) | |
| tree | bc182d33fd2e386bbb21c7af5cd4ab3952a8ef5b | |
| parent | e35d8a93c86950d913dd32684f3aca44bd9edefa (diff) | |
contexthub: Handle unsupported APIs
Bug: b/378545373
Flag: android.chre.flags.offload_api
Test: presubmit
Change-Id: Ica5e7e1e0aa162b1408a6c860c5856db43519e7a
| -rw-r--r-- | services/core/java/com/android/server/location/contexthub/ContextHubService.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/location/contexthub/ContextHubService.java b/services/core/java/com/android/server/location/contexthub/ContextHubService.java index f611c57dab03..8763073ad644 100644 --- a/services/core/java/com/android/server/location/contexthub/ContextHubService.java +++ b/services/core/java/com/android/server/location/contexthub/ContextHubService.java @@ -322,8 +322,15 @@ public class ContextHubService extends IContextHubService.Stub { } if (Flags.offloadApi()) { - mHubInfoRegistry = new HubInfoRegistry(mContextHubWrapper); - Log.i(TAG, "Enabling generic offload API"); + HubInfoRegistry registry; + try { + registry = new HubInfoRegistry(mContextHubWrapper); + Log.i(TAG, "Enabling generic offload API"); + } catch (UnsupportedOperationException e) { + registry = null; + Log.w(TAG, "Generic offload API not supported, disabling"); + } + mHubInfoRegistry = registry; } else { mHubInfoRegistry = null; Log.i(TAG, "Disabling generic offload API"); |