Skip to content

Scoped Storage: Dev Handbook

Arthur Milchior edited this page Apr 15, 2023 · 10 revisions

This document simply contains anything that may be relevant to any person working on the scoped-storage migration. Feel free to add anything that may ever be relevant.

Links

Manual testing

There are many way to test the migration process. Which one you use is a matter of personal preference.

Zipping

  • take a device
  • zip /sdcard/AnkiDroid
  • uninstall current AnkiDroid
  • install the 2.15 APK
  • unzip my backed up /sdcard/AnkiDroid, make sure it's working,
  • install the 2.16 APK

Script version

  • Enable allow_unsafe_migration in local.properties, by adding the line allow_unsafe_migration=true at the end of this file
  • install AnkiDroid on an AOSP emulator
  • executed tools/storage/set_scoped_storage.sh full to re-enable access to /AnkiDroid
  • Change the AnkiDroid Directory to /storage/emulated/0/AnkiDroid

ADB version

The following on a non-Play Store emulator* allows us to test the SDK 29 -> 30 jump:

adb shell am compat disable DEFAULT_SCOPED_STORAGE com.ichi2.anki.debug
adb shell am compat disable FORCE_ENABLE_SCOPED_STORAGE com.ichi2.anki.debug
adb shell pm grant com.ichi2.anki.debug android.permission.READ_EXTERNAL_STORAGE
adb shell pm grant com.ichi2.anki.debug android.permission.WRITE_EXTERNAL_STORAGE
  • Set allow_unsafe_migration in user.properties (disables the need for a logged in user before migration)
  • Setting the AnkiDroid Directory to ~/AnkiDroid prompts for migration
  • After a migration, changing the AnkiDroid Directory back to ~/AnkiDroid allows for another migration

Terminology

  • App Specific folder: The new location: /storage/emulated/0/Android/comi.ichi2.anki[.A/debug]/files/AnkiDroid
  • Root folder: The original location: /stroage/emulated/0/AnkiDroid
Clone this wiki locally