summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Winson Chung <winsonc@google.com> 2021-02-17 14:53:22 -0800
committer Winson Chung <winsonc@google.com> 2021-02-17 14:53:22 -0800
commit1485f80bad6895bf10c27a3958cfc1099d3e6cb6 (patch)
treedf26f90dbca21c23e2d5e755668f8cbeff71f83f
parent857efd19a413356c102d5b5451f94c301cf4db6b (diff)
Enable shell thread
Bug: 161979899 Test: atest WMShellUnitTests Test: atest SystemUITests Change-Id: I5264807b62d0a02013f48a408a64e9a06c7e2c59
-rw-r--r--packages/SystemUI/res/values/config.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java18
2 files changed, 15 insertions, 6 deletions
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 78927f8bf8d4..3037a8825615 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -573,4 +573,7 @@
<!-- Whether to use the split 2-column notification shade -->
<bool name="config_use_split_notification_shade">false</bool>
+
+ <!-- Determines whether the shell features all run on another thread. -->
+ <bool name="config_enableShellMainThread">false</bool>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java b/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java
index fba0b0079012..4d53da9bc5a9 100644
--- a/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java
+++ b/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java
@@ -31,6 +31,7 @@ import android.view.WindowManager;
import com.android.internal.graphics.SfVsyncFrameCallbackProvider;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.statusbar.IStatusBarService;
+import com.android.systemui.R;
import com.android.systemui.dagger.WMComponent;
import com.android.systemui.dagger.WMSingleton;
import com.android.systemui.dagger.qualifiers.Main;
@@ -97,7 +98,12 @@ import dagger.Provides;
@Module
public abstract class WMShellBaseModule {
- private static final boolean ENABLE_SHELL_MAIN_THREAD = false;
+ /**
+ * Returns whether to enable a separate shell thread for the shell features.
+ */
+ private static boolean enableShellMainThread(Context context) {
+ return context.getResources().getBoolean(R.bool.config_enableShellMainThread);
+ }
//
// Shell Concurrency - Components used for managing threading in the Shell and SysUI
@@ -120,8 +126,8 @@ public abstract class WMShellBaseModule {
@WMSingleton
@Provides
@ShellMainThread
- public static Handler provideShellMainHandler(@Main Handler sysuiMainHandler) {
- if (ENABLE_SHELL_MAIN_THREAD) {
+ public static Handler provideShellMainHandler(Context context, @Main Handler sysuiMainHandler) {
+ if (enableShellMainThread(context)) {
HandlerThread mainThread = new HandlerThread("wmshell.main");
mainThread.start();
return mainThread.getThreadHandler();
@@ -135,9 +141,9 @@ public abstract class WMShellBaseModule {
@WMSingleton
@Provides
@ShellMainThread
- public static ShellExecutor provideShellMainExecutor(@ShellMainThread Handler mainHandler,
- @Main ShellExecutor sysuiMainExecutor) {
- if (ENABLE_SHELL_MAIN_THREAD) {
+ public static ShellExecutor provideShellMainExecutor(Context context,
+ @ShellMainThread Handler mainHandler, @Main ShellExecutor sysuiMainExecutor) {
+ if (enableShellMainThread(context)) {
return new HandlerExecutor(mainHandler);
}
return sysuiMainExecutor;