ソースを参照

EuiccChannelManager: Remove last trace of blocking methods

Peter Cai 1 年間 前
コミット
6f8aef8ea8

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

@@ -91,7 +91,7 @@ open class DefaultEuiccChannelManager(
         }
         }
     }
     }
 
 
-    private suspend fun findEuiccChannelByLogicalSlot(logicalSlotId: Int): EuiccChannel? =
+    protected suspend fun findEuiccChannelByLogicalSlot(logicalSlotId: Int): EuiccChannel? =
         withContext(Dispatchers.IO) {
         withContext(Dispatchers.IO) {
             if (logicalSlotId == EuiccChannelManager.USB_CHANNEL_ID) {
             if (logicalSlotId == EuiccChannelManager.USB_CHANNEL_ID) {
                 return@withContext usbChannel
                 return@withContext usbChannel
@@ -108,11 +108,6 @@ open class DefaultEuiccChannelManager(
             null
             null
         }
         }
 
 
-    protected fun findEuiccChannelByLogicalSlotBlocking(logicalSlotId: Int): EuiccChannel? =
-        runBlocking {
-            findEuiccChannelByLogicalSlot(logicalSlotId)
-        }
-
     private suspend fun findAllEuiccChannelsByPhysicalSlot(physicalSlotId: Int): List<EuiccChannel>? {
     private suspend fun findAllEuiccChannelsByPhysicalSlot(physicalSlotId: Int): List<EuiccChannel>? {
         if (physicalSlotId == EuiccChannelManager.USB_CHANNEL_ID) {
         if (physicalSlotId == EuiccChannelManager.USB_CHANNEL_ID) {
             return usbChannel?.let { listOf(it) }
             return usbChannel?.let { listOf(it) }

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

@@ -93,7 +93,7 @@ interface EuiccChannelManager {
      * This is only expected to be implemented when the application is privileged
      * This is only expected to be implemented when the application is privileged
      * TODO: Remove this from the common interface
      * TODO: Remove this from the common interface
      */
      */
-    fun notifyEuiccProfilesChanged(logicalSlotId: Int) {
+    suspend fun notifyEuiccProfilesChanged(logicalSlotId: Int) {
         // no-op by default
         // no-op by default
     }
     }
 }
 }

+ 2 - 2
app/src/main/java/im/angry/openeuicc/core/PrivilegedEuiccChannelManager.kt

@@ -28,9 +28,9 @@ class PrivilegedEuiccChannelManager(
         }
         }
     }
     }
 
 
-    override fun notifyEuiccProfilesChanged(logicalSlotId: Int) {
+    override suspend fun notifyEuiccProfilesChanged(logicalSlotId: Int) {
         appContainer.subscriptionManager.apply {
         appContainer.subscriptionManager.apply {
-            findEuiccChannelByLogicalSlotBlocking(logicalSlotId)?.let {
+            findEuiccChannelByLogicalSlot(logicalSlotId)?.let {
                 tryRefreshCachedEuiccInfo(it.cardId)
                 tryRefreshCachedEuiccInfo(it.cardId)
             }
             }
         }
         }