Compare commits
1 commit
baf717ccfc
...
eb44882498
Author | SHA1 | Date | |
---|---|---|---|
eb44882498 |
2 changed files with 21 additions and 6 deletions
|
@ -69,8 +69,12 @@ class TelephonyManagerApduInterface(
|
|||
|
||||
override val atr: ByteArray?
|
||||
get() = try {
|
||||
tm.iccGetATR(port.card.physicalSlotIndex)
|
||||
tm.iccGetAtr(slotIndex)?.decodeHex()
|
||||
} catch (e: NoSuchMethodException) {
|
||||
try {
|
||||
tm.getAtrUsingSlotId(slotIndex)
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
|
@ -64,12 +64,18 @@ private val getITelephony: Method by lazy {
|
|||
}
|
||||
}
|
||||
|
||||
fun TelephonyManager.iccGetATR(slotId: Int): ByteArray? {
|
||||
fun TelephonyManager.getAtrUsingSlotId(slotId: Int): ByteArray? {
|
||||
val telephony = getITelephony.invoke(this)
|
||||
val getAtrUsingSlotId = telephony.javaClass.getMethod("getAtrUsingSlotId", Int::class.java)
|
||||
return getAtrUsingSlotId.invoke(telephony, slotId) as ByteArray?
|
||||
}
|
||||
|
||||
fun TelephonyManager.iccGetAtr(slotId: Int): String? {
|
||||
val telephony = getITelephony.invoke(this)
|
||||
val iccGetAtr = telephony.javaClass.getMethod("iccGetAtr", Int::class.java)
|
||||
return iccGetAtr.invoke(telephony, slotId) as String?
|
||||
}
|
||||
|
||||
fun TelephonyManager.iccOpenLogicalChannelBySlot(
|
||||
slotId: Int, appletId: String?, p2: Int
|
||||
): IccOpenLogicalChannelResponse =
|
||||
|
@ -107,10 +113,15 @@ fun TelephonyManager.iccTransmitApduLogicalChannelByPort(
|
|||
|
||||
var TelephonyManager.simSlotMapping: Collection<UiccSlotMapping>
|
||||
get() = getSimSlotMapping.invoke(this) as Collection<UiccSlotMapping>
|
||||
set(new) { setSimSlotMapping.invoke(this, new) }
|
||||
set(new) {
|
||||
setSimSlotMapping.invoke(this, new)
|
||||
}
|
||||
|
||||
private val requestEmbeddedSubscriptionInfoListRefresh: Method by lazy {
|
||||
SubscriptionManager::class.java.getMethod("requestEmbeddedSubscriptionInfoListRefresh", Int::class.java)
|
||||
SubscriptionManager::class.java.getMethod(
|
||||
"requestEmbeddedSubscriptionInfoListRefresh",
|
||||
Int::class.java
|
||||
)
|
||||
}
|
||||
|
||||
fun SubscriptionManager.requestEmbeddedSubscriptionInfoListRefresh(cardId: Int) {
|
||||
|
|
Loading…
Add table
Reference in a new issue