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

Commit 793d3d18 authored by Arthur Ishiguro's avatar Arthur Ishiguro
Browse files

Reorders arguments in Context Hub Service methods

No functional change, just reordering things in internal methods to be
consistent with the API definition. Also fixes stale javadoc.

Bug: 117612105
Test: Compile only
Change-Id: I455d3d5c8f1d5077dbacfa96ad1c71da27559b8e
parent 992cd354
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -764,7 +764,7 @@ public final class ContextHubManager {

        IContextHubClient clientProxy;
        try {
            clientProxy = mService.createClient(clientInterface, hubInfo.getId());
            clientProxy = mService.createClient(hubInfo.getId(), clientInterface);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ interface IContextHubService {
    int sendMessage(int contextHubHandle, int nanoAppHandle, in ContextHubMessage msg);

    // Creates a client to send and receive messages
    IContextHubClient createClient(in IContextHubClientCallback client, int contextHubId);
    IContextHubClient createClient(int contextHubId, in IContextHubClientCallback client);

    // Creates a PendingIntent-based client to send and receive messages
    IContextHubClient createPendingIntentClient(
+2 −4
Original line number Diff line number Diff line
@@ -80,15 +80,15 @@ import java.util.function.Consumer;
    /**
     * Registers a new client with the service.
     *
     * @param clientCallback the callback interface of the client to register
     * @param contextHubInfo the object describing the hub this client is attached to
     * @param clientCallback the callback interface of the client to register
     *
     * @return the client interface
     *
     * @throws IllegalStateException if max number of clients have already registered
     */
    /* package */ IContextHubClient registerClient(
            IContextHubClientCallback clientCallback, ContextHubInfo contextHubInfo) {
            ContextHubInfo contextHubInfo, IContextHubClientCallback clientCallback) {
        ContextHubClientBroker broker;
        synchronized (this) {
            short hostEndPointId = getHostEndPointId();
@@ -120,8 +120,6 @@ import java.util.function.Consumer;
     *
     * @return the client interface
     *
     * @throws IllegalArgumentException the PendingIntent was already registered for a different
     *                                  ContextHubClient
     * @throws IllegalStateException    if there were too many registered clients at the service
     */
    /* package */ IContextHubClient registerClient(
+4 −4
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ public class ContextHubService extends IContextHubService.Stub {
        for (int contextHubId : mContextHubIdToInfoMap.keySet()) {
            ContextHubInfo contextHubInfo = mContextHubIdToInfoMap.get(contextHubId);
            IContextHubClient client = mClientManager.registerClient(
                    createDefaultClientCallback(contextHubId), contextHubInfo);
                    contextHubInfo, createDefaultClientCallback(contextHubId));
            defaultClientMap.put(contextHubId, client);

            try {
@@ -608,8 +608,8 @@ public class ContextHubService extends IContextHubService.Stub {
    /**
     * Creates and registers a client at the service for the specified Context Hub.
     *
     * @param clientCallback the client interface to register with the service
     * @param contextHubId   the ID of the hub this client is attached to
     * @param clientCallback the client interface to register with the service
     * @return the generated client interface, null if registration was unsuccessful
     *
     * @throws IllegalArgumentException if contextHubId is not a valid ID
@@ -618,7 +618,7 @@ public class ContextHubService extends IContextHubService.Stub {
     */
    @Override
    public IContextHubClient createClient(
            IContextHubClientCallback clientCallback, int contextHubId) throws RemoteException {
            int contextHubId, IContextHubClientCallback clientCallback) throws RemoteException {
        checkPermissions();
        if (!isValidContextHubId(contextHubId)) {
            throw new IllegalArgumentException("Invalid context hub ID " + contextHubId);
@@ -628,7 +628,7 @@ public class ContextHubService extends IContextHubService.Stub {
        }

        ContextHubInfo contextHubInfo = mContextHubIdToInfoMap.get(contextHubId);
        return mClientManager.registerClient(clientCallback, contextHubInfo);
        return mClientManager.registerClient(contextHubInfo, clientCallback);
    }

    /**