Loading packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java +52 −44 Original line number Diff line number Diff line Loading @@ -161,6 +161,31 @@ class BackgroundTaskLoader implements Runnable { // If we've stopped the loader, then fall through to the above logic to wait on // the load thread if (ssp != null) { processLoadQueueItem(ssp); } // If there are no other items in the list, then just wait until something is added if (!mCancelled && mLoadQueue.isEmpty()) { synchronized(mLoadQueue) { try { mWaitingOnLoadQueue = true; mLoadQueue.wait(); mWaitingOnLoadQueue = false; } catch (InterruptedException ie) { ie.printStackTrace(); } } } } } } /** * This needs to be in a separate method to work around an surprising interpreter behavior: * The register will keep the local reference to cachedThumbnailData even if it falls out of * scope. Putting it into a method fixes this issue. */ private void processLoadQueueItem(SystemServicesProxy ssp) { // Load the next item from the queue final Task t = mLoadQueue.nextTask(); if (t != null) { Loading Loading @@ -190,7 +215,7 @@ class BackgroundTaskLoader implements Runnable { } if (DEBUG) Log.d(TAG, "Loading thumbnail: " + t.key); ThumbnailData cachedThumbnailData = ssp.getTaskThumbnail(t.key.id, final ThumbnailData cachedThumbnailData = ssp.getTaskThumbnail(t.key.id, true /* reducedResolution */); if (cachedThumbnailData.thumbnail == null) { Loading @@ -199,26 +224,9 @@ class BackgroundTaskLoader implements Runnable { if (!mCancelled) { // Notify that the task data has changed final Drawable newIcon = cachedIcon; final ThumbnailData newThumbnailData = cachedThumbnailData; final Drawable finalIcon = cachedIcon; mMainThreadHandler.post( () -> t.notifyTaskDataLoaded(newThumbnailData, newIcon)); } } } // If there are no other items in the list, then just wait until something is added if (!mCancelled && mLoadQueue.isEmpty()) { synchronized(mLoadQueue) { try { mWaitingOnLoadQueue = true; mLoadQueue.wait(); mWaitingOnLoadQueue = false; } catch (InterruptedException ie) { ie.printStackTrace(); } } } () -> t.notifyTaskDataLoaded(cachedThumbnailData, finalIcon)); } } } Loading Loading
packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java +52 −44 Original line number Diff line number Diff line Loading @@ -161,6 +161,31 @@ class BackgroundTaskLoader implements Runnable { // If we've stopped the loader, then fall through to the above logic to wait on // the load thread if (ssp != null) { processLoadQueueItem(ssp); } // If there are no other items in the list, then just wait until something is added if (!mCancelled && mLoadQueue.isEmpty()) { synchronized(mLoadQueue) { try { mWaitingOnLoadQueue = true; mLoadQueue.wait(); mWaitingOnLoadQueue = false; } catch (InterruptedException ie) { ie.printStackTrace(); } } } } } } /** * This needs to be in a separate method to work around an surprising interpreter behavior: * The register will keep the local reference to cachedThumbnailData even if it falls out of * scope. Putting it into a method fixes this issue. */ private void processLoadQueueItem(SystemServicesProxy ssp) { // Load the next item from the queue final Task t = mLoadQueue.nextTask(); if (t != null) { Loading Loading @@ -190,7 +215,7 @@ class BackgroundTaskLoader implements Runnable { } if (DEBUG) Log.d(TAG, "Loading thumbnail: " + t.key); ThumbnailData cachedThumbnailData = ssp.getTaskThumbnail(t.key.id, final ThumbnailData cachedThumbnailData = ssp.getTaskThumbnail(t.key.id, true /* reducedResolution */); if (cachedThumbnailData.thumbnail == null) { Loading @@ -199,26 +224,9 @@ class BackgroundTaskLoader implements Runnable { if (!mCancelled) { // Notify that the task data has changed final Drawable newIcon = cachedIcon; final ThumbnailData newThumbnailData = cachedThumbnailData; final Drawable finalIcon = cachedIcon; mMainThreadHandler.post( () -> t.notifyTaskDataLoaded(newThumbnailData, newIcon)); } } } // If there are no other items in the list, then just wait until something is added if (!mCancelled && mLoadQueue.isEmpty()) { synchronized(mLoadQueue) { try { mWaitingOnLoadQueue = true; mLoadQueue.wait(); mWaitingOnLoadQueue = false; } catch (InterruptedException ie) { ie.printStackTrace(); } } } () -> t.notifyTaskDataLoaded(cachedThumbnailData, finalIcon)); } } } Loading