diff options
author | Etan Cohen <etancohen@google.com> | 2018-08-01 23:02:50 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-08-01 23:02:50 +0000 |
commit | 4abb52b9125356b97adda4e430188b8a976fdc6c (patch) | |
tree | 4ae4af785675249bcd912ccc2f1255b6039e6313 /service | |
parent | 4fc8cdcbb46c788d3e55e23b8cd1dbe061369bc8 (diff) | |
parent | 0ebd13f268eaca16e396089983475674620632f3 (diff) |
Merge "[RTT] Recreate RTT controller when HAL indicates it is invalid" into pi-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/rtt/RttNative.java | 18 |
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; |