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.communal.widgets.EditWidgetsActivity;
23 import com.android.systemui.keyguard.WorkLockActivity;
24 import com.android.systemui.people.PeopleSpaceActivity;
25 import com.android.systemui.people.widget.LaunchConversationActivity;
26 import com.android.systemui.screenshot.appclips.AppClipsActivity;
27 import com.android.systemui.screenshot.appclips.AppClipsTrampolineActivity;
28 import com.android.systemui.screenshot.scroll.LongScreenshotActivity;
29 import com.android.systemui.sensorprivacy.SensorUseStartedActivity;
30 import com.android.systemui.settings.brightness.BrightnessDialog;
31 import com.android.systemui.telephony.ui.activity.SwitchToManagedProfileForCallActivity;
32 import com.android.systemui.touchpad.tutorial.ui.view.TouchpadTutorialActivity;
33 import com.android.systemui.tuner.TunerActivity;
34 import com.android.systemui.usb.UsbAccessoryUriActivity;
35 import com.android.systemui.usb.UsbConfirmActivity;
36 import com.android.systemui.usb.UsbDebuggingActivity;
37 import com.android.systemui.usb.UsbDebuggingSecondaryUserActivity;
38 import com.android.systemui.usb.UsbPermissionActivity;
39 import com.android.systemui.user.CreateUserActivity;
40 
41 import dagger.Binds;
42 import dagger.Module;
43 import dagger.multibindings.ClassKey;
44 import dagger.multibindings.IntoMap;
45 
46 /**
47  * Activities that are injectable should go here.
48  */
49 @Module
50 public abstract class DefaultActivityBinder {
51     /** Inject into TunerActivity. */
52     @Binds
53     @IntoMap
54     @ClassKey(TunerActivity.class)
bindTunerActivity(TunerActivity activity)55     public abstract Activity bindTunerActivity(TunerActivity activity);
56 
57     /** Inject into ForegroundServicesDialog. */
58     @Binds
59     @IntoMap
60     @ClassKey(ForegroundServicesDialog.class)
bindForegroundServicesDialog(ForegroundServicesDialog activity)61     public abstract Activity bindForegroundServicesDialog(ForegroundServicesDialog activity);
62 
63     /** Inject into WorkLockActivity. */
64     @Binds
65     @IntoMap
66     @ClassKey(WorkLockActivity.class)
bindWorkLockActivity(WorkLockActivity activity)67     public abstract Activity bindWorkLockActivity(WorkLockActivity activity);
68 
69     /** Inject into BrightnessDialog. */
70     @Binds
71     @IntoMap
72     @ClassKey(BrightnessDialog.class)
bindBrightnessDialog(BrightnessDialog activity)73     public abstract Activity bindBrightnessDialog(BrightnessDialog activity);
74 
75     /** Inject into UsbDebuggingActivity. */
76     @Binds
77     @IntoMap
78     @ClassKey(UsbDebuggingActivity.class)
bindUsbDebuggingActivity(UsbDebuggingActivity activity)79     public abstract Activity bindUsbDebuggingActivity(UsbDebuggingActivity activity);
80 
81     /** Inject into UsbDebuggingSecondaryUserActivity. */
82     @Binds
83     @IntoMap
84     @ClassKey(UsbDebuggingSecondaryUserActivity.class)
bindUsbDebuggingSecondaryUserActivity( UsbDebuggingSecondaryUserActivity activity)85     public abstract Activity bindUsbDebuggingSecondaryUserActivity(
86             UsbDebuggingSecondaryUserActivity activity);
87 
88     /** Inject into UsbPermissionActivity. */
89     @Binds
90     @IntoMap
91     @ClassKey(UsbPermissionActivity.class)
bindUsbPermissionActivity(UsbPermissionActivity activity)92     public abstract Activity bindUsbPermissionActivity(UsbPermissionActivity activity);
93 
94     /** Inject into UsbConfirmActivity. */
95     @Binds
96     @IntoMap
97     @ClassKey(UsbConfirmActivity.class)
bindUsbConfirmActivity(UsbConfirmActivity activity)98     public abstract Activity bindUsbConfirmActivity(UsbConfirmActivity activity);
99 
100     /** Inject into UsbAccessoryUriActivity. */
101     @Binds
102     @IntoMap
103     @ClassKey(UsbAccessoryUriActivity.class)
bindUsbAccessoryUriActivity(UsbAccessoryUriActivity activity)104     public abstract Activity bindUsbAccessoryUriActivity(UsbAccessoryUriActivity activity);
105 
106     /** Inject into CreateUserActivity. */
107     @Binds
108     @IntoMap
109     @ClassKey(CreateUserActivity.class)
bindCreateUserActivity(CreateUserActivity activity)110     public abstract Activity bindCreateUserActivity(CreateUserActivity activity);
111 
112     /** Inject into PeopleSpaceActivity. */
113     @Binds
114     @IntoMap
115     @ClassKey(PeopleSpaceActivity.class)
bindPeopleSpaceActivity(PeopleSpaceActivity activity)116     public abstract Activity bindPeopleSpaceActivity(PeopleSpaceActivity activity);
117 
118     /** Inject into LongScreenshotActivity. */
119     @Binds
120     @IntoMap
121     @ClassKey(LongScreenshotActivity.class)
bindLongScreenshotActivity(LongScreenshotActivity activity)122     public abstract Activity bindLongScreenshotActivity(LongScreenshotActivity activity);
123 
124     /** Inject into AppClipsTrampolineActivity. */
125     @Binds
126     @IntoMap
127     @ClassKey(AppClipsTrampolineActivity.class)
bindAppClipsTrampolineActivity(AppClipsTrampolineActivity activity)128     public abstract Activity bindAppClipsTrampolineActivity(AppClipsTrampolineActivity activity);
129 
130     /** Inject into AppClipsActivity. */
131     @Binds
132     @IntoMap
133     @ClassKey(AppClipsActivity.class)
bindAppClipsActivity(AppClipsActivity activity)134     public abstract Activity bindAppClipsActivity(AppClipsActivity activity);
135 
136     /** Inject into LaunchConversationActivity. */
137     @Binds
138     @IntoMap
139     @ClassKey(LaunchConversationActivity.class)
bindLaunchConversationActivity(LaunchConversationActivity activity)140     public abstract Activity bindLaunchConversationActivity(LaunchConversationActivity activity);
141 
142     /** Inject into SensorUseStartedActivity. */
143     @Binds
144     @IntoMap
145     @ClassKey(SensorUseStartedActivity.class)
bindSensorUseStartedActivity(SensorUseStartedActivity activity)146     public abstract Activity bindSensorUseStartedActivity(SensorUseStartedActivity activity);
147 
148     /** Inject into EditWidgetsActivity. */
149     @Binds
150     @IntoMap
151     @ClassKey(EditWidgetsActivity.class)
bindEditWidgetsActivity(EditWidgetsActivity activity)152     public abstract Activity bindEditWidgetsActivity(EditWidgetsActivity activity);
153 
154     /** Inject into SwitchToManagedProfileForCallActivity. */
155     @Binds
156     @IntoMap
157     @ClassKey(SwitchToManagedProfileForCallActivity.class)
bindSwitchToManagedProfileForCallActivity( SwitchToManagedProfileForCallActivity activity)158     public abstract Activity bindSwitchToManagedProfileForCallActivity(
159             SwitchToManagedProfileForCallActivity activity);
160 
161     /** Inject into TouchpadTutorialActivity. */
162     @Binds
163     @IntoMap
164     @ClassKey(TouchpadTutorialActivity.class)
bindTouchpadTutorialActivity(TouchpadTutorialActivity activity)165     public abstract Activity bindTouchpadTutorialActivity(TouchpadTutorialActivity activity);
166 }
167