Caching last predictions and loading it with model

Adding support for persisting itemInfos on disk. This uses
a separate xml file. Unlike prefs, it does not keep the items
in memory and is just a wraper over reading/writing a file.

Bug: 160748731
Change-Id: Iaccab9928ab8f30127fb3c2d630ca8ca83f0bd05
This commit is contained in:
Sunny Goyal
2020-07-29 15:03:46 -07:00
parent d62e797d18
commit 762d06136c
13 changed files with 393 additions and 101 deletions

View File

@@ -18,13 +18,17 @@ package com.android.launcher3.model;
import static com.android.launcher3.util.PackageManagerHelper.hasShortcutsPermission;
import android.content.Context;
import android.content.pm.ShortcutInfo;
import androidx.annotation.WorkerThread;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.util.ResourceBasedOverride;
import java.util.Map;
/**
* Class to extend LauncherModel functionality to provide extra data
*/
@@ -65,11 +69,12 @@ public class ModelDelegate implements ResourceBasedOverride {
* Load delegate items if any in the data model
*/
@WorkerThread
public void loadItems() { }
public void loadItems(UserManagerState ums, Map<ShortcutKey, ShortcutInfo> pinnedShortcuts) { }
/**
* Called when the delegate is no loner needed
*/
@WorkerThread
public void destroy() { }
}