Skip to content

fix(android): name a crash after its first frame outside the platform - #501

Merged
gmegidish merged 1 commit into
mobile-next:mainfrom
mobile-kevin:fix-android-crash-process-name
Nov 13, 2026
Merged

gmegidish merged 1 commit into
mobile-next:mainfrom
mobile-kevin:fix-android-crash-process-name

Conversation

@mobile-kevin

Copy link
Copy Markdown
Collaborator

Problem

When an Android Java crash has no Process: line (a process started from the shell, such as uiautomator), device crashes list names it after the class of the first stack frame. The exception usually surfaces inside the framework, so the name is a framework class that says nothing about what crashed:

$ mobilecli device crashes list --device Pixel_9_Pro
[{"processName": "android.os.Parcel", "timestamp": "2026-10-03 00:43:17.468", "id": "2026-10-03_00:43:17.468_30490"}]

The crash itself is uiautomator failing to register its accessibility service; com.android.uiautomator.core.UiAutomationShellWrapper is further down the stack.

Fix

extractProcessFromStack keeps the existing design (name the crash after a stack-frame class when there is no Process: line) but skips frames whose class is in a platform package: android., androidx., com.android.internal., dalvik., java., javax., jdk.internal., kotlin., kotlinx., libcore., sun.. If every frame is a platform frame, it falls back to the first frame as before.

A crash with a Process: line, and native crashes, are unaffected.

After the fix, on the same emulator:

{"processName": "com.android.uiautomator.core.UiAutomationShellWrapper", "timestamp": "2026-10-03 00:43:17.468", ...}

Testing

  • Unit tests written first, failing on main:
    • TestJavaCrashWithoutProcessLineSkipsFrameworkFrames, using the real uiautomator crash from the emulator: expected com.android.uiautomator.core.UiAutomationShellWrapper, got android.os.Parcel.
    • TestJavaCrashSkipsJavaAndKotlinFramesToFindTheAppFrame: expected com.example.myapp.SettingsFragment, got java.lang.Integer.
  • Guard test: TestJavaCrashWithOnlyFrameworkFramesFallsBackToTheFirstFrame passes before and after.
  • All existing crash tests pass unchanged, and go test ./... passes.
  • device crashes list on a Pixel 9 Pro emulator now shows the uiautomator class.

Note

processName still holds a class name in this fallback case, as it did before; this change only makes that class the crashing program's own. A process name proper is not in the logcat output for these crashes.

Found while QA-testing mobile-mcp (BUG-36).

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

Or wait 59 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5a38de2 and 1d001f1.

Files selected for processing: 2

  • devices/android_crash.go
  • devices/android_crash_test.go

@gmegidish
gmegidish force-pushed the fix-android-crash-process-name branch from 18e4cff to d2328aa Compare November 13, 2026 10:48
A Java crash with no 'Process:' line is named after the class of its first
stack frame. The exception often surfaces in the framework, so a uiautomator
crash was listed as 'android.os.Parcel'. Skip frames from platform packages
(android., java., kotlin., dalvik. ...) and fall back to the first frame
only when every frame belongs to the platform.
@gmegidish
gmegidish force-pushed the fix-android-crash-process-name branch from d2328aa to 1d001f1 Compare November 13, 2026 11:57
@gmegidish
gmegidish merged commit b32e4a8 into mobile-next:main Nov 13, 2026
9 checks passed
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