When a user grabs a new phone, and has an existing phone and wishes to migrate apps and data to the new phone. What exactly happens with the SharedPreferences/AndroidKeyStore/AndroidAccountManager?
IE, if the new device has say not the same app, would it copy over everything in SharedPreferences/Datastore?
What if the new phone already have the same app? If its say the same version does the data merge or replaces or the migration fails and the new phone keeps its data?
What if the version of the apps differ? Which version of the app is chosen to be on the new device?
Then, with AndroidAccountManager, my understanding is that one app is chosen to be the main app that is tied to that account type, and if you have multiple apps all using the same account it would still be tied to the first app on the device with that kind of account (assuming IIRC all the apps have the same signing key and is using the same account type).
What happens in the migration? Would it keep that app -> AccountManager link? Or would it be random and whichever app goes first is it?
Then about AndroidKeyStore, since its hardware backed, would that mean all keys are lost and gone? And that means that all process involving them would need a way to generate new keys and to ensure a migration plan works? Would there be any signal about this at all or would it be just the keys are gone and that is it?
By default, Auto Backup includes files in most of the directories that are assigned to your app by the system:
Shared preferences files.
Files saved to your app's internal storage, accessed by getFilesDir() or getDir(String, int).
Files in the directory returned by getDatabasePath(String), which also includes files created with the SQLiteOpenHelper class.
You can find more here : https://developer.android.com/guide/topics/data/autobackup#Files
for android keystoer, keys can never be backed up
for account manager : accounts on old device will be transfered to new device and you might not need to enter 2fa for these accounts.
notice that you are able to restore backup from old phone only at device setup, so you can't have apps installed before this step on your android phone but in case app exist such manfacture app, the app is not launched yet, so it won't have any files.