Support wallpaper backup for non-system users
Wallpaper backup happens through a separate package 'com.android.wallpaperbackup' which shares the system uid. For the system user, WallpaperBackupAgent copies the wallpaper files from /data/system/users/0 and backs them up (explained more in the javadoc of WallpaperBackupAgent). However, for non-system users it will run in the non-system user's 'system' process and it doesn't have access to /data/system. As a workaround, this CL uses WallpaperManager APIs to access the files rather than directly reading them. I decided not to keep the old way of backing up for the system user in WallpaperBackupAgent. Instead all users use the APIs now. There is a small amount of risk with this approach since we change the mechanism for backups for the system user as well but the new approach is arguably more correct than reading system data directories directly. Also, I've refactored WallpaperBackupAgent's backup flow to be more readable. The functionality (and the ordering of logic) should be exactly the same as before, except for using the APIs instead of reading files directly. The restore side remains untouched. The backup bytes that are stored in the cloud or transferred by cable are exactly the same as before, so there shouldn't be any backwards compatibility issues. Bug: 259848850 Test: atest WallpaperBackupAgentTest.java atest WallpaperManagerServiceTests.java Manual testing by backing up and restoring static/live wallpaper between two devices. Change-Id: I9f825da4adc8f9dcd69abe6c99056df6e54cceb2
Loading
Please register or sign in to comment