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 package com.android.tv.common.flags.impl;
17 
18 import dagger.Module;
19 import dagger.Provides;
20 import dagger.Reusable;
21 
22 import com.android.tv.common.flags.BackendKnobsFlags;
23 import com.android.tv.common.flags.CloudEpgFlags;
24 import com.android.tv.common.flags.DvrFlags;
25 import com.android.tv.common.flags.LegacyFlags;
26 import com.android.tv.common.flags.SetupFlags;
27 import com.android.tv.common.flags.StartupFlags;
28 import com.android.tv.common.flags.TunerFlags;
29 import com.android.tv.common.flags.UiFlags;
30 
31 /** Provides public fields for each flag so they can be changed before injection. */
32 @Module
33 public class SettableFlagsModule {
34 
35     public DefaultBackendKnobsFlags backendKnobsFlags = new DefaultBackendKnobsFlags();
36     public DefaultCloudEpgFlags cloudEpgFlags = new DefaultCloudEpgFlags();
37     public DefaultDvrFlags dvrFlags = new DefaultDvrFlags();
38     public DefaultLegacyFlags legacyFlags = DefaultLegacyFlags.DEFAULT;
39     public DefaultSetupFlags setupFlags = new DefaultSetupFlags();
40     public DefaultStartupFlags startupFlags = new DefaultStartupFlags();
41     public DefaultTunerFlags tunerFlags = new DefaultTunerFlags();
42     public DefaultUiFlags uiFlags = new DefaultUiFlags();
43 
44     @Provides
45     @Reusable
provideBackendKnobsFlags()46     BackendKnobsFlags provideBackendKnobsFlags() {
47         return backendKnobsFlags;
48     }
49 
50     @Provides
51     @Reusable
provideCloudEpgFlags()52     CloudEpgFlags provideCloudEpgFlags() {
53         return cloudEpgFlags;
54     }
55 
56     @Provides
57     @Reusable
provideDvrFlags()58     DvrFlags provideDvrFlags() {
59         return dvrFlags;
60     }
61 
62     @Provides
63     @Reusable
provideLegacyFlags()64     LegacyFlags provideLegacyFlags() {
65         return legacyFlags;
66     }
67 
68     @Provides
69     @Reusable
provideSetupFlags()70     SetupFlags provideSetupFlags() {
71         return setupFlags;
72     }
73 
74     @Provides
75     @Reusable
provideStartupFlags()76     StartupFlags provideStartupFlags() {
77         return startupFlags;
78     }
79 
80     @Provides
81     @Reusable
provideTunerFlags()82     TunerFlags provideTunerFlags() {
83         return tunerFlags;
84     }
85 
86     @Provides
87     @Reusable
provideUiFlags()88     UiFlags provideUiFlags() {
89         return uiFlags;
90     }
91 }
92