Merge "Change TetheringManager#RequestDispatcher as static" into main
diff --git a/Tethering/common/TetheringLib/src/android/net/TetheringManager.java b/Tethering/common/TetheringLib/src/android/net/TetheringManager.java
index 5aca642..411971d 100644
--- a/Tethering/common/TetheringLib/src/android/net/TetheringManager.java
+++ b/Tethering/common/TetheringLib/src/android/net/TetheringManager.java
@@ -430,7 +430,7 @@
// Used to dispatch legacy ConnectivityManager methods that expect tethering to be able to
// return results and perform operations synchronously.
// TODO: remove once there are no callers of these legacy methods.
- private class RequestDispatcher {
+ private static class RequestDispatcher {
private final ConditionVariable mWaiting;
public volatile int mRemoteResult;
@@ -446,8 +446,8 @@
mWaiting = new ConditionVariable();
}
- int waitForResult(final RequestHelper request) {
- getConnector(c -> request.runRequest(c, mListener));
+ int waitForResult(final RequestHelper request, final TetheringManager mgr) {
+ mgr.getConnector(c -> request.runRequest(c, mListener));
if (!mWaiting.block(DEFAULT_TIMEOUT_MS)) {
throw new IllegalStateException("Callback timeout");
}
@@ -603,7 +603,7 @@
} catch (RemoteException e) {
throw new IllegalStateException(e);
}
- });
+ }, this);
}
/**
@@ -635,7 +635,7 @@
} catch (RemoteException e) {
throw new IllegalStateException(e);
}
- });
+ }, this);
}
/**
@@ -663,7 +663,7 @@
} catch (RemoteException e) {
throw new IllegalStateException(e);
}
- });
+ }, this);
}
/**
@@ -1751,7 +1751,7 @@
} catch (RemoteException e) {
throw new IllegalStateException(e);
}
- });
+ }, this);
return ret == TETHER_ERROR_NO_ERROR;
}
@@ -1800,6 +1800,6 @@
} catch (RemoteException e) {
throw new IllegalStateException(e);
}
- });
+ }, this);
}
}