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

Commit aafba6db authored by Alex Buynytskyy's avatar Alex Buynytskyy
Browse files

Force save cached pages to file.

Bug: 253568736
Test: atest PackageManagerSettingsTests android.content.pm.cts.PackageManagerTest
Change-Id: I2d1c39f066fc40d3896f1e0c441bcb53ab2da70c
parent db87c407
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -2693,10 +2693,15 @@ public final class Settings implements Watchable, Snappable {
                    FileUtils.S_IRUSR | FileUtils.S_IWUSR | FileUtils.S_IRGRP | FileUtils.S_IWGRP,
                    FileUtils.S_IRUSR | FileUtils.S_IWUSR | FileUtils.S_IRGRP | FileUtils.S_IWGRP,
                    -1, -1);
                    -1, -1);


            try {
            try (FileInputStream in = new FileInputStream(mSettingsFilename);
                FileUtils.copy(mSettingsFilename, mSettingsReserveCopyFilename);
                 FileOutputStream out = new FileOutputStream(mSettingsReserveCopyFilename)) {
                FileUtils.copy(in, out);
                out.flush();
                FileUtils.sync(out);
            } catch (IOException e) {
            } catch (IOException e) {
                Slog.e(TAG, "Failed to backup settings", e);
                Slog.e(TAG,
                        "Failed to write reserve copy of settings: " + mSettingsReserveCopyFilename,
                        e);
            }
            }


            try {
            try {