summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2017-02-09 15:13:26 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-02-09 15:13:27 +0000
commitee13bbb487f6484b8a7d92104c0f3d2997439db3 (patch)
tree460adba34c6153253dccda05442eaa0a28544684 /service
parent37892799c66c1de5ec1713109b12d9d9cf7459fc (diff)
parent5254a256676974e9db86fcb86b2f41af7d4a59f5 (diff)
Merge "[AWARE] Handle HAL failure correctly"
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java24
-rw-r--r--service/java/com/android/server/wifi/aware/WifiAwareStateManager.java59
2 files changed, 68 insertions, 15 deletions
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java b/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java
index f0170c695..0f9a42d7e 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java
@@ -129,7 +129,16 @@ public class WifiAwareDiscoverySessionState {
return false;
}
- return mWifiAwareNativeApi.publish(transactionId, mPubSubId, config);
+ boolean success = mWifiAwareNativeApi.publish(transactionId, mPubSubId, config);
+ if (!success) {
+ try {
+ mCallback.onSessionConfigFail(NanStatusType.INTERNAL_FAILURE);
+ } catch (RemoteException e) {
+ Log.w(TAG, "updatePublish onSessionConfigFail(): RemoteException (FYI): " + e);
+ }
+ }
+
+ return success;
}
/**
@@ -150,7 +159,16 @@ public class WifiAwareDiscoverySessionState {
return false;
}
- return mWifiAwareNativeApi.subscribe(transactionId, mPubSubId, config);
+ boolean success = mWifiAwareNativeApi.subscribe(transactionId, mPubSubId, config);
+ if (!success) {
+ try {
+ mCallback.onSessionConfigFail(NanStatusType.INTERNAL_FAILURE);
+ } catch (RemoteException e) {
+ Log.w(TAG, "updateSubscribe onSessionConfigFail(): RemoteException (FYI): " + e);
+ }
+ }
+
+ return success;
}
/**
@@ -179,7 +197,7 @@ public class WifiAwareDiscoverySessionState {
byte[] peerMac = HexEncoding.decode(peerMacStr.toCharArray(), false);
return mWifiAwareNativeApi.sendMessage(transactionId, mPubSubId, peerId, peerMac, message,
- messageId);
+ messageId);
}
/**
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java b/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java
index 2cb2355d6..dc14458cc 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java
@@ -1370,8 +1370,9 @@ public class WifiAwareStateManager {
String interfaceName = data.getString(MESSAGE_BUNDLE_KEY_INTERFACE_NAME);
byte[] token = data.getByteArray(MESSAGE_BUNDLE_KEY_MESSAGE);
- waitForResponse = initiateDataPathSetupLocal(mCurrentTransactionId, peerId,
- channelRequestType, channel, peer, interfaceName, token);
+ waitForResponse = initiateDataPathSetupLocal(mCurrentTransactionId,
+ networkSpecifier, peerId, channelRequestType, channel, peer,
+ interfaceName, token);
if (waitForResponse) {
WakeupMessage timeout = new WakeupMessage(mContext, getHandler(),
@@ -1798,8 +1799,17 @@ public class WifiAwareStateManager {
boolean notificationRequired =
doesAnyClientNeedIdentityChangeNotifications() || notifyIdentityChange;
- return mWifiAwareNativeApi.enableAndConfigure(transactionId, merged, notificationRequired,
- mCurrentAwareConfiguration == null);
+ boolean success = mWifiAwareNativeApi.enableAndConfigure(transactionId, merged,
+ notificationRequired, mCurrentAwareConfiguration == null);
+ if (!success) {
+ try {
+ callback.onConnectFail(NanStatusType.INTERNAL_FAILURE);
+ } catch (RemoteException e) {
+ Log.w(TAG, "connectLocal onConnectFail(): RemoteException (FYI): " + e);
+ }
+ }
+
+ return success;
}
private boolean disconnectLocal(short transactionId, int clientId) {
@@ -1861,7 +1871,16 @@ public class WifiAwareStateManager {
return false;
}
- return mWifiAwareNativeApi.publish(transactionId, 0, publishConfig);
+ boolean success = mWifiAwareNativeApi.publish(transactionId, 0, publishConfig);
+ if (!success) {
+ try {
+ callback.onSessionConfigFail(NanStatusType.INTERNAL_FAILURE);
+ } catch (RemoteException e) {
+ Log.w(TAG, "publishLocal onSessionConfigFail(): RemoteException (FYI): " + e);
+ }
+ }
+
+ return success;
}
private boolean updatePublishLocal(short transactionId, int clientId, int sessionId,
@@ -1900,7 +1919,16 @@ public class WifiAwareStateManager {
return false;
}
- return mWifiAwareNativeApi.subscribe(transactionId, 0, subscribeConfig);
+ boolean success = mWifiAwareNativeApi.subscribe(transactionId, 0, subscribeConfig);
+ if (!success) {
+ try {
+ callback.onSessionConfigFail(NanStatusType.INTERNAL_FAILURE);
+ } catch (RemoteException e) {
+ Log.w(TAG, "subscribeLocal onSessionConfigFail(): RemoteException (FYI): " + e);
+ }
+ }
+
+ return success;
}
private boolean updateSubscribeLocal(short transactionId, int clientId, int sessionId,
@@ -2022,18 +2050,25 @@ public class WifiAwareStateManager {
mRtt.startRanging(rangingId, client, params);
}
- private boolean initiateDataPathSetupLocal(short transactionId, int peerId,
- int channelRequestType, int channel, byte[] peer, String interfaceName, byte[] token) {
+ private boolean initiateDataPathSetupLocal(short transactionId, String networkSpecifier,
+ int peerId, int channelRequestType, int channel, byte[] peer, String interfaceName,
+ byte[] token) {
if (VDBG) {
Log.v(TAG,
- "initiateDataPathSetupLocal(): transactionId=" + transactionId + ", peerId="
- + peerId + ", channelRequestType=" + channelRequestType + ", channel="
- + channel + ", peer=" + String.valueOf(HexEncoding.encode(peer))
+ "initiateDataPathSetupLocal(): transactionId=" + transactionId
+ + ", networkSpecifier=" + networkSpecifier + ", peerId=" + peerId
+ + ", channelRequestType=" + channelRequestType + ", channel=" + channel
+ + ", peer=" + String.valueOf(HexEncoding.encode(peer))
+ ", interfaceName=" + interfaceName + ", token=" + token);
}
- return mWifiAwareNativeApi.initiateDataPath(transactionId, peerId,
+ boolean success = mWifiAwareNativeApi.initiateDataPath(transactionId, peerId,
channelRequestType, channel, peer, interfaceName, token);
+ if (!success) {
+ mDataPathMgr.onDataPathInitiateFail(networkSpecifier, NanStatusType.INTERNAL_FAILURE);
+ }
+
+ return success;
}
private boolean respondToDataPathRequestLocal(short transactionId, boolean accept,