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.app.Activity;
20 
21 import com.android.systemui.ForegroundServicesDialog;
22 import com.android.systemui.bubbles.BubbleOverflowActivity;
23 import com.android.systemui.keyguard.WorkLockActivity;
24 import com.android.systemui.screenrecord.ScreenRecordDialog;
25 import com.android.systemui.settings.BrightnessDialog;
26 import com.android.systemui.tuner.TunerActivity;
27 import com.android.systemui.usb.UsbDebuggingActivity;
28 import com.android.systemui.usb.UsbDebuggingSecondaryUserActivity;
29 
30 import dagger.Binds;
31 import dagger.Module;
32 import dagger.multibindings.ClassKey;
33 import dagger.multibindings.IntoMap;
34 
35 /**
36  * Activities that are injectable should go here.
37  */
38 @Module
39 public abstract class DefaultActivityBinder {
40     /** Inject into TunerActivity. */
41     @Binds
42     @IntoMap
43     @ClassKey(TunerActivity.class)
bindTunerActivity(TunerActivity activity)44     public abstract Activity bindTunerActivity(TunerActivity activity);
45 
46     /** Inject into ForegroundServicesDialog. */
47     @Binds
48     @IntoMap
49     @ClassKey(ForegroundServicesDialog.class)
bindForegroundServicesDialog(ForegroundServicesDialog activity)50     public abstract Activity bindForegroundServicesDialog(ForegroundServicesDialog activity);
51 
52     /** Inject into WorkLockActivity. */
53     @Binds
54     @IntoMap
55     @ClassKey(WorkLockActivity.class)
bindWorkLockActivity(WorkLockActivity activity)56     public abstract Activity bindWorkLockActivity(WorkLockActivity activity);
57 
58     /** Inject into BrightnessDialog. */
59     @Binds
60     @IntoMap
61     @ClassKey(BrightnessDialog.class)
bindBrightnessDialog(BrightnessDialog activity)62     public abstract Activity bindBrightnessDialog(BrightnessDialog activity);
63 
64     /** Inject into ScreenRecordDialog */
65     @Binds
66     @IntoMap
67     @ClassKey(ScreenRecordDialog.class)
bindScreenRecordDialog(ScreenRecordDialog activity)68     public abstract Activity bindScreenRecordDialog(ScreenRecordDialog activity);
69 
70     /** Inject into BubbleOverflowActivity. */
71     @Binds
72     @IntoMap
73     @ClassKey(BubbleOverflowActivity.class)
bindBubbleOverflowActivity(BubbleOverflowActivity activity)74     public abstract Activity bindBubbleOverflowActivity(BubbleOverflowActivity activity);
75 
76     /** Inject into UsbDebuggingActivity. */
77     @Binds
78     @IntoMap
79     @ClassKey(UsbDebuggingActivity.class)
bindUsbDebuggingActivity(UsbDebuggingActivity activity)80     public abstract Activity bindUsbDebuggingActivity(UsbDebuggingActivity activity);
81 
82     /** Inject into UsbDebuggingSecondaryUserActivity. */
83     @Binds
84     @IntoMap
85     @ClassKey(UsbDebuggingSecondaryUserActivity.class)
bindUsbDebuggingSecondaryUserActivity( UsbDebuggingSecondaryUserActivity activity)86     public abstract Activity bindUsbDebuggingSecondaryUserActivity(
87             UsbDebuggingSecondaryUserActivity activity);
88 }
89