diff options
| -rw-r--r-- | core/java/android/hardware/location/ContextHubManager.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/core/java/android/hardware/location/ContextHubManager.java b/core/java/android/hardware/location/ContextHubManager.java index 18e1b9fecb93..9acefa567ed6 100644 --- a/core/java/android/hardware/location/ContextHubManager.java +++ b/core/java/android/hardware/location/ContextHubManager.java @@ -818,8 +818,24 @@ public final class ContextHubManager { @NonNull PendingIntent pendingIntent, @NonNull ContextHubInfo hubInfo, @NonNull ContextHubClientCallback callback, @NonNull @CallbackExecutor Executor executor) { - // TODO: Implement this - throw new UnsupportedOperationException("Not implemented yet"); + Preconditions.checkNotNull(pendingIntent, "PendingIntent cannot be null"); + Preconditions.checkNotNull(callback, "Callback cannot be null"); + Preconditions.checkNotNull(hubInfo, "ContextHubInfo cannot be null"); + Preconditions.checkNotNull(executor, "Executor cannot be null"); + + ContextHubClient client = new ContextHubClient(hubInfo); + IContextHubClientCallback clientInterface = createClientCallback( + client, callback, executor); + + IContextHubClient clientProxy; + try { + clientProxy = mService.bindClient(pendingIntent, clientInterface, hubInfo.getId()); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + + client.setClientProxy(clientProxy); + return client; } /** |