summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2018-07-10 08:47:36 -0700
committerEtan Cohen <etancohen@google.com>2018-07-20 22:09:14 +0000
commit0ebd13f268eaca16e396089983475674620632f3 (patch)
treeb93a3d3e669e12ef843ba3618ef5418a9b236d07 /service
parenta52e9108f44a2770dc7b0ce00bfb4493c3f8e65e (diff)
[RTT] Recreate RTT controller when HAL indicates it is invalid
When there is a HAL mode transition the RTT controller is destroyed. Mode transition is STA - SAP and back transitions for non-DBS devices. Modification to allow framework to detect when the controller is currently invalid and try to recreate it. Will allow recovery for non-DBS devices: otherwise RTT would only recover when Wi-Fi is toggled. Note: not a full solution since the availability APIs (broadcast + API) do not perform correctly in such transitions. That fix will be deeper and require HalDeviceManager mods. Bug: 111218083 Test: (new) unit test Test: new ACTS - RangeApSupporting11McTest:test_rtt_in_and_after_softap_mode Change-Id: I6d28ef7a50b02fe42e23b9172621bd83452658f1 (cherry picked from commit dfa13f1f48895759f77e5522e9c106765de327c8)
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;