Switch to new protocol for hybrid hotseat

- create predictor from items in bgModel instead of scanning views
- Launcher no longer checks for duplicates before sending pin/unpin events
- sending cached items from last prediction to reduce UI shuffle
- Switch to using UserCache to persist and read ComponentKey

Bug: 148814143
Bug: 156413231
Bug: 156200931
Change-Id: Ide6330bed8eb7f0c6fbec1d1ac21e7f67a9b2be2
This commit is contained in:
Samuel Fufa committed 2020-05-14 17:27:34 -07:00
1 parent bdd6522661
commit d12d6ab98a
9 files changed
+292 -254

No files matched your search

@@ -45,6 +45,8 @@ import android.util.LongSparseArray;
import android.util.MutableInt;
import android.util.TimingLogger;
import androidx.annotation.WorkerThread;
import com.android.launcher3.InstallShortcutReceiver;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
@@ -850,12 +852,11 @@ public class LoaderTask implements Runnable {
}
}
private List<AppInfo> loadCachedPredictions() {
@WorkerThread
private void loadCachedPredictions() {
synchronized (mBgDataModel) {
List<ComponentKey> componentKeys =
mApp.getPredictionModel().getPredictionComponentKeys();
List<AppInfo> results = new ArrayList<>();
if (componentKeys == null) return results;
List<LauncherActivityInfo> l;
mBgDataModel.cachedPredictedItems.clear();
for (ComponentKey key : componentKeys) {
@@ -866,7 +867,6 @@ public class LoaderTask implements Runnable {
mBgDataModel.cachedPredictedItems.add(info);
mIconCache.getTitleAndIcon(info, false);
}
return results;
}
}