Merging task icon cache with content description cache
> Removing activity info cache as icon and description are loaded at the same time > Invalidating icon if task cache is old Bug: 38268585 Bug: 138944598 Change-Id: I28ae61a089556198534d48fcdb3aae6109748dff
This commit is contained in:
1 parent
efefa59f8c
commit
9f975ed089
6 files changed
+110
-205
No files matched your search
@@ -25,11 +25,9 @@ import android.annotation.TargetApi;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.ComponentCallbacks2;
|
||||
import android.content.Context;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.os.Build;
|
||||
import android.os.Looper;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
|
||||
import com.android.launcher3.util.MainThreadInitializedObject;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
@@ -48,8 +46,6 @@ import java.util.function.Consumer;
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
public class RecentsModel extends TaskStackChangeListener {
|
||||
|
||||
private static final String TAG = "RecentsModel";
|
||||
|
||||
// We do not need any synchronization for this variable as its only written on UI thread.
|
||||
public static final MainThreadInitializedObject<RecentsModel> INSTANCE =
|
||||
new MainThreadInitializedObject<>(RecentsModel::new);
|
||||
@@ -70,7 +66,6 @@ public class RecentsModel extends TaskStackChangeListener {
|
||||
mIconCache = new TaskIconCache(context, looper);
|
||||
mThumbnailCache = new TaskThumbnailCache(context, looper);
|
||||
ActivityManagerWrapper.getInstance().registerTaskStackListener(this);
|
||||
setupPackageListener();
|
||||
}
|
||||
|
||||
public TaskIconCache getIconCache() {
|
||||
@@ -183,35 +178,6 @@ public class RecentsModel extends TaskStackChangeListener {
|
||||
}
|
||||
}
|
||||
|
||||
public void onOverviewShown(boolean fromHome, String tag) {
|
||||
SystemUiProxy.INSTANCE.get(mContext).onOverviewShown(fromHome, tag);
|
||||
}
|
||||
|
||||
private void setupPackageListener() {
|
||||
mContext.getSystemService(LauncherApps.class).registerCallback(new LauncherApps.Callback() {
|
||||
@Override
|
||||
public void onPackageRemoved(String packageName, UserHandle user) {
|
||||
mIconCache.invalidatePackage(packageName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPackageChanged(String packageName, UserHandle user) {
|
||||
mIconCache.invalidatePackage(packageName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPackageAdded(String packageName, UserHandle user) { }
|
||||
|
||||
@Override
|
||||
public void onPackagesAvailable(
|
||||
String[] packageNames, UserHandle user, boolean replacing) { }
|
||||
|
||||
@Override
|
||||
public void onPackagesUnavailable(
|
||||
String[] packageNames, UserHandle user, boolean replacing) { }
|
||||
});
|
||||
}
|
||||
|
||||
public void addThumbnailChangeListener(TaskThumbnailChangeListener listener) {
|
||||
mThumbnailChangeListeners.add(listener);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user