Repository navigation
fix(android): name a crash after its first frame outside the platform - #501
Open
mobile-kevin wants to merge 1 commit into
Open
mobile-kevin wants to merge 1 commit into
mobile-kevin wants to merge 1 commit into
Conversation
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.
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50. Or wait 56 minutes for your next included review. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (2)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When an Android Java crash has no
Process:line (a process started from the shell, such as uiautomator),device crashes listnames 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:The crash itself is uiautomator failing to register its accessibility service;
com.android.uiautomator.core.UiAutomationShellWrapperis further down the stack.Fix
extractProcessFromStackkeeps the existing design (name the crash after a stack-frame class when there is noProcess: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:
Testing
main:TestJavaCrashWithoutProcessLineSkipsFrameworkFrames, using the real uiautomator crash from the emulator: expectedcom.android.uiautomator.core.UiAutomationShellWrapper, gotandroid.os.Parcel.TestJavaCrashSkipsJavaAndKotlinFramesToFindTheAppFrame: expectedcom.example.myapp.SettingsFragment, gotjava.lang.Integer.TestJavaCrashWithOnlyFrameworkFramesFallsBackToTheFirstFramepasses before and after.go test ./...passes.device crashes liston a Pixel 9 Pro emulator now shows the uiautomator class.Note
processNamestill 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).