Amplitude-Android icon indicating copy to clipboard operation
Amplitude-Android copied to clipboard

Oncorruption logging

Open djih opened this issue 6 years ago • 1 comments

  1. Added a custom onCorruption handler. Most of the code is from Android's DefaultDatabaseErrorHandler, I just added a call to Diagnostic logger to log an error with the current stack trace
  2. I tried to do something fancy where I add a callback function to the corruption handler so it can also try to re-insert the metadata in the onCorruption method, but AFAIK you can't open a new database instance from inside the DatabaseErrorHandler class
  3. Added some more metrics to the diagnostics logger (free / total / available heap, and free disk space)
  4. Also added SDK + version to the diagnostic events

Unfortunately was not able to trigger the onCorruption handler in any of the unit tests. For some reason the corrupted files trigger a SqliteException: Cannot prepare statement, base error code: 26, instead of SQLiteDatabaseCorruptException which triggers the onCorruption path

djih avatar Jan 16 '19 00:01 djih

Could delegate to instance of default error handler. PTAL @curtisliu

djih avatar Jan 18 '19 00:01 djih