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