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

Commit 87073654 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

resolve merge conflicts of 27ddeff7 to master.

Change-Id: I6dad081fc6dfafb78d5bd73d84e184bae7f6fd1b
parents e3aafb79 27ddeff7
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ import android.text.format.DateUtils;
import android.util.Log;

import com.android.documentsui.model.RootInfo;

import com.android.internal.annotations.GuardedBy;
import com.google.common.util.concurrent.AbstractFuture;

import libcore.io.IoUtils;
@@ -79,6 +79,7 @@ public class RecentLoader extends AsyncTaskLoader<DirectoryResult> {
    private final RootsCache mRoots;
    private final State mState;

    @GuardedBy("mTasks")
    private final HashMap<RootInfo, RecentTask> mTasks = new HashMap<>();

    private final int mSortOrder = State.SORT_ORDER_LAST_MODIFIED;
@@ -165,6 +166,12 @@ public class RecentLoader extends AsyncTaskLoader<DirectoryResult> {

    @Override
    public DirectoryResult loadInBackground() {
        synchronized (mTasks) {
            return loadInBackgroundLocked();
        }
    }

    private DirectoryResult loadInBackgroundLocked() {
        if (mFirstPassLatch == null) {
            // First time through we kick off all the recent tasks, and wait
            // around to see if everyone finishes quickly.
@@ -302,9 +309,11 @@ public class RecentLoader extends AsyncTaskLoader<DirectoryResult> {
        // Ensure the loader is stopped
        onStopLoading();

        synchronized (mTasks) {
            for (RecentTask task : mTasks.values()) {
                IoUtils.closeQuietly(task);
            }
        }

        IoUtils.closeQuietly(mResult);
        mResult = null;