ImportExportWorker: Save logcat of latest operation #278
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.
(Please feel free to close this PR if you're not a fan of this approach or of this functionality in general.)
This updates the worker to spawn and kill logcat and the start and end of every operation. The output is written to sms-ie's external files directory (
/sdcard/Android/data/com.github.tmo1.sms_ie/files
), which is guaranteed to exist and be accessible using regular filesystem APIs. This is useful when an error is not easily reproducible and the user isn't able to get to their computer and grab a logcat via adb before the logs rotate.When an error occurs, the error dialog has a new button to open the directory containing the log file in the system file manager (DocumentsUI). DocumentsUI and USB access are the only two ways to access the external files directory in newer versions of Android. However, DocumentsUI is full featured enough that the user can share the log file or copy it elsewhere.
The downside of these logs compared to
adb logcat
is that they will only contain our own logs. Logs from other apps or other system components (eg. telephony provider) are excluded.