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 /core/java/android/accounts | |
parent | 00453e7a0182b50cf01e65c97650b526284fe084 (diff) | |
download | frameworks_base-61f57379ca2c5b6290c8da7548fa17128f7ab24f.zip frameworks_base-61f57379ca2c5b6290c8da7548fa17128f7ab24f.tar.gz frameworks_base-61f57379ca2c5b6290c8da7548fa17128f7ab24f.tar.bz2 |
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 'core/java/android/accounts')
-rw-r--r-- | core/java/android/accounts/AccountManagerService.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java index 7a9f285..a075bd7 100644 --- a/core/java/android/accounts/AccountManagerService.java +++ b/core/java/android/accounts/AccountManagerService.java @@ -1879,7 +1879,7 @@ public class AccountManagerService private static String getDatabaseName(int userId) { File systemDir = Environment.getSystemSecureDirectory(); - File databaseFile = new File(systemDir, "users/" + userId + "/" + DATABASE_NAME); + File databaseFile = new File(Environment.getUserSystemDirectory(userId), DATABASE_NAME); if (userId == 0) { // Migrate old file, if it exists, to the new location. // Make sure the new file doesn't already exist. A dummy file could have been @@ -1888,7 +1888,7 @@ public class AccountManagerService File oldFile = new File(systemDir, DATABASE_NAME); if (oldFile.exists() && !databaseFile.exists()) { // Check for use directory; create if it doesn't exist, else renameTo will fail - File userDir = new File(systemDir, "users/" + userId); + File userDir = Environment.getUserSystemDirectory(userId); if (!userDir.exists()) { if (!userDir.mkdirs()) { throw new IllegalStateException("User dir cannot be created: " + userDir); |