Log the reason why a WorkspaceItemInfo was removed

In the past we've seen a WorkspaceItem disappeared from the workspace
but wasn't able to determine why it was removed. This CL includes the
reason why it was removed in the error log, which hopefully would help
us debugging similar issues in the future.

Bug: 231239260
Test: make
Change-Id: Iba3d57568c9b3e011a6b65b26f0d4170d42fe1a5
This commit is contained in:
Pinyao Ting
2022-05-10 23:47:36 +00:00
parent 9c7551a9c9
commit 6a41d56b50
12 changed files with 67 additions and 31 deletions

View File

@@ -17,6 +17,8 @@ package com.android.launcher3.model;
import android.util.Log;
import androidx.annotation.Nullable;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherModel.CallbackTask;
@@ -128,8 +130,9 @@ public abstract class BaseModelUpdateTask implements ModelUpdateTask {
scheduleCallbackTask(c -> c.bindAllWidgets(widgets));
}
public void deleteAndBindComponentsRemoved(final Predicate<ItemInfo> matcher) {
getModelWriter().deleteItemsFromDatabase(matcher);
public void deleteAndBindComponentsRemoved(final Predicate<ItemInfo> matcher,
@Nullable final String reason) {
getModelWriter().deleteItemsFromDatabase(matcher, reason);
// Call the components-removed callback
scheduleCallbackTask(c -> c.bindWorkspaceComponentsRemoved(matcher));