From 8a66410296b481d2ddd5c7dc6819cf9368db9bbb Mon Sep 17 00:00:00 2001 From: Etan Cohen Date: Wed, 21 Sep 2016 11:53:24 -0700 Subject: [PATCH] [NAN] Reorder parameters of send message method(s) per API review Move messageId before message in the argument list. (cherry-pick of commit 3da7c88425d826e1a5e662f3d8671900e2ad15e5) Bug: 31470256 Test: unit tests & integration (sl4a) tests. Change-Id: I6bfd673a0f92d9908c5b837b713120927b1a0123 --- .../wifi/nan/WifiNanDiscoveryBaseSession.java | 18 +++++++++--------- .../android/net/wifi/nan/WifiNanManager.java | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java b/wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java index 50951f6d7e20b..a2ed497b06955 100644 --- a/wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java +++ b/wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java @@ -31,8 +31,8 @@ import java.lang.ref.WeakReference; * {@link WifiNanPublishDiscoverySession} and {@link WifiNanSubscribeDiscoverySession}. This * class provides functionality common to both publish and subscribe discovery sessions: * @@ -61,7 +61,7 @@ public class WifiNanDiscoveryBaseSession { /** * Return the maximum permitted retry count when sending messages using - * {@link #sendMessage(int, byte[], int, int)}. + * {@link #sendMessage(int, int, byte[], int)}. * * @return Maximum retry count when sending messages. */ @@ -153,17 +153,17 @@ public class WifiNanDiscoveryBaseSession { * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} * or * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])} events. - * @param message The message to be transmitted. * @param messageId An arbitrary integer used by the caller to identify the message. The same * integer ID will be returned in the callbacks indicating message send success or * failure. The {@code messageId} is not used internally by the NAN service - it * can be arbitrary and non-unique. + * @param message The message to be transmitted. * @param retryCount An integer specifying how many additional service-level (as opposed to PHY * or MAC level) retries should be attempted if there is no ACK from the receiver * (note: no retransmissions are attempted in other failure cases). A value of 0 * indicates no retries. Max permitted value is {@link #getMaxSendRetryCount()}. */ - public void sendMessage(int peerId, @Nullable byte[] message, int messageId, int retryCount) { + public void sendMessage(int peerId, int messageId, @Nullable byte[] message, int retryCount) { if (mTerminated) { Log.w(TAG, "sendMessage: called on terminated session"); return; @@ -191,21 +191,21 @@ public class WifiNanDiscoveryBaseSession { *

* The peer will get a callback indicating a message was received using * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])}. - * Equivalent to {@link #sendMessage(int, byte[], int, int)} with a {@code retryCount} of + * Equivalent to {@link #sendMessage(int, int, byte[], int)} with a {@code retryCount} of * 0. * * @param peerId The peer's ID for the message. Must be a result of an * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(int, byte[], byte[])} * or * {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])} events. - * @param message The message to be transmitted. * @param messageId An arbitrary integer used by the caller to identify the message. The same * integer ID will be returned in the callbacks indicating message send success or * failure. The {@code messageId} is not used internally by the NAN service - it * can be arbitrary and non-unique. + * @param message The message to be transmitted. */ - public void sendMessage(int peerId, @Nullable byte[] message, int messageId) { - sendMessage(peerId, message, messageId, 0); + public void sendMessage(int peerId, int messageId, @Nullable byte[] message) { + sendMessage(peerId, messageId, message, 0); } /** diff --git a/wifi/java/android/net/wifi/nan/WifiNanManager.java b/wifi/java/android/net/wifi/nan/WifiNanManager.java index 0fb604768c50a..722c01c3c5d0e 100644 --- a/wifi/java/android/net/wifi/nan/WifiNanManager.java +++ b/wifi/java/android/net/wifi/nan/WifiNanManager.java @@ -97,7 +97,7 @@ import java.util.Arrays; * the session {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)} and * {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}. Sessions can also * be used to send messages using the - * {@link WifiNanDiscoveryBaseSession#sendMessage(int, byte[], int)} APIs. When an application + * {@link WifiNanDiscoveryBaseSession#sendMessage(int, int, byte[])} APIs. When an application * is finished with a discovery session it must terminate it using the * {@link WifiNanDiscoveryBaseSession#destroy()} API. *