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.mobile.domain.interactor
18 
19 import com.android.settingslib.mobile.TelephonyIcons
20 import com.android.systemui.log.table.TableLogBuffer
21 import com.android.systemui.statusbar.pipeline.mobile.data.model.NetworkNameModel
22 import com.android.systemui.statusbar.pipeline.mobile.domain.model.NetworkTypeIconModel
23 import com.android.systemui.statusbar.pipeline.mobile.domain.model.SignalIconModel
24 import com.android.systemui.statusbar.pipeline.shared.data.model.DataActivityModel
25 import kotlinx.coroutines.flow.MutableStateFlow
26 
27 class FakeMobileIconInteractor(
28     override val tableLogBuffer: TableLogBuffer,
29 ) : MobileIconInteractor {
30     override val alwaysShowDataRatIcon = MutableStateFlow(false)
31 
32     override val activity =
33         MutableStateFlow(
34             DataActivityModel(
35                 hasActivityIn = false,
36                 hasActivityOut = false,
37             )
38         )
39 
40     override val carrierNetworkChangeActive = MutableStateFlow(false)
41 
42     override val mobileIsDefault = MutableStateFlow(true)
43 
44     override val isSingleCarrier = MutableStateFlow(true)
45 
46     override val networkTypeIconGroup =
47         MutableStateFlow<NetworkTypeIconModel>(
48             NetworkTypeIconModel.DefaultIcon(TelephonyIcons.THREE_G)
49         )
50 
51     override val networkName = MutableStateFlow(NetworkNameModel.IntentDerived("demo mode"))
52 
53     override val carrierName = MutableStateFlow("demo mode")
54 
55     override val isRoaming = MutableStateFlow(false)
56 
57     override val isDataConnected = MutableStateFlow(true)
58 
59     override val isInService = MutableStateFlow(true)
60 
61     private val _isDataEnabled = MutableStateFlow(true)
62     override val isDataEnabled = _isDataEnabled
63 
64     override val isForceHidden = MutableStateFlow(false)
65 
66     override val isAllowedDuringAirplaneMode = MutableStateFlow(false)
67 
68     override val signalLevelIcon: MutableStateFlow<SignalIconModel> =
69         MutableStateFlow(
70             SignalIconModel(
71                 level = 0,
72                 numberOfLevels = 4,
73                 showExclamationMark = false,
74                 carrierNetworkChange = false,
75             )
76         )
77 
78     fun setIsDataEnabled(enabled: Boolean) {
79         _isDataEnabled.value = enabled
80     }
81 }
82