Browse Source

OpenEuiccService: handle errors in disabling active profiles

Peter Cai 1 year ago
parent
commit
790a5cf778

+ 3 - 1
app/src/main/java/im/angry/openeuicc/service/OpenEuiccService.kt

@@ -299,7 +299,9 @@ class OpenEuiccService : EuiccService(), OpenEuiccContextMarker {
                         return RESULT_FIRST_USER
                         return RESULT_FIRST_USER
                     }
                     }
                 } else {
                 } else {
-                    channel.lpa.disableActiveProfile(true)
+                    if (!channel.lpa.disableActiveProfile(true)) {
+                        return RESULT_FIRST_USER
+                    }
                 }
                 }
 
 
                 runBlocking {
                 runBlocking {

+ 2 - 2
libs/lpac-jni/src/main/java/net/typeblog/lpac_jni/LocalProfileAssistant.kt

@@ -10,8 +10,8 @@ interface LocalProfileAssistant {
 
 
     // All blocking functions in this class assume that they are executed on non-Main threads
     // All blocking functions in this class assume that they are executed on non-Main threads
     // The IO context in Kotlin's coroutine library is recommended.
     // The IO context in Kotlin's coroutine library is recommended.
-    fun enableProfile(iccid: String, refresh: Boolean = false): Boolean
-    fun disableProfile(iccid: String, refresh: Boolean = false): Boolean
+    fun enableProfile(iccid: String, refresh: Boolean = true): Boolean
+    fun disableProfile(iccid: String, refresh: Boolean = true): Boolean
     fun deleteProfile(iccid: String): Boolean
     fun deleteProfile(iccid: String): Boolean
 
 
     fun downloadProfile(smdp: String, matchingId: String?, imei: String?,
     fun downloadProfile(smdp: String, matchingId: String?, imei: String?,