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

Commit 000861fd authored by Zaiyue Xue's avatar Zaiyue Xue
Browse files

Add @JvmStatic to kotlin util methods

So that java code can call it directly.

Bug: 384795117
Test: manual
Flag: EXEMPT bug fix
Change-Id: I28eb735d4d29287761c88c01fcde039da866da5a
parent 3bed59a9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -31,18 +31,21 @@ import java.util.concurrent.Executors
 */
object LifecycleAwareExecutorFactory {

    @JvmStatic
    fun newSingleThreadExecutor(lifecycle: Lifecycle?): ExecutorService {
        return Executors.newSingleThreadExecutor().also { executor ->
            executor.autoShutdown(lifecycle)
        }
    }

    @JvmStatic
    fun newFixedThreadPool(lifecycle: Lifecycle?, nThreads: Int): ExecutorService {
        return Executors.newFixedThreadPool(nThreads).also { executor ->
            executor.autoShutdown(lifecycle)
        }
    }

    @JvmStatic
    fun newCachedThreadPool(lifecycle: Lifecycle?): ExecutorService {
        return Executors.newCachedThreadPool().also { executor ->
            executor.autoShutdown(lifecycle)