[NAN] API cleanup - rename FLAGS.

Per API guidelines - non-overlapping constants can be (should be)
named with "FLAG".

(cherry-pick of ad3693d59b,
 Change-Id: If8b2c0f9b2818215a64b5635e76731c8fdfd3b8d)

Bug: 27122760
Change-Id: I973d24f4f318471286087e6ae13b77cb119f01e7
(cherry picked from commit e698fab45c)
This commit is contained in:
Etan Cohen
2016-02-17 18:27:43 -08:00
committed by Mitchell Wills
parent 00abb43588
commit 52065684df
2 changed files with 45 additions and 45 deletions

View File

@@ -44,20 +44,20 @@ public class WifiNanEventCallback {
* callback is {@link WifiNanEventCallback#onConfigCompleted(ConfigRequest)}
* .
*/
public static final int LISTEN_CONFIG_COMPLETED = 0x1 << 0;
public static final int FLAG_LISTEN_CONFIG_COMPLETED = 0x1 << 0;
/**
* Configuration failed callback event registration flag. Corresponding
* callback is
* {@link WifiNanEventCallback#onConfigFailed(ConfigRequest, int)}.
*/
public static final int LISTEN_CONFIG_FAILED = 0x1 << 1;
public static final int FLAG_LISTEN_CONFIG_FAILED = 0x1 << 1;
/**
* NAN cluster is down callback event registration flag. Corresponding
* callback is {@link WifiNanEventCallback#onNanDown(int)}.
*/
public static final int LISTEN_NAN_DOWN = 0x1 << 2;
public static final int FLAG_LISTEN_NAN_DOWN = 0x1 << 2;
/**
* NAN identity has changed event registration flag. This may be due to
@@ -66,7 +66,7 @@ public class WifiNanEventCallback {
* recognize you and you need to re-establish your identity. Corresponding
* callback is {@link WifiNanEventCallback#onIdentityChanged()}.
*/
public static final int LISTEN_IDENTITY_CHANGED = 0x1 << 3;
public static final int FLAG_LISTEN_IDENTITY_CHANGED = 0x1 << 3;
private final Handler mHandler;
@@ -91,16 +91,16 @@ public class WifiNanEventCallback {
public void handleMessage(Message msg) {
if (DBG) Log.d(TAG, "What=" + msg.what + ", msg=" + msg);
switch (msg.what) {
case LISTEN_CONFIG_COMPLETED:
case FLAG_LISTEN_CONFIG_COMPLETED:
WifiNanEventCallback.this.onConfigCompleted((ConfigRequest) msg.obj);
break;
case LISTEN_CONFIG_FAILED:
case FLAG_LISTEN_CONFIG_FAILED:
WifiNanEventCallback.this.onConfigFailed((ConfigRequest) msg.obj, msg.arg1);
break;
case LISTEN_NAN_DOWN:
case FLAG_LISTEN_NAN_DOWN:
WifiNanEventCallback.this.onNanDown(msg.arg1);
break;
case LISTEN_IDENTITY_CHANGED:
case FLAG_LISTEN_IDENTITY_CHANGED:
WifiNanEventCallback.this.onIdentityChanged();
break;
}
@@ -110,7 +110,7 @@ public class WifiNanEventCallback {
/**
* Called when NAN configuration is completed. Event will only be delivered
* if registered using {@link WifiNanEventCallback#LISTEN_CONFIG_COMPLETED}.
* if registered using {@link WifiNanEventCallback#FLAG_LISTEN_CONFIG_COMPLETED}.
* A dummy (empty implementation printing out a warning). Make sure to
* override if registered.
*
@@ -125,7 +125,7 @@ public class WifiNanEventCallback {
/**
* Called when NAN configuration failed. Event will only be delivered if
* registered using {@link WifiNanEventCallback#LISTEN_CONFIG_FAILED}. A
* registered using {@link WifiNanEventCallback#FLAG_LISTEN_CONFIG_FAILED}. A
* dummy (empty implementation printing out a warning). Make sure to
* override if registered.
*
@@ -138,7 +138,7 @@ public class WifiNanEventCallback {
/**
* Called when NAN cluster is down. Event will only be delivered if
* registered using {@link WifiNanEventCallback#LISTEN_NAN_DOWN}. A dummy
* registered using {@link WifiNanEventCallback#FLAG_LISTEN_NAN_DOWN}. A dummy
* (empty implementation printing out a warning). Make sure to override if
* registered.
*
@@ -155,7 +155,7 @@ public class WifiNanEventCallback {
* 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 WifiNanEventCallback#LISTEN_IDENTITY_CHANGED}. A dummy (empty
* {@link WifiNanEventCallback#FLAG_LISTEN_IDENTITY_CHANGED}. A dummy (empty
* implementation printing out a warning). Make sure to override if
* registered.
*/
@@ -171,7 +171,7 @@ public class WifiNanEventCallback {
public void onConfigCompleted(ConfigRequest completedConfig) {
if (VDBG) Log.v(TAG, "onConfigCompleted: configRequest=" + completedConfig);
Message msg = mHandler.obtainMessage(LISTEN_CONFIG_COMPLETED);
Message msg = mHandler.obtainMessage(FLAG_LISTEN_CONFIG_COMPLETED);
msg.obj = completedConfig;
mHandler.sendMessage(msg);
}
@@ -182,7 +182,7 @@ public class WifiNanEventCallback {
Log.v(TAG, "onConfigFailed: failedConfig=" + failedConfig + ", reason=" + reason);
}
Message msg = mHandler.obtainMessage(LISTEN_CONFIG_FAILED);
Message msg = mHandler.obtainMessage(FLAG_LISTEN_CONFIG_FAILED);
msg.arg1 = reason;
msg.obj = failedConfig;
mHandler.sendMessage(msg);
@@ -192,7 +192,7 @@ public class WifiNanEventCallback {
public void onNanDown(int reason) {
if (VDBG) Log.v(TAG, "onNanDown: reason=" + reason);
Message msg = mHandler.obtainMessage(LISTEN_NAN_DOWN);
Message msg = mHandler.obtainMessage(FLAG_LISTEN_NAN_DOWN);
msg.arg1 = reason;
mHandler.sendMessage(msg);
}
@@ -201,7 +201,7 @@ public class WifiNanEventCallback {
public void onIdentityChanged() {
if (VDBG) Log.v(TAG, "onIdentityChanged");
Message msg = mHandler.obtainMessage(LISTEN_IDENTITY_CHANGED);
Message msg = mHandler.obtainMessage(FLAG_LISTEN_IDENTITY_CHANGED);
mHandler.sendMessage(msg);
}
};

View File

@@ -52,13 +52,13 @@ public class WifiNanSessionCallback {
*
* @hide
*/
public static final int LISTEN_PUBLISH_FAIL = 0x1 << 0;
public static final int FLAG_LISTEN_PUBLISH_FAIL = 0x1 << 0;
/**
* Publish terminated callback event registration flag. Corresponding
* callback is {@link WifiNanSessionCallback#onPublishTerminated(int)}.
*/
public static final int LISTEN_PUBLISH_TERMINATED = 0x1 << 1;
public static final int FLAG_LISTEN_PUBLISH_TERMINATED = 0x1 << 1;
/**
* Subscribe fail callback event registration flag. Corresponding callback
@@ -66,13 +66,13 @@ public class WifiNanSessionCallback {
*
* @hide
*/
public static final int LISTEN_SUBSCRIBE_FAIL = 0x1 << 2;
public static final int FLAG_LISTEN_SUBSCRIBE_FAIL = 0x1 << 2;
/**
* Subscribe terminated callback event registration flag. Corresponding
* callback is {@link WifiNanSessionCallback#onSubscribeTerminated(int)}.
*/
public static final int LISTEN_SUBSCRIBE_TERMINATED = 0x1 << 3;
public static final int FLAG_LISTEN_SUBSCRIBE_TERMINATED = 0x1 << 3;
/**
* Match (discovery: publish or subscribe) callback event registration flag.
@@ -81,7 +81,7 @@ public class WifiNanSessionCallback {
*
* @hide
*/
public static final int LISTEN_MATCH = 0x1 << 4;
public static final int FLAG_LISTEN_MATCH = 0x1 << 4;
/**
* Message sent successfully callback event registration flag. Corresponding
@@ -89,7 +89,7 @@ public class WifiNanSessionCallback {
*
* @hide
*/
public static final int LISTEN_MESSAGE_SEND_SUCCESS = 0x1 << 5;
public static final int FLAG_LISTEN_MESSAGE_SEND_SUCCESS = 0x1 << 5;
/**
* Message sending failure callback event registration flag. Corresponding
@@ -97,7 +97,7 @@ public class WifiNanSessionCallback {
*
* @hide
*/
public static final int LISTEN_MESSAGE_SEND_FAIL = 0x1 << 6;
public static final int FLAG_LISTEN_MESSAGE_SEND_FAIL = 0x1 << 6;
/**
* Message received callback event registration flag. Corresponding callback
@@ -105,7 +105,7 @@ public class WifiNanSessionCallback {
*
* @hide
*/
public static final int LISTEN_MESSAGE_RECEIVED = 0x1 << 7;
public static final int FLAG_LISTEN_MESSAGE_RECEIVED = 0x1 << 7;
/**
* List of hidden events: which are mandatory - i.e. they will be added to
@@ -113,9 +113,9 @@ public class WifiNanSessionCallback {
*
* @hide
*/
public static final int LISTEN_HIDDEN_FLAGS = LISTEN_PUBLISH_FAIL | LISTEN_SUBSCRIBE_FAIL
| LISTEN_MATCH | LISTEN_MESSAGE_SEND_SUCCESS | LISTEN_MESSAGE_SEND_FAIL
| LISTEN_MESSAGE_RECEIVED;
public static final int LISTEN_HIDDEN_FLAGS = FLAG_LISTEN_PUBLISH_FAIL
| FLAG_LISTEN_SUBSCRIBE_FAIL | FLAG_LISTEN_MATCH | FLAG_LISTEN_MESSAGE_SEND_SUCCESS
| FLAG_LISTEN_MESSAGE_SEND_FAIL | FLAG_LISTEN_MESSAGE_RECEIVED;
/**
* Failure reason flag for {@link WifiNanEventCallback} and
@@ -192,31 +192,31 @@ public class WifiNanSessionCallback {
public void handleMessage(Message msg) {
if (DBG) Log.d(TAG, "What=" + msg.what + ", msg=" + msg);
switch (msg.what) {
case LISTEN_PUBLISH_FAIL:
case FLAG_LISTEN_PUBLISH_FAIL:
WifiNanSessionCallback.this.onPublishFail(msg.arg1);
break;
case LISTEN_PUBLISH_TERMINATED:
case FLAG_LISTEN_PUBLISH_TERMINATED:
WifiNanSessionCallback.this.onPublishTerminated(msg.arg1);
break;
case LISTEN_SUBSCRIBE_FAIL:
case FLAG_LISTEN_SUBSCRIBE_FAIL:
WifiNanSessionCallback.this.onSubscribeFail(msg.arg1);
break;
case LISTEN_SUBSCRIBE_TERMINATED:
case FLAG_LISTEN_SUBSCRIBE_TERMINATED:
WifiNanSessionCallback.this.onSubscribeTerminated(msg.arg1);
break;
case LISTEN_MATCH:
case FLAG_LISTEN_MATCH:
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:
case FLAG_LISTEN_MESSAGE_SEND_SUCCESS:
WifiNanSessionCallback.this.onMessageSendSuccess(msg.arg1);
break;
case LISTEN_MESSAGE_SEND_FAIL:
case FLAG_LISTEN_MESSAGE_SEND_FAIL:
WifiNanSessionCallback.this.onMessageSendFail(msg.arg1, msg.arg2);
break;
case LISTEN_MESSAGE_RECEIVED:
case FLAG_LISTEN_MESSAGE_RECEIVED:
WifiNanSessionCallback.this.onMessageReceived(msg.arg2,
msg.getData().getByteArray(MESSAGE_BUNDLE_KEY_MESSAGE), msg.arg1);
break;
@@ -240,7 +240,7 @@ public class WifiNanSessionCallback {
/**
* Called when a publish operation terminates. Event will only be delivered
* if registered using
* {@link WifiNanSessionCallback#LISTEN_PUBLISH_TERMINATED}. A dummy (empty
* {@link WifiNanSessionCallback#FLAG_LISTEN_PUBLISH_TERMINATED}. A dummy (empty
* implementation printing out a warning). Make sure to override if
* registered.
*
@@ -266,7 +266,7 @@ public class WifiNanSessionCallback {
/**
* Called when a subscribe operation terminates. Event will only be
* delivered if registered using
* {@link WifiNanSessionCallback#LISTEN_SUBSCRIBE_TERMINATED}. A dummy
* {@link WifiNanSessionCallback#FLAG_LISTEN_SUBSCRIBE_TERMINATED}. A dummy
* (empty implementation printing out a warning). Make sure to override if
* registered.
*
@@ -353,7 +353,7 @@ public class WifiNanSessionCallback {
public void onPublishFail(int reason) {
if (VDBG) Log.v(TAG, "onPublishFail: reason=" + reason);
Message msg = mHandler.obtainMessage(LISTEN_PUBLISH_FAIL);
Message msg = mHandler.obtainMessage(FLAG_LISTEN_PUBLISH_FAIL);
msg.arg1 = reason;
mHandler.sendMessage(msg);
}
@@ -362,7 +362,7 @@ public class WifiNanSessionCallback {
public void onPublishTerminated(int reason) {
if (VDBG) Log.v(TAG, "onPublishResponse: reason=" + reason);
Message msg = mHandler.obtainMessage(LISTEN_PUBLISH_TERMINATED);
Message msg = mHandler.obtainMessage(FLAG_LISTEN_PUBLISH_TERMINATED);
msg.arg1 = reason;
mHandler.sendMessage(msg);
}
@@ -371,7 +371,7 @@ public class WifiNanSessionCallback {
public void onSubscribeFail(int reason) {
if (VDBG) Log.v(TAG, "onSubscribeFail: reason=" + reason);
Message msg = mHandler.obtainMessage(LISTEN_SUBSCRIBE_FAIL);
Message msg = mHandler.obtainMessage(FLAG_LISTEN_SUBSCRIBE_FAIL);
msg.arg1 = reason;
mHandler.sendMessage(msg);
}
@@ -380,7 +380,7 @@ public class WifiNanSessionCallback {
public void onSubscribeTerminated(int reason) {
if (VDBG) Log.v(TAG, "onSubscribeTerminated: reason=" + reason);
Message msg = mHandler.obtainMessage(LISTEN_SUBSCRIBE_TERMINATED);
Message msg = mHandler.obtainMessage(FLAG_LISTEN_SUBSCRIBE_TERMINATED);
msg.arg1 = reason;
mHandler.sendMessage(msg);
}
@@ -395,7 +395,7 @@ public class WifiNanSessionCallback {
data.putByteArray(MESSAGE_BUNDLE_KEY_MESSAGE, serviceSpecificInfo);
data.putByteArray(MESSAGE_BUNDLE_KEY_MESSAGE2, matchFilter);
Message msg = mHandler.obtainMessage(LISTEN_MATCH);
Message msg = mHandler.obtainMessage(FLAG_LISTEN_MATCH);
msg.arg1 = serviceSpecificInfoLength;
msg.arg2 = matchFilterLength;
msg.setData(data);
@@ -406,7 +406,7 @@ public class WifiNanSessionCallback {
public void onMessageSendSuccess(int messageId) {
if (VDBG) Log.v(TAG, "onMessageSendSuccess");
Message msg = mHandler.obtainMessage(LISTEN_MESSAGE_SEND_SUCCESS);
Message msg = mHandler.obtainMessage(FLAG_LISTEN_MESSAGE_SEND_SUCCESS);
msg.arg1 = messageId;
mHandler.sendMessage(msg);
}
@@ -415,7 +415,7 @@ public class WifiNanSessionCallback {
public void onMessageSendFail(int messageId, int reason) {
if (VDBG) Log.v(TAG, "onMessageSendFail: reason=" + reason);
Message msg = mHandler.obtainMessage(LISTEN_MESSAGE_SEND_FAIL);
Message msg = mHandler.obtainMessage(FLAG_LISTEN_MESSAGE_SEND_FAIL);
msg.arg1 = messageId;
msg.arg2 = reason;
mHandler.sendMessage(msg);
@@ -431,7 +431,7 @@ public class WifiNanSessionCallback {
Bundle data = new Bundle();
data.putByteArray(MESSAGE_BUNDLE_KEY_MESSAGE, message);
Message msg = mHandler.obtainMessage(LISTEN_MESSAGE_RECEIVED);
Message msg = mHandler.obtainMessage(FLAG_LISTEN_MESSAGE_RECEIVED);
msg.arg1 = messageLength;
msg.arg2 = peerId;
msg.setData(data);