|
@@ -1,7 +1,9 @@
|
|
|
package im.angry.openeuicc.util
|
|
package im.angry.openeuicc.util
|
|
|
|
|
|
|
|
import android.telephony.IccOpenLogicalChannelResponse
|
|
import android.telephony.IccOpenLogicalChannelResponse
|
|
|
|
|
+import android.telephony.SubscriptionManager
|
|
|
import android.telephony.TelephonyManager
|
|
import android.telephony.TelephonyManager
|
|
|
|
|
+import java.lang.Exception
|
|
|
import java.lang.reflect.Method
|
|
import java.lang.reflect.Method
|
|
|
|
|
|
|
|
val TelephonyManager.supportsDSDS: Boolean
|
|
val TelephonyManager.supportsDSDS: Boolean
|
|
@@ -13,6 +15,16 @@ var TelephonyManager.dsdsEnabled: Boolean
|
|
|
switchMultiSimConfig(if (value) { 2 } else {1})
|
|
switchMultiSimConfig(if (value) { 2 } else {1})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+fun SubscriptionManager.tryRefreshCachedEuiccInfo(cardId: Int) {
|
|
|
|
|
+ if (cardId != 0) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ requestEmbeddedSubscriptionInfoListRefresh(cardId)
|
|
|
|
|
+ } catch (e: Exception) {
|
|
|
|
|
+ // Ignore
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// Hidden APIs via reflection to enable building without AOSP source tree
|
|
// Hidden APIs via reflection to enable building without AOSP source tree
|
|
|
private val iccOpenLogicalChannelBySlot: Method by lazy {
|
|
private val iccOpenLogicalChannelBySlot: Method by lazy {
|
|
|
TelephonyManager::class.java.getMethod(
|
|
TelephonyManager::class.java.getMethod(
|
|
@@ -48,4 +60,12 @@ fun TelephonyManager.iccTransmitApduLogicalChannelBySlot(
|
|
|
): String? =
|
|
): String? =
|
|
|
iccTransmitApduLogicalChannelBySlot.invoke(
|
|
iccTransmitApduLogicalChannelBySlot.invoke(
|
|
|
this, slotId, channel, cla, instruction, p1, p2, p3, data
|
|
this, slotId, channel, cla, instruction, p1, p2, p3, data
|
|
|
- ) as String?
|
|
|
|
|
|
|
+ ) as String?
|
|
|
|
|
+
|
|
|
|
|
+private val requestEmbeddedSubscriptionInfoListRefresh: Method by lazy {
|
|
|
|
|
+ SubscriptionManager::class.java.getMethod("requestEmbeddedSubscriptionInfoListRefresh", Int::class.java)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+fun SubscriptionManager.requestEmbeddedSubscriptionInfoListRefresh(cardId: Int): Unit {
|
|
|
|
|
+ requestEmbeddedSubscriptionInfoListRefresh.invoke(this, cardId)
|
|
|
|
|
+}
|