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

Commit da61f371 authored by Winson Chung's avatar Winson Chung Committed by Android Git Automerger
Browse files

am 5a53891d: am 3565b6f0: am f95a9fe5: Merge "Fixing high cpu usage due to...

am 5a53891d: am 3565b6f0: am f95a9fe5: Merge "Fixing high cpu usage due to case not falling through to wait logic. (Bug 18390735)" into lmp-mr1-dev

* commit '5a53891d':
  Fixing high cpu usage due to case not falling through to wait logic. (Bug 18390735)
parents 292f3ad9 5a53891d
Loading
Loading
Loading
Loading
+50 −50
Original line number Original line Diff line number Diff line
@@ -170,10 +170,9 @@ class TaskResourceLoader implements Runnable {
            } else {
            } else {
                RecentsConfiguration config = RecentsConfiguration.getInstance();
                RecentsConfiguration config = RecentsConfiguration.getInstance();
                SystemServicesProxy ssp = mSystemServicesProxy;
                SystemServicesProxy ssp = mSystemServicesProxy;
                // If we've stopped the loader, then fall thorugh to the above logic to wait on
                // If we've stopped the loader, then fall through to the above logic to wait on
                // the load thread
                // the load thread
                if (ssp == null) continue;
                if (ssp != null) {

                    // Load the next item from the queue
                    // Load the next item from the queue
                    final Task t = mLoadQueue.nextTask();
                    final Task t = mLoadQueue.nextTask();
                    if (t != null) {
                    if (t != null) {
@@ -186,8 +185,8 @@ class TaskResourceLoader implements Runnable {
                                    mContext.getResources());
                                    mContext.getResources());


                            if (cachedIcon == null) {
                            if (cachedIcon == null) {
                            ActivityInfo info = ssp.getActivityInfo(t.key.baseIntent.getComponent(),
                                ActivityInfo info = ssp.getActivityInfo(
                                    t.key.userId);
                                        t.key.baseIntent.getComponent(), t.key.userId);
                                if (info != null) {
                                if (info != null) {
                                    if (DEBUG) Log.d(TAG, "Loading icon: " + t.key);
                                    if (DEBUG) Log.d(TAG, "Loading icon: " + t.key);
                                    cachedIcon = ssp.getActivityIcon(info, t.key.userId);
                                    cachedIcon = ssp.getActivityIcon(info, t.key.userId);
@@ -198,8 +197,8 @@ class TaskResourceLoader implements Runnable {
                                cachedIcon = mDefaultApplicationIcon;
                                cachedIcon = mDefaultApplicationIcon;
                            }
                            }


                        // At this point, even if we can't load the icon, we will set the default
                            // At this point, even if we can't load the icon, we will set the
                        // icon.
                            // default icon.
                            mApplicationIconCache.put(t.key, cachedIcon);
                            mApplicationIconCache.put(t.key, cachedIcon);
                        }
                        }
                        // Load the thumbnail if it is stale or we haven't cached one yet
                        // Load the thumbnail if it is stale or we haven't cached one yet
@@ -212,8 +211,8 @@ class TaskResourceLoader implements Runnable {
                                cachedThumbnail = mDefaultThumbnail;
                                cachedThumbnail = mDefaultThumbnail;
                            }
                            }
                            // When svelte, we trim the memory to just the visible thumbnails when
                            // When svelte, we trim the memory to just the visible thumbnails when
                        // leaving, so don't thrash the cache as the user scrolls (just load them
                            // leaving, so don't thrash the cache as the user scrolls (just load
                        // from scratch each time)
                            // them from scratch each time)
                            if (config.svelteLevel < RecentsConfiguration.SVELTE_LIMIT_CACHE) {
                            if (config.svelteLevel < RecentsConfiguration.SVELTE_LIMIT_CACHE) {
                                mThumbnailCache.put(t.key, cachedThumbnail);
                                mThumbnailCache.put(t.key, cachedThumbnail);
                            }
                            }
@@ -231,6 +230,7 @@ class TaskResourceLoader implements Runnable {
                            });
                            });
                        }
                        }
                    }
                    }
                }


                // If there are no other items in the list, then just wait until something is added
                // If there are no other items in the list, then just wait until something is added
                if (!mCancelled && mLoadQueue.isEmpty()) {
                if (!mCancelled && mLoadQueue.isEmpty()) {