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
diff --git a/java/com/android/server/ethernet/EthernetTracker.java b/java/com/android/server/ethernet/EthernetTracker.java
index 0b6547d..53af955 100644
--- a/java/com/android/server/ethernet/EthernetTracker.java
+++ b/java/com/android/server/ethernet/EthernetTracker.java
@@ -34,6 +34,7 @@
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 @@
}
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) {