diff options
author | 2025-02-04 21:31:20 -0800 | |
---|---|---|
committer | 2025-02-04 21:31:20 -0800 | |
commit | cf68d0c99c988fe33b7f9c0bec99d2a4aa0969e3 (patch) | |
tree | 3dae3d70ff3eaeefe3dc7bc19b8b73b8ad7ec178 | |
parent | 7ac313343a03631b0e837b0925e518a542fb8e24 (diff) | |
parent | 8a4c787cf30ef36375d505321d72a07dd7fb6dd8 (diff) |
Merge "Add ShellDesktopThread" into main
2 files changed, 47 insertions, 1 deletions
diff --git a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/annotations/ShellDesktopThread.java b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/annotations/ShellDesktopThread.java new file mode 100644 index 000000000000..cfa00bbb7649 --- /dev/null +++ b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/annotations/ShellDesktopThread.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.wm.shell.shared.annotations; + +import java.lang.annotation.Documented; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import javax.inject.Qualifier; + +/** Annotates a method or qualifies a provider that runs on the Shell desktop thread */ +@Documented +@Inherited +@Qualifier +@Retention(RetentionPolicy.RUNTIME) +public @interface ShellDesktopThread { +} diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellConcurrencyModule.java b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellConcurrencyModule.java index d7ddbdeaa6da..ee3e39e71558 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellConcurrencyModule.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellConcurrencyModule.java @@ -37,6 +37,7 @@ import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.shared.annotations.ExternalMainThread; import com.android.wm.shell.shared.annotations.ShellAnimationThread; 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 com.android.wm.shell.shared.annotations.ShellSplashscreenThread; @@ -193,13 +194,26 @@ public abstract class WMShellConcurrencyModule { } /** + * Provides a Shell desktop thread Executor + */ + @WMSingleton + @Provides + @ShellDesktopThread + public static ShellExecutor provideDesktopModeMiscExecutor() { + HandlerThread shellDesktopThread = new HandlerThread("wmshell.desktop", + THREAD_PRIORITY_TOP_APP_BOOST); + shellDesktopThread.start(); + return new HandlerExecutor(shellDesktopThread.getThreadHandler()); + } + + /** * Provides a Shell background thread Handler for low priority background tasks. */ @WMSingleton @Provides @ShellBackgroundThread public static Handler provideSharedBackgroundHandler() { - HandlerThread shellBackgroundThread = new HandlerThread("wmshell.background", + final HandlerThread shellBackgroundThread = new HandlerThread("wmshell.background", THREAD_PRIORITY_BACKGROUND); shellBackgroundThread.start(); return shellBackgroundThread.getThreadHandler(); |