From d24bbf0e0d73941fe7eb192072829831f27ffad3 Mon Sep 17 00:00:00 2001 From: Kyujin Cho Date: Sat, 20 Jan 2024 15:24:16 +0900 Subject: [PATCH] fix: app crashing on latest beta (#231) --- .idea/misc.xml | 2 +- .../main/java/dev/bluehouse/enablevolte/Moder.kt | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 54d5acd..a781e70 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,7 +1,7 @@ - + diff --git a/app/src/main/java/dev/bluehouse/enablevolte/Moder.kt b/app/src/main/java/dev/bluehouse/enablevolte/Moder.kt index 00c8228..70a4f78 100644 --- a/app/src/main/java/dev/bluehouse/enablevolte/Moder.kt +++ b/app/src/main/java/dev/bluehouse/enablevolte/Moder.kt @@ -78,7 +78,21 @@ open class Moder { class CarrierModer(private val context: Context) : Moder() { val subscriptions: List - get() = this.loadCachedInterface { sub }.getActiveSubscriptionInfoList(null, null) + get() { + val sub = this.loadCachedInterface { sub } + return try { + sub.getActiveSubscriptionInfoList(null, null) + } catch (e: NoSuchMethodError) { + // FIXME: lift up reflect as soon as official source code releases + val getActiveSubscriptionInfoListMethod = sub.javaClass.getMethod( + "getActiveSubscriptionInfoList", + String::class.java, + String::class.java, + Boolean::class.java, + ) + (getActiveSubscriptionInfoListMethod.invoke(sub, null, null, false) as List) + } + } val defaultSubId: Int get() {