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

Commit 4c9e8967 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Reorders arguments in Context Hub Service methods"

parents 76dd1954 793d3d18
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -764,7 +764,7 @@ public final class ContextHubManager {


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


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


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


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


    /**
    /**