Class CrashHandler
Object
org.mozilla.geckoview.CrashHandler
- All Implemented Interfaces:
Thread.UncaughtExceptionHandler
Handler for processing application crashes and sending crash reports.
-
Constructor Summary
ConstructorsConstructorDescriptionCrashHandler(Context aAppContext, Class<? extends Service> aHandlerService) Create and register a CrashHandler for all threads and thread groups.CrashHandler(Class<? extends Service> handlerService) Create and register a CrashHandler for all threads and thread groups.CrashHandler(Thread thread, Context aAppContext, Class<? extends Service> aHandlerService) Create and register a CrashHandler for a particular thread.CrashHandler(Thread thread, Class<? extends Service> handlerService) Create and register a CrashHandler for a particular thread. -
Method Summary
Modifier and TypeMethodDescriptionstatic CrashHandlercreateDefaultCrashHandler(Context context) Return a default CrashHandler object for all threads and thread groups.Returns the application context.Returns the application package name if context is not null; if context is null, CrashHandler's package name will be returned.byte[]getCrashDump(Thread thread, Throwable exc) Get the crash minidump content to be reported.getCrashExtras(Thread thread, Throwable exc) Get the crash "extras" to be reported.static StringGet the standard stack trace string of an exception.static ThrowableGet the root exception from the 'cause' chain of an exception.getServerUrl(Bundle extras) Get the server URL to send the crash report to.booleanlaunchCrashReporter(String dumpFile, String extraFile) Launch the crash reporter activity that sends the crash report to the server.static voidlogException(Thread thread, Throwable exc) Record an exception stack in logs.booleanreportException(Thread thread, Throwable exc) Report an exception to Socorro.static voidTerminate the current process.voiduncaughtException(Thread thread, Throwable exc) Implements the default behavior for handling uncaught exceptions.voidUnregister this CrashHandler for exception handling.
-
Constructor Details
-
CrashHandler
-
CrashHandler
public CrashHandler(@Nullable Context aAppContext, @Nullable Class<? extends Service> aHandlerService) Create and register a CrashHandler for all threads and thread groups.- Parameters:
aAppContext- A Context for retrieving application information.aHandlerService- Service receiving native code crashes
-
CrashHandler
-
CrashHandler
public CrashHandler(@Nullable Thread thread, Context aAppContext, Class<? extends Service> aHandlerService) Create and register a CrashHandler for a particular thread.- Parameters:
thread- A thread to register the CrashHandleraAppContext- A Context for retrieving application information.aHandlerService- Service receiving native code crashes
-
-
Method Details
-
getRootException
-
getExceptionStackTrace
-
terminateProcess
@AnyThread public static void terminateProcess()Terminate the current process. -
unregister
@AnyThread public void unregister()Unregister this CrashHandler for exception handling. -
logException
-
getAppPackageName
Returns the application package name if context is not null; if context is null, CrashHandler's package name will be returned.- Returns:
- the application package name if context is not null; if context is null, CrashHandler's package name will be returned
-
getAppContext
Returns the application context.- Returns:
- the application context
-
getCrashExtras
-
getCrashDump
-
getServerUrl
-
launchCrashReporter
Launch the crash reporter activity that sends the crash report to the server.- Parameters:
dumpFile- Path for the minidump fileextraFile- Path for the crash extra file- Returns:
- Whether the crash reporter was successfully launched
-
reportException
-
uncaughtException
Implements the default behavior for handling uncaught exceptions.- Specified by:
uncaughtExceptionin interfaceThread.UncaughtExceptionHandler- Parameters:
thread- The exception threadexc- An uncaught exception
-
createDefaultCrashHandler
Return a default CrashHandler object for all threads and thread groups.- Parameters:
context- application context- Returns:
- a default CrashHandler object
-