InternetPreferenceController V2 (5/n)
Support ethernet. Bug: 339884322 Flag: com.android.settings.flags.internet_preference_controller_v2 Test: manual - on Internet Test: unit test Change-Id: I73fc9334379daa979f736fc9ff31c3d576a3381b
This commit is contained in:
@@ -33,6 +33,7 @@ import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.conflate
|
||||
import kotlinx.coroutines.flow.flatMapLatest
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
@@ -71,6 +72,7 @@ class InternetPreferenceRepository(
|
||||
when (transportType) {
|
||||
NetworkCapabilities.TRANSPORT_WIFI -> return wifiDisplayInfoFlow()
|
||||
NetworkCapabilities.TRANSPORT_CELLULAR -> return cellularDisplayInfoFlow()
|
||||
NetworkCapabilities.TRANSPORT_ETHERNET -> return ethernetDisplayInfoFlow()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,6 +95,14 @@ class InternetPreferenceRepository(
|
||||
)
|
||||
}
|
||||
|
||||
private fun ethernetDisplayInfoFlow() =
|
||||
flowOf(
|
||||
DisplayInfo(
|
||||
summary = context.getString(R.string.to_switch_networks_disconnect_ethernet),
|
||||
iconResId = R.drawable.ic_settings_ethernet,
|
||||
)
|
||||
)
|
||||
|
||||
private fun defaultDisplayInfoFlow(): Flow<DisplayInfo> =
|
||||
combine(
|
||||
airplaneModeOnFlow,
|
||||
|
||||
Reference in New Issue
Block a user