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

Commit 3fb40bd6 authored by Ray Chen's avatar Ray Chen Committed by Android (Google) Code Review
Browse files

Merge "Fix 6208468 21 ANR(s) in: com.google.android.gallery3d on crespo during...

Merge "Fix 6208468 21 ANR(s) in: com.google.android.gallery3d on crespo during monkey runs for JRM80 b:6208468"
parents 56f23ee0 6b677eb6
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ public class GalleryAppImpl extends Application implements GalleryApp {
    private static final long DOWNLOAD_CAPACITY = 64 * 1024 * 1024; // 64M

    private ImageCacheService mImageCacheService;
    private Object mLock = new Object();
    private DataManager mDataManager;
    private ThreadPool mThreadPool;
    private DownloadCache mDownloadCache;
@@ -60,12 +61,15 @@ public class GalleryAppImpl extends Application implements GalleryApp {
        return mDataManager;
    }

    public synchronized ImageCacheService getImageCacheService() {
    public ImageCacheService getImageCacheService() {
        // This method may block on file I/O so a dedicated lock is needed here.
        synchronized (mLock) {
            if (mImageCacheService == null) {
                mImageCacheService = new ImageCacheService(getAndroidContext());
            }
            return mImageCacheService;
        }
    }

    public synchronized ThreadPool getThreadPool() {
        if (mThreadPool == null) {