浏览代码

EuiccChannelManager: Remove findEuiccChannelByPort() as public method

Peter Cai 1 年之前
父节点
当前提交
7105c43ae4

+ 1 - 6
app-common/src/main/java/im/angry/openeuicc/core/DefaultEuiccChannelManager.kt

@@ -126,7 +126,7 @@ open class DefaultEuiccChannelManager(
         return null
     }
 
-    override suspend fun findEuiccChannelByPort(physicalSlotId: Int, portId: Int): EuiccChannel? =
+    private suspend fun findEuiccChannelByPort(physicalSlotId: Int, portId: Int): EuiccChannel? =
         withContext(Dispatchers.IO) {
             if (physicalSlotId == EuiccChannelManager.USB_CHANNEL_ID) {
                 return@withContext usbChannel
@@ -137,11 +137,6 @@ open class DefaultEuiccChannelManager(
             }
         }
 
-    override fun findEuiccChannelByPortBlocking(physicalSlotId: Int, portId: Int): EuiccChannel? =
-        runBlocking {
-            findEuiccChannelByPort(physicalSlotId, portId)
-        }
-
     override suspend fun findFirstAvailablePort(physicalSlotId: Int): Int =
         withContext(Dispatchers.IO) {
             if (physicalSlotId == EuiccChannelManager.USB_CHANNEL_ID) {

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

@@ -52,12 +52,6 @@ interface EuiccChannelManager {
      */
     fun findEuiccChannelBySlotBlocking(logicalSlotId: Int): EuiccChannel?
 
-    /**
-     * Returns the EuiccChannel corresponding to a **physical** slot and a port ID
-     */
-    suspend fun findEuiccChannelByPort(physicalSlotId: Int, portId: Int): EuiccChannel?
-    fun findEuiccChannelByPortBlocking(physicalSlotId: Int, portId: Int): EuiccChannel?
-
     /**
      * Returns the first mapped & available port ID for a physical slot, or -1 if
      * not found.

+ 0 - 3
app-common/src/main/java/im/angry/openeuicc/util/EuiccChannelFragmentUtils.kt

@@ -36,9 +36,6 @@ val <T> T.euiccChannelManager: EuiccChannelManager where T: Fragment, T: EuiccCh
     get() = (requireActivity() as BaseEuiccAccessActivity).euiccChannelManager
 val <T> T.euiccChannelManagerService: EuiccChannelManagerService where T: Fragment, T: EuiccChannelFragmentMarker
     get() = (requireActivity() as BaseEuiccAccessActivity).euiccChannelManagerService
-val <T> T.channel: EuiccChannel where T: Fragment, T: EuiccChannelFragmentMarker
-    get() =
-        euiccChannelManager.findEuiccChannelByPortBlocking(slotId, portId)!!
 
 suspend fun <T, R> T.withEuiccChannel(fn: suspend (EuiccChannel) -> R): R where T : Fragment, T : EuiccChannelFragmentMarker {
     ensureEuiccChannelManager()