Skip to content

fix: use persistent=false on Android 16 to prevent system phone process crash#465

Open
xiemobiao wants to merge 1 commit into
kyujin-cho:mainfrom
xiemobiao:fix/android16-persistent-crash
Open

fix: use persistent=false on Android 16 to prevent system phone process crash#465
xiemobiao wants to merge 1 commit into
kyujin-cho:mainfrom
xiemobiao:fix/android16-persistent-crash

Conversation

@xiemobiao
Copy link
Copy Markdown

@xiemobiao xiemobiao commented Mar 1, 2026

Summary

  • On Android 16 (SDK 36), calling overrideConfig(persistent=true) crashes the com.android.phone system process with SecurityException: overrideConfig with persistent=true only can be invoked by system app
  • The crash occurs in a different process (com.android.phone, not the app itself), so the existing try-catch in BrokerInstrumentation.kt cannot catch it
  • This fix checks Build.VERSION.SDK_INT and uses persistent=false on Android 16+, preventing the crash entirely

Changes

  • BrokerInstrumentation.kt: Replace try-catch fallback with SDK version check, use persistent=false directly on API 36+
  • Moder.kt: Apply the same fix to overrideConfigDirectly()

Test plan

  • Tested on Pixel 10 Pro XL, Android 16 (BP4A.260205.001, security patch 2026-02-05)
  • VoLTE, VoNR, VoWiFi toggle works without crash
  • 5G SA (NR_SA) successfully connected on China Unicom
  • Shizuku 13.6.0 required for Android 16 compatibility

🤖 Generated with Claude Code

在 Android 16 (SDK 36) 上,调用 overrideConfig(persistent=true) 会导致
com.android.phone 系统进程崩溃,抛出 SecurityException。由于崩溃发生在
不同的进程中,应用的 try-catch 无法捕获该异常。

此修改通过检测 SDK 版本,在 Android 16+ 上直接使用 persistent=false,
从根本上避免崩溃。代价是重启后运营商配置会丢失,但可通过 Shizuku
重新应用,属于可接受的折衷方案。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@xiemobiao xiemobiao changed the title 修复: Android 16 上 overrideConfig(persistent=true) 导致系统进程崩溃 fix: use persistent=false on Android 16 to prevent system phone process crash Mar 1, 2026
@yhkee0404
Copy link
Copy Markdown
Contributor

yhkee0404 commented Mar 7, 2026

It seems the boolean value of persistent in BrokerInstrumentation does not have to be evaluated at all because it is always false following the current implementation of overrideConfigUsingBroker, and the boolean value of persistent evaluated all the time as false on Android 16 (SDK 36) following the current implementation of overrideConfigDirectly may also discourage users who have not applied the troublesome security patches and therefore are still free to set it true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants