refactor: EuiccChannel is not abstract
All checks were successful
/ build-debug (push) Successful in 4m19s
All checks were successful
/ build-debug (push) Successful in 4m19s
This commit is contained in:
parent
3a0d805eb2
commit
6977a32e80
|
@ -24,7 +24,7 @@ open class DefaultEuiccChannelFactory(protected val context: Context) : EuiccCha
|
|||
|
||||
Log.i(DefaultEuiccChannelManager.TAG, "Trying OMAPI for physical slot ${port.card.physicalSlotIndex}")
|
||||
try {
|
||||
return OmapiChannel(seService!!, port)
|
||||
return EuiccChannel(port, OmapiApduInterface(seService!!, port))
|
||||
} catch (e: IllegalArgumentException) {
|
||||
// Failed
|
||||
Log.w(
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
package im.angry.openeuicc.core
|
||||
|
||||
import im.angry.openeuicc.util.*
|
||||
import net.typeblog.lpac_jni.ApduInterface
|
||||
import net.typeblog.lpac_jni.LocalProfileAssistant
|
||||
import net.typeblog.lpac_jni.impl.HttpInterfaceImpl
|
||||
import net.typeblog.lpac_jni.impl.LocalProfileAssistantImpl
|
||||
|
||||
abstract class EuiccChannel(
|
||||
val port: UiccPortInfoCompat
|
||||
class EuiccChannel(
|
||||
val port: UiccPortInfoCompat,
|
||||
apduInterface: ApduInterface,
|
||||
) {
|
||||
val slotId = port.card.physicalSlotIndex // PHYSICAL slot
|
||||
val logicalSlotId = port.logicalSlotIndex
|
||||
val portId = port.portIndex
|
||||
|
||||
abstract val lpa: LocalProfileAssistant
|
||||
val lpa: LocalProfileAssistant = LocalProfileAssistantImpl(apduInterface, HttpInterfaceImpl())
|
||||
|
||||
val valid: Boolean
|
||||
get() = lpa.valid
|
||||
|
||||
|
|
|
@ -5,9 +5,6 @@ import android.se.omapi.SEService
|
|||
import android.se.omapi.Session
|
||||
import im.angry.openeuicc.util.*
|
||||
import net.typeblog.lpac_jni.ApduInterface
|
||||
import net.typeblog.lpac_jni.LocalProfileAssistant
|
||||
import net.typeblog.lpac_jni.impl.HttpInterfaceImpl
|
||||
import net.typeblog.lpac_jni.impl.LocalProfileAssistantImpl
|
||||
|
||||
class OmapiApduInterface(
|
||||
private val service: SEService,
|
||||
|
@ -48,12 +45,3 @@ class OmapiApduInterface(
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class OmapiChannel(
|
||||
service: SEService,
|
||||
port: UiccPortInfoCompat,
|
||||
) : EuiccChannel(port) {
|
||||
override val lpa: LocalProfileAssistant = LocalProfileAssistantImpl(
|
||||
OmapiApduInterface(service, port),
|
||||
HttpInterfaceImpl())
|
||||
}
|
||||
|
|
|
@ -26,9 +26,7 @@ class PrivilegedEuiccChannelFactory(context: Context) : DefaultEuiccChannelFacto
|
|||
"Trying TelephonyManager for slot ${port.card.physicalSlotIndex} port ${port.portIndex}"
|
||||
)
|
||||
try {
|
||||
return TelephonyManagerChannel(
|
||||
port, tm
|
||||
)
|
||||
return EuiccChannel(port, TelephonyManagerApduInterface(port, tm))
|
||||
} catch (e: IllegalArgumentException) {
|
||||
// Failed
|
||||
Log.w(
|
||||
|
|
|
@ -3,10 +3,7 @@ package im.angry.openeuicc.core
|
|||
import android.telephony.IccOpenLogicalChannelResponse
|
||||
import android.telephony.TelephonyManager
|
||||
import im.angry.openeuicc.util.*
|
||||
import net.typeblog.lpac_jni.LocalProfileAssistant
|
||||
import net.typeblog.lpac_jni.ApduInterface
|
||||
import net.typeblog.lpac_jni.impl.HttpInterfaceImpl
|
||||
import net.typeblog.lpac_jni.impl.LocalProfileAssistantImpl
|
||||
|
||||
class TelephonyManagerApduInterface(
|
||||
private val port: UiccPortInfoCompat,
|
||||
|
@ -55,13 +52,3 @@ class TelephonyManagerApduInterface(
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class TelephonyManagerChannel(
|
||||
port: UiccPortInfoCompat,
|
||||
private val tm: TelephonyManager
|
||||
) : EuiccChannel(port) {
|
||||
override val lpa: LocalProfileAssistant = LocalProfileAssistantImpl(
|
||||
TelephonyManagerApduInterface(port, tm),
|
||||
HttpInterfaceImpl()
|
||||
)
|
||||
}
|
Loading…
Reference in a new issue