Merge "Add logs for work tab missing" into udc-dev

This commit is contained in:
Vinit Nayak
2023-04-19 03:34:39 +00:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 0 deletions
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.model;
import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
import android.util.Log;
import androidx.annotation.NonNull;
@@ -30,6 +32,7 @@ import com.android.launcher3.model.BgDataModel.FixedContainerItems;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.widget.model.WidgetsListBaseEntry;
@@ -106,6 +109,10 @@ public abstract class BaseModelUpdateTask implements ModelUpdateTask {
List<WorkspaceItemInfo> workspaceUpdates = allUpdates.stream()
.filter(info -> info.id != ItemInfo.NO_ID)
.collect(Collectors.toList());
if (TestProtocol.sDebugTracing) {
Log.d(WORK_TAB_MISSING, "allUpdates: " + allUpdates.size() + ", workspaceUpdates "
+ workspaceUpdates.size());
}
if (!workspaceUpdates.isEmpty()) {
scheduleCallbackTask(c -> c.bindWorkspaceItemsChanged(workspaceUpdates));
}
@@ -16,10 +16,12 @@
package com.android.launcher3.model;
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER;
import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
import android.content.Context;
import android.content.pm.ShortcutInfo;
import android.os.UserHandle;
import android.util.Log;
import androidx.annotation.NonNull;
@@ -29,6 +31,7 @@ import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.shortcuts.ShortcutRequest;
import com.android.launcher3.shortcuts.ShortcutRequest.QueryResult;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.ItemInfoMatcher;
@@ -60,6 +63,10 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask {
if (mIsUserUnlocked) {
QueryResult shortcuts = new ShortcutRequest(context, mUser)
.query(ShortcutRequest.PINNED);
if (TestProtocol.sDebugTracing) {
Log.d(WORK_TAB_MISSING, "shortcutQuery success? "
+ shortcuts.wasSuccess());
}
if (shortcuts.wasSuccess()) {
for (ShortcutInfo shortcut : shortcuts) {
pinnedShortcuts.put(ShortcutKey.fromInfo(shortcut), shortcut);
@@ -82,6 +89,9 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask {
if (mIsUserUnlocked) {
ShortcutKey key = ShortcutKey.fromItemInfo(si);
ShortcutInfo shortcut = pinnedShortcuts.get(key);
if (TestProtocol.sDebugTracing) {
Log.d(WORK_TAB_MISSING, "shortcutInfo: " + shortcut);
}
// We couldn't verify the shortcut during loader. If its no longer available
// (probably due to clear data), delete the workspace item as well
if (shortcut == null) {