1 /*
2  * Copyright (C) 2022 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.statusbar.pipeline.shared
18 
19 import android.content.Context
20 import android.telephony.TelephonyManager
21 import com.android.systemui.Dumpable
22 import com.android.systemui.res.R
23 import com.android.systemui.dagger.SysUISingleton
24 import com.android.systemui.dump.DumpManager
25 import java.io.PrintWriter
26 import javax.inject.Inject
27 
28 /**
29  * An object storing constants that are used for calculating connectivity icons.
30  *
31  * Stored in a class for logging purposes.
32  */
33 @SysUISingleton
34 class ConnectivityConstants
35 @Inject
36 constructor(
37     context: Context,
38     dumpManager: DumpManager,
39     telephonyManager: TelephonyManager,
40 ) : Dumpable {
41     init {
42         dumpManager.registerNormalDumpable("ConnectivityConstants", this)
43     }
44 
45     /** True if this device has the capability for data connections and false otherwise. */
46     val hasDataCapabilities = telephonyManager.isDataCapable
47 
48     /** True if we should show the activityIn/activityOut icons and false otherwise */
49     val shouldShowActivityConfig = context.resources.getBoolean(R.bool.config_showActivity)
50 
dumpnull51     override fun dump(pw: PrintWriter, args: Array<out String>) {
52         pw.apply {
53             println("hasDataCapabilities=$hasDataCapabilities")
54             println("shouldShowActivityConfig=$shouldShowActivityConfig")
55         }
56     }
57 }
58