EuiccChannelManager: try TelephonyManager even if euicc is removable
However, we still prioritize OMAPI if it is available for removable cards.
This commit is contained in:
parent
ca8b698ee3
commit
5f88bf089c
|
@ -57,6 +57,18 @@ open class EuiccChannelManager(protected val context: Context) {
|
|||
return null
|
||||
}
|
||||
|
||||
protected fun tryOpenEuiccChannelUnprivileged(uiccInfo: UiccCardInfo, channelInfo: EuiccChannelInfo): EuiccChannel? {
|
||||
Log.i(TAG, "Trying OMAPI for slot ${uiccInfo.slotIndex}")
|
||||
try {
|
||||
return OmapiChannel(seService!!, channelInfo)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
// Failed
|
||||
Log.w(TAG, "OMAPI APDU interface unavailable for slot ${uiccInfo.slotIndex}.")
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
private suspend fun tryOpenEuiccChannel(uiccInfo: UiccCardInfo): EuiccChannel? {
|
||||
lock.withLock {
|
||||
ensureSEService()
|
||||
|
@ -81,13 +93,7 @@ open class EuiccChannelManager(protected val context: Context) {
|
|||
var euiccChannel: EuiccChannel? = tryOpenEuiccChannelPrivileged(uiccInfo, channelInfo)
|
||||
|
||||
if (euiccChannel == null) {
|
||||
Log.i(TAG, "Trying OMAPI for slot ${uiccInfo.slotIndex}")
|
||||
try {
|
||||
euiccChannel = OmapiChannel(seService!!, channelInfo)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
// Failed
|
||||
Log.w(TAG, "OMAPI APDU interface unavailable for slot ${uiccInfo.slotIndex}.")
|
||||
}
|
||||
euiccChannel = tryOpenEuiccChannelUnprivileged(uiccInfo, channelInfo)
|
||||
}
|
||||
|
||||
if (euiccChannel != null) {
|
||||
|
|
|
@ -12,7 +12,13 @@ class PrivilegedEuiccChannelManager(context: Context): EuiccChannelManager(conte
|
|||
override fun checkPrivileges() = true // TODO: Implement proper system app check
|
||||
|
||||
override fun tryOpenEuiccChannelPrivileged(uiccInfo: UiccCardInfo, channelInfo: EuiccChannelInfo): EuiccChannel? {
|
||||
if (uiccInfo.isEuicc && !uiccInfo.isRemovable) {
|
||||
if (uiccInfo.isRemovable) {
|
||||
// Attempt unprivileged (OMAPI) before TelephonyManager
|
||||
// but still try TelephonyManager in case OMAPI is broken
|
||||
super.tryOpenEuiccChannelUnprivileged(uiccInfo, channelInfo)?.let { return it }
|
||||
}
|
||||
|
||||
if (uiccInfo.isEuicc) {
|
||||
Log.i(TAG, "Trying TelephonyManager for slot ${uiccInfo.slotIndex}")
|
||||
// TODO: On Tiramisu, we should also connect all available "ports" for MEP support
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue