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

Commit b1c26fab authored by Hung-ying Tyan's avatar Hung-ying Tyan
Browse files

Mark FileCache initialized after init really goes through.

Bug: 5988196
Change-Id: Ia826ce6a33c200a2cd09c21d7ef22f4dd161caa9
parent b79e7627
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -191,7 +191,6 @@ public class FileCache implements Closeable {

    private synchronized void initialize() {
        if (mInitialized) return;
        mInitialized = true;

        if (!mRootDir.isDirectory()) {
            mRootDir.mkdirs();
@@ -209,6 +208,10 @@ public class FileCache implements Closeable {
            cursor.close();
        }
        if (mTotalBytes > mCapacity) freeSomeSpaceIfNeed(MAX_DELETE_COUNT);

        // Mark initialized when everything above went through. If an exception was thrown,
        // initialize() will be retried later.
        mInitialized = true;
    }

    private void freeSomeSpaceIfNeed(int maxDeleteFileCount) {