Browse Source

fix: resolve #329 (#330)

Reviewed-on: https://gitea.angry.im/PeterCxy/OpenEUICC/pulls/330
Co-authored-by: septs <github@septs.pw>
Co-committed-by: septs <github@septs.pw>
septs 4 weeks ago
parent
commit
da34c32187

+ 5 - 1
app/src/main/java/im/angry/openeuicc/ui/PrivilegedSettingsFragment.kt

@@ -12,7 +12,11 @@ class PrivilegedSettingsFragment : SettingsFragment(), PrivilegedEuiccContextMar
         val info = with(requireContext()) {
             packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
         }
-        info.javaClass.getMethod("isSignedWithPlatformKey").invoke(info) as Boolean
+        try {
+            info.javaClass.getMethod("isSignedWithPlatformKey").invoke(info) as Boolean
+        } catch (_: NoSuchMethodException) {
+            false
+        }
     }
 
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {