summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2018-07-20 22:08:21 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-07-20 22:08:21 +0000
commitfcd742419689038226ead41a1672b1fb1b7fc40a (patch)
tree6961c9b428c596d70aec246f3715a8aa5b23ec16 /service
parent5f8a8498536179c6d7060f712c73f5346036936f (diff)
parentdfa13f1f48895759f77e5522e9c106765de327c8 (diff)
Merge "[RTT] Recreate RTT controller when HAL indicates it is invalid"
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/rtt/RttNative.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/rtt/RttNative.java b/service/java/com/android/server/wifi/rtt/RttNative.java
index accd1a2f8..34fd2e3e7 100644
--- a/service/java/com/android/server/wifi/rtt/RttNative.java
+++ b/service/java/com/android/server/wifi/rtt/RttNative.java
@@ -166,6 +166,11 @@ public class RttNative extends IWifiRttControllerEventCallback.Stub {
*/
public boolean rangeRequest(int cmdId, RangingRequest request,
boolean isCalledFromPrivilegedContext) {
+ return rangeRequestInternal(cmdId, request, isCalledFromPrivilegedContext, true);
+ }
+
+ private boolean rangeRequestInternal(int cmdId, RangingRequest request,
+ boolean isCalledFromPrivilegedContext, boolean tryToReinitIfNecessary) {
if (mDbg) {
Log.v(TAG,
"rangeRequest: cmdId=" + cmdId + ", # of requests=" + request.mRttPeers.size());
@@ -175,6 +180,11 @@ public class RttNative extends IWifiRttControllerEventCallback.Stub {
synchronized (mLock) {
if (!isReady()) {
Log.e(TAG, "rangeRequest: RttController is null");
+ if (tryToReinitIfNecessary) {
+ updateController();
+ return rangeRequestInternal(cmdId, request, isCalledFromPrivilegedContext,
+ false);
+ }
return false;
}
@@ -192,6 +202,14 @@ public class RttNative extends IWifiRttControllerEventCallback.Stub {
try {
WifiStatus status = mIWifiRttController.rangeRequest(cmdId, rttConfig);
+ if (status.code == WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID
+ && tryToReinitIfNecessary) {
+ Log.d(TAG, "rangeRequest: RTT controller invalidated from under us - reinit!");
+ mIWifiRttController = null;
+ updateController();
+ return rangeRequestInternal(cmdId, request, isCalledFromPrivilegedContext,
+ false);
+ }
if (status.code != WifiStatusCode.SUCCESS) {
Log.e(TAG, "rangeRequest: cannot issue range request -- code=" + status.code);
return false;