Skip to content

Commit

Permalink
catch correct exception
Browse files Browse the repository at this point in the history
  • Loading branch information
kyujin-cho committed Jan 20, 2024
1 parent fd6feee commit 0f8fd2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions app/src/main/java/dev/bluehouse/enablevolte/Moder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ class CarrierModer(private val context: Context) : Moder() {
val subscriptions: List<SubscriptionInfo>
get() {
val sub = this.loadCachedInterface { sub }
try {
return sub.getActiveSubscriptionInfoList(null, null)
} catch (e: IllegalArgumentException) {
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(
"getActiveSubscriptionInfoListMethod",
String.Companion::class.java,
String.Companion::class.java,
Boolean.Companion::class.java,
"getActiveSubscriptionInfoList",
String::class.java,
String::class.java,
Boolean::class.java,
)
// FIXME: lift up reflect as soon as official source code releases
return (getActiveSubscriptionInfoListMethod.invoke(sub, null, null, null) as List<SubscriptionInfo>)
(getActiveSubscriptionInfoListMethod.invoke(sub, null, null, false) as List<SubscriptionInfo>)
}
}

Expand Down

0 comments on commit 0f8fd2c

Please sign in to comment.