Open david-allison opened 1 week ago
Do we need to do anything here? This is what the user sees on Android 13 when this error is triggered:
I'd propose that we silence this exception if using the default path. Nothing further that we can do
EDIT: Code I used to trigger the exception
Index: AnkiDroid/src/main/java/com/ichi2/anki/preferences/DevOptionsFragment.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/preferences/DevOptionsFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/preferences/DevOptionsFragment.kt
--- a/AnkiDroid/src/main/java/com/ichi2/anki/preferences/DevOptionsFragment.kt (revision 6953d60532ee2762d29b06fd1d76e69203ad8455)
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/preferences/DevOptionsFragment.kt (date 1731426260433)
@@ -17,11 +17,13 @@
import android.content.Context
import androidx.appcompat.app.AlertDialog
+import androidx.core.content.edit
import androidx.preference.Preference
import androidx.preference.SwitchPreferenceCompat
+import com.ichi2.anki.AnkiDroidApp
import com.ichi2.anki.BuildConfig
+import com.ichi2.anki.CollectionHelper
import com.ichi2.anki.CollectionManager
-import com.ichi2.anki.CrashReportService
import com.ichi2.anki.R
import com.ichi2.anki.analytics.UsageAnalytics
import com.ichi2.anki.launchCatchingTask
@@ -63,12 +65,12 @@
}
// Make it possible to test crash reporting
requirePreference<Preference>(R.string.pref_trigger_crash_key).setOnPreferenceClickListener {
- // If we don't delete the limiter data, our test crash may not go through,
- // but we are triggering it very much on purpose, we want to see the crash in ACRA
- this.context?.let { c -> CrashReportService.deleteACRALimiterData(c) }
+ val prefs = AnkiDroidApp.sharedPrefs()
+ prefs.edit {
+ putString(CollectionHelper.PREF_COLLECTION_PATH, "/storage/emulated/0/AnkiDroid")
+ }
- Timber.w("Crash triggered on purpose from advanced preferences in debug mode")
- throw RuntimeException("This is a test crash")
+ false
}
// Make it possible to test analytics
requirePreference<Preference>(R.string.pref_analytics_debug_key).setOnPreferenceClickListener {
...is that the right basis text for the diff? seems like it's removing what we want in the trigger crash dev preference and adding in something totally unrelated?
The Exception occurs when:
play
install"/storage/emulated/0/AnkiDroid"
This is typically either after reinstalling, or after legacy permissions to the folder have been revoked by the Android system
The patch above quickly gets AnkiDroid into the same state and is what I used for testing
InitialActivity::getStartupFailureType
https://ankidroid.org/acra/app/1/bug/250465/report/e6b0ece8-4a72-451e-957e-97b9ff508b12