Add config to enable snapshot preloading

Enable preloading if config_enableTaskSnapshotPreloading instead of
assuming it should be off for all low ram devices. This allows it to be
configured via an overlay.

Test: TaskSnapshotCacheTest
Test: TaskSnapshotControllerTest
Test: TaskSnapshotPersisterLoaderTest
Test: TaskSnapshotSurfaceTest
Bug: 148099851
Change-Id: I9e3320dcff5b710e110cc7199c41c5a004991592
This commit is contained in:
Peter Kalauskas
2020-02-18 16:20:27 -08:00
parent 98e484548c
commit ae11790d31
2 changed files with 6 additions and 1 deletions
@@ -43,6 +43,7 @@ public class TaskThumbnailCache {
private final int mCacheSize;
private final TaskKeyLruCache<ThumbnailData> mCache;
private final HighResLoadingState mHighResLoadingState;
private final boolean mEnableTaskSnapshotPreloading;
public static class HighResLoadingState {
private boolean mIsLowRamDevice;
@@ -100,6 +101,7 @@ public class TaskThumbnailCache {
Resources res = context.getResources();
mCacheSize = res.getInteger(R.integer.recentsThumbnailCacheSize);
mEnableTaskSnapshotPreloading = res.getBoolean(R.bool.config_enableTaskSnapshotPreloading);
mCache = new TaskKeyLruCache<>(mCacheSize);
}
@@ -212,7 +214,7 @@ public class TaskThumbnailCache {
* @return Whether to enable background preloading of task thumbnails.
*/
public boolean isPreloadingEnabled() {
return !mHighResLoadingState.mIsLowRamDevice && mHighResLoadingState.mVisible;
return mEnableTaskSnapshotPreloading && mHighResLoadingState.mVisible;
}
public static abstract class ThumbnailLoadRequest extends HandlerRunnable {
+3
View File
@@ -117,6 +117,9 @@
<!-- Recents -->
<item type="id" name="overview_panel"/>
<!-- Whether to enable background preloading of task thumbnails. -->
<bool name="config_enableTaskSnapshotPreloading">true</bool>
<!-- Configuration resources -->
<array name="dynamic_resources"> </array>
</resources>