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

Commit 9045057e authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Disable uncaught exception handling." into main

parents 78704c53 4ff8d6b1
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