Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6cc24a5d authored by Arthur Ishiguro's avatar Arthur Ishiguro
Browse files

Implements PendingIntent based createClient API

Bug: 117612105
Test: Compile and flash, verify API user can regenerate a
      ContextHubClient
Change-Id: I9f2d4e1b4389e32b0828d494d74151ec56fa9d57
parent d3464c7c
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -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;
    }

    /**