Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0eb39b5 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

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
parent 11dea294
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -1595,16 +1595,16 @@ class AppWidgetServiceImpl {
    AtomicFile savedStateFile() {
        File dir = new File("/data/system/users/" + mUserId);
        File settingsFile = getSettingsFile(mUserId);
        if (!settingsFile.exists() && mUserId == 0) {
            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);
        }
        }
        return new AtomicFile(settingsFile);
    }