[NAN] Remove failure reason codes from API per API review [DO NOT MERGE]
Not all codes are actionable. Will add back if/as needed. Bug: 31470256 Test: unit tests & integration (sl4a) tests. Change-Id: Ia64d978a1e8e8ca62b53643376871ba5979798b8
This commit is contained in:
@@ -16,11 +16,6 @@
|
||||
|
||||
package android.net.wifi.nan;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Base class for NAN attach callbacks. Should be extended by applications and set when calling
|
||||
* {@link WifiNanManager#attach(android.os.Handler, WifiNanAttachCallback)}. These are callbacks
|
||||
@@ -30,34 +25,6 @@ import java.lang.annotation.RetentionPolicy;
|
||||
* @hide PROPOSED_NAN_API
|
||||
*/
|
||||
public class WifiNanAttachCallback {
|
||||
/** @hide */
|
||||
@IntDef({
|
||||
REASON_INVALID_ARGS, REASON_ALREADY_CONNECTED_INCOMPAT_CONFIG, REASON_OTHER
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface EventReasonCodes {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates invalid argument in the requested operation. Failure reason flag for
|
||||
* {@link WifiNanAttachCallback#onAttachFailed(int)}.
|
||||
*/
|
||||
public static final int REASON_INVALID_ARGS = 1000;
|
||||
|
||||
/**
|
||||
* Indicates that a {@link ConfigRequest} passed in
|
||||
* {@code WifiNanManager#attach(android.os.Handler, ConfigRequest, WifiNanAttachCallback)}
|
||||
* couldn't be applied since other connections already exist with an incompatible
|
||||
* configurations. Failure reason flag for {@link WifiNanAttachCallback#onAttachFailed(int)}.
|
||||
*/
|
||||
public static final int REASON_ALREADY_CONNECTED_INCOMPAT_CONFIG = 1001;
|
||||
|
||||
/**
|
||||
* Indicates an unspecified error occurred during the operation. Failure reason flag for
|
||||
* {@link WifiNanAttachCallback#onAttachFailed(int)}.
|
||||
*/
|
||||
public static final int REASON_OTHER = 1002;
|
||||
|
||||
/**
|
||||
* Called when NAN attach operation
|
||||
* {@link WifiNanManager#attach(android.os.Handler, WifiNanAttachCallback)}
|
||||
@@ -73,11 +40,8 @@ public class WifiNanAttachCallback {
|
||||
/**
|
||||
* Called when NAN attach operation
|
||||
* {@link WifiNanManager#attach(android.os.Handler, WifiNanAttachCallback)} failed.
|
||||
*
|
||||
* @param reason Failure reason code, see
|
||||
* {@code WifiNanEventCallback.REASON_*}.
|
||||
*/
|
||||
public void onAttachFailed(@EventReasonCodes int reason) {
|
||||
public void onAttachFailed() {
|
||||
/* empty */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public class WifiNanDiscoveryBaseSession {
|
||||
* {@link WifiNanDiscoverySessionCallback} indicate message was transmitted successfully,
|
||||
* {@link WifiNanDiscoverySessionCallback#onMessageSent(int)}, or transmission failed
|
||||
* (possibly after several retries) -
|
||||
* {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int, int)}.
|
||||
* {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int)}.
|
||||
* <p>
|
||||
* The peer will get a callback indicating a message was received using
|
||||
* {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])}.
|
||||
@@ -187,7 +187,7 @@ public class WifiNanDiscoveryBaseSession {
|
||||
* {@link WifiNanDiscoverySessionCallback} indicate message was transmitted successfully,
|
||||
* {@link WifiNanDiscoverySessionCallback#onMessageSent(int)}, or transmission failed
|
||||
* (possibly after several retries) -
|
||||
* {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int, int)}.
|
||||
* {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int)}.
|
||||
* <p>
|
||||
* The peer will get a callback indicating a message was received using
|
||||
* {@link WifiNanDiscoverySessionCallback#onMessageReceived(int, byte[])}.
|
||||
|
||||
@@ -26,22 +26,15 @@ import java.lang.annotation.RetentionPolicy;
|
||||
* Base class for NAN session events callbacks. Should be extended by
|
||||
* applications wanting notifications. The callbacks are set when a
|
||||
* publish or subscribe session is created using
|
||||
* {@link WifiNanSession#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or
|
||||
* {@link WifiNanSession#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} .
|
||||
* {@link WifiNanSession#publish(android.os.Handler, PublishConfig, WifiNanDiscoverySessionCallback)}
|
||||
* or
|
||||
* {@link WifiNanSession#subscribe(android.os.Handler, SubscribeConfig, WifiNanDiscoverySessionCallback)} .
|
||||
* <p>
|
||||
* A single callback is set at session creation - it cannot be replaced.
|
||||
*
|
||||
* @hide PROPOSED_NAN_API
|
||||
*/
|
||||
public class WifiNanDiscoverySessionCallback {
|
||||
/** @hide */
|
||||
@IntDef({
|
||||
REASON_NO_RESOURCES, REASON_INVALID_ARGS, REASON_NO_MATCH_SESSION,
|
||||
REASON_TX_FAIL, REASON_OTHER })
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface SessionReasonCodes {
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@IntDef({
|
||||
TERMINATE_REASON_DONE, TERMINATE_REASON_FAIL })
|
||||
@@ -49,39 +42,6 @@ public class WifiNanDiscoverySessionCallback {
|
||||
public @interface SessionTerminateCodes {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates no resources to execute the requested operation.
|
||||
* Failure reason flag for {@link WifiNanDiscoverySessionCallback} callbacks.
|
||||
*/
|
||||
public static final int REASON_NO_RESOURCES = 0;
|
||||
|
||||
/**
|
||||
* Indicates invalid argument in the requested operation.
|
||||
* Failure reason flag for {@link WifiNanDiscoverySessionCallback} callbacks.
|
||||
*/
|
||||
public static final int REASON_INVALID_ARGS = 1;
|
||||
|
||||
/**
|
||||
* Indicates a message is transmitted without a match (a discovery) or received message
|
||||
* from peer occurring first.
|
||||
* Failure reason flag for {@link WifiNanDiscoverySessionCallback} callbacks.
|
||||
*/
|
||||
public static final int REASON_NO_MATCH_SESSION = 2;
|
||||
|
||||
/**
|
||||
* Indicates transmission failure: this may be due to local transmission
|
||||
* failure or to no ACK received - remote device didn't receive the
|
||||
* sent message. Failure reason flag for
|
||||
* {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int, int)} callback.
|
||||
*/
|
||||
public static final int REASON_TX_FAIL = 3;
|
||||
|
||||
/**
|
||||
* Indicates an unspecified error occurred during the operation.
|
||||
* Failure reason flag for {@link WifiNanDiscoverySessionCallback} callbacks.
|
||||
*/
|
||||
public static final int REASON_OTHER = 4;
|
||||
|
||||
/**
|
||||
* Indicates that publish or subscribe session is done - all the
|
||||
* requested operations (per {@link PublishConfig} or
|
||||
@@ -100,7 +60,8 @@ public class WifiNanDiscoverySessionCallback {
|
||||
|
||||
/**
|
||||
* Called when a publish operation is started successfully in response to a
|
||||
* {@link WifiNanSession#publish(PublishConfig, WifiNanDiscoverySessionCallback)} operation.
|
||||
* {@link WifiNanSession#publish(android.os.Handler, PublishConfig, WifiNanDiscoverySessionCallback)}
|
||||
* operation.
|
||||
*
|
||||
* @param session The {@link WifiNanPublishDiscoverySession} used to control the
|
||||
* discovery session.
|
||||
@@ -111,7 +72,8 @@ public class WifiNanDiscoverySessionCallback {
|
||||
|
||||
/**
|
||||
* Called when a subscribe operation is started successfully in response to a
|
||||
* {@link WifiNanSession#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} operation.
|
||||
* {@link WifiNanSession#subscribe(android.os.Handler, SubscribeConfig, WifiNanDiscoverySessionCallback)}
|
||||
* operation.
|
||||
*
|
||||
* @param session The {@link WifiNanSubscribeDiscoverySession} used to control the
|
||||
* discovery session.
|
||||
@@ -132,19 +94,17 @@ public class WifiNanDiscoverySessionCallback {
|
||||
|
||||
/**
|
||||
* Called when a publish or subscribe discovery session cannot be created:
|
||||
* {@link WifiNanSession#publish(PublishConfig, WifiNanDiscoverySessionCallback)} or
|
||||
* {@link WifiNanSession#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)},
|
||||
* {@link WifiNanSession#publish(android.os.Handler, PublishConfig, WifiNanDiscoverySessionCallback)}
|
||||
* or
|
||||
* {@link WifiNanSession#subscribe(android.os.Handler, SubscribeConfig, WifiNanDiscoverySessionCallback)},
|
||||
* or when a configuration update fails:
|
||||
* {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)} or
|
||||
* {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}.
|
||||
* <p>
|
||||
* For discovery session updates failure leaves the session running with its previous
|
||||
* configuration - the discovery session is not terminated.
|
||||
*
|
||||
* @param reason The failure reason using
|
||||
* {@code WifiNanDiscoverySessionCallback.REASON_*} codes.
|
||||
*/
|
||||
public void onSessionConfigFailed(@SessionReasonCodes int reason) {
|
||||
public void onSessionConfigFailed() {
|
||||
/* empty */
|
||||
}
|
||||
|
||||
@@ -177,12 +137,12 @@ public class WifiNanDiscoverySessionCallback {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called in response to {@link WifiNanDiscoveryBaseSession#sendMessage(int, byte[], int)}
|
||||
* Called in response to {@link WifiNanDiscoveryBaseSession#sendMessage(int, int, byte[])}
|
||||
* when a message is transmitted successfully - i.e. when it was received successfully by the
|
||||
* peer (corresponds to an ACK being received).
|
||||
* <p>
|
||||
* Note that either this callback or
|
||||
* {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int, int)} will be
|
||||
* {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int)} will be
|
||||
* received - never both.
|
||||
*
|
||||
* @param messageId The arbitrary message ID specified when sending the message.
|
||||
@@ -194,7 +154,7 @@ public class WifiNanDiscoverySessionCallback {
|
||||
/**
|
||||
* Called when message transmission fails - when no ACK is received from the peer.
|
||||
* Retries when ACKs are not received are done by hardware, MAC, and in the NAN stack (using
|
||||
* the {@link WifiNanDiscoveryBaseSession#sendMessage(int, byte[], int, int)} method) - this
|
||||
* the {@link WifiNanDiscoveryBaseSession#sendMessage(int, int, byte[], int)} method) - this
|
||||
* event is received after all retries are exhausted.
|
||||
* <p>
|
||||
* Note that either this callback or
|
||||
@@ -202,18 +162,15 @@ public class WifiNanDiscoverySessionCallback {
|
||||
* - never both.
|
||||
*
|
||||
* @param messageId The arbitrary message ID specified when sending the message.
|
||||
* @param reason The failure reason using
|
||||
* {@code WifiNanDiscoverySessionCallback.REASON_*} codes.
|
||||
*/
|
||||
public void onMessageSendFailed(@SuppressWarnings("unused") int messageId,
|
||||
@SessionReasonCodes int reason) {
|
||||
public void onMessageSendFailed(@SuppressWarnings("unused") int messageId) {
|
||||
/* empty */
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a message is received from a discovery session peer - in response to the
|
||||
* peer's {@link WifiNanDiscoveryBaseSession#sendMessage(int, byte[], int)} or
|
||||
* {@link WifiNanDiscoveryBaseSession#sendMessage(int, byte[], int, int)}.
|
||||
* peer's {@link WifiNanDiscoveryBaseSession#sendMessage(int, int, byte[])} or
|
||||
* {@link WifiNanDiscoveryBaseSession#sendMessage(int, int, byte[], int)}.
|
||||
*
|
||||
* @param peerId The ID of the peer sending the message.
|
||||
* @param message A byte array containing the message.
|
||||
|
||||
@@ -702,7 +702,7 @@ public class WifiNanManager {
|
||||
break;
|
||||
case CALLBACK_CONNECT_FAIL:
|
||||
mNanManager.clear();
|
||||
attachCallback.onAttachFailed(msg.arg1);
|
||||
attachCallback.onAttachFailed();
|
||||
break;
|
||||
case CALLBACK_IDENTITY_CHANGED:
|
||||
identityChangedListener.onIdentityChanged((byte[]) msg.obj);
|
||||
@@ -859,7 +859,7 @@ public class WifiNanManager {
|
||||
mOriginalCallback.onSessionConfigUpdated();
|
||||
break;
|
||||
case CALLBACK_SESSION_CONFIG_FAIL:
|
||||
mOriginalCallback.onSessionConfigFailed(msg.arg1);
|
||||
mOriginalCallback.onSessionConfigFailed();
|
||||
if (mSession == null) {
|
||||
/*
|
||||
* creation failed (as opposed to update
|
||||
@@ -881,7 +881,7 @@ public class WifiNanManager {
|
||||
mOriginalCallback.onMessageSent(msg.arg1);
|
||||
break;
|
||||
case CALLBACK_MESSAGE_SEND_FAIL:
|
||||
mOriginalCallback.onMessageSendFailed(msg.arg1, msg.arg2);
|
||||
mOriginalCallback.onMessageSendFailed(msg.arg1);
|
||||
break;
|
||||
case CALLBACK_MESSAGE_RECEIVED:
|
||||
mOriginalCallback.onMessageReceived(msg.arg1, (byte[]) msg.obj);
|
||||
|
||||
@@ -21,8 +21,8 @@ import android.util.Log;
|
||||
|
||||
/**
|
||||
* A class representing a NAN publish session. Created when
|
||||
* {@link WifiNanSession#publish(PublishConfig, WifiNanDiscoverySessionCallback)} is called and a
|
||||
* discovery session is created and returned in
|
||||
* {@link WifiNanSession#publish(android.os.Handler, PublishConfig, WifiNanDiscoverySessionCallback)}
|
||||
* is called and a discovery session is created and returned in
|
||||
* {@link WifiNanDiscoverySessionCallback#onPublishStarted(WifiNanPublishDiscoverySession)}. See
|
||||
* baseline functionality of all discovery sessions in {@link WifiNanDiscoveryBaseSession}. This
|
||||
* object allows updating an existing/running publish discovery session using
|
||||
@@ -46,7 +46,7 @@ public class WifiNanPublishDiscoverySession extends WifiNanDiscoveryBaseSession
|
||||
* <ul>
|
||||
* <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigUpdated()}: configuration
|
||||
* update succeeded.
|
||||
* <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigFailed(int)}: configuration
|
||||
* <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigFailed()}: configuration
|
||||
* update failed. The publish discovery session is still running using its previous
|
||||
* configuration (i.e. update failure does not terminate the session).
|
||||
* </ul>
|
||||
|
||||
@@ -101,7 +101,7 @@ public class WifiNanSession {
|
||||
* <li>{@link WifiNanDiscoverySessionCallback#onPublishStarted(WifiNanPublishDiscoverySession)}
|
||||
* is called when the publish session is created and provides a handle to the session.
|
||||
* Further operations on the publish session can be executed on that object.
|
||||
* <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigFailed(int)} is called if the
|
||||
* <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigFailed()} is called if the
|
||||
* publish operation failed.
|
||||
* </ul>
|
||||
* <p>
|
||||
@@ -143,7 +143,7 @@ public class WifiNanSession {
|
||||
* <li>{@link WifiNanDiscoverySessionCallback#onSubscribeStarted(WifiNanSubscribeDiscoverySession)}
|
||||
* is called when the subscribe session is created and provides a handle to the session.
|
||||
* Further operations on the subscribe session can be executed on that object.
|
||||
* <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigFailed(int)} is called if the
|
||||
* <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigFailed()} is called if the
|
||||
* subscribe operation failed.
|
||||
* </ul>
|
||||
* <p>
|
||||
|
||||
@@ -21,8 +21,8 @@ import android.util.Log;
|
||||
|
||||
/**
|
||||
* A class representing a NAN subscribe session. Created when
|
||||
* {@link WifiNanSession#subscribe(SubscribeConfig, WifiNanDiscoverySessionCallback)} is called
|
||||
* and a discovery session is created and returned in
|
||||
* {@link WifiNanSession#subscribe(android.os.Handler, SubscribeConfig, WifiNanDiscoverySessionCallback)}
|
||||
* is called and a discovery session is created and returned in
|
||||
* {@link WifiNanDiscoverySessionCallback#onSubscribeStarted(WifiNanSubscribeDiscoverySession)}.
|
||||
* See baseline functionality of all discovery sessions in {@link WifiNanDiscoveryBaseSession}.
|
||||
* This object allows updating an existing/running subscribe discovery session using
|
||||
@@ -48,7 +48,7 @@ public class WifiNanSubscribeDiscoverySession extends WifiNanDiscoveryBaseSessio
|
||||
* <ul>
|
||||
* <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigUpdated()}: configuration
|
||||
* update succeeded.
|
||||
* <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigFailed(int)}: configuration
|
||||
* <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigFailed()}: configuration
|
||||
* update failed. The subscribe discovery session is still running using its previous
|
||||
* configuration (i.e. update failure does not terminate the session).
|
||||
* </ul>
|
||||
|
||||
Reference in New Issue
Block a user