Fixing Launcher preview leaking surface and memory

> Closing existing preview if a new request comes for same host token
> Closing in-memory icon db when closing preview
> Removing unnecessary wait blocks on UI thread and rendering
  view asynchronously
> Fixing preview loading failing on LauncherAppState access

Bug: 186712316
Bug: 187140897
Test: Manual
Change-Id: I045930b007e5dc015320224a197eee20a8354d17
This commit is contained in:
Sunny Goyal
2021-05-19 19:42:14 -07:00
parent fea72152fd
commit df4241ca4e
6 changed files with 255 additions and 271 deletions

View File

@@ -15,6 +15,8 @@
*/
package com.android.launcher3.model;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
import android.content.Context;
import android.util.Log;
@@ -52,8 +54,14 @@ public class ModelPreload implements ModelUpdateTask {
public final void run() {
mModel.startLoaderForResultsIfNotLoaded(
new LoaderResults(mApp, mBgDataModel, mAllAppsList, new Callbacks[0]));
Log.d(TAG, "Preload completed : " + mModel.isModelLoaded());
onComplete(mModel.isModelLoaded());
MODEL_EXECUTOR.post(() -> {
Log.d(TAG, "Preload completed : " + mModel.isModelLoaded());
onComplete(mModel.isModelLoaded());
});
}
public BgDataModel getBgDataModel() {
return mBgDataModel;
}
/**