diff options
2 files changed, 41 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/WifiRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/WifiRepository.kt index a6635361cb3c..0c9c1cc51ca4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/WifiRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/WifiRepository.kt @@ -43,6 +43,7 @@ import com.android.systemui.statusbar.pipeline.shared.ConnectivityPipelineLogger import com.android.systemui.statusbar.pipeline.shared.ConnectivityPipelineLogger.Companion.SB_LOGGING_TAG import com.android.systemui.statusbar.pipeline.shared.ConnectivityPipelineLogger.Companion.logInputChange import com.android.systemui.statusbar.pipeline.wifi.data.model.WifiNetworkModel +import com.android.systemui.statusbar.pipeline.wifi.shared.model.ACTIVITY_PREFIX import com.android.systemui.statusbar.pipeline.wifi.shared.model.WifiActivityModel import java.util.concurrent.Executor import javax.inject.Inject @@ -109,7 +110,12 @@ class WifiRepositoryImpl @Inject constructor( merge(wifiNetworkChangeEvents, wifiStateChangeEvents) .mapLatest { wifiManager.isWifiEnabled } .distinctUntilChanged() - .logInputChange(logger, "enabled") + .logDiffsForTable( + wifiTableLogBuffer, + columnPrefix = "", + columnName = "isWifiEnabled", + initialValue = wifiManager.isWifiEnabled, + ) .stateIn( scope = scope, started = SharingStarted.WhileSubscribed(), @@ -143,7 +149,12 @@ class WifiRepositoryImpl @Inject constructor( awaitClose { connectivityManager.unregisterNetworkCallback(callback) } } .distinctUntilChanged() - .logInputChange(logger, "isWifiDefault") + .logDiffsForTable( + wifiTableLogBuffer, + columnPrefix = "", + columnName = "isWifiDefault", + initialValue = false, + ) .stateIn( scope, started = SharingStarted.WhileSubscribed(), @@ -233,6 +244,11 @@ class WifiRepositoryImpl @Inject constructor( awaitClose { wifiManager.unregisterTrafficStateCallback(callback) } } } + .logDiffsForTable( + wifiTableLogBuffer, + columnPrefix = ACTIVITY_PREFIX, + initialValue = ACTIVITY_DEFAULT, + ) .stateIn( scope, started = SharingStarted.WhileSubscribed(), diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiActivityModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiActivityModel.kt index 574610605b4e..a4ca41c22ad1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiActivityModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiActivityModel.kt @@ -16,10 +16,32 @@ package com.android.systemui.statusbar.pipeline.wifi.shared.model +import com.android.systemui.log.table.Diffable +import com.android.systemui.log.table.TableRowLogger + /** Provides information on the current wifi activity. */ data class WifiActivityModel( /** True if the wifi has activity in (download). */ val hasActivityIn: Boolean, /** True if the wifi has activity out (upload). */ val hasActivityOut: Boolean, -) +) : Diffable<WifiActivityModel> { + + override fun logDiffs(prevVal: WifiActivityModel, row: TableRowLogger) { + if (prevVal.hasActivityIn != hasActivityIn) { + row.logChange(COL_ACTIVITY_IN, hasActivityIn) + } + if (prevVal.hasActivityOut != hasActivityOut) { + row.logChange(COL_ACTIVITY_OUT, hasActivityOut) + } + } + + override fun logFull(row: TableRowLogger) { + row.logChange(COL_ACTIVITY_IN, hasActivityIn) + row.logChange(COL_ACTIVITY_OUT, hasActivityOut) + } +} + +const val ACTIVITY_PREFIX = "wifiActivity" +private const val COL_ACTIVITY_IN = "in" +private const val COL_ACTIVITY_OUT = "out" |