diff options
author | Amith Yamasani <yamasani@google.com> | 2012-08-31 12:12:28 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2012-08-31 15:33:21 -0700 |
commit | 61f57379ca2c5b6290c8da7548fa17128f7ab24f (patch) | |
tree | 1aadc5b172ecf5689455e03e5ab635b709d5021f /services/java/com/android/server/SystemBackupAgent.java | |
parent | 00453e7a0182b50cf01e65c97650b526284fe084 (diff) |
Centralize the creation of the user system directory
Environment.getUserSystemDirectory(int userId)
Use it all relevant places that was hardcoding it.
Also, wipe out the user's system directory when user is removed, otherwise old state
might be transferred to a new user.
Change-Id: I788ce9c4cf9624229e65efa7047bc0c019ccef0a
Diffstat (limited to 'services/java/com/android/server/SystemBackupAgent.java')
-rw-r--r-- | services/java/com/android/server/SystemBackupAgent.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/services/java/com/android/server/SystemBackupAgent.java b/services/java/com/android/server/SystemBackupAgent.java index a7a583c918c7..8cf273dee8cc 100644 --- a/services/java/com/android/server/SystemBackupAgent.java +++ b/services/java/com/android/server/SystemBackupAgent.java @@ -24,8 +24,10 @@ import android.app.backup.FullBackup; import android.app.backup.FullBackupDataOutput; import android.app.backup.WallpaperBackupHelper; import android.content.Context; +import android.os.Environment; import android.os.ParcelFileDescriptor; import android.os.ServiceManager; +import android.os.UserHandle; import android.util.Slog; @@ -45,11 +47,13 @@ public class SystemBackupAgent extends BackupAgentHelper { private static final String WALLPAPER_INFO_FILENAME = "wallpaper_info.xml"; // TODO: Will need to change if backing up non-primary user's wallpaper - private static final String WALLPAPER_IMAGE_DIR = "/data/system/users/0"; + private static final String WALLPAPER_IMAGE_DIR = + Environment.getUserSystemDirectory(UserHandle.USER_OWNER).getAbsolutePath(); private static final String WALLPAPER_IMAGE = WallpaperBackupHelper.WALLPAPER_IMAGE; // TODO: Will need to change if backing up non-primary user's wallpaper - private static final String WALLPAPER_INFO_DIR = "/data/system/users/0"; + private static final String WALLPAPER_INFO_DIR = + Environment.getUserSystemDirectory(UserHandle.USER_OWNER).getAbsolutePath(); private static final String WALLPAPER_INFO = WallpaperBackupHelper.WALLPAPER_INFO; // Use old keys to keep legacy data compatibility and avoid writing two wallpapers private static final String WALLPAPER_IMAGE_KEY = WallpaperBackupHelper.WALLPAPER_IMAGE_KEY; |