Skip to content

Crash reports go into the Google cloud backup although the first run says they «остаётся на телефоне» #156

Closed

Description

@lumenpearson

What is broken.

The first-run confirmation screen promises that an error report never leaves the device unless the user sends it: «Если приложение поведёт себя странно, отчёт об ошибке поможет разобраться. Он остаётся на телефоне, пока вы сами его не отправите.» The switch that turns reports on sits directly under that sentence.

CrashReporter writes each report to getExternalFilesDir("crash_reports"). When external storage is unavailable it writes to filesDir/crash_reports instead. The app declares android:allowBackup="true", and Auto Backup includes getExternalFilesDir() (the external domain) and getFilesDir() by default.

The backup rules exclude only three things: database, sharedpref and file/datastore. They do this in backup_rules.xml and in both the <cloud-backup> and <device-transfer> sections of data_extraction_rules.xml. Nothing excludes the external domain or file/crash_reports. So every report on disk is uploaded to the user's Google Drive backup, and restored onto a new phone, without the user ever sending it.

Each report carries:

  • the device manufacturer, model and codename
  • the Android version
  • the stack trace
  • any note the user typed
  • the last 60 lines of the app's own activity log

The rules file's own header says «Nothing here is worth restoring onto a new device», so leaving the reports out of the excludes was an oversight, not a decision.

The failure scenario.

  1. On the first run, on the «Подтверждение» step, the user reads «Он остаётся на телефоне, пока вы сами его не отправите.» and sets «Отчёты об ошибках» to «Вкл».
  2. The app crashes, or the user writes a manual report. CrashReporter.write creates Android/data/<package>/files/crash_reports/crash_<stamp>_00.log.
  3. Google backup is on, as it is by default on most phones. The next Auto Backup pass runs overnight, idle and charging, and sends the app's full-backup set to the cloud. crash_reports/ is in the external domain and matches no <exclude>, so it is uploaded with the rest.
  4. The report now sits in the user's Google Drive backup, although the user never sent it. After a restore onto a new phone, or a device-to-device transfer (the <device-transfer> rules have the same gap), the old phone's reports reappear in the new install's crash_reports/. The settings in datastore are excluded, so on the new phone «Отчёты об ошибках» is off again, but the old reports are back anyway.

Where.

  • android/core/data/src/main/kotlin/com/lumenpearson/lessons/core/data/diagnostics/CrashReporter.kt:197: context.getExternalFilesDir(REPORTS_DIR) ?: File(context.filesDir, REPORTS_DIR), with REPORTS_DIR = "crash_reports" at line 68. The write happens at lines 231-232.
  • android/app/src/main/AndroidManifest.xml:41-44: allowBackup="true", with dataExtractionRules and fullBackupContent pointing at the two rules files.
  • android/app/src/main/res/xml/backup_rules.xml:10-14: excludes only database, sharedpref and file/datastore.
  • android/app/src/main/res/xml/data_extraction_rules.xml:4-8 (cloud-backup) and :9-13 (device-transfer): the same three excludes.
  • android/app/src/main/res/values/strings.xml:31 (onboarding_ack_footer), with its twin at values-en/strings.xml:35. It is shown at android/app/src/main/kotlin/com/lumenpearson/lessons/ui/onboarding/OnboardingScreen.kt:397, above the reports switch at 408-416.

Activity

  1. lumenpearson commented on Sep 26, 2026

    @lumenpearson
    OwnerAuthor

    Seen on an emulator (AVD Pixel_10_Pro_XL, API 37 (google_apis_playstore, x86_64, 1344×2992 at 480 dpi), 26–27 September 2026).

    1. A real crash (am crash) wrote crash_reports/crash_…_00.log.
    2. bmgr backupnow ran through the local transport, then the files were deleted and bmgr restore ran. A probe file in files/ and one in the external domain came back; the report did not.
    3. The same again with the transport flagged is_device_transfer=true: the same result.

    The Google transport was put back afterwards. Google's own transport to a real account has not been asked. BackupRulesTest's note says so, and this closes with #186.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions