[NAN] Renamed listeners to callback per API guidelines
The interfaces had multiple functions and are hence callback
and not a listener.
Note: purely a rename operation.
(cherry-pick of 0d0f0c7faf530a0fa5595dd539c3f56afeb6603a,
Change-Id: Ib12711f56a64052455843859125d72268c465fc0)
Bug: 27122760
Change-Id: Ie1905a5d907e5b09d449af52814b1aacb6426477
diff --git a/Android.mk b/Android.mk
index c5ed6fa..c6c1112 100644
--- a/Android.mk
+++ b/Android.mk
@@ -427,9 +427,9 @@
telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl \
telephony/java/com/android/internal/telephony/IWapPushManager.aidl \
wifi/java/android/net/wifi/IWifiManager.aidl \
- wifi/java/android/net/wifi/nan/IWifiNanEventListener.aidl \
+ wifi/java/android/net/wifi/nan/IWifiNanEventCallback.aidl \
wifi/java/android/net/wifi/nan/IWifiNanManager.aidl \
- wifi/java/android/net/wifi/nan/IWifiNanSessionListener.aidl \
+ wifi/java/android/net/wifi/nan/IWifiNanSessionCallback.aidl \
wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl \
wifi/java/android/net/wifi/IWifiScanner.aidl \
wifi/java/android/net/wifi/IRttManager.aidl \
diff --git a/wifi/java/android/net/wifi/nan/IWifiNanEventListener.aidl b/wifi/java/android/net/wifi/nan/IWifiNanEventCallback.aidl
similarity index 95%
rename from wifi/java/android/net/wifi/nan/IWifiNanEventListener.aidl
rename to wifi/java/android/net/wifi/nan/IWifiNanEventCallback.aidl
index fa666af..c4ba928 100644
--- a/wifi/java/android/net/wifi/nan/IWifiNanEventListener.aidl
+++ b/wifi/java/android/net/wifi/nan/IWifiNanEventCallback.aidl
@@ -23,7 +23,7 @@
*
* {@hide}
*/
-oneway interface IWifiNanEventListener
+oneway interface IWifiNanEventCallback
{
void onConfigCompleted(in ConfigRequest completedConfig);
void onConfigFailed(in ConfigRequest failedConfig, int reason);
diff --git a/wifi/java/android/net/wifi/nan/IWifiNanManager.aidl b/wifi/java/android/net/wifi/nan/IWifiNanManager.aidl
index 911d13c..d1cf90d 100644
--- a/wifi/java/android/net/wifi/nan/IWifiNanManager.aidl
+++ b/wifi/java/android/net/wifi/nan/IWifiNanManager.aidl
@@ -19,8 +19,8 @@
import android.app.PendingIntent;
import android.net.wifi.nan.ConfigRequest;
-import android.net.wifi.nan.IWifiNanEventListener;
-import android.net.wifi.nan.IWifiNanSessionListener;
+import android.net.wifi.nan.IWifiNanEventCallback;
+import android.net.wifi.nan.IWifiNanSessionCallback;
import android.net.wifi.nan.PublishConfig;
import android.net.wifi.nan.SubscribeConfig;
@@ -32,12 +32,12 @@
interface IWifiNanManager
{
// client API
- int connect(in IBinder binder, in IWifiNanEventListener listener, int events);
+ int connect(in IBinder binder, in IWifiNanEventCallback callback, int events);
void disconnect(int clientId, in IBinder binder);
void requestConfig(int clientId, in ConfigRequest configRequest);
// session API
- int createSession(int clientId, in IWifiNanSessionListener listener, int events);
+ int createSession(int clientId, in IWifiNanSessionCallback callback, int events);
void publish(int clientId, int sessionId, in PublishConfig publishConfig);
void subscribe(int clientId, int sessionId, in SubscribeConfig subscribeConfig);
void sendMessage(int clientId, int sessionId, int peerId, in byte[] message, int messageLength,
diff --git a/wifi/java/android/net/wifi/nan/IWifiNanSessionListener.aidl b/wifi/java/android/net/wifi/nan/IWifiNanSessionCallback.aidl
similarity index 96%
rename from wifi/java/android/net/wifi/nan/IWifiNanSessionListener.aidl
rename to wifi/java/android/net/wifi/nan/IWifiNanSessionCallback.aidl
index d60d8ca..c79f2f8 100644
--- a/wifi/java/android/net/wifi/nan/IWifiNanSessionListener.aidl
+++ b/wifi/java/android/net/wifi/nan/IWifiNanSessionCallback.aidl
@@ -21,7 +21,7 @@
*
* {@hide}
*/
-oneway interface IWifiNanSessionListener
+oneway interface IWifiNanSessionCallback
{
void onPublishFail(int reason);
void onPublishTerminated(int reason);
diff --git a/wifi/java/android/net/wifi/nan/WifiNanEventListener.java b/wifi/java/android/net/wifi/nan/WifiNanEventCallback.java
similarity index 77%
rename from wifi/java/android/net/wifi/nan/WifiNanEventListener.java
rename to wifi/java/android/net/wifi/nan/WifiNanEventCallback.java
index 9e6ed4e..0929402 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanEventListener.java
+++ b/wifi/java/android/net/wifi/nan/WifiNanEventCallback.java
@@ -25,36 +25,37 @@
* Base class for NAN events callbacks. Should be extended by applications
* wanting notifications. These are callbacks applying to the NAN connection as
* a whole - not to specific publish or subscribe sessions - for that see
- * {@link WifiNanSessionListener}.
+ * {@link WifiNanSessionCallback}.
* <p>
* During registration specify which specific events are desired using a set of
- * {@code NanEventListener.LISTEN_*} flags OR'd together. Only those events will
- * be delivered to the registered listener. Override those callbacks
- * {@code NanEventListener.on*} for the registered events.
+ * {@code NanEventCallback.LISTEN_*} flags OR'd together. Only those events will
+ * be delivered to the registered callback. Override those callbacks
+ * {@code WifiNanEventCallback.on*} for the registered events.
*
* @hide PROPOSED_NAN_API
*/
-public class WifiNanEventListener {
- private static final String TAG = "WifiNanEventListener";
+public class WifiNanEventCallback {
+ private static final String TAG = "WifiNanEventCallback";
private static final boolean DBG = false;
private static final boolean VDBG = false; // STOPSHIP if true
/**
* Configuration completion callback event registration flag. Corresponding
- * callback is {@link WifiNanEventListener#onConfigCompleted(ConfigRequest)}.
+ * callback is {@link WifiNanEventCallback#onConfigCompleted(ConfigRequest)}
+ * .
*/
public static final int LISTEN_CONFIG_COMPLETED = 0x1 << 0;
/**
* Configuration failed callback event registration flag. Corresponding
* callback is
- * {@link WifiNanEventListener#onConfigFailed(ConfigRequest, int)}.
+ * {@link WifiNanEventCallback#onConfigFailed(ConfigRequest, int)}.
*/
public static final int LISTEN_CONFIG_FAILED = 0x1 << 1;
/**
* NAN cluster is down callback event registration flag. Corresponding
- * callback is {@link WifiNanEventListener#onNanDown(int)}.
+ * callback is {@link WifiNanEventCallback#onNanDown(int)}.
*/
public static final int LISTEN_NAN_DOWN = 0x1 << 2;
@@ -63,27 +64,27 @@
* joining a cluster, starting a cluster, or discovery interface change. The
* implication is that peers you've been communicating with may no longer
* recognize you and you need to re-establish your identity. Corresponding
- * callback is {@link WifiNanEventListener#onIdentityChanged()}.
+ * callback is {@link WifiNanEventCallback#onIdentityChanged()}.
*/
public static final int LISTEN_IDENTITY_CHANGED = 0x1 << 3;
private final Handler mHandler;
/**
- * Constructs a {@link WifiNanEventListener} using the looper of the current
+ * Constructs a {@link WifiNanEventCallback} using the looper of the current
* thread. I.e. all callbacks will be delivered on the current thread.
*/
- public WifiNanEventListener() {
+ public WifiNanEventCallback() {
this(Looper.myLooper());
}
/**
- * Constructs a {@link WifiNanEventListener} using the specified looper. I.e.
- * all callbacks will delivered on the thread of the specified looper.
+ * Constructs a {@link WifiNanEventCallback} using the specified looper.
+ * I.e. all callbacks will delivered on the thread of the specified looper.
*
* @param looper The looper on which to execute the callbacks.
*/
- public WifiNanEventListener(Looper looper) {
+ public WifiNanEventCallback(Looper looper) {
if (VDBG) Log.v(TAG, "ctor: looper=" + looper);
mHandler = new Handler(looper) {
@Override
@@ -91,16 +92,16 @@
if (DBG) Log.d(TAG, "What=" + msg.what + ", msg=" + msg);
switch (msg.what) {
case LISTEN_CONFIG_COMPLETED:
- WifiNanEventListener.this.onConfigCompleted((ConfigRequest) msg.obj);
+ WifiNanEventCallback.this.onConfigCompleted((ConfigRequest) msg.obj);
break;
case LISTEN_CONFIG_FAILED:
- WifiNanEventListener.this.onConfigFailed((ConfigRequest) msg.obj, msg.arg1);
+ WifiNanEventCallback.this.onConfigFailed((ConfigRequest) msg.obj, msg.arg1);
break;
case LISTEN_NAN_DOWN:
- WifiNanEventListener.this.onNanDown(msg.arg1);
+ WifiNanEventCallback.this.onNanDown(msg.arg1);
break;
case LISTEN_IDENTITY_CHANGED:
- WifiNanEventListener.this.onIdentityChanged();
+ WifiNanEventCallback.this.onIdentityChanged();
break;
}
}
@@ -109,8 +110,8 @@
/**
* Called when NAN configuration is completed. Event will only be delivered
- * if registered using {@link WifiNanEventListener#LISTEN_CONFIG_COMPLETED}. A
- * dummy (empty implementation printing out a warning). Make sure to
+ * if registered using {@link WifiNanEventCallback#LISTEN_CONFIG_COMPLETED}.
+ * A dummy (empty implementation printing out a warning). Make sure to
* override if registered.
*
* @param completedConfig The actual configuration request which was
@@ -124,11 +125,12 @@
/**
* Called when NAN configuration failed. Event will only be delivered if
- * registered using {@link WifiNanEventListener#LISTEN_CONFIG_FAILED}. A dummy
- * (empty implementation printing out a warning). Make sure to override if
- * registered.
+ * registered using {@link WifiNanEventCallback#LISTEN_CONFIG_FAILED}. A
+ * dummy (empty implementation printing out a warning). Make sure to
+ * override if registered.
*
- * @param reason Failure reason code, see {@code NanSessionListener.FAIL_*}.
+ * @param reason Failure reason code, see
+ * {@code WifiNanSessionCallback.FAIL_*}.
*/
public void onConfigFailed(ConfigRequest failedConfig, int reason) {
Log.w(TAG, "onConfigFailed: called in stub - override if interested or disable");
@@ -136,11 +138,12 @@
/**
* Called when NAN cluster is down. Event will only be delivered if
- * registered using {@link WifiNanEventListener#LISTEN_NAN_DOWN}. A dummy (empty
- * implementation printing out a warning). Make sure to override if
+ * registered using {@link WifiNanEventCallback#LISTEN_NAN_DOWN}. A dummy
+ * (empty implementation printing out a warning). Make sure to override if
* registered.
*
- * @param reason Reason code for event, see {@code NanSessionListener.FAIL_*}.
+ * @param reason Reason code for event, see
+ * {@code WifiNanSessionCallback.FAIL_*}.
*/
public void onNanDown(int reason) {
Log.w(TAG, "onNanDown: called in stub - override if interested or disable");
@@ -152,7 +155,7 @@
* implication is that peers you've been communicating with may no longer
* recognize you and you need to re-establish your identity. Event will only
* be delivered if registered using
- * {@link WifiNanEventListener#LISTEN_IDENTITY_CHANGED}. A dummy (empty
+ * {@link WifiNanEventCallback#LISTEN_IDENTITY_CHANGED}. A dummy (empty
* implementation printing out a warning). Make sure to override if
* registered.
*/
@@ -163,7 +166,7 @@
/**
* {@hide}
*/
- public IWifiNanEventListener callback = new IWifiNanEventListener.Stub() {
+ public IWifiNanEventCallback callback = new IWifiNanEventCallback.Stub() {
@Override
public void onConfigCompleted(ConfigRequest completedConfig) {
if (VDBG) Log.v(TAG, "onConfigCompleted: configRequest=" + completedConfig);
diff --git a/wifi/java/android/net/wifi/nan/WifiNanManager.java b/wifi/java/android/net/wifi/nan/WifiNanManager.java
index 21be52b..d483bc0 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanManager.java
+++ b/wifi/java/android/net/wifi/nan/WifiNanManager.java
@@ -59,16 +59,16 @@
* have explicitly {@link WifiNanManager#disconnect()} need to call this
* function to re-connect.
*
- * @param listener A listener extended from {@link WifiNanEventListener}.
- * @param events The set of events to be delivered to the {@code listener}.
- * OR'd event flags from {@link WifiNanEventListener
- * NanEventListener.LISTEN*}.
+ * @param callback A callback extended from {@link WifiNanEventCallback}.
+ * @param events The set of events to be delivered to the {@code callback}.
+ * OR'd event flags from {@link WifiNanEventCallback
+ * WifiNanEventCallback.LISTEN*}.
*/
- public void connect(WifiNanEventListener listener, int events) {
+ public void connect(WifiNanEventCallback callback, int events) {
try {
if (VDBG) Log.v(TAG, "connect()");
- if (listener == null) {
- throw new IllegalArgumentException("Invalid listener - must not be null");
+ if (callback == null) {
+ throw new IllegalArgumentException("Invalid callback - must not be null");
}
if (mClientId != -1) {
Log.w(TAG, "connect(): mClientId=" + mClientId
@@ -77,7 +77,7 @@
if (mBinder == null) {
mBinder = new Binder();
}
- mClientId = mService.connect(mBinder, listener.callback, events);
+ mClientId = mService.connect(mBinder, callback.callback, events);
} catch (RemoteException e) {
Log.w(TAG, "connect RemoteException (FYI - ignoring): " + e);
}
@@ -90,7 +90,7 @@
* are cancelled.
* <p>
* An application may then re-connect using
- * {@link WifiNanManager#connect(WifiNanEventListener, int)} .
+ * {@link WifiNanManager#connect(WifiNanEventCallback, int)} .
*/
public void disconnect() {
try {
@@ -110,8 +110,8 @@
* multiple applications and configure NAN differently from individual
* requests.
* <p>
- * The {@link WifiNanEventListener#onConfigCompleted(ConfigRequest)} will be
- * called when configuration is completed (if a listener is registered for
+ * The {@link WifiNanEventCallback#onConfigCompleted(ConfigRequest)} will be
+ * called when configuration is completed (if a callback is registered for
* this specific event).
*
* @param configRequest The requested NAN configuration.
@@ -127,23 +127,23 @@
/**
* Request a NAN publish session. The results of the publish session
- * operation will result in callbacks to the indicated listener:
- * {@link WifiNanSessionListener NanSessionListener.on*}.
+ * operation will result in callbacks to the indicated callback:
+ * {@link WifiNanSessionCallback NanSessionCallback.on*}.
*
* @param publishConfig The {@link PublishConfig} specifying the
* configuration of the publish session.
- * @param listener The {@link WifiNanSessionListener} derived objects to be
+ * @param callback The {@link WifiNanSessionCallback} derived objects to be
* used for the event callbacks specified by {@code events}.
- * @param events The list of events to be delivered to the {@code listener}
- * object. An OR'd value of {@link WifiNanSessionListener
- * NanSessionListener.LISTEN_*}.
+ * @param events The list of events to be delivered to the {@code callback}
+ * object. An OR'd value of {@link WifiNanSessionCallback
+ * WifiNanSessionCallback.LISTEN_*}.
* @return The {@link WifiNanPublishSession} which can be used to further
* control the publish session.
*/
public WifiNanPublishSession publish(PublishConfig publishConfig,
- WifiNanSessionListener listener, int events) {
- return publishRaw(publishConfig, listener,
- events | WifiNanSessionListener.LISTEN_HIDDEN_FLAGS);
+ WifiNanSessionCallback callback, int events) {
+ return publishRaw(publishConfig, callback,
+ events | WifiNanSessionCallback.LISTEN_HIDDEN_FLAGS);
}
/**
@@ -152,7 +152,7 @@
* @hide
*/
public WifiNanPublishSession publishRaw(PublishConfig publishConfig,
- WifiNanSessionListener listener, int events) {
+ WifiNanSessionCallback callback, int events) {
if (VDBG) Log.v(TAG, "publish(): config=" + publishConfig);
if (publishConfig.mPublishType == PublishConfig.PUBLISH_TYPE_UNSOLICITED
@@ -165,14 +165,14 @@
throw new IllegalArgumentException("Invalid publish config: SOLICITED "
+ "publishes (passive) can't have a Tx filter");
}
- if (listener == null) {
- throw new IllegalArgumentException("Invalid listener - must not be null");
+ if (callback == null) {
+ throw new IllegalArgumentException("Invalid callback - must not be null");
}
int sessionId;
try {
- sessionId = mService.createSession(mClientId, listener.callback, events);
+ sessionId = mService.createSession(mClientId, callback.callback, events);
if (DBG) Log.d(TAG, "publish: session created - sessionId=" + sessionId);
mService.publish(mClientId, sessionId, publishConfig);
} catch (RemoteException e) {
@@ -209,23 +209,23 @@
/**
* Request a NAN subscribe session. The results of the subscribe session
- * operation will result in callbacks to the indicated listener:
- * {@link WifiNanSessionListener NanSessionListener.on*}.
+ * operation will result in callbacks to the indicated callback:
+ * {@link WifiNanSessionCallback WifiNanSessionCallback.on*}.
*
* @param subscribeConfig The {@link SubscribeConfig} specifying the
* configuration of the subscribe session.
- * @param listener The {@link WifiNanSessionListener} derived objects to be
+ * @param callback The {@link WifiNanSessionCallback} derived objects to be
* used for the event callbacks specified by {@code events}.
- * @param events The list of events to be delivered to the {@code listener}
- * object. An OR'd value of {@link WifiNanSessionListener
- * NanSessionListener.LISTEN_*}.
+ * @param events The list of events to be delivered to the {@code callback}
+ * object. An OR'd value of {@link WifiNanSessionCallback
+ * WifiNanSessionCallback.LISTEN_*}.
* @return The {@link WifiNanSubscribeSession} which can be used to further
* control the subscribe session.
*/
public WifiNanSubscribeSession subscribe(SubscribeConfig subscribeConfig,
- WifiNanSessionListener listener, int events) {
- return subscribeRaw(subscribeConfig, listener,
- events | WifiNanSessionListener.LISTEN_HIDDEN_FLAGS);
+ WifiNanSessionCallback callback, int events) {
+ return subscribeRaw(subscribeConfig, callback,
+ events | WifiNanSessionCallback.LISTEN_HIDDEN_FLAGS);
}
/**
@@ -234,7 +234,7 @@
* @hide
*/
public WifiNanSubscribeSession subscribeRaw(SubscribeConfig subscribeConfig,
- WifiNanSessionListener listener, int events) {
+ WifiNanSessionCallback callback, int events) {
if (VDBG) {
Log.v(TAG, "subscribe(): config=" + subscribeConfig);
}
@@ -253,7 +253,7 @@
int sessionId;
try {
- sessionId = mService.createSession(mClientId, listener.callback, events);
+ sessionId = mService.createSession(mClientId, callback.callback, events);
if (DBG) Log.d(TAG, "subscribe: session created - sessionId=" + sessionId);
mService.subscribe(mClientId, sessionId, subscribeConfig);
} catch (RemoteException e) {
diff --git a/wifi/java/android/net/wifi/nan/WifiNanSession.java b/wifi/java/android/net/wifi/nan/WifiNanSession.java
index bc1787f..a903583 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanSession.java
+++ b/wifi/java/android/net/wifi/nan/WifiNanSession.java
@@ -94,11 +94,11 @@
* Sends a message to the specified destination. Message transmission is
* part of the current discovery session - i.e. executed subsequent to a
* publish/subscribe
- * {@link WifiNanSessionListener#onMatch(int, byte[], int, byte[], int)}
+ * {@link WifiNanSessionCallback#onMatch(int, byte[], int, byte[], int)}
* event.
*
* @param peerId The peer's ID for the message. Must be a result of an
- * {@link WifiNanSessionListener#onMatch(int, byte[], int, byte[], int)}
+ * {@link WifiNanSessionCallback#onMatch(int, byte[], int, byte[], int)}
* event.
* @param message The message to be transmitted.
* @param messageLength The number of bytes from the {@code message} to be
diff --git a/wifi/java/android/net/wifi/nan/WifiNanSessionListener.java b/wifi/java/android/net/wifi/nan/WifiNanSessionCallback.java
similarity index 78%
rename from wifi/java/android/net/wifi/nan/WifiNanSessionListener.java
rename to wifi/java/android/net/wifi/nan/WifiNanSessionCallback.java
index 4cc9cf5..884fcf5 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanSessionListener.java
+++ b/wifi/java/android/net/wifi/nan/WifiNanSessionCallback.java
@@ -26,29 +26,29 @@
* Base class for NAN session events callbacks. Should be extended by
* applications wanting notifications. The callbacks are registered when a
* publish or subscribe session is created using
- * {@link WifiNanManager#publish(PublishConfig, WifiNanSessionListener, int)} or
- * {@link WifiNanManager#subscribe(SubscribeConfig, WifiNanSessionListener, int)}
+ * {@link WifiNanManager#publish(PublishConfig, WifiNanSessionCallback, int)} or
+ * {@link WifiNanManager#subscribe(SubscribeConfig, WifiNanSessionCallback, int)}
* . These are callbacks applying to a specific NAN session. Events
* corresponding to the NAN link are delivered using
- * {@link WifiNanEventListener}.
+ * {@link WifiNanEventCallback}.
* <p>
- * A single listener is registered at session creation - it cannot be replaced.
+ * A single callback is registered at session creation - it cannot be replaced.
* <p>
* During registration specify which specific events are desired using a set of
- * {@code NanSessionListener.LISTEN_*} flags OR'd together. Only those events
- * will be delivered to the registered listener. Override those callbacks
- * {@code NanSessionListener.on*} for the registered events.
+ * {@code WifiNanSessionCallback.LISTEN_*} flags OR'd together. Only those
+ * events will be delivered to the registered callback. Override those callbacks
+ * {@code WifiNanSessionCallback.on*} for the registered events.
*
* @hide PROPOSED_NAN_API
*/
-public class WifiNanSessionListener {
- private static final String TAG = "WifiNanSessionListener";
+public class WifiNanSessionCallback {
+ private static final String TAG = "WifiNanSessionCallback";
private static final boolean DBG = false;
private static final boolean VDBG = false; // STOPSHIP if true
/**
* Publish fail callback event registration flag. Corresponding callback is
- * {@link WifiNanSessionListener#onPublishFail(int)}.
+ * {@link WifiNanSessionCallback#onPublishFail(int)}.
*
* @hide
*/
@@ -56,13 +56,13 @@
/**
* Publish terminated callback event registration flag. Corresponding
- * callback is {@link WifiNanSessionListener#onPublishTerminated(int)}.
+ * callback is {@link WifiNanSessionCallback#onPublishTerminated(int)}.
*/
public static final int LISTEN_PUBLISH_TERMINATED = 0x1 << 1;
/**
* Subscribe fail callback event registration flag. Corresponding callback
- * is {@link WifiNanSessionListener#onSubscribeFail(int)}.
+ * is {@link WifiNanSessionCallback#onSubscribeFail(int)}.
*
* @hide
*/
@@ -70,14 +70,14 @@
/**
* Subscribe terminated callback event registration flag. Corresponding
- * callback is {@link WifiNanSessionListener#onSubscribeTerminated(int)}.
+ * callback is {@link WifiNanSessionCallback#onSubscribeTerminated(int)}.
*/
public static final int LISTEN_SUBSCRIBE_TERMINATED = 0x1 << 3;
/**
* Match (discovery: publish or subscribe) callback event registration flag.
* Corresponding callback is
- * {@link WifiNanSessionListener#onMatch(int, byte[], int, byte[], int)}.
+ * {@link WifiNanSessionCallback#onMatch(int, byte[], int, byte[], int)}.
*
* @hide
*/
@@ -85,7 +85,7 @@
/**
* Message sent successfully callback event registration flag. Corresponding
- * callback is {@link WifiNanSessionListener#onMessageSendSuccess()}.
+ * callback is {@link WifiNanSessionCallback#onMessageSendSuccess()}.
*
* @hide
*/
@@ -93,7 +93,7 @@
/**
* Message sending failure callback event registration flag. Corresponding
- * callback is {@link WifiNanSessionListener#onMessageSendFail(int)}.
+ * callback is {@link WifiNanSessionCallback#onMessageSendFail(int)}.
*
* @hide
*/
@@ -101,7 +101,7 @@
/**
* Message received callback event registration flag. Corresponding callback
- * is {@link WifiNanSessionListener#onMessageReceived(int, byte[], int)}.
+ * is {@link WifiNanSessionCallback#onMessageReceived(int, byte[], int)}.
*
* @hide
*/
@@ -118,37 +118,37 @@
| LISTEN_MESSAGE_RECEIVED;
/**
- * Failure reason flag for {@link WifiNanEventListener} and
- * {@link WifiNanSessionListener} callbacks. Indicates no resources to execute
- * the requested operation.
+ * Failure reason flag for {@link WifiNanEventCallback} and
+ * {@link WifiNanSessionCallback} callbacks. Indicates no resources to
+ * execute the requested operation.
*/
public static final int FAIL_REASON_NO_RESOURCES = 0;
/**
- * Failure reason flag for {@link WifiNanEventListener} and
- * {@link WifiNanSessionListener} callbacks. Indicates invalid argument in the
- * requested operation.
+ * Failure reason flag for {@link WifiNanEventCallback} and
+ * {@link WifiNanSessionCallback} callbacks. Indicates invalid argument in
+ * the requested operation.
*/
public static final int FAIL_REASON_INVALID_ARGS = 1;
/**
- * Failure reason flag for {@link WifiNanEventListener} and
- * {@link WifiNanSessionListener} callbacks. Indicates a message is transmitted
- * without a match (i.e. a discovery) occurring first.
+ * Failure reason flag for {@link WifiNanEventCallback} and
+ * {@link WifiNanSessionCallback} callbacks. Indicates a message is
+ * transmitted without a match (i.e. a discovery) occurring first.
*/
public static final int FAIL_REASON_NO_MATCH_SESSION = 2;
/**
- * Failure reason flag for {@link WifiNanEventListener} and
- * {@link WifiNanSessionListener} callbacks. Indicates an unspecified error
+ * Failure reason flag for {@link WifiNanEventCallback} and
+ * {@link WifiNanSessionCallback} callbacks. Indicates an unspecified error
* occurred during the operation.
*/
public static final int FAIL_REASON_OTHER = 3;
/**
* Failure reason flag for
- * {@link WifiNanSessionListener#onPublishTerminated(int)} and
- * {@link WifiNanSessionListener#onSubscribeTerminated(int)} callbacks.
+ * {@link WifiNanSessionCallback#onPublishTerminated(int)} and
+ * {@link WifiNanSessionCallback#onSubscribeTerminated(int)} callbacks.
* Indicates that publish or subscribe session is done - i.e. all the
* requested operations (per {@link PublishConfig} or
* {@link SubscribeConfig}) have been executed.
@@ -157,8 +157,8 @@
/**
* Failure reason flag for
- * {@link WifiNanSessionListener#onPublishTerminated(int)} and
- * {@link WifiNanSessionListener#onSubscribeTerminated(int)} callbacks.
+ * {@link WifiNanSessionCallback#onPublishTerminated(int)} and
+ * {@link WifiNanSessionCallback#onSubscribeTerminated(int)} callbacks.
* Indicates that publish or subscribe session is terminated due to a
* failure.
*/
@@ -171,20 +171,21 @@
private final Handler mHandler;
/**
- * Constructs a {@link WifiNanSessionListener} using the looper of the current
- * thread. I.e. all callbacks will be delivered on the current thread.
+ * Constructs a {@link WifiNanSessionCallback} using the looper of the
+ * current thread. I.e. all callbacks will be delivered on the current
+ * thread.
*/
- public WifiNanSessionListener() {
+ public WifiNanSessionCallback() {
this(Looper.myLooper());
}
/**
- * Constructs a {@link WifiNanSessionListener} using the specified looper. I.e.
- * all callbacks will delivered on the thread of the specified looper.
+ * Constructs a {@link WifiNanSessionCallback} using the specified looper.
+ * I.e. all callbacks will delivered on the thread of the specified looper.
*
* @param looper The looper on which to execute the callbacks.
*/
- public WifiNanSessionListener(Looper looper) {
+ public WifiNanSessionCallback(Looper looper) {
if (VDBG) Log.v(TAG, "ctor: looper=" + looper);
mHandler = new Handler(looper) {
@Override
@@ -192,31 +193,31 @@
if (DBG) Log.d(TAG, "What=" + msg.what + ", msg=" + msg);
switch (msg.what) {
case LISTEN_PUBLISH_FAIL:
- WifiNanSessionListener.this.onPublishFail(msg.arg1);
+ WifiNanSessionCallback.this.onPublishFail(msg.arg1);
break;
case LISTEN_PUBLISH_TERMINATED:
- WifiNanSessionListener.this.onPublishTerminated(msg.arg1);
+ WifiNanSessionCallback.this.onPublishTerminated(msg.arg1);
break;
case LISTEN_SUBSCRIBE_FAIL:
- WifiNanSessionListener.this.onSubscribeFail(msg.arg1);
+ WifiNanSessionCallback.this.onSubscribeFail(msg.arg1);
break;
case LISTEN_SUBSCRIBE_TERMINATED:
- WifiNanSessionListener.this.onSubscribeTerminated(msg.arg1);
+ WifiNanSessionCallback.this.onSubscribeTerminated(msg.arg1);
break;
case LISTEN_MATCH:
- WifiNanSessionListener.this.onMatch(
+ WifiNanSessionCallback.this.onMatch(
msg.getData().getInt(MESSAGE_BUNDLE_KEY_PEER_ID),
msg.getData().getByteArray(MESSAGE_BUNDLE_KEY_MESSAGE), msg.arg1,
msg.getData().getByteArray(MESSAGE_BUNDLE_KEY_MESSAGE2), msg.arg2);
break;
case LISTEN_MESSAGE_SEND_SUCCESS:
- WifiNanSessionListener.this.onMessageSendSuccess(msg.arg1);
+ WifiNanSessionCallback.this.onMessageSendSuccess(msg.arg1);
break;
case LISTEN_MESSAGE_SEND_FAIL:
- WifiNanSessionListener.this.onMessageSendFail(msg.arg1, msg.arg2);
+ WifiNanSessionCallback.this.onMessageSendFail(msg.arg1, msg.arg2);
break;
case LISTEN_MESSAGE_RECEIVED:
- WifiNanSessionListener.this.onMessageReceived(msg.arg2,
+ WifiNanSessionCallback.this.onMessageReceived(msg.arg2,
msg.getData().getByteArray(MESSAGE_BUNDLE_KEY_MESSAGE), msg.arg1);
break;
}
@@ -229,8 +230,8 @@
* implementation printing out a log message). Override to implement your
* custom response.
*
- * @param reason The failure reason using {@code NanSessionListener.FAIL_*}
- * codes.
+ * @param reason The failure reason using
+ * {@code WifiNanSessionCallback.FAIL_*} codes.
*/
public void onPublishFail(int reason) {
if (VDBG) Log.v(TAG, "onPublishFail: called in stub - override if interested");
@@ -238,12 +239,13 @@
/**
* Called when a publish operation terminates. Event will only be delivered
- * if registered using {@link WifiNanSessionListener#LISTEN_PUBLISH_TERMINATED}.
- * A dummy (empty implementation printing out a warning). Make sure to
- * override if registered.
+ * if registered using
+ * {@link WifiNanSessionCallback#LISTEN_PUBLISH_TERMINATED}. A dummy (empty
+ * implementation printing out a warning). Make sure to override if
+ * registered.
*
* @param reason The termination reason using
- * {@code NanSessionListener.TERMINATE_*} codes.
+ * {@code WifiNanSessionCallback.TERMINATE_*} codes.
*/
public void onPublishTerminated(int reason) {
Log.w(TAG, "onPublishTerminated: called in stub - override if interested or disable");
@@ -254,8 +256,8 @@
* implementation printing out a log message). Override to implement your
* custom response.
*
- * @param reason The failure reason using {@code NanSessionListener.FAIL_*}
- * codes.
+ * @param reason The failure reason using
+ * {@code WifiNanSessionCallback.FAIL_*} codes.
*/
public void onSubscribeFail(int reason) {
if (VDBG) Log.v(TAG, "onSubscribeFail: called in stub - override if interested");
@@ -264,12 +266,12 @@
/**
* Called when a subscribe operation terminates. Event will only be
* delivered if registered using
- * {@link WifiNanSessionListener#LISTEN_SUBSCRIBE_TERMINATED}. A dummy (empty
- * implementation printing out a warning). Make sure to override if
+ * {@link WifiNanSessionCallback#LISTEN_SUBSCRIBE_TERMINATED}. A dummy
+ * (empty implementation printing out a warning). Make sure to override if
* registered.
*
* @param reason The termination reason using
- * {@code NanSessionListener.TERMINATE_*} codes.
+ * {@code WifiNanSessionCallback.TERMINATE_*} codes.
*/
public void onSubscribeTerminated(int reason) {
Log.w(TAG, "onSubscribeTerminated: called in stub - override if interested or disable");
@@ -303,7 +305,7 @@
* message). Override to implement your custom response.
* <p>
* Note that either this callback or
- * {@link WifiNanSessionListener#onMessageSendFail(int, int)} will be
+ * {@link WifiNanSessionCallback#onMessageSendFail(int, int)} will be
* received - never both.
*/
public void onMessageSendSuccess(int messageId) {
@@ -319,11 +321,11 @@
* message). Override to implement your custom response.
* <p>
* Note that either this callback or
- * {@link WifiNanSessionListener#onMessageSendSuccess(int)} will be received
+ * {@link WifiNanSessionCallback#onMessageSendSuccess(int)} will be received
* - never both
*
- * @param reason The failure reason using {@code NanSessionListener.FAIL_*}
- * codes.
+ * @param reason The failure reason using
+ * {@code WifiNanSessionCallback.FAIL_*} codes.
*/
public void onMessageSendFail(int messageId, int reason) {
if (VDBG) Log.v(TAG, "onMessageSendFail: called in stub - override if interested");
@@ -346,7 +348,7 @@
/**
* {@hide}
*/
- public IWifiNanSessionListener callback = new IWifiNanSessionListener.Stub() {
+ public IWifiNanSessionCallback callback = new IWifiNanSessionCallback.Stub() {
@Override
public void onPublishFail(int reason) {
if (VDBG) Log.v(TAG, "onPublishFail: reason=" + reason);