diff --git a/app/src/main/java/im/angry/openeuicc/core/TelephonyManagerApduInterface.kt b/app/src/main/java/im/angry/openeuicc/core/TelephonyManagerApduInterface.kt index f06e317..b3b2089 100644 --- a/app/src/main/java/im/angry/openeuicc/core/TelephonyManagerApduInterface.kt +++ b/app/src/main/java/im/angry/openeuicc/core/TelephonyManagerApduInterface.kt @@ -69,12 +69,8 @@ class TelephonyManagerApduInterface( override val atr: ByteArray? get() = try { - tm.iccGetAtr(slotIndex)?.decodeHex() - } catch (e: NoSuchMethodException) { - try { - tm.getAtrUsingSlotId(slotIndex) - } catch (e: Exception) { - null - } + tm.iccGetATR(port.card.physicalSlotIndex) + } catch (e: Exception) { + null } } \ No newline at end of file diff --git a/libs/hidden-apis-shim/src/main/java/im/angry/openeuicc/util/TelephonyManagerHiddenApi.kt b/libs/hidden-apis-shim/src/main/java/im/angry/openeuicc/util/TelephonyManagerHiddenApi.kt index 0d5d463..288742b 100644 --- a/libs/hidden-apis-shim/src/main/java/im/angry/openeuicc/util/TelephonyManagerHiddenApi.kt +++ b/libs/hidden-apis-shim/src/main/java/im/angry/openeuicc/util/TelephonyManagerHiddenApi.kt @@ -64,18 +64,12 @@ private val getITelephony: Method by lazy { } } -fun TelephonyManager.getAtrUsingSlotId(slotId: Int): ByteArray? { +fun TelephonyManager.iccGetATR(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 = @@ -113,15 +107,10 @@ fun TelephonyManager.iccTransmitApduLogicalChannelByPort( var TelephonyManager.simSlotMapping: Collection get() = getSimSlotMapping.invoke(this) as Collection - 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) {