feat: added native crash handler#2450
Conversation
Greptile SummaryThis PR introduces a new Cordova plugin,
Confidence Score: 5/5The crash handler is correctly implemented and the faulting process is unconditionally terminated in the finally block. The three blocking concerns from the previous review round (process not terminated, too-narrow exception catch, TLS protocol blacklist removal) are all resolved. No new logic bugs were found. CrashActivity.java — null getLaunchIntentForPackage exits silently (previously discussed); System.java — duplicate imports should be deduplicated. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Main as Main Process
participant AMS as ActivityManagerService
participant Crash as :crash Process
Note over Main: App running normally
Main->>Main: CrashHandler.initialize()
Main->>Main: Thread.setDefaultUncaughtExceptionHandler()
Note over Main: Uncaught exception thrown
Main->>Main: uncaughtException(thread, throwable)
Main->>AMS: context.startActivity(CrashActivity intent)
Main->>Main: Process.killProcess() + System.exit(10)
AMS->>Crash: Start CrashActivity
Crash->>Crash: loadThemeColors() + build UI
alt Restart
Crash->>AMS: startActivity(launch intent)
Crash->>Crash: System.exit(0)
else Close
Crash->>Crash: System.exit(0)
end
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Main as Main Process
participant AMS as ActivityManagerService
participant Crash as :crash Process
Note over Main: App running normally
Main->>Main: CrashHandler.initialize()
Main->>Main: Thread.setDefaultUncaughtExceptionHandler()
Note over Main: Uncaught exception thrown
Main->>Main: uncaughtException(thread, throwable)
Main->>AMS: context.startActivity(CrashActivity intent)
Main->>Main: Process.killProcess() + System.exit(10)
AMS->>Crash: Start CrashActivity
Crash->>Crash: loadThemeColors() + build UI
alt Restart
Crash->>AMS: startActivity(launch intent)
Crash->>Crash: System.exit(0)
else Close
Crash->>Crash: System.exit(0)
end
Reviews (4): Last reviewed commit: "catch Throwable instead of Exception to ..." | Re-trigger Greptile |
…ity.java Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
No |
This will help debug issues like #2158