1 /*
2  * Copyright (C) 2015 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.systemui.statusbar.connectivity
17 
18 import android.content.Context
19 import android.net.ConnectivityManager
20 import android.net.NetworkScoreManager
21 import android.net.wifi.WifiManager
22 import android.os.Handler
23 
24 import com.android.settingslib.wifi.WifiStatusTracker
25 import com.android.systemui.dagger.qualifiers.Main
26 
27 import javax.inject.Inject
28 
29 /**
30  * Factory class for [WifiStatusTracker] which lives in SettingsLib (and thus doesn't use Dagger).
31  * This enables the constructors for NetworkControllerImpl and WifiSignalController to be slightly
32  * nicer.
33  */
34 internal class WifiStatusTrackerFactory @Inject constructor(
35     private val mContext: Context,
36     private val mWifiManager: WifiManager?,
37     private val mNetworkScoreManager: NetworkScoreManager,
38     private val mConnectivityManager: ConnectivityManager,
39     @Main private val mMainHandler: Handler
40 ) {
createTrackernull41     fun createTracker(callback: Runnable?, bgHandler: Handler?): WifiStatusTracker {
42         return WifiStatusTracker(mContext,
43                 mWifiManager,
44                 mNetworkScoreManager,
45                 mConnectivityManager,
46                 callback,
47                 mMainHandler,
48                 bgHandler)
49     }
50 }
51