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.wm.shell.dagger; 18 19 import android.os.HandlerThread; 20 21 import androidx.annotation.Nullable; 22 23 import com.android.wm.shell.appzoomout.AppZoomOut; 24 import com.android.wm.shell.back.BackAnimation; 25 import com.android.wm.shell.bubbles.Bubbles; 26 import com.android.wm.shell.bubbles.bar.BubbleBarExpandedView; 27 import com.android.wm.shell.desktopmode.DesktopMode; 28 import com.android.wm.shell.displayareahelper.DisplayAreaHelper; 29 import com.android.wm.shell.keyguard.KeyguardTransitions; 30 import com.android.wm.shell.onehanded.OneHanded; 31 import com.android.wm.shell.pip.Pip; 32 import com.android.wm.shell.recents.RecentTasks; 33 import com.android.wm.shell.shared.ShellTransitions; 34 import com.android.wm.shell.shared.annotations.ShellMainThread; 35 import com.android.wm.shell.splitscreen.SplitScreen; 36 import com.android.wm.shell.startingsurface.StartingSurface; 37 import com.android.wm.shell.sysui.ShellInterface; 38 import com.android.wm.shell.taskview.TaskViewFactory; 39 40 import dagger.BindsInstance; 41 import dagger.Subcomponent; 42 43 import java.util.Optional; 44 45 /** 46 * Dagger Subcomponent for WindowManager. This class explicitly describes the interfaces exported 47 * from the WM component into the SysUI component, and references the specific dependencies 48 * provided by its particular device/form-factor SystemUI implementation. 49 * 50 * <p> ie. {@link WMComponent} includes {@link WMShellModule} and {@code TvWMComponent} includes 51 * {@link TvWMShellModule} 52 */ 53 @WMSingleton 54 @Subcomponent(modules = {WMShellModule.class}) 55 public interface WMComponent { 56 57 /** 58 * Builder for a WMComponent. 59 */ 60 @Subcomponent.Builder 61 interface Builder { 62 63 @BindsInstance setShellMainThread(@ullable @hellMainThread HandlerThread t)64 Builder setShellMainThread(@Nullable @ShellMainThread HandlerThread t); 65 build()66 WMComponent build(); 67 } 68 69 /** 70 * Initializes all the WMShell components before starting any of the SystemUI components. 71 */ init()72 default void init() { 73 getShell().onInit(); 74 } 75 76 // Interfaces provided to SysUI 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 @WMSingleton getAppZoomOut()121 Optional<AppZoomOut> getAppZoomOut(); 122 123 // Injector methods to support field injection 124 125 /** Injector method for {@link BubbleBarExpandedView}. */ inject(BubbleBarExpandedView bubbleBarExpandedView)126 void inject(BubbleBarExpandedView bubbleBarExpandedView); 127 } 128