Merge "Move dagger modules into shell library for reuse" into sc-v2-dev am: 90d2471b4c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16195494 Change-Id: Icb3ef10d52313deceeb08bff224cbf8733a107d4
This commit is contained in:
@@ -132,11 +132,12 @@ android_library {
|
|||||||
"kotlinx-coroutines-android",
|
"kotlinx-coroutines-android",
|
||||||
"kotlinx-coroutines-core",
|
"kotlinx-coroutines-core",
|
||||||
"iconloader_base",
|
"iconloader_base",
|
||||||
"jsr330",
|
|
||||||
"protolog-lib",
|
"protolog-lib",
|
||||||
"WindowManager-Shell-proto",
|
"WindowManager-Shell-proto",
|
||||||
|
"dagger2",
|
||||||
"jsr330",
|
"jsr330",
|
||||||
],
|
],
|
||||||
kotlincflags: ["-Xjvm-default=enable"],
|
kotlincflags: ["-Xjvm-default=enable"],
|
||||||
manifest: "AndroidManifest.xml",
|
manifest: "AndroidManifest.xml",
|
||||||
|
plugins: ["dagger2-compiler"],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,10 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<resources>
|
<resources>
|
||||||
|
<!-- Determines whether the shell features all run on another thread. This is to be overrided
|
||||||
|
by the resources of the app using the Shell library. -->
|
||||||
|
<bool name="config_enableShellMainThread">false</bool>
|
||||||
|
|
||||||
<!-- Animation duration for PIP when entering. -->
|
<!-- Animation duration for PIP when entering. -->
|
||||||
<integer name="config_pipEnterAnimationDuration">425</integer>
|
<integer name="config_pipEnterAnimationDuration">425</integer>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 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.common.annotations;
|
||||||
|
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
|
||||||
|
import javax.inject.Qualifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Annotates a method or qualifies a provider that runs on the main-thread of the process using
|
||||||
|
* this library.
|
||||||
|
*/
|
||||||
|
@Qualifier
|
||||||
|
@Documented
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
public @interface ExternalMainThread {
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
The dagger modules in this directory can be included by the host SysUI using the Shell library for
|
||||||
|
explicity injection of Shell components. Apps using this library are not required to use these
|
||||||
|
dagger modules for setup, but it is recommended for them to include them as needed.
|
||||||
|
|
||||||
|
The modules are currently inherited as such:
|
||||||
|
|
||||||
|
+- WMShellBaseModule (common shell features across SysUI)
|
||||||
|
|
|
||||||
|
+- WMShellModule (handheld)
|
||||||
|
|
|
||||||
|
+- TvPipModule (tv pip)
|
||||||
|
|
|
||||||
|
+- TvWMShellModule (tv)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 The Android Open Source Project
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,12 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.systemui.wmshell;
|
package com.android.wm.shell.dagger;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
|
||||||
import com.android.systemui.dagger.WMSingleton;
|
|
||||||
import com.android.wm.shell.ShellTaskOrganizer;
|
import com.android.wm.shell.ShellTaskOrganizer;
|
||||||
import com.android.wm.shell.WindowManagerShellWrapper;
|
import com.android.wm.shell.WindowManagerShellWrapper;
|
||||||
import com.android.wm.shell.common.DisplayController;
|
import com.android.wm.shell.common.DisplayController;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 The Android Open Source Project
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,14 +14,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.systemui.wmshell;
|
package com.android.wm.shell.dagger;
|
||||||
|
|
||||||
import android.animation.AnimationHandler;
|
import android.animation.AnimationHandler;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
|
|
||||||
import com.android.systemui.dagger.WMComponent;
|
|
||||||
import com.android.systemui.dagger.WMSingleton;
|
|
||||||
import com.android.wm.shell.ShellTaskOrganizer;
|
import com.android.wm.shell.ShellTaskOrganizer;
|
||||||
import com.android.wm.shell.common.DisplayController;
|
import com.android.wm.shell.common.DisplayController;
|
||||||
import com.android.wm.shell.common.DisplayImeController;
|
import com.android.wm.shell.common.DisplayImeController;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 The Android Open Source Project
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.systemui.wmshell;
|
package com.android.wm.shell.dagger;
|
||||||
|
|
||||||
import android.app.ActivityTaskManager;
|
import android.app.ActivityTaskManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -27,8 +27,6 @@ import android.view.WindowManager;
|
|||||||
import com.android.internal.logging.UiEventLogger;
|
import com.android.internal.logging.UiEventLogger;
|
||||||
import com.android.internal.statusbar.IStatusBarService;
|
import com.android.internal.statusbar.IStatusBarService;
|
||||||
import com.android.launcher3.icons.IconProvider;
|
import com.android.launcher3.icons.IconProvider;
|
||||||
import com.android.systemui.dagger.WMComponent;
|
|
||||||
import com.android.systemui.dagger.WMSingleton;
|
|
||||||
import com.android.wm.shell.RootDisplayAreaOrganizer;
|
import com.android.wm.shell.RootDisplayAreaOrganizer;
|
||||||
import com.android.wm.shell.RootTaskDisplayAreaOrganizer;
|
import com.android.wm.shell.RootTaskDisplayAreaOrganizer;
|
||||||
import com.android.wm.shell.ShellCommandHandler;
|
import com.android.wm.shell.ShellCommandHandler;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 The Android Open Source Project
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.systemui.wmshell;
|
package com.android.wm.shell.dagger;
|
||||||
|
|
||||||
import static android.os.Process.THREAD_PRIORITY_DISPLAY;
|
import static android.os.Process.THREAD_PRIORITY_DISPLAY;
|
||||||
import static android.os.Process.THREAD_PRIORITY_TOP_APP_BOOST;
|
import static android.os.Process.THREAD_PRIORITY_TOP_APP_BOOST;
|
||||||
@@ -24,18 +24,18 @@ import android.content.Context;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
|
import android.os.Looper;
|
||||||
import android.os.Trace;
|
import android.os.Trace;
|
||||||
|
|
||||||
import com.android.internal.graphics.SfVsyncFrameCallbackProvider;
|
import com.android.internal.graphics.SfVsyncFrameCallbackProvider;
|
||||||
import com.android.systemui.R;
|
|
||||||
import com.android.systemui.dagger.WMSingleton;
|
|
||||||
import com.android.systemui.dagger.qualifiers.Main;
|
|
||||||
import com.android.wm.shell.common.HandlerExecutor;
|
import com.android.wm.shell.common.HandlerExecutor;
|
||||||
import com.android.wm.shell.common.ShellExecutor;
|
import com.android.wm.shell.common.ShellExecutor;
|
||||||
import com.android.wm.shell.common.annotations.ChoreographerSfVsync;
|
import com.android.wm.shell.common.annotations.ChoreographerSfVsync;
|
||||||
|
import com.android.wm.shell.common.annotations.ExternalMainThread;
|
||||||
import com.android.wm.shell.common.annotations.ShellAnimationThread;
|
import com.android.wm.shell.common.annotations.ShellAnimationThread;
|
||||||
import com.android.wm.shell.common.annotations.ShellMainThread;
|
import com.android.wm.shell.common.annotations.ShellMainThread;
|
||||||
import com.android.wm.shell.common.annotations.ShellSplashscreenThread;
|
import com.android.wm.shell.common.annotations.ShellSplashscreenThread;
|
||||||
|
import com.android.wm.shell.R;
|
||||||
|
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
@@ -61,13 +61,26 @@ public abstract class WMShellConcurrencyModule {
|
|||||||
// Shell Concurrency - Components used for managing threading in the Shell and SysUI
|
// Shell Concurrency - Components used for managing threading in the Shell and SysUI
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide a SysUI main-thread Handler.
|
||||||
|
*
|
||||||
|
* Prefer the Main Executor when possible.
|
||||||
|
*/
|
||||||
|
@Provides
|
||||||
|
@ExternalMainThread
|
||||||
|
public static Handler provideMainHandler() {
|
||||||
|
return new Handler(Looper.getMainLooper());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide a SysUI main-thread Executor.
|
* Provide a SysUI main-thread Executor.
|
||||||
*/
|
*/
|
||||||
@WMSingleton
|
@WMSingleton
|
||||||
@Provides
|
@Provides
|
||||||
@Main
|
@ExternalMainThread
|
||||||
public static ShellExecutor provideSysUIMainExecutor(@Main Handler sysuiMainHandler) {
|
public static ShellExecutor provideSysUIMainExecutor(
|
||||||
|
@ExternalMainThread Handler sysuiMainHandler) {
|
||||||
return new HandlerExecutor(sysuiMainHandler);
|
return new HandlerExecutor(sysuiMainHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +91,8 @@ public abstract class WMShellConcurrencyModule {
|
|||||||
@WMSingleton
|
@WMSingleton
|
||||||
@Provides
|
@Provides
|
||||||
@ShellMainThread
|
@ShellMainThread
|
||||||
public static Handler provideShellMainHandler(Context context, @Main Handler sysuiMainHandler) {
|
public static Handler provideShellMainHandler(Context context,
|
||||||
|
@ExternalMainThread Handler sysuiMainHandler) {
|
||||||
if (enableShellMainThread(context)) {
|
if (enableShellMainThread(context)) {
|
||||||
HandlerThread mainThread = new HandlerThread("wmshell.main", THREAD_PRIORITY_DISPLAY);
|
HandlerThread mainThread = new HandlerThread("wmshell.main", THREAD_PRIORITY_DISPLAY);
|
||||||
mainThread.start();
|
mainThread.start();
|
||||||
@@ -99,7 +113,8 @@ public abstract class WMShellConcurrencyModule {
|
|||||||
@Provides
|
@Provides
|
||||||
@ShellMainThread
|
@ShellMainThread
|
||||||
public static ShellExecutor provideShellMainExecutor(Context context,
|
public static ShellExecutor provideShellMainExecutor(Context context,
|
||||||
@ShellMainThread Handler mainHandler, @Main ShellExecutor sysuiMainExecutor) {
|
@ShellMainThread Handler mainHandler,
|
||||||
|
@ExternalMainThread ShellExecutor sysuiMainExecutor) {
|
||||||
if (enableShellMainThread(context)) {
|
if (enableShellMainThread(context)) {
|
||||||
return new HandlerExecutor(mainHandler);
|
return new HandlerExecutor(mainHandler);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 The Android Open Source Project
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,15 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.systemui.wmshell;
|
package com.android.wm.shell.dagger;
|
||||||
|
|
||||||
import android.animation.AnimationHandler;
|
import android.animation.AnimationHandler;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
|
|
||||||
import com.android.systemui.dagger.WMComponent;
|
|
||||||
import com.android.systemui.dagger.WMSingleton;
|
|
||||||
import com.android.wm.shell.ShellTaskOrganizer;
|
import com.android.wm.shell.ShellTaskOrganizer;
|
||||||
import com.android.wm.shell.WindowManagerShellWrapper;
|
import com.android.wm.shell.WindowManagerShellWrapper;
|
||||||
import com.android.wm.shell.apppairs.AppPairsController;
|
import com.android.wm.shell.apppairs.AppPairsController;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 The Android Open Source Project
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.systemui.dagger;
|
package com.android.wm.shell.dagger;
|
||||||
|
|
||||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
@@ -654,9 +654,6 @@
|
|||||||
<!-- Whether to use the split 2-column notification shade -->
|
<!-- Whether to use the split 2-column notification shade -->
|
||||||
<bool name="config_use_split_notification_shade">false</bool>
|
<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>
|
|
||||||
|
|
||||||
<!-- Default udfps icon. Same path as ic_fingerprint.xml -->
|
<!-- Default udfps icon. Same path as ic_fingerprint.xml -->
|
||||||
<string name="config_udfpsIcon" translatable="false">
|
<string name="config_udfpsIcon" translatable="false">
|
||||||
M25.5,16.3283C28.47,14.8433 31.9167,14 35.5834,14C39.2501,14 42.6968,14.8433 45.6668,16.3283
|
M25.5,16.3283C28.47,14.8433 31.9167,14 35.5834,14C39.2501,14 42.6968,14.8433 45.6668,16.3283
|
||||||
|
|||||||
@@ -20,13 +20,14 @@ import android.content.Context;
|
|||||||
|
|
||||||
import com.android.systemui.SystemUIFactory;
|
import com.android.systemui.SystemUIFactory;
|
||||||
import com.android.systemui.tv.TvWMComponent;
|
import com.android.systemui.tv.TvWMComponent;
|
||||||
import com.android.systemui.wmshell.TvWMShellModule;
|
import com.android.wm.shell.dagger.TvWMShellModule;
|
||||||
import com.android.systemui.wmshell.WMShellModule;
|
import com.android.wm.shell.dagger.WMShellModule;
|
||||||
import com.android.wm.shell.ShellCommandHandler;
|
import com.android.wm.shell.ShellCommandHandler;
|
||||||
import com.android.wm.shell.ShellInit;
|
import com.android.wm.shell.ShellInit;
|
||||||
import com.android.wm.shell.TaskViewFactory;
|
import com.android.wm.shell.TaskViewFactory;
|
||||||
import com.android.wm.shell.apppairs.AppPairs;
|
import com.android.wm.shell.apppairs.AppPairs;
|
||||||
import com.android.wm.shell.bubbles.Bubbles;
|
import com.android.wm.shell.bubbles.Bubbles;
|
||||||
|
import com.android.wm.shell.dagger.WMSingleton;
|
||||||
import com.android.wm.shell.displayareahelper.DisplayAreaHelper;
|
import com.android.wm.shell.displayareahelper.DisplayAreaHelper;
|
||||||
import com.android.wm.shell.hidedisplaycutout.HideDisplayCutout;
|
import com.android.wm.shell.hidedisplaycutout.HideDisplayCutout;
|
||||||
import com.android.wm.shell.legacysplitscreen.LegacySplitScreen;
|
import com.android.wm.shell.legacysplitscreen.LegacySplitScreen;
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
package com.android.systemui.tv;
|
package com.android.systemui.tv;
|
||||||
|
|
||||||
import com.android.systemui.dagger.WMComponent;
|
import com.android.systemui.dagger.WMComponent;
|
||||||
import com.android.systemui.dagger.WMSingleton;
|
import com.android.wm.shell.dagger.WMSingleton;
|
||||||
import com.android.systemui.wmshell.TvWMShellModule;
|
import com.android.wm.shell.dagger.TvWMShellModule;
|
||||||
|
|
||||||
import dagger.Subcomponent;
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user