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 showSliceAttribution = MutableStateFlow(false) 52 53 override val networkName = MutableStateFlow(NetworkNameModel.IntentDerived("demo mode")) 54 55 override val carrierName = MutableStateFlow("demo mode") 56 57 override val isRoaming = MutableStateFlow(false) 58 59 override val isDataConnected = MutableStateFlow(true) 60 61 override val isInService = MutableStateFlow(true) 62 63 override val isEmergencyOnly = MutableStateFlow(true) 64 65 override val isNonTerrestrial = MutableStateFlow(false) 66 67 private val _isDataEnabled = MutableStateFlow(true) 68 override val isDataEnabled = _isDataEnabled 69 70 override val isForceHidden = MutableStateFlow(false) 71 72 override val isAllowedDuringAirplaneMode = MutableStateFlow(false) 73 74 override val signalLevelIcon: MutableStateFlow<SignalIconModel> = 75 MutableStateFlow( 76 SignalIconModel.Cellular( 77 level = 0, 78 numberOfLevels = 4, 79 showExclamationMark = false, 80 carrierNetworkChange = false, 81 ) 82 ) 83 setIsDataEnablednull84 fun setIsDataEnabled(enabled: Boolean) { 85 _isDataEnabled.value = enabled 86 } 87 } 88