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

Commit 265c183e authored by Winson Chung's avatar Winson Chung Committed by android-build-merger
Browse files

Merge "Fix issue with deferred start of the background loader." into oc-dev am: 13bd6342

am: 8d7692c8

Change-Id: I7dc950c411efbd8e6c7fd6f2d3031ebd80d8ac72
parents e2c7dddd 8d7692c8
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ class BackgroundTaskLoader implements Runnable {
    Bitmap mDefaultThumbnail;
    BitmapDrawable mDefaultIcon;

    boolean mStarted;
    boolean mCancelled;
    boolean mWaitingOnLoadQueue;

@@ -122,18 +123,23 @@ class BackgroundTaskLoader implements Runnable {
                android.os.Process.THREAD_PRIORITY_BACKGROUND);
        mLoadThread.start();
        mLoadThreadHandler = new Handler(mLoadThread.getLooper());
        mLoadThreadHandler.post(this);
    }

    /** Restarts the loader thread */
    void start(Context context) {
        mContext = context;
        mCancelled = false;
        // Notify the load thread to start loading
        if (!mStarted) {
            // Start loading on the load thread
            mStarted = true;
            mLoadThreadHandler.post(this);
        } else {
            // Notify the load thread to start loading again
            synchronized (mLoadThread) {
                mLoadThread.notifyAll();
            }
        }
    }

    /** Requests the loader thread to stop after the current iteration */
    void stop() {