Compare commits
1 commit
9541c14112
...
85dfd44b4f
Author | SHA1 | Date | |
---|---|---|---|
85dfd44b4f |
2 changed files with 5 additions and 9 deletions
|
@ -26,7 +26,6 @@ import kotlinx.coroutines.runBlocking
|
|||
open class QuickAvailabilityFragment : Fragment(), OpenEuiccContextMarker {
|
||||
companion object {
|
||||
enum class Compatibility {
|
||||
NOT_SUPPORTED,
|
||||
COMPATIBLE,
|
||||
NOT_COMPATIBLE,
|
||||
}
|
||||
|
@ -91,11 +90,11 @@ open class QuickAvailabilityFragment : Fragment(), OpenEuiccContextMarker {
|
|||
}
|
||||
|
||||
suspend fun getCompatibilityCheckResult(): CompatibilityResult {
|
||||
val service = connectSEService(requireContext())
|
||||
if (!service.isConnected) {
|
||||
return CompatibilityResult(Compatibility.NOT_SUPPORTED)
|
||||
val seService = connectSEService(requireContext())
|
||||
if (!seService.isConnected) {
|
||||
return CompatibilityResult(Compatibility.NOT_COMPATIBLE)
|
||||
}
|
||||
val slots = service.readers.filter { it.isSIM }.mapNotNull { reader ->
|
||||
val slots = seService.readers.filter { it.isSIM }.mapNotNull { reader ->
|
||||
try {
|
||||
// Note: we ONLY check the default ISD-R AID, because this test is for the _device_,
|
||||
// NOT the eUICC. We don't care what AID a potential eUICC might use, all we need to
|
||||
|
@ -108,6 +107,7 @@ open class QuickAvailabilityFragment : Fragment(), OpenEuiccContextMarker {
|
|||
// SecurityException is only thrown when Channel is constructed, which means everything else needs to succeed
|
||||
reader.slotIndex
|
||||
} catch (_: Exception) {
|
||||
// Ignore
|
||||
null
|
||||
}
|
||||
}
|
||||
|
@ -121,9 +121,6 @@ open class QuickAvailabilityFragment : Fragment(), OpenEuiccContextMarker {
|
|||
val usbHost = requireContext().packageManager
|
||||
.hasSystemFeature(PackageManager.FEATURE_USB_HOST)
|
||||
val resId = when (result.compatibility) {
|
||||
Compatibility.NOT_SUPPORTED ->
|
||||
R.string.quick_availability_not_supported
|
||||
|
||||
Compatibility.COMPATIBLE ->
|
||||
R.string.quick_availability_compatible
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
<!-- Quick Availability -->
|
||||
<string name="quick_availability">Quick Availability</string>
|
||||
<string name="quick_availability_compatible">Your smartphone can use %s compatible cards</string>
|
||||
<string name="quick_availability_not_supported">Your smartphone is not supported with %s</string>
|
||||
<string name="quick_availability_not_compatible">Your smartphone is not compatible with %s</string>
|
||||
<string name="quick_availability_not_compatible_but_usb">Your smartphone is not compatible with %s, but can be managed using a USB smart card reader</string>
|
||||
<string name="quick_availability_result_slots">SIM card slots accessible: %s</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue