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