Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ff8d6b1 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Disable uncaught exception handling.

It's uncovering existing failures that need to be chased elsewhere.

Bug: 323438048
Test: TH
Change-Id: Ife5bb2d72b1a575c3a11d2486e73dd210403d77a
parent 5d269216
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ public class HandlerThreadTest {
    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");
+12 −3
Original line number Diff line number Diff line
@@ -57,6 +57,11 @@ public class RavenwoodRuleImpl {

    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 class RavenwoodRuleImpl {
    }

    public static void init(RavenwoodRule rule) {
        if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) {
            maybeThrowPendingUncaughtException(false);
            Thread.setDefaultUncaughtExceptionHandler(sUncaughtExceptionHandler);
        }

        RuntimeInit.redirectLogStreams();

@@ -129,8 +136,10 @@ public class RavenwoodRuleImpl {
        android.os.Binder.reset$ravenwood();
        android.os.Process.reset$ravenwood();

        if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) {
            maybeThrowPendingUncaughtException(true);
        }
    }

    public static void logTestRunner(String label, Description description) {
        // This message string carefully matches the exact format emitted by on-device tests, to