Skip to content

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

Open
mobile-kevin wants to merge 1 commit into
mobile-next:mainfrom
mobile-kevin:fix-android-crash-process-name
Open

mobile-kevin wants to merge 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).

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.
@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 56 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
  • Configuration used: Repository: mobile-next/mobilecli/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 84688f3a-18c4-4b7d-9969-0af8acd9209e
📥 Commits

Reviewing files that changed from the base of the PR and between aca77be and 18e4cff.

📒 Files selected for processing (2)
  • devices/android_crash.go
  • devices/android_crash_test.go

Comment @coderabbitai help to get the list of available commands.

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.

1 participant