1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.systemui.wmshell; 18 19 import android.animation.AnimationHandler; 20 import android.content.Context; 21 import android.view.IWindowManager; 22 23 import com.android.systemui.dagger.WMComponent; 24 import com.android.systemui.dagger.WMSingleton; 25 import com.android.wm.shell.ShellTaskOrganizer; 26 import com.android.wm.shell.common.DisplayController; 27 import com.android.wm.shell.common.DisplayImeController; 28 import com.android.wm.shell.common.ShellExecutor; 29 import com.android.wm.shell.common.SyncTransactionQueue; 30 import com.android.wm.shell.common.SystemWindows; 31 import com.android.wm.shell.common.TaskStackListenerImpl; 32 import com.android.wm.shell.common.TransactionPool; 33 import com.android.wm.shell.common.annotations.ChoreographerSfVsync; 34 import com.android.wm.shell.common.annotations.ShellMainThread; 35 import com.android.wm.shell.legacysplitscreen.LegacySplitScreenController; 36 import com.android.wm.shell.startingsurface.StartingWindowTypeAlgorithm; 37 import com.android.wm.shell.startingsurface.tv.TvStartingWindowTypeAlgorithm; 38 import com.android.wm.shell.transition.Transitions; 39 40 import dagger.Module; 41 import dagger.Provides; 42 43 /** 44 * Provides dependencies from {@link com.android.wm.shell}, these dependencies are only 45 * accessible from components within the WM subcomponent (can be explicitly exposed to the 46 * SysUIComponent, see {@link WMComponent}). 47 * 48 * This module only defines Shell dependencies for the TV SystemUI implementation. Common 49 * dependencies should go into {@link WMShellBaseModule}. 50 */ 51 @Module(includes = {TvPipModule.class}) 52 public class TvWMShellModule { 53 54 // 55 // Internal common - Components used internally by multiple shell features 56 // 57 58 @WMSingleton 59 @Provides provideDisplayImeController(IWindowManager wmService, DisplayController displayController, @ShellMainThread ShellExecutor mainExecutor, TransactionPool transactionPool)60 static DisplayImeController provideDisplayImeController(IWindowManager wmService, 61 DisplayController displayController, @ShellMainThread ShellExecutor mainExecutor, 62 TransactionPool transactionPool) { 63 return new DisplayImeController(wmService, displayController, mainExecutor, 64 transactionPool); 65 } 66 67 // 68 // Split/multiwindow 69 // 70 71 @WMSingleton 72 @Provides provideSplitScreen(Context context, DisplayController displayController, SystemWindows systemWindows, DisplayImeController displayImeController, TransactionPool transactionPool, ShellTaskOrganizer shellTaskOrganizer, SyncTransactionQueue syncQueue, TaskStackListenerImpl taskStackListener, Transitions transitions, @ShellMainThread ShellExecutor mainExecutor, @ChoreographerSfVsync AnimationHandler sfVsyncAnimationHandler)73 static LegacySplitScreenController provideSplitScreen(Context context, 74 DisplayController displayController, SystemWindows systemWindows, 75 DisplayImeController displayImeController, TransactionPool transactionPool, 76 ShellTaskOrganizer shellTaskOrganizer, SyncTransactionQueue syncQueue, 77 TaskStackListenerImpl taskStackListener, Transitions transitions, 78 @ShellMainThread ShellExecutor mainExecutor, 79 @ChoreographerSfVsync AnimationHandler sfVsyncAnimationHandler) { 80 return new LegacySplitScreenController(context, displayController, systemWindows, 81 displayImeController, transactionPool, shellTaskOrganizer, syncQueue, 82 taskStackListener, transitions, mainExecutor, sfVsyncAnimationHandler); 83 } 84 85 // 86 // Starting Windows (Splash Screen) 87 // 88 89 @WMSingleton 90 @Provides provideStartingWindowTypeAlgorithm()91 static StartingWindowTypeAlgorithm provideStartingWindowTypeAlgorithm() { 92 return new TvStartingWindowTypeAlgorithm(); 93 }; 94 } 95