Disable shared preferences data from being automatically backed up in google cloud
Summary: From Android API 23 and so on data that application writes to shared preferences are backed up in google cloud if not deleted prior to application being uninstalled. We do not want this behaviour since we are about to deliver backup service for that purpose.
Test Plan:
Temporarily add a line that logs encryption key in SQLiteQueryExecutor::initialize(). Ensure in Android log cat that encryption key changes with every application re-install.
Independently execute the following steps:
- Change allowBackup to true. Install the app.
- In Android studio check Device File Explorer for the file: data/data/app.comm.android/shared_prefs/SecureStore.xml. Save the content under "comm.encryptionKey" identifier. Kill the app
- Execute the following instructions: https://developer.android.com/guide/topics/data/testingbackup apart from "Test restore" section.
- Uninstall the app. Install it again.
- Repeat step 2. Ensure contents are exactly the same.
- Uninstall the app. Revert allowBackup to false. Install the app.
- Repeat step 2. Ensure contents differ.
- Try to complete step 3. Ensure that command adb shell bmgr backupnow app.comm.android now fails.
Steps and outputs above prove that allowBackup=true enables us to restore secrets after applications is uninstalled which is undesirable. It also proves that allowBackup=false disables this possibility. Therefore setting allowBackup=false is a necessary step that is a subject of this differential.
Reviewers: tomek, atul, ashoat
Reviewed By: tomek, ashoat
Subscribers: ashoat, adrian, abosh
Differential Revision: https://phab.comm.dev/D4663