Skip to content

Commit d72ad2a

Browse files
Amith YamasaniAndroid (Google) Code Review
authored andcommitted
Merge "Fix a bug in appwidget migration to multiuser directory." into jb-dev
2 parents dd8412d + e0eb39b commit d72ad2a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

services/java/com/android/server/AppWidgetServiceImpl.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,15 +1595,15 @@ static File getSettingsFile(int userId) {
15951595
AtomicFile savedStateFile() {
15961596
File dir = new File("/data/system/users/" + mUserId);
15971597
File settingsFile = getSettingsFile(mUserId);
1598-
if (!dir.exists()) {
1599-
dir.mkdirs();
1600-
if (mUserId == 0) {
1601-
// Migrate old data
1602-
File oldFile = new File("/data/system/" + SETTINGS_FILENAME);
1603-
// Method doesn't throw an exception on failure. Ignore any errors
1604-
// in moving the file (like non-existence)
1605-
oldFile.renameTo(settingsFile);
1606-
}
1598+
if (!settingsFile.exists() && mUserId == 0) {
1599+
if (!dir.exists()) {
1600+
dir.mkdirs();
1601+
}
1602+
// Migrate old data
1603+
File oldFile = new File("/data/system/" + SETTINGS_FILENAME);
1604+
// Method doesn't throw an exception on failure. Ignore any errors
1605+
// in moving the file (like non-existence)
1606+
oldFile.renameTo(settingsFile);
16071607
}
16081608
return new AtomicFile(settingsFile);
16091609
}

0 commit comments

Comments
 (0)