|
@@ -57,7 +57,10 @@ open class DefaultEuiccChannelManager(
|
|
|
protected open val uiccCards: Collection<UiccCardInfoCompat>
|
|
protected open val uiccCards: Collection<UiccCardInfoCompat>
|
|
|
get() = (0..<tm.activeModemCountCompat).map { FakeUiccCardInfoCompat(it) }
|
|
get() = (0..<tm.activeModemCountCompat).map { FakeUiccCardInfoCompat(it) }
|
|
|
|
|
|
|
|
- private suspend inline fun tryOpenChannelWithKnownAids(openFn: (ByteArray, EuiccChannel.SecureElementId) -> EuiccChannel?): List<EuiccChannel> {
|
|
|
|
|
|
|
+ private suspend inline fun tryOpenChannelWithKnownAids(
|
|
|
|
|
+ supportsMultiSE: Boolean,
|
|
|
|
|
+ openFn: (ByteArray, EuiccChannel.SecureElementId) -> EuiccChannel?
|
|
|
|
|
+ ): List<EuiccChannel> {
|
|
|
var isdrAidList =
|
|
var isdrAidList =
|
|
|
parseIsdrAidList(appContainer.preferenceRepository.isdrAidListFlow.first())
|
|
parseIsdrAidList(appContainer.preferenceRepository.isdrAidListFlow.first())
|
|
|
val ret = mutableListOf<EuiccChannel>()
|
|
val ret = mutableListOf<EuiccChannel>()
|
|
@@ -102,6 +105,12 @@ open class DefaultEuiccChannelManager(
|
|
|
if (channel != null) {
|
|
if (channel != null) {
|
|
|
ret.add(channel)
|
|
ret.add(channel)
|
|
|
openedAids.add(aid)
|
|
openedAids.add(aid)
|
|
|
|
|
+
|
|
|
|
|
+ // This only exists because the UI side doesn't yet support multi-SE over USB readers properly.
|
|
|
|
|
+ // TODO: Fix that and remove this.
|
|
|
|
|
+ if (!supportsMultiSE) {
|
|
|
|
|
+ break@outer
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -145,8 +154,9 @@ open class DefaultEuiccChannelManager(
|
|
|
return null
|
|
return null
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // This function is not responsible for managing USB channels (see the initial check), so supportsMultiSE is true.
|
|
|
val channels =
|
|
val channels =
|
|
|
- tryOpenChannelWithKnownAids { isdrAid, seId ->
|
|
|
|
|
|
|
+ tryOpenChannelWithKnownAids(supportsMultiSE = true) { isdrAid, seId ->
|
|
|
euiccChannelFactory.tryOpenEuiccChannel(
|
|
euiccChannelFactory.tryOpenEuiccChannel(
|
|
|
port,
|
|
port,
|
|
|
isdrAid,
|
|
isdrAid,
|
|
@@ -374,7 +384,8 @@ open class DefaultEuiccChannelManager(
|
|
|
UsbCcidContext.createFromUsbDevice(context, device, iface) ?: return@forEach
|
|
UsbCcidContext.createFromUsbDevice(context, device, iface) ?: return@forEach
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- val channels = tryOpenChannelWithKnownAids { isdrAid, seId ->
|
|
|
|
|
|
|
+ // TODO: We should also support multiple SEs over USB readers (the code here already does, UI doesn't yet)
|
|
|
|
|
+ val channels = tryOpenChannelWithKnownAids(supportsMultiSE = false) { isdrAid, seId ->
|
|
|
euiccChannelFactory.tryOpenUsbEuiccChannel(ccidCtx, isdrAid, seId)
|
|
euiccChannelFactory.tryOpenUsbEuiccChannel(ccidCtx, isdrAid, seId)
|
|
|
}
|
|
}
|
|
|
if (channels.isNotEmpty() && channels[0].valid) {
|
|
if (channels.isNotEmpty() && channels[0].valid) {
|