1 /* 2 * Copyright (C) 2019 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.dagger; 18 19 import android.os.HandlerThread; 20 21 import androidx.annotation.Nullable; 22 23 import com.android.systemui.SystemUIInitializer; 24 import com.android.wm.shell.back.BackAnimation; 25 import com.android.wm.shell.bubbles.Bubbles; 26 import com.android.wm.shell.dagger.WMShellModule; 27 import com.android.wm.shell.dagger.WMSingleton; 28 import com.android.wm.shell.desktopmode.DesktopMode; 29 import com.android.wm.shell.displayareahelper.DisplayAreaHelper; 30 import com.android.wm.shell.keyguard.KeyguardTransitions; 31 import com.android.wm.shell.onehanded.OneHanded; 32 import com.android.wm.shell.pip.Pip; 33 import com.android.wm.shell.recents.RecentTasks; 34 import com.android.wm.shell.shared.ShellTransitions; 35 import com.android.wm.shell.shared.annotations.ShellMainThread; 36 import com.android.wm.shell.splitscreen.SplitScreen; 37 import com.android.wm.shell.startingsurface.StartingSurface; 38 import com.android.wm.shell.sysui.ShellInterface; 39 import com.android.wm.shell.taskview.TaskViewFactory; 40 41 import dagger.BindsInstance; 42 import dagger.Subcomponent; 43 44 import java.util.Optional; 45 46 /** 47 * Dagger Subcomponent for WindowManager. This class explicitly describes the interfaces exported 48 * from the WM component into the SysUI component (in 49 * {@link SystemUIInitializer#init(boolean)}), and references the specific dependencies 50 * provided by its particular device/form-factor SystemUI implementation. 51 * 52 * ie. {@link WMComponent} includes {@link WMShellModule} 53 * and {@code TvWMComponent} includes {@link com.android.wm.shell.dagger.TvWMShellModule} 54 */ 55 @WMSingleton 56 @Subcomponent(modules = {WMShellModule.class}) 57 public interface WMComponent { 58 59 /** 60 * Builder for a WMComponent. 61 */ 62 @Subcomponent.Builder 63 interface Builder { 64 65 @BindsInstance setShellMainThread(@ullable @hellMainThread HandlerThread t)66 Builder setShellMainThread(@Nullable @ShellMainThread HandlerThread t); 67 build()68 WMComponent build(); 69 } 70 71 /** 72 * Initializes all the WMShell components before starting any of the SystemUI components. 73 */ init()74 default void init() { 75 getShell().onInit(); 76 } 77 78 @WMSingleton getShell()79 ShellInterface getShell(); 80 81 @WMSingleton getOneHanded()82 Optional<OneHanded> getOneHanded(); 83 84 @WMSingleton getPip()85 Optional<Pip> getPip(); 86 87 @WMSingleton getSplitScreen()88 Optional<SplitScreen> getSplitScreen(); 89 90 @WMSingleton getBubbles()91 Optional<Bubbles> getBubbles(); 92 93 @WMSingleton getTaskViewFactory()94 Optional<TaskViewFactory> getTaskViewFactory(); 95 96 @WMSingleton getShellTransitions()97 ShellTransitions getShellTransitions(); 98 99 @WMSingleton getKeyguardTransitions()100 KeyguardTransitions getKeyguardTransitions(); 101 102 @WMSingleton getStartingSurface()103 Optional<StartingSurface> getStartingSurface(); 104 105 @WMSingleton getDisplayAreaHelper()106 Optional<DisplayAreaHelper> getDisplayAreaHelper(); 107 108 @WMSingleton getRecentTasks()109 Optional<RecentTasks> getRecentTasks(); 110 111 @WMSingleton getBackAnimation()112 Optional<BackAnimation> getBackAnimation(); 113 114 /** 115 * Optional {@link DesktopMode} component for interacting with desktop mode. 116 */ 117 @WMSingleton getDesktopMode()118 Optional<DesktopMode> getDesktopMode(); 119 } 120