Disable uncaught exception handling.
It's uncovering existing failures that need to be chased elsewhere.
Bug: 323438048
Test: TH
Change-Id: Ife5bb2d72b1a575c3a11d2486e73dd210403d77a
diff --git a/core/tests/coretests/src/android/os/HandlerThreadTest.java b/core/tests/coretests/src/android/os/HandlerThreadTest.java
index 1ad71da..3237812 100644
--- a/core/tests/coretests/src/android/os/HandlerThreadTest.java
+++ b/core/tests/coretests/src/android/os/HandlerThreadTest.java
@@ -126,7 +126,7 @@
public void testUncaughtExceptionFails() throws Exception {
// For the moment we can only test Ravenwood; on a physical device uncaught exceptions
// are detected, but reported as test failures at a higher level where we can't inspect
- Assume.assumeTrue(RavenwoodRule.isOnRavenwood());
+ Assume.assumeTrue(false); // TODO: re-enable
mThrown.expect(IllegalStateException.class);
final HandlerThread thread = new HandlerThread("HandlerThreadTest");
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java
index 85fa65a..7b5932b 100644
--- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java
@@ -58,6 +58,11 @@
private static ScheduledFuture<?> sPendingTimeout;
/**
+ * When enabled, attempt to detect uncaught exceptions from background threads.
+ */
+ private static final boolean ENABLE_UNCAUGHT_EXCEPTION_DETECTION = false;
+
+ /**
* When set, an unhandled exception was discovered (typically on a background thread), and we
* capture it here to ensure it's reported as a test failure.
*/
@@ -75,8 +80,10 @@
}
public static void init(RavenwoodRule rule) {
- maybeThrowPendingUncaughtException(false);
- Thread.setDefaultUncaughtExceptionHandler(sUncaughtExceptionHandler);
+ if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) {
+ maybeThrowPendingUncaughtException(false);
+ Thread.setDefaultUncaughtExceptionHandler(sUncaughtExceptionHandler);
+ }
RuntimeInit.redirectLogStreams();
@@ -129,7 +136,9 @@
android.os.Binder.reset$ravenwood();
android.os.Process.reset$ravenwood();
- maybeThrowPendingUncaughtException(true);
+ if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) {
+ maybeThrowPendingUncaughtException(true);
+ }
}
public static void logTestRunner(String label, Description description) {