forked from PeterCxy/OpenEUICC
CompatibilityCheck: show unknown status when "secure element is not present"
Some devices "optimize" their OMAPI by reporting this status when both slots are empty. Even just inserting one SIM would fix this error for both slots. In this case, we should not imply that the device is incompatible.
This commit is contained in:
parent
048764d305
commit
252000660a
|
@ -64,6 +64,9 @@ class CompatibilityCheckActivity: AppCompatActivity() {
|
||||||
CompatibilityCheck.State.FAILURE -> {
|
CompatibilityCheck.State.FAILURE -> {
|
||||||
root.findViewById<View>(R.id.compatibility_check_error).visibility = View.VISIBLE
|
root.findViewById<View>(R.id.compatibility_check_error).visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
CompatibilityCheck.State.FAILURE_UNKNOWN -> {
|
||||||
|
root.findViewById<View>(R.id.compatibility_check_unknown).visibility = View.VISIBLE
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
root.findViewById<View>(R.id.compatibility_check_progress_bar).visibility = View.VISIBLE
|
root.findViewById<View>(R.id.compatibility_check_progress_bar).visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import im.angry.easyeuicc.R
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
fun getCompatibilityChecks(context: Context): List<CompatibilityCheck> =
|
fun getCompatibilityChecks(context: Context): List<CompatibilityCheck> =
|
||||||
listOf(
|
listOf(
|
||||||
|
@ -38,6 +39,7 @@ abstract class CompatibilityCheck(context: Context) {
|
||||||
NOT_STARTED,
|
NOT_STARTED,
|
||||||
IN_PROGRESS,
|
IN_PROGRESS,
|
||||||
SUCCESS,
|
SUCCESS,
|
||||||
|
FAILURE_UNKNOWN, // The check technically failed, but no conclusion can be drawn
|
||||||
FAILURE
|
FAILURE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +51,7 @@ abstract class CompatibilityCheck(context: Context) {
|
||||||
|
|
||||||
val description: String
|
val description: String
|
||||||
get() = when {
|
get() = when {
|
||||||
state == State.FAILURE && this::failureDescription.isInitialized -> failureDescription
|
(state == State.FAILURE || state == State.FAILURE_UNKNOWN) && this::failureDescription.isInitialized -> failureDescription
|
||||||
else -> defaultDescription
|
else -> defaultDescription
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,6 +141,14 @@ internal class IsdrChannelAccessCheck(private val context: Context): Compatibili
|
||||||
// ref: https://android.googlesource.com/platform/frameworks/base/+/4fe64fb4712a99d5da9c9a0eb8fd5169b252e1e1/omapi/java/android/se/omapi/Session.java#305
|
// ref: https://android.googlesource.com/platform/frameworks/base/+/4fe64fb4712a99d5da9c9a0eb8fd5169b252e1e1/omapi/java/android/se/omapi/Session.java#305
|
||||||
// SecurityException is only thrown when Channel is constructed, which means everything else needs to succeed
|
// SecurityException is only thrown when Channel is constructed, which means everything else needs to succeed
|
||||||
Pair(it.slotIndex, State.SUCCESS)
|
Pair(it.slotIndex, State.SUCCESS)
|
||||||
|
} catch (e: IOException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
if (e.message?.contains("Secure Element is not present") == true) {
|
||||||
|
failureDescription = context.getString(R.string.compatibility_check_isdr_channel_desc_unknown)
|
||||||
|
Pair(it.slotIndex, State.FAILURE_UNKNOWN)
|
||||||
|
} else {
|
||||||
|
Pair(it.slotIndex, State.FAILURE)
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
Pair(it.slotIndex, State.FAILURE)
|
Pair(it.slotIndex, State.FAILURE)
|
||||||
|
|
5
app-unpriv/src/main/res/drawable/ic_question_outline.xml
Normal file
5
app-unpriv/src/main/res/drawable/ic_question_outline.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:autoMirrored="true" android:height="24dp"
|
||||||
|
android:tint="?attr/colorControlNormal" android:viewportHeight="24"
|
||||||
|
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M11,18h2v-2h-2v2zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM12,6c-2.21,0 -4,1.79 -4,4h2c0,-1.1 0.9,-2 2,-2s2,0.9 2,2c0,2 -3,1.75 -3,5h2c0,-2.25 3,-2.5 3,-5 0,-2.21 -1.79,-4 -4,-4z"/>
|
||||||
|
</vector>
|
|
@ -60,6 +60,14 @@
|
||||||
android:layout_width="32dp"
|
android:layout_width="32dp"
|
||||||
android:layout_height="32dp" />
|
android:layout_height="32dp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/compatibility_check_unknown"
|
||||||
|
android:src="@drawable/ic_question_outline"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -13,6 +13,7 @@
|
||||||
<string name="compatibility_check_omapi_connectivity_fail_sim_number">Only the following SIM slots are accessible via OMAPI: %s.</string>
|
<string name="compatibility_check_omapi_connectivity_fail_sim_number">Only the following SIM slots are accessible via OMAPI: %s.</string>
|
||||||
<string name="compatibility_check_isdr_channel">ISD-R Channel Access</string>
|
<string name="compatibility_check_isdr_channel">ISD-R Channel Access</string>
|
||||||
<string name="compatibility_check_isdr_channel_desc">Does your device support opening an ISD-R (management) channel to eSIMs via OMAPI?</string>
|
<string name="compatibility_check_isdr_channel_desc">Does your device support opening an ISD-R (management) channel to eSIMs via OMAPI?</string>
|
||||||
|
<string name="compatibility_check_isdr_channel_desc_unknown">Cannot determine whether ISD-R access through OMAPI is supported. You might want to retry with SIM cards inserted (any SIM card will do) if not already.</string>
|
||||||
<string name="compatibility_check_isdr_channel_desc_partial_fail">OMAPI access to ISD-R is only possible on the following SIM slots: %s.</string>
|
<string name="compatibility_check_isdr_channel_desc_partial_fail">OMAPI access to ISD-R is only possible on the following SIM slots: %s.</string>
|
||||||
<string name="compatibility_check_known_broken">Known Broken?</string>
|
<string name="compatibility_check_known_broken">Known Broken?</string>
|
||||||
<string name="compatibility_check_known_broken_desc">Making sure your device is not known to have bugs associated with removable eSIMs.</string>
|
<string name="compatibility_check_known_broken_desc">Making sure your device is not known to have bugs associated with removable eSIMs.</string>
|
||||||
|
|
Loading…
Reference in a new issue