Repository navigation
AppStartMetrics crashes in isolated process (WebView) on API 35+ #5596
Description
AppStartMetrics.registerLifecycleCallbacks calls ActivityManager.getHistoricalProcessStartReasons() unconditionally on API 35+ (Android 15). When the app uses a WebView, Android spawns an isolated WebView process and calls Application.onCreate within it. Isolated processes are sandboxed and cannot make this IPC call, resulting in a fatal SecurityException that crashes the app before Sentry can capture it.
Root cause
registerLifecycleCallbacks (introduced for ApplicationStartInfo support on API 35+) does not guard against the isolated-process context:
// AppStartMetrics.java
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
final ActivityManager activityManager =
(ActivityManager) application.getSystemService(Context.ACTIVITY_SERVICE);
if (activityManager != null) {
// Throws SecurityException in isolated processes (e.g. WebView process)
final List<ApplicationStartInfo> historicalProcessStartReasons =
activityManager.getHistoricalProcessStartReasons(1);
...
}
}Android enforces that isolated processes (see ActivityManagerService.enforceNotIsolatedCaller) cannot call getHistoricalProcessStartReasons. The WebView process runs Application.onCreate in this isolated context, triggering the crash.
Stack trace (sanitized)
java.lang.RuntimeException
at android.app.ActivityThread.handleBindApplication
...
Caused by java.lang.SecurityException: Isolated process not allowed to call getHistoricalProcessStartReasons
at android.app.ActivityManager.getHistoricalProcessStartReasons
at io.sentry.android.core.performance.AppStartMetrics.registerLifecycleCallbacks (AppStartMetrics.java:346)
at io.sentry.android.core.performance.AppStartMetrics.onApplicationCreate (AppStartMetrics.java:307)
at android.app.ActivityThread.handleBindApplication
...
Caused by android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.enforceNotIsolatedCaller
at com.android.server.am.ActivityManagerService.getHistoricalProcessStartReasons
...
Reproduction
- Initialize Sentry Android SDK on API 35+ (Android 15) in an app that uses WebView.
- Launch the app — Android spins up an isolated WebView process.
AppStartMetrics.registerLifecycleCallbacksfires inside the isolated process and crashes ongetHistoricalProcessStartReasons.
Expected behavior
SDK should skip the getHistoricalProcessStartReasons call (and ideally all app-start tracking) when running in an isolated process.
Workaround
Guard Sentry initialization to the main process only:
if (!android.os.Process.isIsolated()) {
SentryAndroid.init(context) { options -> ... }
}Affected versions
Confirmed present in sentry-java 8.37.1 (shipped with @sentry/react-native 8.7.0) and verified unpatched in current main (8.44.1). No existing issue or PR found tracking this.
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsWaiting for: Product Owner
Activity
linear-code commentedon Jun 22, 2026
JAVA-582
github-actions commentedon Jun 24, 2026
A PR closing this issue has just been released 🚀
This issue was referenced by PR #5597, which was included in the 8.43.3 release.