• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.data.repository
18 
19 import com.android.systemui.log.table.TableLogBuffer
20 import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionState
21 import com.android.systemui.statusbar.pipeline.mobile.data.model.NetworkNameModel
22 import com.android.systemui.statusbar.pipeline.mobile.data.model.ResolvedNetworkType
23 import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileConnectionRepository.Companion.DEFAULT_NUM_LEVELS
24 import com.android.systemui.statusbar.pipeline.shared.data.model.DataActivityModel
25 import kotlinx.coroutines.flow.MutableStateFlow
26 
27 // TODO(b/261632894): remove this in favor of the real impl or DemoMobileConnectionRepository
28 class FakeMobileConnectionRepository(
29     override val subId: Int,
30     override val tableLogBuffer: TableLogBuffer,
31 ) : MobileConnectionRepository {
32     override val isEmergencyOnly = MutableStateFlow(false)
33     override val isRoaming = MutableStateFlow(false)
34     override val operatorAlphaShort: MutableStateFlow<String?> = MutableStateFlow(null)
35     override val isInService = MutableStateFlow(false)
36     override val isGsm = MutableStateFlow(false)
37     override val cdmaLevel = MutableStateFlow(0)
38     override val primaryLevel = MutableStateFlow(0)
39     override val dataConnectionState = MutableStateFlow(DataConnectionState.Disconnected)
40     override val dataActivityDirection =
41         MutableStateFlow(DataActivityModel(hasActivityIn = false, hasActivityOut = false))
42     override val carrierNetworkChangeActive = MutableStateFlow(false)
43     override val resolvedNetworkType: MutableStateFlow<ResolvedNetworkType> =
44         MutableStateFlow(ResolvedNetworkType.UnknownNetworkType)
45 
46     override val numberOfLevels = MutableStateFlow(DEFAULT_NUM_LEVELS)
47 
48     private val _dataEnabled = MutableStateFlow(true)
49     override val dataEnabled = _dataEnabled
50 
51     override val cdmaRoaming = MutableStateFlow(false)
52 
53     override val networkName =
54         MutableStateFlow<NetworkNameModel>(NetworkNameModel.Default("default"))
55 
setDataEnablednull56     fun setDataEnabled(enabled: Boolean) {
57         _dataEnabled.value = enabled
58     }
59 }
60