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

Commit 52f6df19 authored by Qijing Yao's avatar Qijing Yao Committed by Android (Google) Code Review
Browse files

Merge "Add DesktopDispatcher" into main

parents 30517800 09e46db7
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -203,16 +203,27 @@ public abstract class WMShellConcurrencyModule {
    }

    /**
     * Provides a Shell desktop thread Executor
     * Provides a Shell desktop thread Handler for desktop mode related tasks.
     */
    @WMSingleton
    @Provides
    @ShellDesktopThread
    public static ShellExecutor provideDesktopModeMiscExecutor() {
    public static Handler provideDesktopModeMiscHandler() {
        HandlerThread shellDesktopThread = new HandlerThread("wmshell.desktop",
                THREAD_PRIORITY_TOP_APP_BOOST);
        shellDesktopThread.start();
        return new HandlerExecutor(shellDesktopThread.getThreadHandler());
        return shellDesktopThread.getThreadHandler();
    }

    /**
     * Provides a Shell desktop thread Executor for desktop mode related tasks.
     */
    @WMSingleton
    @Provides
    @ShellDesktopThread
    public static ShellExecutor provideDesktopModeMiscExecutor(
            @ShellDesktopThread Handler handler) {
        return new HandlerExecutor(handler);
    }

    /**
+7 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.wm.shell.dagger
import android.os.Handler
import com.android.wm.shell.common.ShellExecutor
import com.android.wm.shell.shared.annotations.ShellBackgroundThread
import com.android.wm.shell.shared.annotations.ShellDesktopThread
import com.android.wm.shell.shared.annotations.ShellMainThread
import dagger.Module
import dagger.Provides
@@ -57,6 +58,12 @@ class WMShellCoroutinesModule {
      @ShellBackgroundThread backgroundHandler: Handler
  ): MainCoroutineDispatcher = backgroundHandler.asCoroutineDispatcher()

  @Provides
  @ShellDesktopThread
  fun provideDesktopDispatcher(
    @ShellDesktopThread desktopHandler: Handler
  ): MainCoroutineDispatcher = desktopHandler.asCoroutineDispatcher()

  @Provides
  @WMSingleton
  @ShellMainThread