summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2016-11-15 17:25:38 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-11-15 17:25:38 +0000
commitb98623f8491bc0690f8f7ea723b8df78e50dc499 (patch)
tree1b14bbdcd2a17218f18721d357043b61e7579f84
parent154bcdd91306505f3c52cffaba296384f6468427 (diff)
parent6b25452574623a2b7d12e47b588b15aec2321e79 (diff)
Merge "[AWARE] Update framework code for simplified HAL error codes"
am: 6b25452574 Change-Id: I13049886fc3137986df87241a8c7b2b342a5f602
-rw-r--r--service/java/com/android/server/wifi/aware/WifiAwareNative.java162
-rw-r--r--service/java/com/android/server/wifi/aware/WifiAwareStateManager.java3
-rw-r--r--service/jni/com_android_server_wifi_aware_WifiAwareNative.cpp25
-rw-r--r--tests/wifitests/jni/wifi_aware_hal_mock.cpp1
-rw-r--r--tests/wifitests/src/com/android/server/wifi/aware/WifiAwareHalTest.java59
-rw-r--r--tests/wifitests/src/com/android/server/wifi/aware/WifiAwareRttStateManagerTest.java2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java8
7 files changed, 77 insertions, 183 deletions
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareNative.java b/service/java/com/android/server/wifi/aware/WifiAwareNative.java
index 305f26a53..63da45827 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareNative.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareNative.java
@@ -635,122 +635,29 @@ public class WifiAwareNative {
public static final int AWARE_STATUS_ERROR = -1;
// direct copy from wifi_nan.h: need to keep in sync
- /* Aware Protocol Response Codes */
+ /* Aware HAL Status Codes */
public static final int AWARE_STATUS_SUCCESS = 0;
- public static final int AWARE_STATUS_TIMEOUT = 1;
- public static final int AWARE_STATUS_DE_FAILURE = 2;
- public static final int AWARE_STATUS_INVALID_MSG_VERSION = 3;
- public static final int AWARE_STATUS_INVALID_MSG_LEN = 4;
- public static final int AWARE_STATUS_INVALID_MSG_ID = 5;
- public static final int AWARE_STATUS_INVALID_HANDLE = 6;
- public static final int AWARE_STATUS_NO_SPACE_AVAILABLE = 7;
- public static final int AWARE_STATUS_INVALID_PUBLISH_TYPE = 8;
- public static final int AWARE_STATUS_INVALID_TX_TYPE = 9;
- public static final int AWARE_STATUS_INVALID_MATCH_ALGORITHM = 10;
- public static final int AWARE_STATUS_DISABLE_IN_PROGRESS = 11;
- public static final int AWARE_STATUS_INVALID_TLV_LEN = 12;
- public static final int AWARE_STATUS_INVALID_TLV_TYPE = 13;
- public static final int AWARE_STATUS_MISSING_TLV_TYPE = 14;
- public static final int AWARE_STATUS_INVALID_TOTAL_TLVS_LEN = 15;
- public static final int AWARE_STATUS_INVALID_MATCH_HANDLE = 16;
- public static final int AWARE_STATUS_INVALID_TLV_VALUE = 17;
- public static final int AWARE_STATUS_INVALID_TX_PRIORITY = 18;
- public static final int AWARE_STATUS_INVALID_CONNECTION_MAP = 19;
- public static final int AWARE_STATUS_INVALID_TCA_ID = 20;
- public static final int AWARE_STATUS_INVALID_STATS_ID = 21;
- public static final int AWARE_STATUS_AWARE_NOT_ALLOWED = 22;
- public static final int AWARE_STATUS_NO_OTA_ACK = 23;
- public static final int AWARE_STATUS_TX_FAIL = 24;
- public static final int AWARE_STATUS_ALREADY_ENABLED = 25;
-
- /* Aware Configuration Response codes */
- public static final int AWARE_STATUS_INVALID_RSSI_CLOSE_VALUE = 4096;
- public static final int AWARE_STATUS_INVALID_RSSI_MIDDLE_VALUE = 4097;
- public static final int AWARE_STATUS_INVALID_HOP_COUNT_LIMIT = 4098;
- public static final int AWARE_STATUS_INVALID_MASTER_PREFERENCE_VALUE = 4099;
- public static final int AWARE_STATUS_INVALID_LOW_CLUSTER_ID_VALUE = 4100;
- public static final int AWARE_STATUS_INVALID_HIGH_CLUSTER_ID_VALUE = 4101;
- public static final int AWARE_STATUS_INVALID_BACKGROUND_SCAN_PERIOD = 4102;
- public static final int AWARE_STATUS_INVALID_RSSI_PROXIMITY_VALUE = 4103;
- public static final int AWARE_STATUS_INVALID_SCAN_CHANNEL = 4104;
- public static final int AWARE_STATUS_INVALID_POST_AWARE_CONNECTIVITY_CAPABILITIES_BITMAP = 4105;
- public static final int AWARE_STATUS_INVALID_FA_MAP_NUMCHAN_VALUE = 4106;
- public static final int AWARE_STATUS_INVALID_FA_MAP_DURATION_VALUE = 4107;
- public static final int AWARE_STATUS_INVALID_FA_MAP_CLASS_VALUE = 4108;
- public static final int AWARE_STATUS_INVALID_FA_MAP_CHANNEL_VALUE = 4109;
- public static final int AWARE_STATUS_INVALID_FA_MAP_AVAILABILITY_INTERVAL_BITMAP_VALUE = 4110;
- public static final int AWARE_STATUS_INVALID_FA_MAP_MAP_ID = 4111;
- public static final int AWARE_STATUS_INVALID_POST_AWARE_DISCOVERY_CONN_TYPE_VALUE = 4112;
- public static final int AWARE_STATUS_INVALID_POST_AWARE_DISCOVERY_DEVICE_ROLE_VALUE = 4113;
- public static final int AWARE_STATUS_INVALID_POST_AWARE_DISCOVERY_DURATION_VALUE = 4114;
- public static final int AWARE_STATUS_INVALID_POST_AWARE_DISCOVERY_BITMAP_VALUE = 4115;
- public static final int AWARE_STATUS_MISSING_FUTHER_AVAILABILITY_MAP = 4116;
- public static final int AWARE_STATUS_INVALID_BAND_CONFIG_FLAGS = 4117;
- public static final int AWARE_STATUS_INVALID_RANDOM_FACTOR_UPDATE_TIME_VALUE = 4118;
- public static final int AWARE_STATUS_INVALID_ONGOING_SCAN_PERIOD = 4119;
- public static final int AWARE_STATUS_INVALID_DW_INTERVAL_VALUE = 4120;
- public static final int AWARE_STATUS_INVALID_DB_INTERVAL_VALUE = 4121;
-
- /* publish/subscribe termination reasons */
- public static final int AWARE_TERMINATED_REASON_INVALID = 8192;
- public static final int AWARE_TERMINATED_REASON_TIMEOUT = 8193;
- public static final int AWARE_TERMINATED_REASON_USER_REQUEST = 8194;
- public static final int AWARE_TERMINATED_REASON_FAILURE = 8195;
- public static final int AWARE_TERMINATED_REASON_COUNT_REACHED = 8196;
- public static final int AWARE_TERMINATED_REASON_DE_SHUTDOWN = 8197;
- public static final int AWARE_TERMINATED_REASON_DISABLE_IN_PROGRESS = 8198;
- public static final int AWARE_TERMINATED_REASON_POST_DISC_ATTR_EXPIRED = 8199;
- public static final int AWARE_TERMINATED_REASON_POST_DISC_LEN_EXCEEDED = 8200;
- public static final int AWARE_TERMINATED_REASON_FURTHER_AVAIL_MAP_EMPTY = 8201;
-
- /* 9000-9500 NDP Status type */
- public static final int AWARE_STATUS_NDP_UNSUPPORTED_CONCURRENCY = 9000;
- public static final int AWARE_STATUS_NDP_AWARE_DATA_IFACE_CREATE_FAILED = 9001;
- public static final int AWARE_STATUS_NDP_AWARE_DATA_IFACE_DELETE_FAILED = 9002;
- public static final int AWARE_STATUS_NDP_DATA_INITIATOR_REQUEST_FAILED = 9003;
- public static final int AWARE_STATUS_NDP_DATA_RESPONDER_REQUEST_FAILED = 9004;
- public static final int AWARE_STATUS_NDP_INVALID_SERVICE_INSTANCE_ID = 9005;
- public static final int AWARE_STATUS_NDP_INVALID_NDP_INSTANCE_ID = 9006;
- public static final int AWARE_STATUS_NDP_INVALID_RESPONSE_CODE = 9007;
- public static final int AWARE_STATUS_NDP_INVALID_APP_INFO_LEN = 9008;
-
- /* OTA failures and timeouts during negotiation */
- public static final int AWARE_STATUS_NDP_MGMT_FRAME_REQUEST_FAILED = 9009;
- public static final int AWARE_STATUS_NDP_MGMT_FRAME_RESPONSE_FAILED = 9010;
- public static final int AWARE_STATUS_NDP_MGMT_FRAME_CONFIRM_FAILED = 9011;
- public static final int AWARE_STATUS_NDP_END_FAILED = 9012;
- public static final int AWARE_STATUS_NDP_MGMT_FRAME_END_REQUEST_FAILED = 9013;
-
- /* 9500 onwards vendor specific error codes */
- public static final int AWARE_STATUS_NDP_VENDOR_SPECIFIC_ERROR = 9500;
-
- private static int translateHalStatusToAwareSessionCallbackTerminate(int halStatus) {
- switch (halStatus) {
- case AWARE_TERMINATED_REASON_TIMEOUT:
- case AWARE_TERMINATED_REASON_USER_REQUEST:
- case AWARE_TERMINATED_REASON_COUNT_REACHED:
- return WifiAwareDiscoverySessionCallback.TERMINATE_REASON_DONE;
-
- case AWARE_TERMINATED_REASON_INVALID:
- case AWARE_TERMINATED_REASON_FAILURE:
- case AWARE_TERMINATED_REASON_DE_SHUTDOWN:
- case AWARE_TERMINATED_REASON_DISABLE_IN_PROGRESS:
- case AWARE_TERMINATED_REASON_POST_DISC_ATTR_EXPIRED:
- case AWARE_TERMINATED_REASON_POST_DISC_LEN_EXCEEDED:
- case AWARE_TERMINATED_REASON_FURTHER_AVAIL_MAP_EMPTY:
- return WifiAwareDiscoverySessionCallback.TERMINATE_REASON_FAIL;
- }
-
- return WifiAwareDiscoverySessionCallback.TERMINATE_REASON_FAIL;
- }
+ public static final int AWARE_STATUS_INTERNAL_FAILURE = 1;
+ public static final int AWARE_STATUS_PROTOCOL_FAILURE = 2;
+ public static final int AWARE_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID = 3;
+ public static final int AWARE_STATUS_NO_RESOURCE_AVAILABLE = 4;
+ public static final int AWARE_STATUS_INVALID_PARAM = 5;
+ public static final int AWARE_STATUS_INVALID_REQUESTOR_INSTANCE_ID = 6;
+ public static final int AWARE_STATUS_INVALID_SERVICE_INSTANCE_ID = 7;
+ public static final int AWARE_STATUS_INVALID_NDP_ID = 8;
+ public static final int AWARE_STATUS_NAN_NOT_ALLOWED = 9;
+ public static final int AWARE_STATUS_NO_OTA_ACK = 10;
+ public static final int AWARE_STATUS_ALREADY_ENABLED = 11;
+ public static final int AWARE_STATUS_FOLLOWUP_QUEUE_FULL = 12;
+ public static final int AWARE_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 13;
// callback from native
private static void onAwareNotifyResponse(short transactionId, int responseType, int status,
- int value) {
+ String nanError) {
if (VDBG) {
Log.v(TAG,
"onAwareNotifyResponse: transactionId=" + transactionId + ", responseType="
- + responseType + ", status=" + status + ", value=" + value);
+ + responseType + ", status=" + status + ", nanError=" + nanError);
}
WifiAwareStateManager stateMgr = WifiAwareStateManager.getInstance();
@@ -768,7 +675,7 @@ public class WifiAwareNative {
if (status != AWARE_STATUS_SUCCESS) {
Log.e(TAG,
"onAwareNotifyResponse: AWARE_RESPONSE_PUBLISH_CANCEL error - status="
- + status + ", value=" + value);
+ + status + ", nanError=" + nanError);
}
break;
case AWARE_RESPONSE_TRANSMIT_FOLLOWUP:
@@ -782,7 +689,7 @@ public class WifiAwareNative {
if (status != AWARE_STATUS_SUCCESS) {
Log.e(TAG,
"onAwareNotifyResponse: AWARE_RESPONSE_PUBLISH_CANCEL error - status="
- + status + ", value=" + value);
+ + status + ", nanError=" + nanError);
}
break;
case AWARE_RESPONSE_DP_INTERFACE_CREATE:
@@ -790,7 +697,7 @@ public class WifiAwareNative {
Log.e(TAG,
"onAwareNotifyResponse: AWARE_RESPONSE_DP_INTERFACE_CREATE error - "
+ "status="
- + status + ", value=" + value);
+ + status + ", nanError=" + nanError);
}
stateMgr.onCreateDataPathInterfaceResponse(transactionId,
status == AWARE_STATUS_SUCCESS, status);
@@ -800,7 +707,7 @@ public class WifiAwareNative {
Log.e(TAG,
"onAwareNotifyResponse: AWARE_RESPONSE_DP_INTERFACE_DELETE error - "
+ "status="
- + status + ", value=" + value);
+ + status + ", nanError=" + nanError);
}
stateMgr.onDeleteDataPathInterfaceResponse(transactionId,
status == AWARE_STATUS_SUCCESS, status);
@@ -809,7 +716,7 @@ public class WifiAwareNative {
if (status != AWARE_STATUS_SUCCESS) {
Log.e(TAG,
"onAwareNotifyResponse: AWARE_RESPONSE_DP_RESPONDER_RESPONSE error - "
- + "status=" + status + ", value=" + value);
+ + "status=" + status + ", nanError=" + nanError);
}
stateMgr.onRespondToDataPathSetupRequestResponse(transactionId,
status == AWARE_STATUS_SUCCESS, status);
@@ -817,7 +724,7 @@ public class WifiAwareNative {
case AWARE_RESPONSE_DP_END:
if (status != AWARE_STATUS_SUCCESS) {
Log.e(TAG, "onAwareNotifyResponse: AWARE_RESPONSE_DP_END error - status="
- + status + ", value=" + value);
+ + status + ", nanError=" + nanError);
}
stateMgr.onEndDataPathResponse(transactionId, status == AWARE_STATUS_SUCCESS,
status);
@@ -829,12 +736,12 @@ public class WifiAwareNative {
}
private static void onAwareNotifyResponsePublishSubscribe(short transactionId, int responseType,
- int status, int value, int pubSubId) {
+ int status, String nanError, int pubSubId) {
if (VDBG) {
Log.v(TAG,
"onAwareNotifyResponsePublishSubscribe: transactionId=" + transactionId
- + ", responseType=" + responseType + ", status=" + status + ", value="
- + value + ", pubSubId=" + pubSubId);
+ + ", responseType=" + responseType + ", status=" + status
+ + ", nanError=" + nanError + ", pubSubId=" + pubSubId);
}
switch (responseType) {
@@ -864,10 +771,11 @@ public class WifiAwareNative {
}
private static void onAwareNotifyResponseCapabilities(short transactionId, int status,
- int value, Capabilities capabilities) {
+ String nanError, Capabilities capabilities) {
if (VDBG) {
Log.v(TAG, "onAwareNotifyResponseCapabilities: transactionId=" + transactionId
- + ", status=" + status + ", value=" + value + ", capabilities=" + capabilities);
+ + ", status=" + status + ", nanError=" + nanError + ", capabilities="
+ + capabilities);
}
if (status == AWARE_STATUS_SUCCESS) {
@@ -875,16 +783,16 @@ public class WifiAwareNative {
capabilities);
} else {
Log.e(TAG, "onAwareNotifyResponseCapabilities: error status=" + status
- + ", value=" + value);
+ + ", nanError=" + nanError);
}
}
private static void onAwareNotifyResponseDataPathInitiate(short transactionId, int status,
- int value, int ndpId) {
+ String nanError, int ndpId) {
if (VDBG) {
Log.v(TAG,
"onAwareNotifyResponseDataPathInitiate: transactionId=" + transactionId
- + ", status=" + status + ", value=" + value + ", ndpId=" + ndpId);
+ + ", status=" + status + ", nanError=" + nanError + ", ndpId=" + ndpId);
}
if (status == AWARE_STATUS_SUCCESS) {
WifiAwareStateManager.getInstance().onInitiateDataPathResponseSuccess(transactionId,
@@ -938,7 +846,9 @@ public class WifiAwareNative {
if (VDBG) Log.v(TAG, "onPublishTerminated: publishId=" + publishId + ", status=" + status);
WifiAwareStateManager.getInstance().onSessionTerminatedNotification(publishId,
- translateHalStatusToAwareSessionCallbackTerminate(status), true);
+ status == AWARE_STATUS_SUCCESS
+ ? WifiAwareDiscoverySessionCallback.TERMINATE_REASON_DONE
+ : WifiAwareDiscoverySessionCallback.TERMINATE_REASON_FAIL, true);
}
// callback from native
@@ -948,7 +858,9 @@ public class WifiAwareNative {
}
WifiAwareStateManager.getInstance().onSessionTerminatedNotification(subscribeId,
- translateHalStatusToAwareSessionCallbackTerminate(status), false);
+ status == AWARE_STATUS_SUCCESS
+ ? WifiAwareDiscoverySessionCallback.TERMINATE_REASON_DONE
+ : WifiAwareDiscoverySessionCallback.TERMINATE_REASON_FAIL, false);
}
// callback from native
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java b/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java
index a1f5d28d6..f43f44a91 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java
@@ -1109,8 +1109,7 @@ public class WifiAwareStateManager {
int retryCount = sentMessage.getData()
.getInt(MESSAGE_BUNDLE_KEY_RETRY_COUNT);
- if (retryCount > 0 && (reason == WifiAwareNative.AWARE_STATUS_NO_OTA_ACK
- || reason == WifiAwareNative.AWARE_STATUS_TX_FAIL)) {
+ if (retryCount > 0 && reason == WifiAwareNative.AWARE_STATUS_NO_OTA_ACK) {
if (DBG) {
Log.d(TAG,
"NOTIFICATION_TYPE_ON_MESSAGE_SEND_FAIL: transactionId="
diff --git a/service/jni/com_android_server_wifi_aware_WifiAwareNative.cpp b/service/jni/com_android_server_wifi_aware_WifiAwareNative.cpp
index f1d292b41..fc9a08da4 100644
--- a/service/jni/com_android_server_wifi_aware_WifiAwareNative.cpp
+++ b/service/jni/com_android_server_wifi_aware_WifiAwareNative.cpp
@@ -46,21 +46,22 @@ extern wifi_hal_fn hal_fn;
static void OnNanNotifyResponse(transaction_id id, NanResponseMsg* msg) {
ALOGD(
- "OnNanNotifyResponse: transaction_id=%d, status=%d, value=%d, response_type=%d",
- id, msg->status, msg->value, msg->response_type);
+ "OnNanNotifyResponse: transaction_id=%d, status=%d, nan_error=%s, response_type=%d",
+ id, msg->status, msg->nan_error, msg->response_type);
JNIHelper helper(mVM);
+ JNIObject<jstring> nan_error = helper.newStringUTF(msg->nan_error);
switch (msg->response_type) {
case NAN_RESPONSE_PUBLISH:
helper.reportEvent(mCls, "onAwareNotifyResponsePublishSubscribe",
- "(SIIII)V", (short) id, (int) msg->response_type,
- (int) msg->status, (int) msg->value,
+ "(SIILjava/lang/String;I)V", (short) id, (int) msg->response_type,
+ (int) msg->status, nan_error.get(),
msg->body.publish_response.publish_id);
break;
case NAN_RESPONSE_SUBSCRIBE:
helper.reportEvent(mCls, "onAwareNotifyResponsePublishSubscribe",
- "(SIIII)V", (short) id, (int) msg->response_type,
- (int) msg->status, (int) msg->value,
+ "(SIILjava/lang/String;I)V", (short) id, (int) msg->response_type,
+ (int) msg->status, nan_error.get(),
msg->body.subscribe_response.subscribe_id);
break;
case NAN_GET_CAPABILITIES: {
@@ -104,19 +105,19 @@ static void OnNanNotifyResponse(transaction_id id, NanResponseMsg* msg) {
helper.reportEvent(
mCls, "onAwareNotifyResponseCapabilities",
- "(SIILcom/android/server/wifi/aware/WifiAwareNative$Capabilities;)V",
- (short) id, (int) msg->status, (int) msg->value, data.get());
+ "(SILjava/lang/String;Lcom/android/server/wifi/aware/WifiAwareNative$Capabilities;)V",
+ (short) id, (int) msg->status, nan_error.get(), data.get());
break;
}
case NAN_DP_INITIATOR_RESPONSE:
- helper.reportEvent(mCls, "onAwareNotifyResponseDataPathInitiate", "(SIII)V", (short) id,
- (int) msg->status, (int) msg->value,
+ helper.reportEvent(mCls, "onAwareNotifyResponseDataPathInitiate", "(SILjava/lang/String;I)V",
+ (short) id, (int) msg->status, nan_error.get(),
msg->body.data_request_response.ndp_instance_id);
break;
default:
- helper.reportEvent(mCls, "onAwareNotifyResponse", "(SIII)V", (short) id,
+ helper.reportEvent(mCls, "onAwareNotifyResponse", "(SIILjava/lang/String;)V", (short) id,
(int) msg->response_type, (int) msg->status,
- (int) msg->value);
+ nan_error.get());
break;
}
}
diff --git a/tests/wifitests/jni/wifi_aware_hal_mock.cpp b/tests/wifitests/jni/wifi_aware_hal_mock.cpp
index ae5a259ef..d3d1a884c 100644
--- a/tests/wifitests/jni/wifi_aware_hal_mock.cpp
+++ b/tests/wifitests/jni/wifi_aware_hal_mock.cpp
@@ -489,7 +489,6 @@ extern "C" void Java_com_android_server_wifi_aware_WifiAwareHalMock_callNotifyRe
NanResponseMsg msg;
msg.status = (NanStatusType) jsonR.get_int("status", &error);
- msg.value = jsonR.get_int("value", &error);
msg.response_type = (NanResponseType) jsonR.get_int("response_type", &error);
if (msg.response_type == NAN_RESPONSE_PUBLISH) {
msg.body.publish_response.publish_id = jsonR.get_int(
diff --git a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareHalTest.java b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareHalTest.java
index 100b37295..489fe6d46 100644
--- a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareHalTest.java
@@ -327,7 +327,6 @@ public class WifiAwareHalTest {
Bundle args = new Bundle();
args.putInt("status", WifiAwareNative.AWARE_STATUS_SUCCESS);
- args.putInt("value", 0);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_GET_CAPABILITIES);
args.putInt("body.aware_capabilities.max_concurrent_aware_clusters",
@@ -387,7 +386,6 @@ public class WifiAwareHalTest {
Bundle args = new Bundle();
args.putInt("status", WifiAwareNative.AWARE_STATUS_SUCCESS);
- args.putInt("value", 0);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_ENABLED);
WifiAwareHalMock.callNotifyResponse(transactionId,
@@ -402,15 +400,14 @@ public class WifiAwareHalTest {
final short transactionId = 23;
Bundle args = new Bundle();
- args.putInt("status", WifiAwareNative.AWARE_STATUS_INVALID_BAND_CONFIG_FLAGS);
- args.putInt("value", 0);
+ args.putInt("status", WifiAwareNative.AWARE_STATUS_INVALID_PARAM);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_ENABLED);
WifiAwareHalMock.callNotifyResponse(transactionId,
HalMockUtils.convertBundleToJson(args).toString());
verify(mAwareStateManager).onConfigFailedResponse(transactionId,
- WifiAwareNative.AWARE_STATUS_INVALID_BAND_CONFIG_FLAGS);
+ WifiAwareNative.AWARE_STATUS_INVALID_PARAM);
verifyNoMoreInteractions(mAwareStateManager);
}
@@ -421,7 +418,6 @@ public class WifiAwareHalTest {
Bundle args = new Bundle();
args.putInt("status", WifiAwareNative.AWARE_STATUS_SUCCESS);
- args.putInt("value", 0);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_PUBLISH);
args.putInt("body.publish_response.publish_id", publishId);
@@ -438,8 +434,7 @@ public class WifiAwareHalTest {
final int publishId = 127;
Bundle args = new Bundle();
- args.putInt("status", WifiAwareNative.AWARE_STATUS_NO_SPACE_AVAILABLE);
- args.putInt("value", 57);
+ args.putInt("status", WifiAwareNative.AWARE_STATUS_NO_RESOURCE_AVAILABLE);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_PUBLISH);
args.putInt("body.publish_response.publish_id", publishId);
@@ -447,7 +442,7 @@ public class WifiAwareHalTest {
HalMockUtils.convertBundleToJson(args).toString());
verify(mAwareStateManager).onSessionConfigFailResponse(transactionId, true,
- WifiAwareNative.AWARE_STATUS_NO_SPACE_AVAILABLE);
+ WifiAwareNative.AWARE_STATUS_NO_RESOURCE_AVAILABLE);
verifyNoMoreInteractions(mAwareStateManager);
}
@@ -457,7 +452,6 @@ public class WifiAwareHalTest {
Bundle args = new Bundle();
args.putInt("status", WifiAwareNative.AWARE_STATUS_SUCCESS);
- args.putInt("value", 0);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_PUBLISH_CANCEL);
WifiAwareHalMock.callNotifyResponse(transactionId,
@@ -473,7 +467,6 @@ public class WifiAwareHalTest {
Bundle args = new Bundle();
args.putInt("status", WifiAwareNative.AWARE_STATUS_SUCCESS);
- args.putInt("value", 0);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_SUBSCRIBE);
args.putInt("body.subscribe_response.subscribe_id", subscribeId);
@@ -491,8 +484,7 @@ public class WifiAwareHalTest {
final int subscribeId = 198;
Bundle args = new Bundle();
- args.putInt("status", WifiAwareNative.AWARE_STATUS_DE_FAILURE);
- args.putInt("value", 0);
+ args.putInt("status", WifiAwareNative.AWARE_STATUS_INTERNAL_FAILURE);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_SUBSCRIBE);
args.putInt("body.subscribe_response.subscribe_id", subscribeId);
@@ -500,7 +492,7 @@ public class WifiAwareHalTest {
HalMockUtils.convertBundleToJson(args).toString());
verify(mAwareStateManager).onSessionConfigFailResponse(transactionId, false,
- WifiAwareNative.AWARE_STATUS_DE_FAILURE);
+ WifiAwareNative.AWARE_STATUS_INTERNAL_FAILURE);
verifyNoMoreInteractions(mAwareStateManager);
}
@@ -509,8 +501,7 @@ public class WifiAwareHalTest {
final short transactionId = 23;
Bundle args = new Bundle();
- args.putInt("status", WifiAwareNative.AWARE_STATUS_DE_FAILURE);
- args.putInt("value", 0);
+ args.putInt("status", WifiAwareNative.AWARE_STATUS_INTERNAL_FAILURE);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_SUBSCRIBE_CANCEL);
WifiAwareHalMock.callNotifyResponse(transactionId,
@@ -525,7 +516,6 @@ public class WifiAwareHalTest {
Bundle args = new Bundle();
args.putInt("status", WifiAwareNative.AWARE_STATUS_SUCCESS);
- args.putInt("value", 0);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_TRANSMIT_FOLLOWUP);
WifiAwareHalMock.callNotifyResponse(transactionId,
@@ -540,26 +530,24 @@ public class WifiAwareHalTest {
final short transactionId = 45;
Bundle args = new Bundle();
- args.putInt("status", WifiAwareNative.AWARE_STATUS_TIMEOUT);
- args.putInt("value", 0);
+ args.putInt("status", WifiAwareNative.AWARE_STATUS_INTERNAL_FAILURE);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_TRANSMIT_FOLLOWUP);
WifiAwareHalMock.callNotifyResponse(transactionId,
HalMockUtils.convertBundleToJson(args).toString());
verify(mAwareStateManager).onMessageSendQueuedFailResponse(transactionId,
- WifiAwareNative.AWARE_STATUS_TIMEOUT);
+ WifiAwareNative.AWARE_STATUS_INTERNAL_FAILURE);
verifyNoMoreInteractions(mAwareStateManager);
}
@Test
public void testNotifyResponseCreateDataPath() throws JSONException {
final short transactionId = 48;
- final int reason = WifiAwareNative.AWARE_STATUS_TIMEOUT;
+ final int reason = WifiAwareNative.AWARE_STATUS_INTERNAL_FAILURE;
Bundle args = new Bundle();
args.putInt("status", reason);
- args.putInt("value", 0);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_DP_INTERFACE_CREATE);
WifiAwareHalMock.callNotifyResponse(transactionId,
@@ -572,11 +560,10 @@ public class WifiAwareHalTest {
@Test
public void testNotifyResponseDeleteDataPath() throws JSONException {
final short transactionId = 49;
- final int reason = WifiAwareNative.AWARE_STATUS_DE_FAILURE;
+ final int reason = WifiAwareNative.AWARE_STATUS_INTERNAL_FAILURE;
Bundle args = new Bundle();
args.putInt("status", reason);
- args.putInt("value", 0);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_DP_INTERFACE_DELETE);
WifiAwareHalMock.callNotifyResponse(transactionId,
@@ -593,7 +580,6 @@ public class WifiAwareHalTest {
Bundle args = new Bundle();
args.putInt("status", WifiAwareNative.AWARE_STATUS_SUCCESS);
- args.putInt("value", 0);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_DP_INITIATOR_RESPONSE);
args.putInt("body.data_request_response.ndp_instance_id", ndpId);
@@ -607,11 +593,10 @@ public class WifiAwareHalTest {
@Test
public void testNotifyResponseInitiateDataPathFail() throws JSONException {
final short transactionId = 49;
- final int reason = WifiAwareNative.AWARE_STATUS_NDP_DATA_INITIATOR_REQUEST_FAILED;
+ final int reason = WifiAwareNative.AWARE_STATUS_INVALID_PARAM;
Bundle args = new Bundle();
args.putInt("status", reason);
- args.putInt("value", 0);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_DP_INITIATOR_RESPONSE);
args.putInt("body.data_request_response.ndp_instance_id", 5555); // NOP
@@ -625,11 +610,10 @@ public class WifiAwareHalTest {
@Test
public void testNotifyResponseRespondToDataPathSetupRequest() throws JSONException {
final short transactionId = 50;
- final int reason = WifiAwareNative.AWARE_STATUS_DISABLE_IN_PROGRESS;
+ final int reason = WifiAwareNative.AWARE_STATUS_NAN_NOT_ALLOWED;
Bundle args = new Bundle();
args.putInt("status", reason);
- args.putInt("value", 0);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_DP_RESPONDER_RESPONSE);
WifiAwareHalMock.callNotifyResponse(transactionId,
@@ -643,11 +627,10 @@ public class WifiAwareHalTest {
@Test
public void testNotifyResponseEndDataPath() throws JSONException {
final short transactionId = 50;
- final int reason = WifiAwareNative.AWARE_STATUS_NDP_END_FAILED;
+ final int reason = WifiAwareNative.AWARE_STATUS_INVALID_NDP_ID;
Bundle args = new Bundle();
args.putInt("status", reason);
- args.putInt("value", 0);
args.putInt("response_type", WifiAwareNative.AWARE_RESPONSE_DP_END);
WifiAwareHalMock.callNotifyResponse(transactionId,
@@ -664,7 +647,6 @@ public class WifiAwareHalTest {
Bundle args = new Bundle();
args.putInt("status", WifiAwareNative.AWARE_STATUS_SUCCESS);
- args.putInt("value", 0);
args.putInt("response_type", invalidTransactionId);
WifiAwareHalMock.callNotifyResponse(transactionId,
@@ -679,7 +661,7 @@ public class WifiAwareHalTest {
Bundle args = new Bundle();
args.putInt("publish_id", publishId);
- args.putInt("reason", WifiAwareNative.AWARE_TERMINATED_REASON_COUNT_REACHED);
+ args.putInt("reason", WifiAwareNative.AWARE_STATUS_SUCCESS);
WifiAwareHalMock.callPublishTerminated(HalMockUtils.convertBundleToJson(args).toString());
@@ -694,7 +676,7 @@ public class WifiAwareHalTest {
Bundle args = new Bundle();
args.putInt("subscribe_id", subscribeId);
- args.putInt("reason", WifiAwareNative.AWARE_TERMINATED_REASON_FAILURE);
+ args.putInt("reason", WifiAwareNative.AWARE_STATUS_INTERNAL_FAILURE);
WifiAwareHalMock.callSubscribeTerminated(HalMockUtils.convertBundleToJson(args).toString());
@@ -796,11 +778,12 @@ public class WifiAwareHalTest {
@Test
public void testDisabled() throws JSONException {
Bundle args = new Bundle();
- args.putInt("reason", WifiAwareNative.AWARE_STATUS_DE_FAILURE);
+ args.putInt("reason", WifiAwareNative.AWARE_STATUS_INTERNAL_FAILURE);
WifiAwareHalMock.callDisabled(HalMockUtils.convertBundleToJson(args).toString());
- verify(mAwareStateManager).onAwareDownNotification(WifiAwareNative.AWARE_STATUS_DE_FAILURE);
+ verify(mAwareStateManager).onAwareDownNotification(
+ WifiAwareNative.AWARE_STATUS_INTERNAL_FAILURE);
verifyNoMoreInteractions(mAwareStateManager);
}
@@ -824,12 +807,12 @@ public class WifiAwareHalTest {
Bundle args = new Bundle();
args.putInt("id", transactionId);
- args.putInt("reason", WifiAwareNative.AWARE_STATUS_TX_FAIL);
+ args.putInt("reason", WifiAwareNative.AWARE_STATUS_NO_OTA_ACK);
WifiAwareHalMock.callTransmitFollowup(HalMockUtils.convertBundleToJson(args).toString());
verify(mAwareStateManager).onMessageSendFailNotification(transactionId,
- WifiAwareNative.AWARE_STATUS_TX_FAIL);
+ WifiAwareNative.AWARE_STATUS_NO_OTA_ACK);
verifyNoMoreInteractions(mAwareStateManager);
}
diff --git a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareRttStateManagerTest.java b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareRttStateManagerTest.java
index a4b75c296..ebc7935a6 100644
--- a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareRttStateManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareRttStateManagerTest.java
@@ -29,10 +29,10 @@ import android.net.wifi.IRttManager;
import android.net.wifi.RttManager;
import android.os.Handler;
import android.os.Message;
+import android.os.test.TestLooper;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.internal.util.test.BidirectionalAsyncChannelServer;
-import android.os.test.TestLooper;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java
index 42492039f..e80784576 100644
--- a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java
@@ -1475,7 +1475,7 @@ public class WifiAwareStateManagerTest {
// (4) loop and fail until reach retryCount
for (int i = 0; i < retryCount; ++i) {
mDut.onMessageSendFailNotification(transactionId.getValue(),
- WifiAwareNative.AWARE_STATUS_TX_FAIL);
+ WifiAwareNative.AWARE_STATUS_NO_OTA_ACK);
mMockLooper.dispatchAll();
inOrder.verify(mMockNative).sendMessage(transactionId.capture(), eq(subscribeId),
eq(requestorId), eq(peerMac), eq(ssi.getBytes()), eq(messageId));
@@ -1562,7 +1562,7 @@ public class WifiAwareStateManagerTest {
// (4) loop and fail until reach retryCount+1
for (int i = 0; i < retryCount + 1; ++i) {
mDut.onMessageSendFailNotification(transactionId.getValue(),
- WifiAwareNative.AWARE_STATUS_TX_FAIL);
+ WifiAwareNative.AWARE_STATUS_NO_OTA_ACK);
mMockLooper.dispatchAll();
if (i != retryCount) {
@@ -1574,7 +1574,7 @@ public class WifiAwareStateManagerTest {
}
inOrder.verify(mockSessionCallback).onMessageSendFail(messageId,
- WifiAwareNative.AWARE_STATUS_TX_FAIL);
+ WifiAwareNative.AWARE_STATUS_NO_OTA_ACK);
validateInternalSendMessageQueuesCleanedUp(messageId);
verifyNoMoreInteractions(mockCallback, mockSessionCallback, mMockNative);
@@ -1873,7 +1873,7 @@ public class WifiAwareStateManagerTest {
mDut.onMessageSendQueuedSuccessResponse(transactionId);
if (!packetRetx) {
mDut.onMessageSendFailNotification(transactionId,
- WifiAwareNative.AWARE_STATUS_TX_FAIL);
+ WifiAwareNative.AWARE_STATUS_NO_OTA_ACK);
} else {
ops[OP_QUEUE_OK_SEND_RETX_OK]++;
mDut.onMessageSendSuccessNotification(transactionId);