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.registerLifecycleCallbacks fires inside the isolated process and crashes on getHistoricalProcessStartReasons.
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.
AppStartMetrics.registerLifecycleCallbackscallsActivityManager.getHistoricalProcessStartReasons()unconditionally on API 35+ (Android 15). When the app uses a WebView, Android spawns an isolated WebView process and callsApplication.onCreatewithin it. Isolated processes are sandboxed and cannot make this IPC call, resulting in a fatalSecurityExceptionthat crashes the app before Sentry can capture it.Root cause
registerLifecycleCallbacks(introduced forApplicationStartInfosupport on API 35+) does not guard against the isolated-process context:Android enforces that isolated processes (see
ActivityManagerService.enforceNotIsolatedCaller) cannot callgetHistoricalProcessStartReasons. The WebView process runsApplication.onCreatein this isolated context, triggering the crash.Stack trace (sanitized)
Reproduction
AppStartMetrics.registerLifecycleCallbacksfires inside the isolated process and crashes ongetHistoricalProcessStartReasons.Expected behavior
SDK should skip the
getHistoricalProcessStartReasonscall (and ideally all app-start tracking) when running in an isolated process.Workaround
Guard Sentry initialization to the main process only:
Affected versions
Confirmed present in sentry-java
8.37.1(shipped with@sentry/react-native8.7.0) and verified unpatched in currentmain(8.44.1). No existing issue or PR found tracking this.