Merge "Add separated Pip1 and Pip2 dagger module" into udc-qpr-dev
This commit is contained in:
@@ -31,6 +31,7 @@ import com.android.wm.shell.common.SyncTransactionQueue;
|
|||||||
import com.android.wm.shell.common.SystemWindows;
|
import com.android.wm.shell.common.SystemWindows;
|
||||||
import com.android.wm.shell.common.TransactionPool;
|
import com.android.wm.shell.common.TransactionPool;
|
||||||
import com.android.wm.shell.common.annotations.ShellMainThread;
|
import com.android.wm.shell.common.annotations.ShellMainThread;
|
||||||
|
import com.android.wm.shell.dagger.pip.TvPipModule;
|
||||||
import com.android.wm.shell.draganddrop.DragAndDropController;
|
import com.android.wm.shell.draganddrop.DragAndDropController;
|
||||||
import com.android.wm.shell.recents.RecentTasksController;
|
import com.android.wm.shell.recents.RecentTasksController;
|
||||||
import com.android.wm.shell.splitscreen.SplitScreenController;
|
import com.android.wm.shell.splitscreen.SplitScreenController;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import static com.android.wm.shell.onehanded.OneHandedController.SUPPORT_ONE_HAN
|
|||||||
|
|
||||||
import android.app.ActivityTaskManager;
|
import android.app.ActivityTaskManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
@@ -45,7 +44,6 @@ import com.android.wm.shell.common.DisplayImeController;
|
|||||||
import com.android.wm.shell.common.DisplayInsetsController;
|
import com.android.wm.shell.common.DisplayInsetsController;
|
||||||
import com.android.wm.shell.common.DisplayLayout;
|
import com.android.wm.shell.common.DisplayLayout;
|
||||||
import com.android.wm.shell.common.DockStateReader;
|
import com.android.wm.shell.common.DockStateReader;
|
||||||
import com.android.wm.shell.common.FloatingContentCoordinator;
|
|
||||||
import com.android.wm.shell.common.LaunchAdjacentController;
|
import com.android.wm.shell.common.LaunchAdjacentController;
|
||||||
import com.android.wm.shell.common.ShellExecutor;
|
import com.android.wm.shell.common.ShellExecutor;
|
||||||
import com.android.wm.shell.common.SyncTransactionQueue;
|
import com.android.wm.shell.common.SyncTransactionQueue;
|
||||||
@@ -76,10 +74,6 @@ import com.android.wm.shell.keyguard.KeyguardTransitions;
|
|||||||
import com.android.wm.shell.onehanded.OneHanded;
|
import com.android.wm.shell.onehanded.OneHanded;
|
||||||
import com.android.wm.shell.onehanded.OneHandedController;
|
import com.android.wm.shell.onehanded.OneHandedController;
|
||||||
import com.android.wm.shell.pip.Pip;
|
import com.android.wm.shell.pip.Pip;
|
||||||
import com.android.wm.shell.pip.PipMediaController;
|
|
||||||
import com.android.wm.shell.pip.PipSurfaceTransactionHelper;
|
|
||||||
import com.android.wm.shell.pip.PipUiEventLogger;
|
|
||||||
import com.android.wm.shell.pip.phone.PipTouchHandler;
|
|
||||||
import com.android.wm.shell.recents.RecentTasks;
|
import com.android.wm.shell.recents.RecentTasks;
|
||||||
import com.android.wm.shell.recents.RecentTasksController;
|
import com.android.wm.shell.recents.RecentTasksController;
|
||||||
import com.android.wm.shell.recents.RecentsTransitionHandler;
|
import com.android.wm.shell.recents.RecentsTransitionHandler;
|
||||||
@@ -103,13 +97,13 @@ import com.android.wm.shell.unfold.UnfoldAnimationController;
|
|||||||
import com.android.wm.shell.unfold.UnfoldTransitionHandler;
|
import com.android.wm.shell.unfold.UnfoldTransitionHandler;
|
||||||
import com.android.wm.shell.windowdecor.WindowDecorViewModel;
|
import com.android.wm.shell.windowdecor.WindowDecorViewModel;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import dagger.BindsOptionalOf;
|
import dagger.BindsOptionalOf;
|
||||||
import dagger.Lazy;
|
import dagger.Lazy;
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides basic dependencies from {@link com.android.wm.shell}, these dependencies are only
|
* Provides basic dependencies from {@link com.android.wm.shell}, these dependencies are only
|
||||||
* accessible from components within the WM subcomponent (can be explicitly exposed to the
|
* accessible from components within the WM subcomponent (can be explicitly exposed to the
|
||||||
@@ -469,40 +463,6 @@ public abstract class WMShellBaseModule {
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Pip (optional feature)
|
|
||||||
//
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static FloatingContentCoordinator provideFloatingContentCoordinator() {
|
|
||||||
return new FloatingContentCoordinator();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Needs handler for registering broadcast receivers
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipMediaController providePipMediaController(Context context,
|
|
||||||
@ShellMainThread Handler mainHandler) {
|
|
||||||
return new PipMediaController(context, mainHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipSurfaceTransactionHelper providePipSurfaceTransactionHelper(Context context) {
|
|
||||||
return new PipSurfaceTransactionHelper(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipUiEventLogger providePipUiEventLogger(UiEventLogger uiEventLogger,
|
|
||||||
PackageManager packageManager) {
|
|
||||||
return new PipUiEventLogger(uiEventLogger, packageManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
@BindsOptionalOf
|
|
||||||
abstract PipTouchHandler optionalPipTouchHandler();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Recent tasks
|
// Recent tasks
|
||||||
//
|
//
|
||||||
@@ -838,7 +798,6 @@ public abstract class WMShellBaseModule {
|
|||||||
Optional<BubbleController> bubblesOptional,
|
Optional<BubbleController> bubblesOptional,
|
||||||
Optional<SplitScreenController> splitScreenOptional,
|
Optional<SplitScreenController> splitScreenOptional,
|
||||||
Optional<Pip> pipOptional,
|
Optional<Pip> pipOptional,
|
||||||
Optional<PipTouchHandler> pipTouchHandlerOptional,
|
|
||||||
FullscreenTaskListener fullscreenTaskListener,
|
FullscreenTaskListener fullscreenTaskListener,
|
||||||
Optional<UnfoldAnimationController> unfoldAnimationController,
|
Optional<UnfoldAnimationController> unfoldAnimationController,
|
||||||
Optional<UnfoldTransitionHandler> unfoldTransitionHandler,
|
Optional<UnfoldTransitionHandler> unfoldTransitionHandler,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.wm.shell.dagger;
|
package com.android.wm.shell.dagger;
|
||||||
|
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.LauncherApps;
|
import android.content.pm.LauncherApps;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -46,13 +47,12 @@ import com.android.wm.shell.common.FloatingContentCoordinator;
|
|||||||
import com.android.wm.shell.common.LaunchAdjacentController;
|
import com.android.wm.shell.common.LaunchAdjacentController;
|
||||||
import com.android.wm.shell.common.ShellExecutor;
|
import com.android.wm.shell.common.ShellExecutor;
|
||||||
import com.android.wm.shell.common.SyncTransactionQueue;
|
import com.android.wm.shell.common.SyncTransactionQueue;
|
||||||
import com.android.wm.shell.common.SystemWindows;
|
|
||||||
import com.android.wm.shell.common.TabletopModeController;
|
|
||||||
import com.android.wm.shell.common.TaskStackListenerImpl;
|
import com.android.wm.shell.common.TaskStackListenerImpl;
|
||||||
import com.android.wm.shell.common.TransactionPool;
|
import com.android.wm.shell.common.TransactionPool;
|
||||||
import com.android.wm.shell.common.annotations.ShellAnimationThread;
|
import com.android.wm.shell.common.annotations.ShellAnimationThread;
|
||||||
import com.android.wm.shell.common.annotations.ShellBackgroundThread;
|
import com.android.wm.shell.common.annotations.ShellBackgroundThread;
|
||||||
import com.android.wm.shell.common.annotations.ShellMainThread;
|
import com.android.wm.shell.common.annotations.ShellMainThread;
|
||||||
|
import com.android.wm.shell.dagger.pip.PipModule;
|
||||||
import com.android.wm.shell.desktopmode.DesktopModeController;
|
import com.android.wm.shell.desktopmode.DesktopModeController;
|
||||||
import com.android.wm.shell.desktopmode.DesktopModeStatus;
|
import com.android.wm.shell.desktopmode.DesktopModeStatus;
|
||||||
import com.android.wm.shell.desktopmode.DesktopModeTaskRepository;
|
import com.android.wm.shell.desktopmode.DesktopModeTaskRepository;
|
||||||
@@ -67,27 +67,7 @@ import com.android.wm.shell.freeform.FreeformTaskTransitionHandler;
|
|||||||
import com.android.wm.shell.freeform.FreeformTaskTransitionObserver;
|
import com.android.wm.shell.freeform.FreeformTaskTransitionObserver;
|
||||||
import com.android.wm.shell.keyguard.KeyguardTransitionHandler;
|
import com.android.wm.shell.keyguard.KeyguardTransitionHandler;
|
||||||
import com.android.wm.shell.onehanded.OneHandedController;
|
import com.android.wm.shell.onehanded.OneHandedController;
|
||||||
import com.android.wm.shell.pip.Pip;
|
|
||||||
import com.android.wm.shell.pip.PipAnimationController;
|
|
||||||
import com.android.wm.shell.pip.PipAppOpsListener;
|
|
||||||
import com.android.wm.shell.pip.PipBoundsAlgorithm;
|
|
||||||
import com.android.wm.shell.pip.PipBoundsState;
|
|
||||||
import com.android.wm.shell.pip.PipDisplayLayoutState;
|
|
||||||
import com.android.wm.shell.pip.PipMediaController;
|
|
||||||
import com.android.wm.shell.pip.PipParamsChangedForwarder;
|
|
||||||
import com.android.wm.shell.pip.PipSnapAlgorithm;
|
|
||||||
import com.android.wm.shell.pip.PipSurfaceTransactionHelper;
|
|
||||||
import com.android.wm.shell.pip.PipTaskOrganizer;
|
|
||||||
import com.android.wm.shell.pip.PipTransition;
|
|
||||||
import com.android.wm.shell.pip.PipTransitionController;
|
import com.android.wm.shell.pip.PipTransitionController;
|
||||||
import com.android.wm.shell.pip.PipTransitionState;
|
|
||||||
import com.android.wm.shell.pip.PipUiEventLogger;
|
|
||||||
import com.android.wm.shell.pip.phone.PhonePipKeepClearAlgorithm;
|
|
||||||
import com.android.wm.shell.pip.phone.PhonePipMenuController;
|
|
||||||
import com.android.wm.shell.pip.phone.PipController;
|
|
||||||
import com.android.wm.shell.pip.phone.PipMotionHelper;
|
|
||||||
import com.android.wm.shell.pip.phone.PipSizeSpecHandler;
|
|
||||||
import com.android.wm.shell.pip.phone.PipTouchHandler;
|
|
||||||
import com.android.wm.shell.recents.RecentTasksController;
|
import com.android.wm.shell.recents.RecentTasksController;
|
||||||
import com.android.wm.shell.recents.RecentsTransitionHandler;
|
import com.android.wm.shell.recents.RecentsTransitionHandler;
|
||||||
import com.android.wm.shell.splitscreen.SplitScreenController;
|
import com.android.wm.shell.splitscreen.SplitScreenController;
|
||||||
@@ -127,7 +107,10 @@ import java.util.Optional;
|
|||||||
* This module only defines Shell dependencies for handheld SystemUI implementation. Common
|
* This module only defines Shell dependencies for handheld SystemUI implementation. Common
|
||||||
* dependencies should go into {@link WMShellBaseModule}.
|
* dependencies should go into {@link WMShellBaseModule}.
|
||||||
*/
|
*/
|
||||||
@Module(includes = WMShellBaseModule.class)
|
@Module(includes = {
|
||||||
|
WMShellBaseModule.class,
|
||||||
|
PipModule.class
|
||||||
|
})
|
||||||
public abstract class WMShellModule {
|
public abstract class WMShellModule {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -350,195 +333,6 @@ public abstract class WMShellModule {
|
|||||||
windowDecorViewModel, mainExecutor);
|
windowDecorViewModel, mainExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Pip
|
|
||||||
//
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static Optional<Pip> providePip(Context context,
|
|
||||||
ShellInit shellInit,
|
|
||||||
ShellCommandHandler shellCommandHandler,
|
|
||||||
ShellController shellController,
|
|
||||||
DisplayController displayController,
|
|
||||||
PipAnimationController pipAnimationController,
|
|
||||||
PipAppOpsListener pipAppOpsListener,
|
|
||||||
PipBoundsAlgorithm pipBoundsAlgorithm,
|
|
||||||
PhonePipKeepClearAlgorithm pipKeepClearAlgorithm,
|
|
||||||
PipBoundsState pipBoundsState,
|
|
||||||
PipSizeSpecHandler pipSizeSpecHandler,
|
|
||||||
PipDisplayLayoutState pipDisplayLayoutState,
|
|
||||||
PipMotionHelper pipMotionHelper,
|
|
||||||
PipMediaController pipMediaController,
|
|
||||||
PhonePipMenuController phonePipMenuController,
|
|
||||||
PipTaskOrganizer pipTaskOrganizer,
|
|
||||||
PipTransitionState pipTransitionState,
|
|
||||||
PipTouchHandler pipTouchHandler,
|
|
||||||
PipTransitionController pipTransitionController,
|
|
||||||
WindowManagerShellWrapper windowManagerShellWrapper,
|
|
||||||
TaskStackListenerImpl taskStackListener,
|
|
||||||
PipParamsChangedForwarder pipParamsChangedForwarder,
|
|
||||||
DisplayInsetsController displayInsetsController,
|
|
||||||
TabletopModeController pipTabletopController,
|
|
||||||
Optional<OneHandedController> oneHandedController,
|
|
||||||
@ShellMainThread ShellExecutor mainExecutor) {
|
|
||||||
return Optional.ofNullable(PipController.create(
|
|
||||||
context, shellInit, shellCommandHandler, shellController,
|
|
||||||
displayController, pipAnimationController, pipAppOpsListener, pipBoundsAlgorithm,
|
|
||||||
pipKeepClearAlgorithm, pipBoundsState, pipSizeSpecHandler, pipDisplayLayoutState,
|
|
||||||
pipMotionHelper, pipMediaController, phonePipMenuController, pipTaskOrganizer,
|
|
||||||
pipTransitionState, pipTouchHandler, pipTransitionController,
|
|
||||||
windowManagerShellWrapper, taskStackListener, pipParamsChangedForwarder,
|
|
||||||
displayInsetsController, pipTabletopController, oneHandedController, mainExecutor));
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipBoundsState providePipBoundsState(Context context,
|
|
||||||
PipSizeSpecHandler pipSizeSpecHandler, PipDisplayLayoutState pipDisplayLayoutState) {
|
|
||||||
return new PipBoundsState(context, pipSizeSpecHandler, pipDisplayLayoutState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipSnapAlgorithm providePipSnapAlgorithm() {
|
|
||||||
return new PipSnapAlgorithm();
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PhonePipKeepClearAlgorithm providePhonePipKeepClearAlgorithm(Context context) {
|
|
||||||
return new PhonePipKeepClearAlgorithm(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipSizeSpecHandler providePipSizeSpecHelper(Context context,
|
|
||||||
PipDisplayLayoutState pipDisplayLayoutState) {
|
|
||||||
return new PipSizeSpecHandler(context, pipDisplayLayoutState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipBoundsAlgorithm providesPipBoundsAlgorithm(Context context,
|
|
||||||
PipBoundsState pipBoundsState, PipSnapAlgorithm pipSnapAlgorithm,
|
|
||||||
PhonePipKeepClearAlgorithm pipKeepClearAlgorithm,
|
|
||||||
PipSizeSpecHandler pipSizeSpecHandler) {
|
|
||||||
return new PipBoundsAlgorithm(context, pipBoundsState, pipSnapAlgorithm,
|
|
||||||
pipKeepClearAlgorithm, pipSizeSpecHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handler is used by Icon.loadDrawableAsync
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PhonePipMenuController providesPipPhoneMenuController(Context context,
|
|
||||||
PipBoundsState pipBoundsState, PipMediaController pipMediaController,
|
|
||||||
SystemWindows systemWindows,
|
|
||||||
Optional<SplitScreenController> splitScreenOptional,
|
|
||||||
PipUiEventLogger pipUiEventLogger,
|
|
||||||
@ShellMainThread ShellExecutor mainExecutor,
|
|
||||||
@ShellMainThread Handler mainHandler) {
|
|
||||||
return new PhonePipMenuController(context, pipBoundsState, pipMediaController,
|
|
||||||
systemWindows, splitScreenOptional, pipUiEventLogger, mainExecutor, mainHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipTouchHandler providePipTouchHandler(Context context,
|
|
||||||
ShellInit shellInit,
|
|
||||||
PhonePipMenuController menuPhoneController,
|
|
||||||
PipBoundsAlgorithm pipBoundsAlgorithm,
|
|
||||||
PipBoundsState pipBoundsState,
|
|
||||||
PipSizeSpecHandler pipSizeSpecHandler,
|
|
||||||
PipTaskOrganizer pipTaskOrganizer,
|
|
||||||
PipMotionHelper pipMotionHelper,
|
|
||||||
FloatingContentCoordinator floatingContentCoordinator,
|
|
||||||
PipUiEventLogger pipUiEventLogger,
|
|
||||||
@ShellMainThread ShellExecutor mainExecutor) {
|
|
||||||
return new PipTouchHandler(context, shellInit, menuPhoneController, pipBoundsAlgorithm,
|
|
||||||
pipBoundsState, pipSizeSpecHandler, pipTaskOrganizer, pipMotionHelper,
|
|
||||||
floatingContentCoordinator, pipUiEventLogger, mainExecutor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipTransitionState providePipTransitionState() {
|
|
||||||
return new PipTransitionState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipTaskOrganizer providePipTaskOrganizer(Context context,
|
|
||||||
SyncTransactionQueue syncTransactionQueue,
|
|
||||||
PipTransitionState pipTransitionState,
|
|
||||||
PipBoundsState pipBoundsState,
|
|
||||||
PipDisplayLayoutState pipDisplayLayoutState,
|
|
||||||
PipBoundsAlgorithm pipBoundsAlgorithm,
|
|
||||||
PhonePipMenuController menuPhoneController,
|
|
||||||
PipAnimationController pipAnimationController,
|
|
||||||
PipSurfaceTransactionHelper pipSurfaceTransactionHelper,
|
|
||||||
PipTransitionController pipTransitionController,
|
|
||||||
PipParamsChangedForwarder pipParamsChangedForwarder,
|
|
||||||
Optional<SplitScreenController> splitScreenControllerOptional,
|
|
||||||
DisplayController displayController,
|
|
||||||
PipUiEventLogger pipUiEventLogger, ShellTaskOrganizer shellTaskOrganizer,
|
|
||||||
@ShellMainThread ShellExecutor mainExecutor) {
|
|
||||||
return new PipTaskOrganizer(context,
|
|
||||||
syncTransactionQueue, pipTransitionState, pipBoundsState, pipDisplayLayoutState,
|
|
||||||
pipBoundsAlgorithm, menuPhoneController, pipAnimationController,
|
|
||||||
pipSurfaceTransactionHelper, pipTransitionController, pipParamsChangedForwarder,
|
|
||||||
splitScreenControllerOptional, displayController, pipUiEventLogger,
|
|
||||||
shellTaskOrganizer, mainExecutor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipAnimationController providePipAnimationController(PipSurfaceTransactionHelper
|
|
||||||
pipSurfaceTransactionHelper) {
|
|
||||||
return new PipAnimationController(pipSurfaceTransactionHelper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipTransitionController providePipTransitionController(Context context,
|
|
||||||
ShellInit shellInit, ShellTaskOrganizer shellTaskOrganizer, Transitions transitions,
|
|
||||||
PipAnimationController pipAnimationController, PipBoundsAlgorithm pipBoundsAlgorithm,
|
|
||||||
PipBoundsState pipBoundsState, PipDisplayLayoutState pipDisplayLayoutState,
|
|
||||||
PipTransitionState pipTransitionState, PhonePipMenuController pipMenuController,
|
|
||||||
PipSurfaceTransactionHelper pipSurfaceTransactionHelper,
|
|
||||||
Optional<SplitScreenController> splitScreenOptional) {
|
|
||||||
return new PipTransition(context, shellInit, shellTaskOrganizer, transitions,
|
|
||||||
pipBoundsState, pipDisplayLayoutState, pipTransitionState, pipMenuController,
|
|
||||||
pipBoundsAlgorithm, pipAnimationController, pipSurfaceTransactionHelper,
|
|
||||||
splitScreenOptional);
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipAppOpsListener providePipAppOpsListener(Context context,
|
|
||||||
PipTouchHandler pipTouchHandler,
|
|
||||||
@ShellMainThread ShellExecutor mainExecutor) {
|
|
||||||
return new PipAppOpsListener(context, pipTouchHandler.getMotionHelper(), mainExecutor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipMotionHelper providePipMotionHelper(Context context,
|
|
||||||
PipBoundsState pipBoundsState, PipTaskOrganizer pipTaskOrganizer,
|
|
||||||
PhonePipMenuController menuController, PipSnapAlgorithm pipSnapAlgorithm,
|
|
||||||
PipTransitionController pipTransitionController,
|
|
||||||
FloatingContentCoordinator floatingContentCoordinator) {
|
|
||||||
return new PipMotionHelper(context, pipBoundsState, pipTaskOrganizer,
|
|
||||||
menuController, pipSnapAlgorithm, pipTransitionController,
|
|
||||||
floatingContentCoordinator);
|
|
||||||
}
|
|
||||||
|
|
||||||
@WMSingleton
|
|
||||||
@Provides
|
|
||||||
static PipParamsChangedForwarder providePipParamsChangedForwarder() {
|
|
||||||
return new PipParamsChangedForwarder();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Transitions
|
// Transitions
|
||||||
//
|
//
|
||||||
@@ -548,7 +342,7 @@ public abstract class WMShellModule {
|
|||||||
static DefaultMixedHandler provideDefaultMixedHandler(
|
static DefaultMixedHandler provideDefaultMixedHandler(
|
||||||
ShellInit shellInit,
|
ShellInit shellInit,
|
||||||
Optional<SplitScreenController> splitScreenOptional,
|
Optional<SplitScreenController> splitScreenOptional,
|
||||||
Optional<PipTouchHandler> pipTouchHandlerOptional,
|
@Nullable PipTransitionController pipTransitionController,
|
||||||
Optional<RecentsTransitionHandler> recentsTransitionHandler,
|
Optional<RecentsTransitionHandler> recentsTransitionHandler,
|
||||||
KeyguardTransitionHandler keyguardTransitionHandler,
|
KeyguardTransitionHandler keyguardTransitionHandler,
|
||||||
Optional<DesktopModeController> desktopModeController,
|
Optional<DesktopModeController> desktopModeController,
|
||||||
@@ -556,8 +350,9 @@ public abstract class WMShellModule {
|
|||||||
Optional<UnfoldTransitionHandler> unfoldHandler,
|
Optional<UnfoldTransitionHandler> unfoldHandler,
|
||||||
Transitions transitions) {
|
Transitions transitions) {
|
||||||
return new DefaultMixedHandler(shellInit, transitions, splitScreenOptional,
|
return new DefaultMixedHandler(shellInit, transitions, splitScreenOptional,
|
||||||
pipTouchHandlerOptional, recentsTransitionHandler, keyguardTransitionHandler,
|
pipTransitionController, recentsTransitionHandler,
|
||||||
desktopModeController, desktopTasksController, unfoldHandler);
|
keyguardTransitionHandler, desktopModeController, desktopTasksController,
|
||||||
|
unfoldHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WMSingleton
|
@WMSingleton
|
||||||
|
|||||||
@@ -0,0 +1,271 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.dagger.pip;
|
||||||
|
|
||||||
|
import android.annotation.Nullable;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Handler;
|
||||||
|
|
||||||
|
import com.android.wm.shell.ShellTaskOrganizer;
|
||||||
|
import com.android.wm.shell.WindowManagerShellWrapper;
|
||||||
|
import com.android.wm.shell.common.DisplayController;
|
||||||
|
import com.android.wm.shell.common.DisplayInsetsController;
|
||||||
|
import com.android.wm.shell.common.FloatingContentCoordinator;
|
||||||
|
import com.android.wm.shell.common.ShellExecutor;
|
||||||
|
import com.android.wm.shell.common.SyncTransactionQueue;
|
||||||
|
import com.android.wm.shell.common.SystemWindows;
|
||||||
|
import com.android.wm.shell.common.TabletopModeController;
|
||||||
|
import com.android.wm.shell.common.TaskStackListenerImpl;
|
||||||
|
import com.android.wm.shell.common.annotations.ShellMainThread;
|
||||||
|
import com.android.wm.shell.dagger.WMShellBaseModule;
|
||||||
|
import com.android.wm.shell.dagger.WMSingleton;
|
||||||
|
import com.android.wm.shell.onehanded.OneHandedController;
|
||||||
|
import com.android.wm.shell.pip.Pip;
|
||||||
|
import com.android.wm.shell.pip.PipAnimationController;
|
||||||
|
import com.android.wm.shell.pip.PipAppOpsListener;
|
||||||
|
import com.android.wm.shell.pip.PipBoundsAlgorithm;
|
||||||
|
import com.android.wm.shell.pip.PipBoundsState;
|
||||||
|
import com.android.wm.shell.pip.PipDisplayLayoutState;
|
||||||
|
import com.android.wm.shell.pip.PipMediaController;
|
||||||
|
import com.android.wm.shell.pip.PipParamsChangedForwarder;
|
||||||
|
import com.android.wm.shell.pip.PipSnapAlgorithm;
|
||||||
|
import com.android.wm.shell.pip.PipSurfaceTransactionHelper;
|
||||||
|
import com.android.wm.shell.pip.PipTaskOrganizer;
|
||||||
|
import com.android.wm.shell.pip.PipTransition;
|
||||||
|
import com.android.wm.shell.pip.PipTransitionController;
|
||||||
|
import com.android.wm.shell.pip.PipTransitionState;
|
||||||
|
import com.android.wm.shell.pip.PipUiEventLogger;
|
||||||
|
import com.android.wm.shell.pip.PipUtils;
|
||||||
|
import com.android.wm.shell.pip.phone.PhonePipKeepClearAlgorithm;
|
||||||
|
import com.android.wm.shell.pip.phone.PhonePipMenuController;
|
||||||
|
import com.android.wm.shell.pip.phone.PipController;
|
||||||
|
import com.android.wm.shell.pip.phone.PipMotionHelper;
|
||||||
|
import com.android.wm.shell.pip.phone.PipSizeSpecHandler;
|
||||||
|
import com.android.wm.shell.pip.phone.PipTouchHandler;
|
||||||
|
import com.android.wm.shell.splitscreen.SplitScreenController;
|
||||||
|
import com.android.wm.shell.sysui.ShellCommandHandler;
|
||||||
|
import com.android.wm.shell.sysui.ShellController;
|
||||||
|
import com.android.wm.shell.sysui.ShellInit;
|
||||||
|
import com.android.wm.shell.transition.Transitions;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides dependencies from {@link com.android.wm.shell.pip}, this implementation is meant to be
|
||||||
|
* replaced by the sibling {@link Pip2Module}.
|
||||||
|
*/
|
||||||
|
@Module(includes = {
|
||||||
|
Pip1SharedModule.class,
|
||||||
|
WMShellBaseModule.class
|
||||||
|
})
|
||||||
|
public abstract class Pip1Module {
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static Optional<Pip> providePip1(Context context,
|
||||||
|
ShellInit shellInit,
|
||||||
|
ShellCommandHandler shellCommandHandler,
|
||||||
|
ShellController shellController,
|
||||||
|
DisplayController displayController,
|
||||||
|
PipAnimationController pipAnimationController,
|
||||||
|
PipAppOpsListener pipAppOpsListener,
|
||||||
|
PipBoundsAlgorithm pipBoundsAlgorithm,
|
||||||
|
PhonePipKeepClearAlgorithm pipKeepClearAlgorithm,
|
||||||
|
PipBoundsState pipBoundsState,
|
||||||
|
PipSizeSpecHandler pipSizeSpecHandler,
|
||||||
|
PipDisplayLayoutState pipDisplayLayoutState,
|
||||||
|
PipMotionHelper pipMotionHelper,
|
||||||
|
PipMediaController pipMediaController,
|
||||||
|
PhonePipMenuController phonePipMenuController,
|
||||||
|
PipTaskOrganizer pipTaskOrganizer,
|
||||||
|
PipTransitionState pipTransitionState,
|
||||||
|
PipTouchHandler pipTouchHandler,
|
||||||
|
PipTransitionController pipTransitionController,
|
||||||
|
WindowManagerShellWrapper windowManagerShellWrapper,
|
||||||
|
TaskStackListenerImpl taskStackListener,
|
||||||
|
PipParamsChangedForwarder pipParamsChangedForwarder,
|
||||||
|
DisplayInsetsController displayInsetsController,
|
||||||
|
TabletopModeController pipTabletopController,
|
||||||
|
Optional<OneHandedController> oneHandedController,
|
||||||
|
@ShellMainThread ShellExecutor mainExecutor) {
|
||||||
|
if (PipUtils.isPip2ExperimentEnabled()) {
|
||||||
|
return Optional.empty();
|
||||||
|
} else {
|
||||||
|
return Optional.ofNullable(PipController.create(
|
||||||
|
context, shellInit, shellCommandHandler, shellController,
|
||||||
|
displayController, pipAnimationController, pipAppOpsListener,
|
||||||
|
pipBoundsAlgorithm,
|
||||||
|
pipKeepClearAlgorithm, pipBoundsState, pipSizeSpecHandler,
|
||||||
|
pipDisplayLayoutState,
|
||||||
|
pipMotionHelper, pipMediaController, phonePipMenuController, pipTaskOrganizer,
|
||||||
|
pipTransitionState, pipTouchHandler, pipTransitionController,
|
||||||
|
windowManagerShellWrapper, taskStackListener, pipParamsChangedForwarder,
|
||||||
|
displayInsetsController, pipTabletopController, oneHandedController,
|
||||||
|
mainExecutor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipBoundsState providePipBoundsState(Context context,
|
||||||
|
PipSizeSpecHandler pipSizeSpecHandler, PipDisplayLayoutState pipDisplayLayoutState) {
|
||||||
|
return new PipBoundsState(context, pipSizeSpecHandler, pipDisplayLayoutState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipSnapAlgorithm providePipSnapAlgorithm() {
|
||||||
|
return new PipSnapAlgorithm();
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PhonePipKeepClearAlgorithm providePhonePipKeepClearAlgorithm(Context context) {
|
||||||
|
return new PhonePipKeepClearAlgorithm(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipSizeSpecHandler providePipSizeSpecHelper(Context context,
|
||||||
|
PipDisplayLayoutState pipDisplayLayoutState) {
|
||||||
|
return new PipSizeSpecHandler(context, pipDisplayLayoutState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipBoundsAlgorithm providesPipBoundsAlgorithm(Context context,
|
||||||
|
PipBoundsState pipBoundsState, PipSnapAlgorithm pipSnapAlgorithm,
|
||||||
|
PhonePipKeepClearAlgorithm pipKeepClearAlgorithm,
|
||||||
|
PipSizeSpecHandler pipSizeSpecHandler) {
|
||||||
|
return new PipBoundsAlgorithm(context, pipBoundsState, pipSnapAlgorithm,
|
||||||
|
pipKeepClearAlgorithm, pipSizeSpecHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handler is used by Icon.loadDrawableAsync
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PhonePipMenuController providesPipPhoneMenuController(Context context,
|
||||||
|
PipBoundsState pipBoundsState, PipMediaController pipMediaController,
|
||||||
|
SystemWindows systemWindows,
|
||||||
|
Optional<SplitScreenController> splitScreenOptional,
|
||||||
|
PipUiEventLogger pipUiEventLogger,
|
||||||
|
@ShellMainThread ShellExecutor mainExecutor,
|
||||||
|
@ShellMainThread Handler mainHandler) {
|
||||||
|
return new PhonePipMenuController(context, pipBoundsState, pipMediaController,
|
||||||
|
systemWindows, splitScreenOptional, pipUiEventLogger, mainExecutor, mainHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipTouchHandler providePipTouchHandler(Context context,
|
||||||
|
ShellInit shellInit,
|
||||||
|
PhonePipMenuController menuPhoneController,
|
||||||
|
PipBoundsAlgorithm pipBoundsAlgorithm,
|
||||||
|
PipBoundsState pipBoundsState,
|
||||||
|
PipSizeSpecHandler pipSizeSpecHandler,
|
||||||
|
PipTaskOrganizer pipTaskOrganizer,
|
||||||
|
PipMotionHelper pipMotionHelper,
|
||||||
|
FloatingContentCoordinator floatingContentCoordinator,
|
||||||
|
PipUiEventLogger pipUiEventLogger,
|
||||||
|
@ShellMainThread ShellExecutor mainExecutor) {
|
||||||
|
return new PipTouchHandler(context, shellInit, menuPhoneController, pipBoundsAlgorithm,
|
||||||
|
pipBoundsState, pipSizeSpecHandler, pipTaskOrganizer, pipMotionHelper,
|
||||||
|
floatingContentCoordinator, pipUiEventLogger, mainExecutor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipTransitionState providePipTransitionState() {
|
||||||
|
return new PipTransitionState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipTaskOrganizer providePipTaskOrganizer(Context context,
|
||||||
|
SyncTransactionQueue syncTransactionQueue,
|
||||||
|
PipTransitionState pipTransitionState,
|
||||||
|
PipBoundsState pipBoundsState,
|
||||||
|
PipDisplayLayoutState pipDisplayLayoutState,
|
||||||
|
PipBoundsAlgorithm pipBoundsAlgorithm,
|
||||||
|
PhonePipMenuController menuPhoneController,
|
||||||
|
PipAnimationController pipAnimationController,
|
||||||
|
PipSurfaceTransactionHelper pipSurfaceTransactionHelper,
|
||||||
|
PipTransitionController pipTransitionController,
|
||||||
|
PipParamsChangedForwarder pipParamsChangedForwarder,
|
||||||
|
Optional<SplitScreenController> splitScreenControllerOptional,
|
||||||
|
DisplayController displayController,
|
||||||
|
PipUiEventLogger pipUiEventLogger, ShellTaskOrganizer shellTaskOrganizer,
|
||||||
|
@ShellMainThread ShellExecutor mainExecutor) {
|
||||||
|
return new PipTaskOrganizer(context,
|
||||||
|
syncTransactionQueue, pipTransitionState, pipBoundsState, pipDisplayLayoutState,
|
||||||
|
pipBoundsAlgorithm, menuPhoneController, pipAnimationController,
|
||||||
|
pipSurfaceTransactionHelper, pipTransitionController, pipParamsChangedForwarder,
|
||||||
|
splitScreenControllerOptional, displayController, pipUiEventLogger,
|
||||||
|
shellTaskOrganizer, mainExecutor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipAnimationController providePipAnimationController(PipSurfaceTransactionHelper
|
||||||
|
pipSurfaceTransactionHelper) {
|
||||||
|
return new PipAnimationController(pipSurfaceTransactionHelper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
@Nullable
|
||||||
|
static PipTransition providePipTransition(Context context,
|
||||||
|
ShellInit shellInit, ShellTaskOrganizer shellTaskOrganizer, Transitions transitions,
|
||||||
|
PipAnimationController pipAnimationController, PipBoundsAlgorithm pipBoundsAlgorithm,
|
||||||
|
PipBoundsState pipBoundsState, PipDisplayLayoutState pipDisplayLayoutState,
|
||||||
|
PipTransitionState pipTransitionState, PhonePipMenuController pipMenuController,
|
||||||
|
PipSurfaceTransactionHelper pipSurfaceTransactionHelper,
|
||||||
|
Optional<SplitScreenController> splitScreenOptional) {
|
||||||
|
return new PipTransition(context, shellInit, shellTaskOrganizer, transitions,
|
||||||
|
pipBoundsState, pipDisplayLayoutState, pipTransitionState, pipMenuController,
|
||||||
|
pipBoundsAlgorithm, pipAnimationController, pipSurfaceTransactionHelper,
|
||||||
|
splitScreenOptional);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipAppOpsListener providePipAppOpsListener(Context context,
|
||||||
|
PipTouchHandler pipTouchHandler,
|
||||||
|
@ShellMainThread ShellExecutor mainExecutor) {
|
||||||
|
return new PipAppOpsListener(context, pipTouchHandler.getMotionHelper(), mainExecutor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipMotionHelper providePipMotionHelper(Context context,
|
||||||
|
PipBoundsState pipBoundsState, PipTaskOrganizer pipTaskOrganizer,
|
||||||
|
PhonePipMenuController menuController, PipSnapAlgorithm pipSnapAlgorithm,
|
||||||
|
PipTransitionController pipTransitionController,
|
||||||
|
FloatingContentCoordinator floatingContentCoordinator) {
|
||||||
|
return new PipMotionHelper(context, pipBoundsState, pipTaskOrganizer,
|
||||||
|
menuController, pipSnapAlgorithm, pipTransitionController,
|
||||||
|
floatingContentCoordinator);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipParamsChangedForwarder providePipParamsChangedForwarder() {
|
||||||
|
return new PipParamsChangedForwarder();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.dagger.pip;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Handler;
|
||||||
|
|
||||||
|
import com.android.internal.logging.UiEventLogger;
|
||||||
|
import com.android.wm.shell.common.FloatingContentCoordinator;
|
||||||
|
import com.android.wm.shell.common.annotations.ShellMainThread;
|
||||||
|
import com.android.wm.shell.dagger.WMSingleton;
|
||||||
|
import com.android.wm.shell.pip.PipMediaController;
|
||||||
|
import com.android.wm.shell.pip.PipSurfaceTransactionHelper;
|
||||||
|
import com.android.wm.shell.pip.PipUiEventLogger;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides shared dependencies from {@link com.android.wm.shell.pip}, this implementation is
|
||||||
|
* shared with {@link TvPipModule} and possibly other form factors.
|
||||||
|
*/
|
||||||
|
@Module
|
||||||
|
public abstract class Pip1SharedModule {
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static FloatingContentCoordinator provideFloatingContentCoordinator() {
|
||||||
|
return new FloatingContentCoordinator();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Needs handler for registering broadcast receivers
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipMediaController providePipMediaController(Context context,
|
||||||
|
@ShellMainThread Handler mainHandler) {
|
||||||
|
return new PipMediaController(context, mainHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipSurfaceTransactionHelper providePipSurfaceTransactionHelper(Context context) {
|
||||||
|
return new PipSurfaceTransactionHelper(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
static PipUiEventLogger providePipUiEventLogger(UiEventLogger uiEventLogger,
|
||||||
|
PackageManager packageManager) {
|
||||||
|
return new PipUiEventLogger(uiEventLogger, packageManager);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.dagger.pip;
|
||||||
|
|
||||||
|
import android.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.android.wm.shell.dagger.WMSingleton;
|
||||||
|
import com.android.wm.shell.pip2.PipTransition;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides dependencies from {@link com.android.wm.shell.pip2}, this implementation is meant to be
|
||||||
|
* the successor of its sibling {@link Pip1SharedModule}.
|
||||||
|
*/
|
||||||
|
@Module
|
||||||
|
public abstract class Pip2Module {
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
@Nullable
|
||||||
|
static PipTransition providePipTransition() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.dagger.pip;
|
||||||
|
|
||||||
|
import android.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.android.wm.shell.dagger.WMSingleton;
|
||||||
|
import com.android.wm.shell.pip.PipTransitionController;
|
||||||
|
import com.android.wm.shell.pip.PipUtils;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides dependencies for external components / modules reference PiP and extracts away the
|
||||||
|
* selection of legacy and new PiP implementation.
|
||||||
|
*/
|
||||||
|
@Module(includes = {
|
||||||
|
Pip1Module.class,
|
||||||
|
Pip2Module.class
|
||||||
|
})
|
||||||
|
public abstract class PipModule {
|
||||||
|
@WMSingleton
|
||||||
|
@Provides
|
||||||
|
@Nullable
|
||||||
|
static PipTransitionController providePipTransitionController(
|
||||||
|
com.android.wm.shell.pip.PipTransition legacyPipTransition,
|
||||||
|
com.android.wm.shell.pip2.PipTransition newPipTransition) {
|
||||||
|
return PipUtils.isPip2ExperimentEnabled() ? newPipTransition : legacyPipTransition;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2021 The Android Open Source Project
|
* Copyright (C) 2023 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.wm.shell.dagger;
|
package com.android.wm.shell.dagger.pip;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -28,6 +28,8 @@ import com.android.wm.shell.common.SyncTransactionQueue;
|
|||||||
import com.android.wm.shell.common.SystemWindows;
|
import com.android.wm.shell.common.SystemWindows;
|
||||||
import com.android.wm.shell.common.TaskStackListenerImpl;
|
import com.android.wm.shell.common.TaskStackListenerImpl;
|
||||||
import com.android.wm.shell.common.annotations.ShellMainThread;
|
import com.android.wm.shell.common.annotations.ShellMainThread;
|
||||||
|
import com.android.wm.shell.dagger.WMShellBaseModule;
|
||||||
|
import com.android.wm.shell.dagger.WMSingleton;
|
||||||
import com.android.wm.shell.pip.Pip;
|
import com.android.wm.shell.pip.Pip;
|
||||||
import com.android.wm.shell.pip.PipAnimationController;
|
import com.android.wm.shell.pip.PipAnimationController;
|
||||||
import com.android.wm.shell.pip.PipAppOpsListener;
|
import com.android.wm.shell.pip.PipAppOpsListener;
|
||||||
@@ -62,7 +64,9 @@ import java.util.Optional;
|
|||||||
/**
|
/**
|
||||||
* Provides TV specific dependencies for Pip.
|
* Provides TV specific dependencies for Pip.
|
||||||
*/
|
*/
|
||||||
@Module(includes = {WMShellBaseModule.class})
|
@Module(includes = {
|
||||||
|
WMShellBaseModule.class,
|
||||||
|
Pip1SharedModule.class})
|
||||||
public abstract class TvPipModule {
|
public abstract class TvPipModule {
|
||||||
@WMSingleton
|
@WMSingleton
|
||||||
@Provides
|
@Provides
|
||||||
@@ -67,4 +67,11 @@ public interface Pip {
|
|||||||
* view hierarchy or destroyed.
|
* view hierarchy or destroyed.
|
||||||
*/
|
*/
|
||||||
default void removePipExclusionBoundsChangeListener(Consumer<Rect> listener) { }
|
default void removePipExclusionBoundsChangeListener(Consumer<Rect> listener) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@link PipTransitionController} instance.
|
||||||
|
*/
|
||||||
|
default PipTransitionController getPipTransitionController() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ public class PipMediaController {
|
|||||||
mContext = context;
|
mContext = context;
|
||||||
mMainHandler = mainHandler;
|
mMainHandler = mainHandler;
|
||||||
mHandlerExecutor = new HandlerExecutor(mMainHandler);
|
mHandlerExecutor = new HandlerExecutor(mMainHandler);
|
||||||
|
if (!PipUtils.isPip2ExperimentEnabled()) {
|
||||||
IntentFilter mediaControlFilter = new IntentFilter();
|
IntentFilter mediaControlFilter = new IntentFilter();
|
||||||
mediaControlFilter.addAction(ACTION_PLAY);
|
mediaControlFilter.addAction(ACTION_PLAY);
|
||||||
mediaControlFilter.addAction(ACTION_PAUSE);
|
mediaControlFilter.addAction(ACTION_PAUSE);
|
||||||
@@ -157,6 +158,7 @@ public class PipMediaController {
|
|||||||
mediaControlFilter.addAction(ACTION_PREV);
|
mediaControlFilter.addAction(ACTION_PREV);
|
||||||
mContext.registerReceiverForAllUsers(mMediaActionReceiver, mediaControlFilter,
|
mContext.registerReceiverForAllUsers(mMediaActionReceiver, mediaControlFilter,
|
||||||
SYSTEMUI_PERMISSION, mainHandler, Context.RECEIVER_EXPORTED);
|
SYSTEMUI_PERMISSION, mainHandler, Context.RECEIVER_EXPORTED);
|
||||||
|
}
|
||||||
|
|
||||||
// Creates the standard media buttons that we may show.
|
// Creates the standard media buttons that we may show.
|
||||||
mPauseAction = getDefaultRemoteAction(R.string.pip_pause,
|
mPauseAction = getDefaultRemoteAction(R.string.pip_pause,
|
||||||
|
|||||||
@@ -364,6 +364,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
|
|||||||
mMainExecutor = mainExecutor;
|
mMainExecutor = mainExecutor;
|
||||||
|
|
||||||
// TODO: Can be removed once wm components are created on the shell-main thread
|
// TODO: Can be removed once wm components are created on the shell-main thread
|
||||||
|
if (!PipUtils.isPip2ExperimentEnabled()) {
|
||||||
mMainExecutor.execute(() -> {
|
mMainExecutor.execute(() -> {
|
||||||
mTaskOrganizer.addListenerForType(this, TASK_LISTENER_TYPE_PIP);
|
mTaskOrganizer.addListenerForType(this, TASK_LISTENER_TYPE_PIP);
|
||||||
});
|
});
|
||||||
@@ -372,6 +373,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
|
|||||||
displayController.addDisplayWindowListener(this);
|
displayController.addDisplayWindowListener(this);
|
||||||
pipTransitionController.registerPipTransitionCallback(mPipTransitionCallback);
|
pipTransitionController.registerPipTransitionCallback(mPipTransitionCallback);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public PipTransitionController getTransitionController() {
|
public PipTransitionController getTransitionController() {
|
||||||
return mPipTransitionController;
|
return mPipTransitionController;
|
||||||
|
|||||||
@@ -142,10 +142,12 @@ public abstract class PipTransitionController implements Transitions.TransitionH
|
|||||||
mPipBoundsAlgorithm = pipBoundsAlgorithm;
|
mPipBoundsAlgorithm = pipBoundsAlgorithm;
|
||||||
mPipAnimationController = pipAnimationController;
|
mPipAnimationController = pipAnimationController;
|
||||||
mTransitions = transitions;
|
mTransitions = transitions;
|
||||||
|
if (!PipUtils.isPip2ExperimentEnabled()) {
|
||||||
if (Transitions.ENABLE_SHELL_TRANSITIONS) {
|
if (Transitions.ENABLE_SHELL_TRANSITIONS) {
|
||||||
shellInit.addInitCallback(this::onInit, this);
|
shellInit.addInitCallback(this::onInit, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onInit() {
|
private void onInit() {
|
||||||
mTransitions.addHandler(this);
|
mTransitions.addHandler(this);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import android.app.RemoteAction;
|
|||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
import android.os.SystemProperties;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
@@ -46,6 +47,9 @@ public class PipUtils {
|
|||||||
// Minimum difference between two floats (e.g. aspect ratios) to consider them not equal.
|
// Minimum difference between two floats (e.g. aspect ratios) to consider them not equal.
|
||||||
private static final double EPSILON = 1e-7;
|
private static final double EPSILON = 1e-7;
|
||||||
|
|
||||||
|
private static final String ENABLE_PIP2_IMPLEMENTATION =
|
||||||
|
"persist.wm.debug.enable_pip2_implementation";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the ComponentName and user id of the top non-SystemUI activity in the pinned stack.
|
* @return the ComponentName and user id of the top non-SystemUI activity in the pinned stack.
|
||||||
* The component name may be null if no such activity exists.
|
* The component name may be null if no such activity exists.
|
||||||
@@ -134,4 +138,8 @@ public class PipUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isPip2ExperimentEnabled() {
|
||||||
|
return SystemProperties.getBoolean(ENABLE_PIP2_IMPLEMENTATION, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -461,8 +461,6 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
|||||||
Optional<OneHandedController> oneHandedController,
|
Optional<OneHandedController> oneHandedController,
|
||||||
ShellExecutor mainExecutor
|
ShellExecutor mainExecutor
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mShellCommandHandler = shellCommandHandler;
|
mShellCommandHandler = shellCommandHandler;
|
||||||
mShellController = shellController;
|
mShellController = shellController;
|
||||||
@@ -493,8 +491,10 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
|||||||
mDisplayInsetsController = displayInsetsController;
|
mDisplayInsetsController = displayInsetsController;
|
||||||
mTabletopModeController = tabletopModeController;
|
mTabletopModeController = tabletopModeController;
|
||||||
|
|
||||||
|
if (!PipUtils.isPip2ExperimentEnabled()) {
|
||||||
shellInit.addInitCallback(this::onInit, this);
|
shellInit.addInitCallback(this::onInit, this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onInit() {
|
private void onInit() {
|
||||||
mShellCommandHandler.addDumpCallback(this::dump, this);
|
mShellCommandHandler.addDumpCallback(this::dump, this);
|
||||||
@@ -1258,6 +1258,11 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
|||||||
PipController.this.showPictureInPictureMenu();
|
PipController.this.showPictureInPictureMenu();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PipTransitionController getPipTransitionController() {
|
||||||
|
return mPipTransitionController;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import com.android.wm.shell.pip.PipBoundsState;
|
|||||||
import com.android.wm.shell.pip.PipTaskOrganizer;
|
import com.android.wm.shell.pip.PipTaskOrganizer;
|
||||||
import com.android.wm.shell.pip.PipTransitionController;
|
import com.android.wm.shell.pip.PipTransitionController;
|
||||||
import com.android.wm.shell.pip.PipUiEventLogger;
|
import com.android.wm.shell.pip.PipUiEventLogger;
|
||||||
|
import com.android.wm.shell.pip.PipUtils;
|
||||||
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
||||||
import com.android.wm.shell.sysui.ShellInit;
|
import com.android.wm.shell.sysui.ShellInit;
|
||||||
|
|
||||||
@@ -228,8 +229,10 @@ public class PipTouchHandler {
|
|||||||
// TODO(b/181599115): This should really be initializes as part of the pip controller, but
|
// TODO(b/181599115): This should really be initializes as part of the pip controller, but
|
||||||
// until all PIP implementations derive from the controller, just initialize the touch handler
|
// until all PIP implementations derive from the controller, just initialize the touch handler
|
||||||
// if it is needed
|
// if it is needed
|
||||||
|
if (!PipUtils.isPip2ExperimentEnabled()) {
|
||||||
shellInit.addInitCallback(this::onInit, this);
|
shellInit.addInitCallback(this::onInit, this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the touch handler is initialized.
|
* Called when the touch handler is initialized.
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.pip2;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.android.wm.shell.ShellTaskOrganizer;
|
||||||
|
import com.android.wm.shell.pip.PipAnimationController;
|
||||||
|
import com.android.wm.shell.pip.PipBoundsAlgorithm;
|
||||||
|
import com.android.wm.shell.pip.PipBoundsState;
|
||||||
|
import com.android.wm.shell.pip.PipMenuController;
|
||||||
|
import com.android.wm.shell.pip.PipTransitionController;
|
||||||
|
import com.android.wm.shell.sysui.ShellInit;
|
||||||
|
import com.android.wm.shell.transition.Transitions;
|
||||||
|
|
||||||
|
/** Placeholder, for demonstrate purpose only. */
|
||||||
|
public abstract class PipTransition extends PipTransitionController {
|
||||||
|
public PipTransition(
|
||||||
|
@NonNull ShellInit shellInit,
|
||||||
|
@NonNull ShellTaskOrganizer shellTaskOrganizer,
|
||||||
|
@NonNull Transitions transitions,
|
||||||
|
PipBoundsState pipBoundsState,
|
||||||
|
PipMenuController pipMenuController,
|
||||||
|
PipBoundsAlgorithm pipBoundsAlgorithm,
|
||||||
|
PipAnimationController pipAnimationController) {
|
||||||
|
super(shellInit, shellTaskOrganizer, transitions, pipBoundsState, pipMenuController,
|
||||||
|
pipBoundsAlgorithm, pipAnimationController);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# PLACEHOLDER
|
||||||
|
|
||||||
|
This is meant to be the doc for the pip2 package.
|
||||||
@@ -49,7 +49,6 @@ import com.android.wm.shell.desktopmode.DesktopModeStatus;
|
|||||||
import com.android.wm.shell.desktopmode.DesktopTasksController;
|
import com.android.wm.shell.desktopmode.DesktopTasksController;
|
||||||
import com.android.wm.shell.keyguard.KeyguardTransitionHandler;
|
import com.android.wm.shell.keyguard.KeyguardTransitionHandler;
|
||||||
import com.android.wm.shell.pip.PipTransitionController;
|
import com.android.wm.shell.pip.PipTransitionController;
|
||||||
import com.android.wm.shell.pip.phone.PipTouchHandler;
|
|
||||||
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
||||||
import com.android.wm.shell.recents.RecentsTransitionHandler;
|
import com.android.wm.shell.recents.RecentsTransitionHandler;
|
||||||
import com.android.wm.shell.splitscreen.SplitScreenController;
|
import com.android.wm.shell.splitscreen.SplitScreenController;
|
||||||
@@ -147,7 +146,7 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
|
|||||||
|
|
||||||
public DefaultMixedHandler(@NonNull ShellInit shellInit, @NonNull Transitions player,
|
public DefaultMixedHandler(@NonNull ShellInit shellInit, @NonNull Transitions player,
|
||||||
Optional<SplitScreenController> splitScreenControllerOptional,
|
Optional<SplitScreenController> splitScreenControllerOptional,
|
||||||
Optional<PipTouchHandler> pipTouchHandlerOptional,
|
@Nullable PipTransitionController pipTransitionController,
|
||||||
Optional<RecentsTransitionHandler> recentsHandlerOptional,
|
Optional<RecentsTransitionHandler> recentsHandlerOptional,
|
||||||
KeyguardTransitionHandler keyguardHandler,
|
KeyguardTransitionHandler keyguardHandler,
|
||||||
Optional<DesktopModeController> desktopModeControllerOptional,
|
Optional<DesktopModeController> desktopModeControllerOptional,
|
||||||
@@ -155,11 +154,12 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
|
|||||||
Optional<UnfoldTransitionHandler> unfoldHandler) {
|
Optional<UnfoldTransitionHandler> unfoldHandler) {
|
||||||
mPlayer = player;
|
mPlayer = player;
|
||||||
mKeyguardHandler = keyguardHandler;
|
mKeyguardHandler = keyguardHandler;
|
||||||
if (Transitions.ENABLE_SHELL_TRANSITIONS && pipTouchHandlerOptional.isPresent()
|
if (Transitions.ENABLE_SHELL_TRANSITIONS
|
||||||
|
&& pipTransitionController != null
|
||||||
&& splitScreenControllerOptional.isPresent()) {
|
&& splitScreenControllerOptional.isPresent()) {
|
||||||
// Add after dependencies because it is higher priority
|
// Add after dependencies because it is higher priority
|
||||||
shellInit.addInitCallback(() -> {
|
shellInit.addInitCallback(() -> {
|
||||||
mPipHandler = pipTouchHandlerOptional.get().getTransitionHandler();
|
mPipHandler = pipTransitionController;
|
||||||
mSplitHandler = splitScreenControllerOptional.get().getTransitionHandler();
|
mSplitHandler = splitScreenControllerOptional.get().getTransitionHandler();
|
||||||
mPlayer.addHandler(this);
|
mPlayer.addHandler(this);
|
||||||
if (mSplitHandler != null) {
|
if (mSplitHandler != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user