Merge "Add logs for PackageUpdatedTask" into udc-dev

This commit is contained in:
Vinit Nayak
2023-04-26 23:05:42 +00:00
committed by Android (Google) Code Review
3 changed files with 18 additions and 2 deletions

View File

@@ -151,7 +151,12 @@ public abstract class BaseModelUpdateTask implements ModelUpdateTask {
}
public void bindApplicationsIfNeeded() {
if (mAllAppsList.getAndResetChangeFlag()) {
boolean changeFlag = mAllAppsList.getAndResetChangeFlag();
if (TestProtocol.sDebugTracing) {
Log.d(WORK_TAB_MISSING, "bindApplicationsIfNeeded changeFlag? " +
changeFlag);
}
if (changeFlag) {
AppInfo[] apps = mAllAppsList.copyData();
int flags = mAllAppsList.getFlags();
scheduleCallbackTask(c -> c.bindAllApplications(apps, flags));

View File

@@ -44,6 +44,7 @@ import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.pm.PackageInstallInfo;
import com.android.launcher3.pm.UserCache;
import com.android.launcher3.shortcuts.ShortcutRequest;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.FlagOp;
import com.android.launcher3.util.IntSet;
import com.android.launcher3.util.ItemInfoMatcher;
@@ -67,7 +68,7 @@ import java.util.stream.Collectors;
*/
public class PackageUpdatedTask extends BaseModelUpdateTask {
private static final boolean DEBUG = false;
private static boolean DEBUG = false;
private static final String TAG = "PackageUpdatedTask";
public static final int OP_NONE = 0;
@@ -92,6 +93,11 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
mOp = op;
mUser = user;
mPackages = packages;
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.WORK_TAB_MISSING, "PackageUpdatedTask mOp: " + mOp +
" packageCount: " + mPackages.length);
DEBUG = true;
}
}
@Override
@@ -136,6 +142,9 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
// The update may have changed which shortcuts/widgets are available.
// Refresh the widgets for the package if we have an activity running.
Launcher launcher = Launcher.ACTIVITY_TRACKER.getCreatedActivity();
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.WORK_TAB_MISSING, "launcher: " + launcher);
}
if (launcher != null) {
launcher.refreshAndBindWidgetsForPackageUser(
new PackageUserKey(packages[i], mUser));

View File

@@ -105,6 +105,8 @@ public class WorkProfileTest extends AbstractLauncherUiTest {
}
private void waitForWorkTabSetup() {
// Added for b/243688989 flake to determine if we really are in allApps or not at this point
mLauncher.getAllApps();
waitForLauncherCondition("Work tab not setup", launcher -> {
if (launcher.getAppsView().getContentView() instanceof AllAppsPagedView) {
Log.d(WORK_TAB_MISSING, "Deferring AppsStore updates");