1 /* 2 * Copyright (C) 2021 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.dreams.dagger; 18 19 import static com.android.systemui.dreams.dagger.DreamOverlayModule.DREAM_TOUCH_HANDLERS; 20 21 import static java.lang.annotation.RetentionPolicy.RUNTIME; 22 23 import android.annotation.Nullable; 24 25 import androidx.lifecycle.LifecycleOwner; 26 27 import com.android.systemui.complication.ComplicationHostViewController; 28 import com.android.systemui.dreams.DreamOverlayContainerViewController; 29 import com.android.systemui.dreams.touch.DreamOverlayTouchMonitor; 30 import com.android.systemui.dreams.touch.DreamTouchHandler; 31 import com.android.systemui.dreams.touch.dagger.DreamTouchModule; 32 import com.android.systemui.touch.TouchInsetManager; 33 34 import dagger.BindsInstance; 35 import dagger.Subcomponent; 36 37 import java.lang.annotation.Documented; 38 import java.lang.annotation.Retention; 39 import java.util.Set; 40 41 import javax.inject.Named; 42 import javax.inject.Scope; 43 44 /** 45 * Dagger subcomponent for {@link DreamOverlayModule}. 46 */ 47 @Subcomponent(modules = { 48 DreamTouchModule.class, 49 DreamOverlayModule.class, 50 }) 51 @DreamOverlayComponent.DreamOverlayScope 52 public interface DreamOverlayComponent { 53 /** Simple factory for {@link DreamOverlayComponent}. */ 54 @Subcomponent.Factory 55 interface Factory { create( @indsInstance LifecycleOwner lifecycleOwner, @BindsInstance ComplicationHostViewController complicationHostViewController, @BindsInstance TouchInsetManager touchInsetManager, @BindsInstance @Named(DREAM_TOUCH_HANDLERS) @Nullable Set<DreamTouchHandler> dreamTouchHandlers)56 DreamOverlayComponent create( 57 @BindsInstance LifecycleOwner lifecycleOwner, 58 @BindsInstance ComplicationHostViewController complicationHostViewController, 59 @BindsInstance TouchInsetManager touchInsetManager, 60 @BindsInstance @Named(DREAM_TOUCH_HANDLERS) @Nullable 61 Set<DreamTouchHandler> dreamTouchHandlers); 62 } 63 64 /** Scope annotation for singleton items within the {@link DreamOverlayComponent}. */ 65 @Documented 66 @Retention(RUNTIME) 67 @Scope 68 @interface DreamOverlayScope {} 69 70 /** Builds a {@link DreamOverlayContainerViewController}. */ getDreamOverlayContainerViewController()71 DreamOverlayContainerViewController getDreamOverlayContainerViewController(); 72 73 /** Builds a {@link DreamOverlayTouchMonitor} */ getDreamOverlayTouchMonitor()74 DreamOverlayTouchMonitor getDreamOverlayTouchMonitor(); 75 } 76