| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package com.android.wm.shell.dagger; |
| 18 |
|
| 19 |
import static com.android.wm.shell.onehanded.OneHandedController.SUPPORT_ONE_HANDED_MODE; |
| 20 |
|
| 21 |
import android.app.ActivityTaskManager; |
| 22 |
import android.content.Context; |
| 23 |
import android.content.pm.PackageManager; |
| 24 |
import android.os.Handler; |
| 25 |
import android.os.SystemProperties; |
| 26 |
import android.view.IWindowManager; |
| 27 |
|
| 28 |
import com.android.internal.logging.UiEventLogger; |
| 29 |
import com.android.launcher3.icons.IconProvider; |
| 30 |
import com.android.wm.shell.ProtoLogController; |
| 31 |
import com.android.wm.shell.R; |
| 32 |
import com.android.wm.shell.RootDisplayAreaOrganizer; |
| 33 |
import com.android.wm.shell.RootTaskDisplayAreaOrganizer; |
| 34 |
import com.android.wm.shell.ShellTaskOrganizer; |
| 35 |
import com.android.wm.shell.TaskViewFactory; |
| 36 |
import com.android.wm.shell.TaskViewFactoryController; |
| 37 |
import com.android.wm.shell.TaskViewTransitions; |
| 38 |
import com.android.wm.shell.WindowManagerShellWrapper; |
| 39 |
import com.android.wm.shell.activityembedding.ActivityEmbeddingController; |
| 40 |
import com.android.wm.shell.back.BackAnimation; |
| 41 |
import com.android.wm.shell.back.BackAnimationController; |
| 42 |
import com.android.wm.shell.bubbles.BubbleController; |
| 43 |
import com.android.wm.shell.bubbles.Bubbles; |
| 44 |
import com.android.wm.shell.common.DisplayController; |
| 45 |
import com.android.wm.shell.common.DisplayImeController; |
| 46 |
import com.android.wm.shell.common.DisplayInsetsController; |
| 47 |
import com.android.wm.shell.common.DisplayLayout; |
| 48 |
import com.android.wm.shell.common.DockStateReader; |
| 49 |
import com.android.wm.shell.common.FloatingContentCoordinator; |
| 50 |
import com.android.wm.shell.common.ShellExecutor; |
| 51 |
import com.android.wm.shell.common.SyncTransactionQueue; |
| 52 |
import com.android.wm.shell.common.SystemWindows; |
| 53 |
import com.android.wm.shell.common.TaskStackListenerImpl; |
| 54 |
import com.android.wm.shell.common.TransactionPool; |
| 55 |
import com.android.wm.shell.common.annotations.ShellAnimationThread; |
| 56 |
import com.android.wm.shell.common.annotations.ShellBackgroundThread; |
| 57 |
import com.android.wm.shell.common.annotations.ShellMainThread; |
| 58 |
import com.android.wm.shell.common.annotations.ShellSplashscreenThread; |
| 59 |
import com.android.wm.shell.compatui.CompatUIController; |
| 60 |
import com.android.wm.shell.desktopmode.DesktopMode; |
| 61 |
import com.android.wm.shell.desktopmode.DesktopModeController; |
| 62 |
import com.android.wm.shell.desktopmode.DesktopModeStatus; |
| 63 |
import com.android.wm.shell.desktopmode.DesktopModeTaskRepository; |
| 64 |
import com.android.wm.shell.desktopmode.DesktopTasksController; |
| 65 |
import com.android.wm.shell.displayareahelper.DisplayAreaHelper; |
| 66 |
import com.android.wm.shell.displayareahelper.DisplayAreaHelperController; |
| 67 |
import com.android.wm.shell.draganddrop.DragAndDropController; |
| 68 |
import com.android.wm.shell.freeform.FreeformComponents; |
| 69 |
import com.android.wm.shell.fullscreen.FullscreenTaskListener; |
| 70 |
import com.android.wm.shell.hidedisplaycutout.HideDisplayCutoutController; |
| 71 |
import com.android.wm.shell.onehanded.OneHanded; |
| 72 |
import com.android.wm.shell.onehanded.OneHandedController; |
| 73 |
import com.android.wm.shell.pip.Pip; |
| 74 |
import com.android.wm.shell.pip.PipMediaController; |
| 75 |
import com.android.wm.shell.pip.PipSurfaceTransactionHelper; |
| 76 |
import com.android.wm.shell.pip.PipUiEventLogger; |
| 77 |
import com.android.wm.shell.pip.phone.PipTouchHandler; |
| 78 |
import com.android.wm.shell.recents.RecentTasks; |
| 79 |
import com.android.wm.shell.recents.RecentTasksController; |
| 80 |
import com.android.wm.shell.splitscreen.SplitScreen; |
| 81 |
import com.android.wm.shell.splitscreen.SplitScreenController; |
| 82 |
import com.android.wm.shell.startingsurface.StartingSurface; |
| 83 |
import com.android.wm.shell.startingsurface.StartingWindowController; |
| 84 |
import com.android.wm.shell.startingsurface.StartingWindowTypeAlgorithm; |
| 85 |
import com.android.wm.shell.startingsurface.phone.PhoneStartingWindowTypeAlgorithm; |
| 86 |
import com.android.wm.shell.sysui.ShellCommandHandler; |
| 87 |
import com.android.wm.shell.sysui.ShellController; |
| 88 |
import com.android.wm.shell.sysui.ShellInit; |
| 89 |
import com.android.wm.shell.sysui.ShellInterface; |
| 90 |
import com.android.wm.shell.transition.ShellTransitions; |
| 91 |
import com.android.wm.shell.transition.Transitions; |
| 92 |
import com.android.wm.shell.unfold.ShellUnfoldProgressProvider; |
| 93 |
import com.android.wm.shell.unfold.UnfoldAnimationController; |
| 94 |
import com.android.wm.shell.unfold.UnfoldTransitionHandler; |
| 95 |
import com.android.wm.shell.windowdecor.WindowDecorViewModel; |
| 96 |
|
| 97 |
import java.util.Optional; |
| 98 |
|
| 99 |
import dagger.BindsOptionalOf; |
| 100 |
import dagger.Lazy; |
| 101 |
import dagger.Module; |
| 102 |
import dagger.Provides; |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
@Module(includes = WMShellConcurrencyModule.class) |
| 114 |
public abstract class WMShellBaseModule { |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
@WMSingleton |
| 121 |
@Provides |
| 122 |
static DisplayController provideDisplayController(Context context, |
| 123 |
IWindowManager wmService, |
| 124 |
ShellInit shellInit, |
| 125 |
@ShellMainThread ShellExecutor mainExecutor) { |
| 126 |
return new DisplayController(context, wmService, shellInit, mainExecutor); |
| 127 |
} |
| 128 |
|
| 129 |
@WMSingleton |
| 130 |
@Provides |
| 131 |
static DisplayInsetsController provideDisplayInsetsController(IWindowManager wmService, |
| 132 |
ShellInit shellInit, |
| 133 |
DisplayController displayController, |
| 134 |
@ShellMainThread ShellExecutor mainExecutor) { |
| 135 |
return new DisplayInsetsController(wmService, shellInit, displayController, |
| 136 |
mainExecutor); |
| 137 |
} |
| 138 |
|
| 139 |
@WMSingleton |
| 140 |
@Provides |
| 141 |
static DisplayImeController provideDisplayImeController( |
| 142 |
IWindowManager wmService, |
| 143 |
ShellInit shellInit, |
| 144 |
DisplayController displayController, |
| 145 |
DisplayInsetsController displayInsetsController, |
| 146 |
TransactionPool transactionPool, |
| 147 |
@ShellMainThread ShellExecutor mainExecutor |
| 148 |
) { |
| 149 |
return new DisplayImeController(wmService, shellInit, displayController, |
| 150 |
displayInsetsController, transactionPool, mainExecutor); |
| 151 |
} |
| 152 |
|
| 153 |
@WMSingleton |
| 154 |
@Provides |
| 155 |
static DisplayLayout provideDisplayLayout() { |
| 156 |
return new DisplayLayout(); |
| 157 |
} |
| 158 |
|
| 159 |
@WMSingleton |
| 160 |
@Provides |
| 161 |
static DragAndDropController provideDragAndDropController(Context context, |
| 162 |
ShellInit shellInit, |
| 163 |
ShellController shellController, |
| 164 |
DisplayController displayController, |
| 165 |
UiEventLogger uiEventLogger, |
| 166 |
IconProvider iconProvider, |
| 167 |
@ShellMainThread ShellExecutor mainExecutor) { |
| 168 |
return new DragAndDropController(context, shellInit, shellController, displayController, |
| 169 |
uiEventLogger, iconProvider, mainExecutor); |
| 170 |
} |
| 171 |
|
| 172 |
@WMSingleton |
| 173 |
@Provides |
| 174 |
static ShellTaskOrganizer provideShellTaskOrganizer( |
| 175 |
Context context, |
| 176 |
ShellInit shellInit, |
| 177 |
ShellCommandHandler shellCommandHandler, |
| 178 |
CompatUIController compatUI, |
| 179 |
Optional<UnfoldAnimationController> unfoldAnimationController, |
| 180 |
Optional<RecentTasksController> recentTasksOptional, |
| 181 |
@ShellMainThread ShellExecutor mainExecutor |
| 182 |
) { |
| 183 |
if (!context.getResources().getBoolean(R.bool.config_registerShellTaskOrganizerOnInit)) { |
| 184 |
|
| 185 |
shellInit = new ShellInit(mainExecutor); |
| 186 |
} |
| 187 |
return new ShellTaskOrganizer(shellInit, shellCommandHandler, compatUI, |
| 188 |
unfoldAnimationController, recentTasksOptional, mainExecutor); |
| 189 |
} |
| 190 |
|
| 191 |
@WMSingleton |
| 192 |
@Provides |
| 193 |
static CompatUIController provideCompatUIController(Context context, |
| 194 |
ShellInit shellInit, |
| 195 |
ShellController shellController, |
| 196 |
DisplayController displayController, DisplayInsetsController displayInsetsController, |
| 197 |
DisplayImeController imeController, SyncTransactionQueue syncQueue, |
| 198 |
@ShellMainThread ShellExecutor mainExecutor, Lazy<Transitions> transitionsLazy, |
| 199 |
DockStateReader dockStateReader) { |
| 200 |
return new CompatUIController(context, shellInit, shellController, displayController, |
| 201 |
displayInsetsController, imeController, syncQueue, mainExecutor, transitionsLazy, |
| 202 |
dockStateReader); |
| 203 |
} |
| 204 |
|
| 205 |
@WMSingleton |
| 206 |
@Provides |
| 207 |
static SyncTransactionQueue provideSyncTransactionQueue(TransactionPool pool, |
| 208 |
@ShellMainThread ShellExecutor mainExecutor) { |
| 209 |
return new SyncTransactionQueue(pool, mainExecutor); |
| 210 |
} |
| 211 |
|
| 212 |
@WMSingleton |
| 213 |
@Provides |
| 214 |
static SystemWindows provideSystemWindows(DisplayController displayController, |
| 215 |
IWindowManager wmService) { |
| 216 |
return new SystemWindows(displayController, wmService); |
| 217 |
} |
| 218 |
|
| 219 |
@WMSingleton |
| 220 |
@Provides |
| 221 |
static IconProvider provideIconProvider(Context context) { |
| 222 |
return new IconProvider(context); |
| 223 |
} |
| 224 |
|
| 225 |
|
| 226 |
@WMSingleton |
| 227 |
@Provides |
| 228 |
static TaskStackListenerImpl providerTaskStackListenerImpl( |
| 229 |
@ShellMainThread Handler mainHandler) { |
| 230 |
return new TaskStackListenerImpl(mainHandler); |
| 231 |
} |
| 232 |
|
| 233 |
@WMSingleton |
| 234 |
@Provides |
| 235 |
static TransactionPool provideTransactionPool() { |
| 236 |
return new TransactionPool(); |
| 237 |
} |
| 238 |
|
| 239 |
@WMSingleton |
| 240 |
@Provides |
| 241 |
static WindowManagerShellWrapper provideWindowManagerShellWrapper( |
| 242 |
@ShellMainThread ShellExecutor mainExecutor) { |
| 243 |
return new WindowManagerShellWrapper(mainExecutor); |
| 244 |
} |
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
@WMSingleton |
| 251 |
@Provides |
| 252 |
static Optional<BackAnimation> provideBackAnimation( |
| 253 |
Optional<BackAnimationController> backAnimationController) { |
| 254 |
return backAnimationController.map(BackAnimationController::getBackAnimationImpl); |
| 255 |
} |
| 256 |
|
| 257 |
@WMSingleton |
| 258 |
@Provides |
| 259 |
static Optional<BackAnimationController> provideBackAnimationController( |
| 260 |
Context context, |
| 261 |
ShellInit shellInit, |
| 262 |
ShellController shellController, |
| 263 |
@ShellMainThread ShellExecutor shellExecutor, |
| 264 |
@ShellBackgroundThread Handler backgroundHandler |
| 265 |
) { |
| 266 |
if (BackAnimationController.IS_ENABLED) { |
| 267 |
return Optional.of( |
| 268 |
new BackAnimationController(shellInit, shellController, shellExecutor, |
| 269 |
backgroundHandler, context)); |
| 270 |
} |
| 271 |
return Optional.empty(); |
| 272 |
} |
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
@WMSingleton |
| 279 |
@Provides |
| 280 |
static Optional<Bubbles> provideBubbles(Optional<BubbleController> bubbleController) { |
| 281 |
return bubbleController.map((controller) -> controller.asBubbles()); |
| 282 |
} |
| 283 |
|
| 284 |
@BindsOptionalOf |
| 285 |
abstract BubbleController optionalBubblesController(); |
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
@BindsOptionalOf |
| 293 |
@DynamicOverride |
| 294 |
abstract FullscreenTaskListener optionalFullscreenTaskListener(); |
| 295 |
|
| 296 |
@WMSingleton |
| 297 |
@Provides |
| 298 |
static FullscreenTaskListener provideFullscreenTaskListener( |
| 299 |
@DynamicOverride Optional<FullscreenTaskListener> fullscreenTaskListener, |
| 300 |
ShellInit shellInit, |
| 301 |
ShellTaskOrganizer shellTaskOrganizer, |
| 302 |
SyncTransactionQueue syncQueue, |
| 303 |
Optional<RecentTasksController> recentTasksOptional, |
| 304 |
Optional<WindowDecorViewModel> windowDecorViewModelOptional) { |
| 305 |
if (fullscreenTaskListener.isPresent()) { |
| 306 |
return fullscreenTaskListener.get(); |
| 307 |
} else { |
| 308 |
return new FullscreenTaskListener(shellInit, shellTaskOrganizer, syncQueue, |
| 309 |
recentTasksOptional, windowDecorViewModelOptional); |
| 310 |
} |
| 311 |
} |
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
@BindsOptionalOf |
| 318 |
abstract WindowDecorViewModel optionalWindowDecorViewModel(); |
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
@BindsOptionalOf |
| 325 |
abstract ShellUnfoldProgressProvider optionalShellUnfoldProgressProvider(); |
| 326 |
|
| 327 |
|
| 328 |
@BindsOptionalOf |
| 329 |
@DynamicOverride |
| 330 |
abstract UnfoldAnimationController optionalUnfoldController(); |
| 331 |
|
| 332 |
@WMSingleton |
| 333 |
@Provides |
| 334 |
static Optional<UnfoldAnimationController> provideUnfoldController( |
| 335 |
@DynamicOverride Lazy<Optional<UnfoldAnimationController>> |
| 336 |
fullscreenUnfoldController, |
| 337 |
Optional<ShellUnfoldProgressProvider> progressProvider) { |
| 338 |
if (progressProvider.isPresent() |
| 339 |
&& progressProvider.get() != ShellUnfoldProgressProvider.NO_PROVIDER) { |
| 340 |
return fullscreenUnfoldController.get(); |
| 341 |
} |
| 342 |
return Optional.empty(); |
| 343 |
} |
| 344 |
|
| 345 |
@BindsOptionalOf |
| 346 |
@DynamicOverride |
| 347 |
abstract UnfoldTransitionHandler optionalUnfoldTransitionHandler(); |
| 348 |
|
| 349 |
@WMSingleton |
| 350 |
@Provides |
| 351 |
static Optional<UnfoldTransitionHandler> provideUnfoldTransitionHandler( |
| 352 |
Optional<ShellUnfoldProgressProvider> progressProvider, |
| 353 |
@DynamicOverride Lazy<Optional<UnfoldTransitionHandler>> handler) { |
| 354 |
if (progressProvider.isPresent() |
| 355 |
&& progressProvider.get() != ShellUnfoldProgressProvider.NO_PROVIDER) { |
| 356 |
return handler.get(); |
| 357 |
} |
| 358 |
return Optional.empty(); |
| 359 |
} |
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
@BindsOptionalOf |
| 367 |
@DynamicOverride |
| 368 |
abstract FreeformComponents optionalFreeformComponents(); |
| 369 |
|
| 370 |
@WMSingleton |
| 371 |
@Provides |
| 372 |
static Optional<FreeformComponents> provideFreeformComponents( |
| 373 |
@DynamicOverride Optional<FreeformComponents> freeformComponents, |
| 374 |
Context context) { |
| 375 |
if (FreeformComponents.isFreeformEnabled(context)) { |
| 376 |
return freeformComponents; |
| 377 |
} |
| 378 |
return Optional.empty(); |
| 379 |
} |
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
@WMSingleton |
| 386 |
@Provides |
| 387 |
static Optional<HideDisplayCutoutController> provideHideDisplayCutoutController(Context context, |
| 388 |
ShellInit shellInit, |
| 389 |
ShellCommandHandler shellCommandHandler, |
| 390 |
ShellController shellController, |
| 391 |
DisplayController displayController, |
| 392 |
@ShellMainThread ShellExecutor mainExecutor) { |
| 393 |
return Optional.ofNullable( |
| 394 |
HideDisplayCutoutController.create(context, shellInit, shellCommandHandler, |
| 395 |
shellController, displayController, mainExecutor)); |
| 396 |
} |
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
@WMSingleton |
| 403 |
@Provides |
| 404 |
static Optional<OneHanded> provideOneHanded(Optional<OneHandedController> oneHandedController) { |
| 405 |
return oneHandedController.map((controller) -> controller.asOneHanded()); |
| 406 |
} |
| 407 |
|
| 408 |
|
| 409 |
@BindsOptionalOf |
| 410 |
@DynamicOverride |
| 411 |
abstract OneHandedController optionalOneHandedController(); |
| 412 |
|
| 413 |
@WMSingleton |
| 414 |
@Provides |
| 415 |
static Optional<OneHandedController> providesOneHandedController( |
| 416 |
@DynamicOverride Optional<OneHandedController> oneHandedController) { |
| 417 |
if (SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false)) { |
| 418 |
return oneHandedController; |
| 419 |
} |
| 420 |
return Optional.empty(); |
| 421 |
} |
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
@WMSingleton |
| 428 |
@Provides |
| 429 |
static FloatingContentCoordinator provideFloatingContentCoordinator() { |
| 430 |
return new FloatingContentCoordinator(); |
| 431 |
} |
| 432 |
|
| 433 |
|
| 434 |
@WMSingleton |
| 435 |
@Provides |
| 436 |
static PipMediaController providePipMediaController(Context context, |
| 437 |
@ShellMainThread Handler mainHandler) { |
| 438 |
return new PipMediaController(context, mainHandler); |
| 439 |
} |
| 440 |
|
| 441 |
@WMSingleton |
| 442 |
@Provides |
| 443 |
static PipSurfaceTransactionHelper providePipSurfaceTransactionHelper(Context context) { |
| 444 |
return new PipSurfaceTransactionHelper(context); |
| 445 |
} |
| 446 |
|
| 447 |
@WMSingleton |
| 448 |
@Provides |
| 449 |
static PipUiEventLogger providePipUiEventLogger(UiEventLogger uiEventLogger, |
| 450 |
PackageManager packageManager) { |
| 451 |
return new PipUiEventLogger(uiEventLogger, packageManager); |
| 452 |
} |
| 453 |
|
| 454 |
@BindsOptionalOf |
| 455 |
abstract PipTouchHandler optionalPipTouchHandler(); |
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
@WMSingleton |
| 462 |
@Provides |
| 463 |
static Optional<RecentTasks> provideRecentTasks( |
| 464 |
Optional<RecentTasksController> recentTasksController) { |
| 465 |
return recentTasksController.map((controller) -> controller.asRecentTasks()); |
| 466 |
} |
| 467 |
|
| 468 |
@WMSingleton |
| 469 |
@Provides |
| 470 |
static Optional<RecentTasksController> provideRecentTasksController( |
| 471 |
Context context, |
| 472 |
ShellInit shellInit, |
| 473 |
ShellController shellController, |
| 474 |
ShellCommandHandler shellCommandHandler, |
| 475 |
TaskStackListenerImpl taskStackListener, |
| 476 |
ActivityTaskManager activityTaskManager, |
| 477 |
Optional<DesktopModeTaskRepository> desktopModeTaskRepository, |
| 478 |
@ShellMainThread ShellExecutor mainExecutor |
| 479 |
) { |
| 480 |
return Optional.ofNullable( |
| 481 |
RecentTasksController.create(context, shellInit, shellController, |
| 482 |
shellCommandHandler, taskStackListener, activityTaskManager, |
| 483 |
desktopModeTaskRepository, mainExecutor)); |
| 484 |
} |
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
@WMSingleton |
| 491 |
@Provides |
| 492 |
static ShellTransitions provideRemoteTransitions(Transitions transitions) { |
| 493 |
return transitions.asRemoteTransitions(); |
| 494 |
} |
| 495 |
|
| 496 |
@WMSingleton |
| 497 |
@Provides |
| 498 |
static Transitions provideTransitions(Context context, |
| 499 |
ShellInit shellInit, |
| 500 |
ShellController shellController, |
| 501 |
ShellTaskOrganizer organizer, |
| 502 |
TransactionPool pool, |
| 503 |
DisplayController displayController, |
| 504 |
@ShellMainThread ShellExecutor mainExecutor, |
| 505 |
@ShellMainThread Handler mainHandler, |
| 506 |
@ShellAnimationThread ShellExecutor animExecutor) { |
| 507 |
if (!context.getResources().getBoolean(R.bool.config_registerShellTransitionsOnInit)) { |
| 508 |
|
| 509 |
shellInit = new ShellInit(mainExecutor); |
| 510 |
} |
| 511 |
return new Transitions(context, shellInit, shellController, organizer, pool, |
| 512 |
displayController, mainExecutor, mainHandler, animExecutor); |
| 513 |
} |
| 514 |
|
| 515 |
@WMSingleton |
| 516 |
@Provides |
| 517 |
static TaskViewTransitions provideTaskViewTransitions(Transitions transitions) { |
| 518 |
return new TaskViewTransitions(transitions); |
| 519 |
} |
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
@WMSingleton |
| 526 |
@Provides |
| 527 |
static RootTaskDisplayAreaOrganizer provideRootTaskDisplayAreaOrganizer( |
| 528 |
@ShellMainThread ShellExecutor mainExecutor, Context context) { |
| 529 |
return new RootTaskDisplayAreaOrganizer(mainExecutor, context); |
| 530 |
} |
| 531 |
|
| 532 |
@WMSingleton |
| 533 |
@Provides |
| 534 |
static RootDisplayAreaOrganizer provideRootDisplayAreaOrganizer( |
| 535 |
@ShellMainThread ShellExecutor mainExecutor) { |
| 536 |
return new RootDisplayAreaOrganizer(mainExecutor); |
| 537 |
} |
| 538 |
|
| 539 |
@WMSingleton |
| 540 |
@Provides |
| 541 |
static Optional<DisplayAreaHelper> provideDisplayAreaHelper( |
| 542 |
@ShellMainThread ShellExecutor mainExecutor, |
| 543 |
RootDisplayAreaOrganizer rootDisplayAreaOrganizer) { |
| 544 |
return Optional.of(new DisplayAreaHelperController(mainExecutor, |
| 545 |
rootDisplayAreaOrganizer)); |
| 546 |
} |
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
@WMSingleton |
| 553 |
@Provides |
| 554 |
static Optional<SplitScreen> provideSplitScreen( |
| 555 |
Optional<SplitScreenController> splitScreenController) { |
| 556 |
return splitScreenController.map((controller) -> controller.asSplitScreen()); |
| 557 |
} |
| 558 |
|
| 559 |
|
| 560 |
@BindsOptionalOf |
| 561 |
@DynamicOverride |
| 562 |
abstract SplitScreenController optionalSplitScreenController(); |
| 563 |
|
| 564 |
@WMSingleton |
| 565 |
@Provides |
| 566 |
static Optional<SplitScreenController> providesSplitScreenController( |
| 567 |
@DynamicOverride Optional<SplitScreenController> splitscreenController, |
| 568 |
Context context) { |
| 569 |
if (ActivityTaskManager.supportsSplitScreenMultiWindow(context)) { |
| 570 |
return splitscreenController; |
| 571 |
} |
| 572 |
return Optional.empty(); |
| 573 |
} |
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
@WMSingleton |
| 580 |
@Provides |
| 581 |
static Optional<StartingSurface> provideStartingSurface( |
| 582 |
StartingWindowController startingWindowController) { |
| 583 |
return Optional.of(startingWindowController.asStartingSurface()); |
| 584 |
} |
| 585 |
|
| 586 |
@WMSingleton |
| 587 |
@Provides |
| 588 |
static StartingWindowController provideStartingWindowController( |
| 589 |
Context context, |
| 590 |
ShellInit shellInit, |
| 591 |
ShellController shellController, |
| 592 |
ShellTaskOrganizer shellTaskOrganizer, |
| 593 |
@ShellSplashscreenThread ShellExecutor splashScreenExecutor, |
| 594 |
StartingWindowTypeAlgorithm startingWindowTypeAlgorithm, IconProvider iconProvider, |
| 595 |
TransactionPool pool) { |
| 596 |
return new StartingWindowController(context, shellInit, shellController, shellTaskOrganizer, |
| 597 |
splashScreenExecutor, startingWindowTypeAlgorithm, iconProvider, pool); |
| 598 |
} |
| 599 |
|
| 600 |
|
| 601 |
@BindsOptionalOf |
| 602 |
@DynamicOverride |
| 603 |
abstract StartingWindowTypeAlgorithm optionalStartingWindowTypeAlgorithm(); |
| 604 |
|
| 605 |
@WMSingleton |
| 606 |
@Provides |
| 607 |
static StartingWindowTypeAlgorithm provideStartingWindowTypeAlgorithm( |
| 608 |
@DynamicOverride Optional<StartingWindowTypeAlgorithm> startingWindowTypeAlgorithm |
| 609 |
) { |
| 610 |
if (startingWindowTypeAlgorithm.isPresent()) { |
| 611 |
return startingWindowTypeAlgorithm.get(); |
| 612 |
} |
| 613 |
|
| 614 |
return new PhoneStartingWindowTypeAlgorithm(); |
| 615 |
} |
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
@WMSingleton |
| 622 |
@Provides |
| 623 |
static Optional<TaskViewFactory> provideTaskViewFactory( |
| 624 |
TaskViewFactoryController taskViewFactoryController) { |
| 625 |
return Optional.of(taskViewFactoryController.asTaskViewFactory()); |
| 626 |
} |
| 627 |
|
| 628 |
@WMSingleton |
| 629 |
@Provides |
| 630 |
static TaskViewFactoryController provideTaskViewFactoryController( |
| 631 |
ShellTaskOrganizer shellTaskOrganizer, |
| 632 |
@ShellMainThread ShellExecutor mainExecutor, |
| 633 |
SyncTransactionQueue syncQueue, |
| 634 |
TaskViewTransitions taskViewTransitions) { |
| 635 |
return new TaskViewFactoryController(shellTaskOrganizer, mainExecutor, syncQueue, |
| 636 |
taskViewTransitions); |
| 637 |
} |
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
|
| 642 |
|
| 643 |
|
| 644 |
@WMSingleton |
| 645 |
@Provides |
| 646 |
static Optional<ActivityEmbeddingController> provideActivityEmbeddingController( |
| 647 |
Context context, |
| 648 |
ShellInit shellInit, |
| 649 |
Transitions transitions) { |
| 650 |
return Optional.ofNullable( |
| 651 |
ActivityEmbeddingController.create(context, shellInit, transitions)); |
| 652 |
} |
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
@WMSingleton |
| 659 |
@Provides |
| 660 |
static ShellInterface provideShellSysuiCallbacks( |
| 661 |
@ShellCreateTrigger Object createTrigger, |
| 662 |
ShellController shellController) { |
| 663 |
return shellController.asShell(); |
| 664 |
} |
| 665 |
|
| 666 |
@WMSingleton |
| 667 |
@Provides |
| 668 |
static ShellController provideShellController(ShellInit shellInit, |
| 669 |
ShellCommandHandler shellCommandHandler, |
| 670 |
@ShellMainThread ShellExecutor mainExecutor) { |
| 671 |
return new ShellController(shellInit, shellCommandHandler, mainExecutor); |
| 672 |
} |
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
@WMSingleton |
| 679 |
@Provides |
| 680 |
static Optional<DesktopMode> provideDesktopMode( |
| 681 |
Optional<DesktopModeController> desktopModeController, |
| 682 |
Optional<DesktopTasksController> desktopTasksController) { |
| 683 |
if (DesktopModeStatus.isProto2Enabled()) { |
| 684 |
return desktopTasksController.map(DesktopTasksController::asDesktopMode); |
| 685 |
} |
| 686 |
return desktopModeController.map(DesktopModeController::asDesktopMode); |
| 687 |
} |
| 688 |
|
| 689 |
@BindsOptionalOf |
| 690 |
@DynamicOverride |
| 691 |
abstract DesktopModeController optionalDesktopModeController(); |
| 692 |
|
| 693 |
@WMSingleton |
| 694 |
@Provides |
| 695 |
static Optional<DesktopModeController> provideDesktopModeController( |
| 696 |
@DynamicOverride Optional<Lazy<DesktopModeController>> desktopModeController) { |
| 697 |
|
| 698 |
|
| 699 |
|
| 700 |
if (DesktopModeStatus.isProto1Enabled()) { |
| 701 |
return desktopModeController.map(Lazy::get); |
| 702 |
} |
| 703 |
return Optional.empty(); |
| 704 |
} |
| 705 |
|
| 706 |
@BindsOptionalOf |
| 707 |
@DynamicOverride |
| 708 |
abstract DesktopTasksController optionalDesktopTasksController(); |
| 709 |
|
| 710 |
@WMSingleton |
| 711 |
@Provides |
| 712 |
static Optional<DesktopTasksController> providesDesktopTasksController( |
| 713 |
@DynamicOverride Optional<Lazy<DesktopTasksController>> desktopTasksController) { |
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
if (DesktopModeStatus.isProto2Enabled()) { |
| 718 |
return desktopTasksController.map(Lazy::get); |
| 719 |
} |
| 720 |
return Optional.empty(); |
| 721 |
} |
| 722 |
|
| 723 |
@BindsOptionalOf |
| 724 |
@DynamicOverride |
| 725 |
abstract DesktopModeTaskRepository optionalDesktopModeTaskRepository(); |
| 726 |
|
| 727 |
@WMSingleton |
| 728 |
@Provides |
| 729 |
static Optional<DesktopModeTaskRepository> provideDesktopTaskRepository( |
| 730 |
@DynamicOverride Optional<Lazy<DesktopModeTaskRepository>> desktopModeTaskRepository) { |
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
if (DesktopModeStatus.isAnyEnabled()) { |
| 735 |
return desktopModeTaskRepository.map(Lazy::get); |
| 736 |
} |
| 737 |
return Optional.empty(); |
| 738 |
} |
| 739 |
|
| 740 |
|
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
|
| 745 |
@BindsOptionalOf |
| 746 |
@ShellCreateTriggerOverride |
| 747 |
abstract Object provideIndependentShellComponentsToCreateOverride(); |
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
@WMSingleton |
| 752 |
@ShellCreateTrigger |
| 753 |
@Provides |
| 754 |
static Object provideIndependentShellComponentsToCreate( |
| 755 |
DisplayController displayController, |
| 756 |
DisplayImeController displayImeController, |
| 757 |
DisplayInsetsController displayInsetsController, |
| 758 |
DragAndDropController dragAndDropController, |
| 759 |
ShellTaskOrganizer shellTaskOrganizer, |
| 760 |
Optional<BubbleController> bubblesOptional, |
| 761 |
Optional<SplitScreenController> splitScreenOptional, |
| 762 |
Optional<Pip> pipOptional, |
| 763 |
Optional<PipTouchHandler> pipTouchHandlerOptional, |
| 764 |
FullscreenTaskListener fullscreenTaskListener, |
| 765 |
Optional<UnfoldAnimationController> unfoldAnimationController, |
| 766 |
Optional<UnfoldTransitionHandler> unfoldTransitionHandler, |
| 767 |
Optional<FreeformComponents> freeformComponents, |
| 768 |
Optional<RecentTasksController> recentTasksOptional, |
| 769 |
Optional<OneHandedController> oneHandedControllerOptional, |
| 770 |
Optional<HideDisplayCutoutController> hideDisplayCutoutControllerOptional, |
| 771 |
Optional<ActivityEmbeddingController> activityEmbeddingOptional, |
| 772 |
Transitions transitions, |
| 773 |
StartingWindowController startingWindow, |
| 774 |
ProtoLogController protoLogController, |
| 775 |
@ShellCreateTriggerOverride Optional<Object> overriddenCreateTrigger) { |
| 776 |
return new Object(); |
| 777 |
} |
| 778 |
|
| 779 |
@WMSingleton |
| 780 |
@Provides |
| 781 |
static ShellInit provideShellInit(@ShellMainThread ShellExecutor mainExecutor) { |
| 782 |
return new ShellInit(mainExecutor); |
| 783 |
} |
| 784 |
|
| 785 |
@WMSingleton |
| 786 |
@Provides |
| 787 |
static ShellCommandHandler provideShellCommandHandler() { |
| 788 |
return new ShellCommandHandler(); |
| 789 |
} |
| 790 |
|
| 791 |
@WMSingleton |
| 792 |
@Provides |
| 793 |
static ProtoLogController provideProtoLogController( |
| 794 |
ShellInit shellInit, |
| 795 |
ShellCommandHandler shellCommandHandler) { |
| 796 |
return new ProtoLogController(shellInit, shellCommandHandler); |
| 797 |
} |
| 798 |
} |