ソースを参照

EuiccChannelManager: retire enumerateEuiccChannels()

Peter Cai 1 年間 前
コミット
0ef435956c

+ 0 - 13
app-common/src/main/java/im/angry/openeuicc/core/DefaultEuiccChannelManager.kt

@@ -11,14 +11,8 @@ import im.angry.openeuicc.util.*
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.delay
 import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.flow.collect
-import kotlinx.coroutines.flow.count
 import kotlinx.coroutines.flow.flow
 import kotlinx.coroutines.flow.flowOn
-import kotlinx.coroutines.flow.map
-import kotlinx.coroutines.flow.mapNotNull
-import kotlinx.coroutines.flow.onEach
-import kotlinx.coroutines.flow.toList
 import kotlinx.coroutines.runBlocking
 import kotlinx.coroutines.sync.Mutex
 import kotlinx.coroutines.sync.withLock
@@ -229,13 +223,6 @@ open class DefaultEuiccChannelManager(
         }
     }
 
-    override suspend fun enumerateEuiccChannels(): List<EuiccChannel> =
-        withContext(Dispatchers.IO) {
-            flowEuiccPorts().mapNotNull { (slotId, portId) ->
-                findEuiccChannelByPort(slotId, portId)
-            }.toList()
-        }
-
     override fun flowEuiccPorts(): Flow<Pair<Int, Int>> = flow {
         uiccCards.forEach { info ->
             info.ports.forEach { port ->

+ 6 - 5
app-common/src/main/java/im/angry/openeuicc/core/EuiccChannelManager.kt

@@ -19,12 +19,13 @@ interface EuiccChannelManager {
     }
 
     /**
-     * Scan all possible _device internal_ sources for EuiccChannels, return them and have all
-     * scanned channels cached; these channels will remain open for the entire lifetime of
-     * this EuiccChannelManager object, unless disconnected externally or invalidate()'d
+     * Scan all possible _device internal_ sources for EuiccChannels, as a flow, return their physical
+     * (slotId, portId) and have all scanned channels cached; these channels will remain open
+     * for the entire lifetime of this EuiccChannelManager object, unless disconnected externally
+     * or invalidate()'d.
+     *
+     * To obtain a temporary reference to a EuiccChannel, use `withEuiccChannel()`.
      */
-    suspend fun enumerateEuiccChannels(): List<EuiccChannel>
-
     fun flowEuiccPorts(): Flow<Pair<Int, Int>>
 
     /**