summaryrefslogtreecommitdiffstats
path: root/core/java/android/accounts/AccountManagerService.java
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2012-04-11 16:06:03 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-11 16:06:03 -0700
commit856fbbedbb57da5620026d71a338744a2e875ec3 (patch)
tree1c7e6cc13d40298bcfb2f77980e21146a6e4bf1f /core/java/android/accounts/AccountManagerService.java
parentc2676102d269038234f7018090d70af0ba754e83 (diff)
parenta23bb38628ac1f5dc4ebe6847faedc424dd5fce1 (diff)
downloadframeworks_base-856fbbedbb57da5620026d71a338744a2e875ec3.zip
frameworks_base-856fbbedbb57da5620026d71a338744a2e875ec3.tar.gz
frameworks_base-856fbbedbb57da5620026d71a338744a2e875ec3.tar.bz2
Merge "Don't migrate accounts.db if already migrated."
Diffstat (limited to 'core/java/android/accounts/AccountManagerService.java')
-rw-r--r--core/java/android/accounts/AccountManagerService.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index 241fecb..2b643c2 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -1869,9 +1869,12 @@ public class AccountManagerService
File systemDir = Environment.getSystemSecureDirectory();
File databaseFile = new File(systemDir, "users/" + userId + "/" + DATABASE_NAME);
if (userId == 0) {
- // Migrate old file, if it exists, to the new location
+ // 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
+ // accidentally created in the old location, causing the new one to become corrupted
+ // as well.
File oldFile = new File(systemDir, DATABASE_NAME);
- if (oldFile.exists()) {
+ 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);
if (!userDir.exists()) {