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.keyguard.WorkLockActivity;
23 import com.android.systemui.people.PeopleSpaceActivity;
24 import com.android.systemui.people.widget.LaunchConversationActivity;
25 import com.android.systemui.screenshot.LongScreenshotActivity;
26 import com.android.systemui.sensorprivacy.SensorUseStartedActivity;
27 import com.android.systemui.sensorprivacy.television.TvUnblockSensorActivity;
28 import com.android.systemui.settings.brightness.BrightnessDialog;
29 import com.android.systemui.statusbar.tv.notifications.TvNotificationPanelActivity;
30 import com.android.systemui.tuner.TunerActivity;
31 import com.android.systemui.usb.UsbDebuggingActivity;
32 import com.android.systemui.usb.UsbDebuggingSecondaryUserActivity;
33 import com.android.systemui.user.CreateUserActivity;
34 
35 import dagger.Binds;
36 import dagger.Module;
37 import dagger.multibindings.ClassKey;
38 import dagger.multibindings.IntoMap;
39 
40 /**
41  * Activities that are injectable should go here.
42  */
43 @Module
44 public abstract class DefaultActivityBinder {
45     /** Inject into TunerActivity. */
46     @Binds
47     @IntoMap
48     @ClassKey(TunerActivity.class)
bindTunerActivity(TunerActivity activity)49     public abstract Activity bindTunerActivity(TunerActivity activity);
50 
51     /** Inject into ForegroundServicesDialog. */
52     @Binds
53     @IntoMap
54     @ClassKey(ForegroundServicesDialog.class)
bindForegroundServicesDialog(ForegroundServicesDialog activity)55     public abstract Activity bindForegroundServicesDialog(ForegroundServicesDialog activity);
56 
57     /** Inject into WorkLockActivity. */
58     @Binds
59     @IntoMap
60     @ClassKey(WorkLockActivity.class)
bindWorkLockActivity(WorkLockActivity activity)61     public abstract Activity bindWorkLockActivity(WorkLockActivity activity);
62 
63     /** Inject into BrightnessDialog. */
64     @Binds
65     @IntoMap
66     @ClassKey(BrightnessDialog.class)
bindBrightnessDialog(BrightnessDialog activity)67     public abstract Activity bindBrightnessDialog(BrightnessDialog activity);
68 
69     /** Inject into UsbDebuggingActivity. */
70     @Binds
71     @IntoMap
72     @ClassKey(UsbDebuggingActivity.class)
bindUsbDebuggingActivity(UsbDebuggingActivity activity)73     public abstract Activity bindUsbDebuggingActivity(UsbDebuggingActivity activity);
74 
75     /** Inject into UsbDebuggingSecondaryUserActivity. */
76     @Binds
77     @IntoMap
78     @ClassKey(UsbDebuggingSecondaryUserActivity.class)
bindUsbDebuggingSecondaryUserActivity( UsbDebuggingSecondaryUserActivity activity)79     public abstract Activity bindUsbDebuggingSecondaryUserActivity(
80             UsbDebuggingSecondaryUserActivity activity);
81 
82     /** Inject into CreateUserActivity. */
83     @Binds
84     @IntoMap
85     @ClassKey(CreateUserActivity.class)
bindCreateUserActivity(CreateUserActivity activity)86     public abstract Activity bindCreateUserActivity(CreateUserActivity activity);
87 
88     /** Inject into TvNotificationPanelActivity. */
89     @Binds
90     @IntoMap
91     @ClassKey(TvNotificationPanelActivity.class)
bindTvNotificationPanelActivity(TvNotificationPanelActivity activity)92     public abstract Activity bindTvNotificationPanelActivity(TvNotificationPanelActivity activity);
93 
94     /** Inject into PeopleSpaceActivity. */
95     @Binds
96     @IntoMap
97     @ClassKey(PeopleSpaceActivity.class)
bindPeopleSpaceActivity(PeopleSpaceActivity activity)98     public abstract Activity bindPeopleSpaceActivity(PeopleSpaceActivity activity);
99 
100     /** Inject into LongScreenshotActivity. */
101     @Binds
102     @IntoMap
103     @ClassKey(LongScreenshotActivity.class)
bindLongScreenshotActivity(LongScreenshotActivity activity)104     public abstract Activity bindLongScreenshotActivity(LongScreenshotActivity activity);
105 
106     /** Inject into LaunchConversationActivity. */
107     @Binds
108     @IntoMap
109     @ClassKey(LaunchConversationActivity.class)
bindLaunchConversationActivity(LaunchConversationActivity activity)110     public abstract Activity bindLaunchConversationActivity(LaunchConversationActivity activity);
111 
112     /** Inject into SensorUseStartedActivity. */
113     @Binds
114     @IntoMap
115     @ClassKey(SensorUseStartedActivity.class)
bindSensorUseStartedActivity(SensorUseStartedActivity activity)116     public abstract Activity bindSensorUseStartedActivity(SensorUseStartedActivity activity);
117 
118     /** Inject into TvUnblockSensorActivity. */
119     @Binds
120     @IntoMap
121     @ClassKey(TvUnblockSensorActivity.class)
bindTvUnblockSensorActivity(TvUnblockSensorActivity activity)122     public abstract Activity bindTvUnblockSensorActivity(TvUnblockSensorActivity activity);
123 }
124