summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/TestLooper.java8
2 files changed, 4 insertions, 5 deletions
diff --git a/Android.bp b/Android.bp
index bef6c85049..d23d8552d7 100644
--- a/Android.bp
+++ b/Android.bp
@@ -167,6 +167,7 @@ java_defaults {
"-Xep:StringCaseLocaleUsage:ERROR",
"-Xep:StringCharset:ERROR",
"-Xep:SynchronizeOnNonFinalField:ERROR",
+ "-Xep:ThreadJoinLoop:ERROR",
"-Xep:ToStringReturnsNull:ERROR",
"-Xep:TruthConstantAsserts:ERROR",
"-Xep:TruthIncompatibleType:ERROR",
diff --git a/android/app/tests/unit/src/com/android/bluetooth/TestLooper.java b/android/app/tests/unit/src/com/android/bluetooth/TestLooper.java
index 31f4515578..ae64352e37 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/TestLooper.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/TestLooper.java
@@ -27,6 +27,8 @@ import android.util.Log;
import com.android.modules.utils.HandlerExecutor;
+import com.google.common.util.concurrent.Uninterruptibles;
+
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -298,11 +300,7 @@ public class TestLooper {
if (mAutoDispatchThread.isAlive()) {
mAutoDispatchThread.interrupt();
}
- try {
- mAutoDispatchThread.join();
- } catch (InterruptedException e) {
- // Catch exception from join.
- }
+ Uninterruptibles.joinUninterruptibly(mAutoDispatchThread);
RuntimeException e = mAutoDispatchThread.getException();
mAutoDispatchThread = null;