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

Commit f83962d2 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 9692

* changes:
  Bootstrap the ever-backed-up bookkeeping properly
parents 6dabc956 dfec20b1
Loading
Loading
Loading
Loading
+32 −26
Original line number Diff line number Diff line
@@ -307,6 +307,9 @@ class BackupManagerService extends IBackupManager.Stub {
        mEverStored = new File(mBaseStateDir, "processed");
        File tempProcessedFile = new File(mBaseStateDir, "processed.new");
        try {
            // If there are previous contents, parse them out then start a new
            // file to continue the recordkeeping.
            if (mEverStored.exists()) {
                RandomAccessFile temp = new RandomAccessFile(tempProcessedFile, "rw");
                mEverStoredStream = new RandomAccessFile(mEverStored, "r");

@@ -336,7 +339,10 @@ class BackupManagerService extends IBackupManager.Stub {
                temp.close();
                mEverStoredStream.close();
                tempProcessedFile.renameTo(mEverStored);
            }
            // This will create the file if it doesn't exist
            mEverStoredStream = new RandomAccessFile(mEverStored, "rwd");
            mEverStoredStream.seek(mEverStoredStream.length());
        } catch (IOException e) {
            Log.e(TAG, "Unable to open known-stored file!");
            mEverStoredStream = null;