CompatibilityCheck: Improve OMAPI connectivity check
Some checks failed
/ build-debug (push) Has been cancelled

Stop failing the test if only some slots can be seen. Display a text
warning users of that, but don't appear as a failure.
This commit is contained in:
Peter Cai 2024-03-04 18:38:01 -05:00
parent 49af0ffee9
commit a101ae6805
2 changed files with 6 additions and 4 deletions

View file

@ -47,11 +47,13 @@ abstract class CompatibilityCheck(context: Context) {
abstract val title: String
protected abstract val defaultDescription: String
protected lateinit var successDescription: String
protected lateinit var failureDescription: String
val description: String
get() = when {
(state == State.FAILURE || state == State.FAILURE_UNKNOWN) && this::failureDescription.isInitialized -> failureDescription
state == State.SUCCESS && this::successDescription.isInitialized -> successDescription
else -> defaultDescription
}
@ -111,9 +113,9 @@ internal class OmapiConnCheck(private val context: Context): CompatibilityCheck(
failureDescription = context.getString(R.string.compatibility_check_omapi_connectivity_fail)
return State.FAILURE
} else if (simReaders.size < tm.activeModemCountCompat) {
failureDescription = context.getString(R.string.compatibility_check_omapi_connectivity_fail_sim_number,
successDescription = context.getString(R.string.compatibility_check_omapi_connectivity_partial_success_sim_number,
simReaders.map { it.slotIndex }.joinToString(", "))
return State.FAILURE
return State.SUCCESS
}
return State.SUCCESS

View file

@ -9,8 +9,8 @@
<string name="compatibility_check_system_features_no_omapi">Your device has no support for accessing SIM cards via OMAPI.</string>
<string name="compatibility_check_omapi_connectivity">OMAPI Connectivity</string>
<string name="compatibility_check_omapi_connectivity_desc">Does your device allow access to Secure Elements on SIM cards via OMAPI?</string>
<string name="compatibility_check_omapi_connectivity_fail">Unable to detect Secure Element readers for SIM cards via OMAPI.</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_omapi_connectivity_fail">Unable to detect Secure Element readers for SIM cards via OMAPI. If you have not inserted a SIM in this device, try inserting one and retry this check.</string>
<string name="compatibility_check_omapi_connectivity_partial_success_sim_number">Successfully detected Secure Element access, but only for the following SIM slots: %s.</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_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>