|
|
@@ -5,10 +5,7 @@ import im.angry.openeuicc.di.AppContainer
|
|
|
import im.angry.openeuicc.util.*
|
|
|
import java.lang.Exception
|
|
|
|
|
|
-class PrivilegedEuiccChannelManager(
|
|
|
- appContainer: AppContainer,
|
|
|
- context: Context
|
|
|
-) :
|
|
|
+class PrivilegedEuiccChannelManager(appContainer: AppContainer, context: Context) :
|
|
|
DefaultEuiccChannelManager(appContainer, context) {
|
|
|
override val uiccCards: Collection<UiccCardInfoCompat>
|
|
|
get() = tm.uiccCardsInfoCompat
|
|
|
@@ -17,10 +14,15 @@ class PrivilegedEuiccChannelManager(
|
|
|
// due to a (potentially) forced restart
|
|
|
// This should be called every time the application is restarted
|
|
|
fun closeAllStaleChannels() {
|
|
|
- for (card in tm.uiccCardsInfo) {
|
|
|
- for (channel in 0 until 10) {
|
|
|
+ for (card in tm.uiccCardsInfoCompat) {
|
|
|
+ // As a further option, support of logical channels is expanded up to 19 supplementary logical channels as defined by the latest version of [ISO 7816-4].
|
|
|
+ //
|
|
|
+ // from <https://globalplatform.org/wp-content/uploads/2018/05/GPC_CardSpecification_v2.3.1_PublicRelease_CC.pdf#page=34>
|
|
|
+ // from <https://globalplatform.org/wp-content/uploads/2018/05/GPC_CardSpecification_v2.3.1_PublicRelease_CC.pdf#page=147>
|
|
|
+ // from <https://github.com/seek-for-android/pool/blob/01627dfb/src/smartcard-api/src/org/simalliance/openmobileapi/service/Channel.java#L156-L183>
|
|
|
+ for (channel in 0 until 20) {
|
|
|
try {
|
|
|
- tm.iccCloseLogicalChannelBySlot(card.slotIndex, channel)
|
|
|
+ tm.iccCloseLogicalChannelBySlot(card.physicalSlotIndex, channel)
|
|
|
} catch (_: Exception) {
|
|
|
// We do not care
|
|
|
}
|
|
|
@@ -29,10 +31,7 @@ class PrivilegedEuiccChannelManager(
|
|
|
}
|
|
|
|
|
|
override suspend fun notifyEuiccProfilesChanged(logicalSlotId: Int) {
|
|
|
- appContainer.subscriptionManager.apply {
|
|
|
- findEuiccChannelByLogicalSlot(logicalSlotId)?.let {
|
|
|
- tryRefreshCachedEuiccInfo(it.cardId)
|
|
|
- }
|
|
|
- }
|
|
|
+ val channel = findEuiccChannelByLogicalSlot(logicalSlotId) ?: return
|
|
|
+ appContainer.subscriptionManager.tryRefreshCachedEuiccInfo(channel.cardId)
|
|
|
}
|
|
|
}
|