chore: cleanup #81

Merged
PeterCxy merged 3 commits from septs/OpenEUICC:cleanup into master 2024-12-07 15:57:16 +01:00
5 changed files with 8 additions and 7 deletions

View file

@ -38,8 +38,8 @@ class OmapiApduInterface(
check(!this::lastChannel.isInitialized) { check(!this::lastChannel.isInitialized) {
"Can only open one channel" "Can only open one channel"
} }
lastChannel = session.openLogicalChannel(aid)!!; lastChannel = session.openLogicalChannel(aid)!!
return 1; return 1
} }
override fun logicalChannelClose(handle: Int) { override fun logicalChannelClose(handle: Int) {

View file

@ -109,7 +109,7 @@ open class MainActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
override fun onOptionsItemSelected(item: MenuItem): Boolean = override fun onOptionsItemSelected(item: MenuItem): Boolean =
when (item.itemId) { when (item.itemId) {
R.id.settings -> { R.id.settings -> {
startActivity(Intent(this, SettingsActivity::class.java)); startActivity(Intent(this, SettingsActivity::class.java))
true true
} }
R.id.reload -> { R.id.reload -> {

View file

@ -39,7 +39,7 @@ class TelephonyManagerApduInterface(
val hex = aid.encodeHex() val hex = aid.encodeHex()
val channel = tm.iccOpenLogicalChannelByPortCompat(port.card.physicalSlotIndex, port.portIndex, hex, 0) val channel = tm.iccOpenLogicalChannelByPortCompat(port.card.physicalSlotIndex, port.portIndex, hex, 0)
if (channel.status != IccOpenLogicalChannelResponse.STATUS_NO_ERROR || channel.channel == IccOpenLogicalChannelResponse.INVALID_CHANNEL) { if (channel.status != IccOpenLogicalChannelResponse.STATUS_NO_ERROR || channel.channel == IccOpenLogicalChannelResponse.INVALID_CHANNEL) {
throw IllegalArgumentException("Cannot open logical channel $hex via TelephonManager on slot ${port.card.physicalSlotIndex} port ${port.portIndex}"); throw IllegalArgumentException("Cannot open logical channel $hex via TelephonManager on slot ${port.card.physicalSlotIndex} port ${port.portIndex}")
} }
lastChannel = channel.channel lastChannel = channel.channel
return lastChannel return lastChannel

View file

@ -94,6 +94,7 @@ val TelephonyManager.uiccCardsInfoCompat: List<RealUiccCardInfoCompat>
fun TelephonyManager.iccOpenLogicalChannelByPortCompat( fun TelephonyManager.iccOpenLogicalChannelByPortCompat(
slotIndex: Int, portIndex: Int, aid: String?, p2: Int slotIndex: Int, portIndex: Int, aid: String?, p2: Int
): IccOpenLogicalChannelResponse = ): IccOpenLogicalChannelResponse =
@Suppress("UNNECESSARY_NOT_NULL_ASSERTION")
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
iccOpenLogicalChannelByPort(slotIndex, portIndex, aid, p2)!! iccOpenLogicalChannelByPort(slotIndex, portIndex, aid, p2)!!
} else { } else {

View file

@ -16,9 +16,9 @@ android {
externalNativeBuild { externalNativeBuild {
ndkBuild { ndkBuild {
cFlags( cFlags(
"-fmacro-prefix-map=${project.projectDir.toString()}=/fake/path/", "-fmacro-prefix-map=${project.projectDir}=/fake/path/",
"-fdebug-prefix-map=${project.projectDir.toString()}=/fake/path/", "-fdebug-prefix-map=${project.projectDir}=/fake/path/",
"-ffile-prefix-map=${project.projectDir.toString()}=/fake/path/" "-ffile-prefix-map=${project.projectDir}=/fake/path/"
) )
} }
} }