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

Commit 3be399d8 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Mark `HandlerThread` as daemon on Ravenwood.

Underlying test infrastructure waits for non-daemon threads to exit
at the end of any suite execution, which makes callers wait for the
unresponsive timeout to be triggered.

This change updates `HandlerThread` to be daemon so that we don't
cause the test suite execution to wait for any lingering threads
that a test author forgot to tear down.

Bug: 320520716
Test: atest FrameworksCoreTestsRavenwood:TestLooperManagerTest
Change-Id: I14a2f62dd67b059ed7ec19b13f9e16db8af68624
parent 9614500d
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ public class HandlerThread extends Thread {
    public HandlerThread(String name) {
        super(name);
        mPriority = Process.THREAD_PRIORITY_DEFAULT;
        onCreated();
    }
    
    /**
@@ -46,6 +47,19 @@ public class HandlerThread extends Thread {
    public HandlerThread(String name, int priority) {
        super(name);
        mPriority = priority;
        onCreated();
    }

    /** @hide */
    @android.ravenwood.annotation.RavenwoodReplace
    protected void onCreated() {
    }

    /** @hide */
    protected void onCreated$ravenwood() {
        // Mark ourselves as daemon to enable tests to terminate quickly when finished, despite
        // any HandlerThread instances that may be lingering around
        setDaemon(true);
    }

    /**