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

Commit fecc78e4 authored by Hall Liu's avatar Hall Liu
Browse files

Fix thread leak in ImsManagerTest

Add methods to stop the default executor's HandlerThread during testing

Bug: 156287358
Test: atest FrameworksTelephonyTests
Change-Id: Iea3553c9564a45b85596aacd5012e26b712a832d
parent 2a4164bf
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -210,7 +210,8 @@ public class ImsManager implements IFeatureConnector {
        void executeRunnable(Runnable runnable);
    }

    private static class ImsExecutorFactory implements ExecutorFactory {
    @VisibleForTesting
    public static class ImsExecutorFactory implements ExecutorFactory {

        private final HandlerThread mThreadHandler;
        private final Handler mHandler;
@@ -225,6 +226,10 @@ public class ImsManager implements IFeatureConnector {
        public void executeRunnable(Runnable runnable) {
            mHandler.post(runnable);
        }

        public void destroy() {
            mThreadHandler.quit();
        }
    }

    // Replaced with single-threaded executor for testing.