From e0eb39b54812b9403496f0d300395eee73ffa57a Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Tue, 1 May 2012 13:48:48 -0700 Subject: [PATCH] Fix a bug in appwidget migration to multiuser directory. Bug: 6393606 Migrate the old appwidgets.xml if the file doesn't exist, not if the directory doesn't exist. It worked earlier because this was the first service that I migrated to multi-user :( Change-Id: I59bcbc31ff9d101e44dff5e5f44b3cab8f08dc06 --- .../com/android/server/AppWidgetServiceImpl.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/services/java/com/android/server/AppWidgetServiceImpl.java b/services/java/com/android/server/AppWidgetServiceImpl.java index a0b8c531afa84..36f154ae4cb1b 100644 --- a/services/java/com/android/server/AppWidgetServiceImpl.java +++ b/services/java/com/android/server/AppWidgetServiceImpl.java @@ -1595,15 +1595,15 @@ class AppWidgetServiceImpl { AtomicFile savedStateFile() { File dir = new File("/data/system/users/" + mUserId); File settingsFile = getSettingsFile(mUserId); - if (!dir.exists()) { - dir.mkdirs(); - if (mUserId == 0) { - // Migrate old data - File oldFile = new File("/data/system/" + SETTINGS_FILENAME); - // Method doesn't throw an exception on failure. Ignore any errors - // in moving the file (like non-existence) - oldFile.renameTo(settingsFile); + if (!settingsFile.exists() && mUserId == 0) { + if (!dir.exists()) { + dir.mkdirs(); } + // Migrate old data + File oldFile = new File("/data/system/" + SETTINGS_FILENAME); + // Method doesn't throw an exception on failure. Ignore any errors + // in moving the file (like non-existence) + oldFile.renameTo(settingsFile); } return new AtomicFile(settingsFile); }