1 /*
2  * Copyright (C) 2017 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.dialer.phonelookup;
18 
19 import com.android.dialer.inject.DialerVariant;
20 import com.android.dialer.inject.InstallIn;
21 import com.android.dialer.phonelookup.blockednumber.SystemBlockedNumberPhoneLookup;
22 import com.android.dialer.phonelookup.cequint.CequintPhoneLookup;
23 import com.android.dialer.phonelookup.cnap.CnapPhoneLookup;
24 import com.android.dialer.phonelookup.cp2.Cp2DefaultDirectoryPhoneLookup;
25 import com.android.dialer.phonelookup.cp2.Cp2ExtendedDirectoryPhoneLookup;
26 import com.android.dialer.phonelookup.emergency.EmergencyPhoneLookup;
27 import com.android.dialer.phonelookup.spam.SpamPhoneLookup;
28 import com.google.common.collect.ImmutableList;
29 import dagger.Module;
30 import dagger.Provides;
31 
32 /** Dagger module which binds the PhoneLookup implementation. */
33 @InstallIn(variants = {DialerVariant.DIALER_TEST})
34 @Module
35 public abstract class PhoneLookupModule {
36 
37   @Provides
38   @SuppressWarnings({"unchecked", "rawtype"})
providePhoneLookupList( CequintPhoneLookup cequintPhoneLookup, CnapPhoneLookup cnapPhoneLookup, Cp2DefaultDirectoryPhoneLookup cp2DefaultDirectoryPhoneLookup, Cp2ExtendedDirectoryPhoneLookup cp2ExtendedDirectoryPhoneLookup, EmergencyPhoneLookup emergencyPhoneLookup, SystemBlockedNumberPhoneLookup systemBlockedNumberPhoneLookup, SpamPhoneLookup spamPhoneLookup)39   static ImmutableList<PhoneLookup> providePhoneLookupList(
40       CequintPhoneLookup cequintPhoneLookup,
41       CnapPhoneLookup cnapPhoneLookup,
42       Cp2DefaultDirectoryPhoneLookup cp2DefaultDirectoryPhoneLookup,
43       Cp2ExtendedDirectoryPhoneLookup cp2ExtendedDirectoryPhoneLookup,
44       EmergencyPhoneLookup emergencyPhoneLookup,
45       SystemBlockedNumberPhoneLookup systemBlockedNumberPhoneLookup,
46       SpamPhoneLookup spamPhoneLookup) {
47     return ImmutableList.of(
48         cequintPhoneLookup,
49         cnapPhoneLookup,
50         cp2DefaultDirectoryPhoneLookup,
51         cp2ExtendedDirectoryPhoneLookup,
52         emergencyPhoneLookup,
53         systemBlockedNumberPhoneLookup,
54         spamPhoneLookup);
55   }
56 }
57