Replace runWithScissors with a custom implementation.

This is not any better than the previous code though...
But it should behave the same.

Test: FrameworksNetTests
Change-Id: Ia3d379681cb0f17dd5f86062b7cfe84f1547fadb
This commit is contained in:
Chalard Jean
2022-01-20 16:22:33 +09:00
parent b63e7aebee
commit 6339ef0b4e

View File

@@ -34,6 +34,7 @@ import android.net.IpConfiguration.ProxySettings;
import android.net.LinkAddress;
import android.net.NetworkCapabilities;
import android.net.StaticIpConfiguration;
import android.os.ConditionVariable;
import android.os.Handler;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
@@ -662,7 +663,13 @@ public class EthernetTracker {
}
private void postAndWaitForRunnable(Runnable r) {
mHandler.runWithScissors(r, 2000L /* timeout */);
final ConditionVariable cv = new ConditionVariable();
if (mHandler.post(() -> {
r.run();
cv.open();
})) {
cv.block(2000L);
}
}
void dump(FileDescriptor fd, IndentingPrintWriter pw, String[] args) {