Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80bb8a12 authored by vadimt's avatar vadimt
Browse files

Adding tracing for workspace loading that never finishes

Test: presubmit
Bug: 267200150
Flag: N/A
Change-Id: I6cfe6be101412e9d8d9498fc06c70d1d14561441
parent 883871e2
Loading
Loading
Loading
Loading
+26 −0
Original line number Original line Diff line number Diff line
@@ -34,6 +34,7 @@ import com.android.launcher3.model.BgDataModel.FixedContainerItems;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.IntSet;
import com.android.launcher3.util.IntSet;
import com.android.launcher3.util.LooperExecutor;
import com.android.launcher3.util.LooperExecutor;
@@ -267,18 +268,33 @@ public abstract class BaseLauncherBinder {
            sortWorkspaceItemsSpatially(idp, currentWorkspaceItems);
            sortWorkspaceItemsSpatially(idp, currentWorkspaceItems);
            sortWorkspaceItemsSpatially(idp, otherWorkspaceItems);
            sortWorkspaceItemsSpatially(idp, otherWorkspaceItems);


            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "Before posting startBinding");
            }
            // Tell the workspace that we're about to start binding items
            // Tell the workspace that we're about to start binding items
            executeCallbacksTask(c -> {
            executeCallbacksTask(c -> {
                c.clearPendingBinds();
                c.clearPendingBinds();
                c.startBinding();
                c.startBinding();
            }, mUiExecutor);
            }, mUiExecutor);


            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "1");
            }
            // Bind workspace screens
            // Bind workspace screens
            executeCallbacksTask(c -> c.bindScreens(mOrderedScreenIds), mUiExecutor);
            executeCallbacksTask(c -> c.bindScreens(mOrderedScreenIds), mUiExecutor);


            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "2");
            }
            // Load items on the current page.
            // Load items on the current page.
            bindWorkspaceItems(currentWorkspaceItems, mUiExecutor);
            bindWorkspaceItems(currentWorkspaceItems, mUiExecutor);
            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "3");
            }
            bindAppWidgets(currentAppWidgets, mUiExecutor);
            bindAppWidgets(currentAppWidgets, mUiExecutor);
            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "4");
            }
            if (!FeatureFlags.CHANGE_MODEL_DELEGATE_LOADING_ORDER.get()) {
            if (!FeatureFlags.CHANGE_MODEL_DELEGATE_LOADING_ORDER.get()) {
                mExtraItems.forEach(item ->
                mExtraItems.forEach(item ->
                        executeCallbacksTask(c -> c.bindExtraContainerItems(item), mUiExecutor));
                        executeCallbacksTask(c -> c.bindExtraContainerItems(item), mUiExecutor));
@@ -287,8 +303,18 @@ public abstract class BaseLauncherBinder {
            RunnableList pendingTasks = new RunnableList();
            RunnableList pendingTasks = new RunnableList();
            Executor pendingExecutor = pendingTasks::add;
            Executor pendingExecutor = pendingTasks::add;
            bindWorkspaceItems(otherWorkspaceItems, pendingExecutor);
            bindWorkspaceItems(otherWorkspaceItems, pendingExecutor);

            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "5");
            }
            bindAppWidgets(otherAppWidgets, pendingExecutor);
            bindAppWidgets(otherAppWidgets, pendingExecutor);
            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "6");
            }
            executeCallbacksTask(c -> c.finishBindingItems(currentScreenIds), pendingExecutor);
            executeCallbacksTask(c -> c.finishBindingItems(currentScreenIds), pendingExecutor);
            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "After posting finishBindingItems");
            }
            pendingExecutor.execute(
            pendingExecutor.execute(
                    () -> {
                    () -> {
                        MODEL_EXECUTOR.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT);
                        MODEL_EXECUTOR.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT);
+1 −0
Original line number Original line Diff line number Diff line
@@ -155,6 +155,7 @@ public final class TestProtocol {
    public static final String VIEW_AND_ACTIVITY_LEAKS = "b/260260325";
    public static final String VIEW_AND_ACTIVITY_LEAKS = "b/260260325";
    public static final String WORK_TAB_MISSING = "b/243688989";
    public static final String WORK_TAB_MISSING = "b/243688989";
    public static final String TWO_TASKBAR_LONG_CLICKS = "b/262282528";
    public static final String TWO_TASKBAR_LONG_CLICKS = "b/262282528";
    public static final String WORKSPACE_LOADS_FOREVER = "b/267200150";


    public static final String REQUEST_EMULATE_DISPLAY = "emulate-display";
    public static final String REQUEST_EMULATE_DISPLAY = "emulate-display";
    public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display";
    public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display";
+4 −0
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.celllayout.testcases.MultipleCellLayoutsSimpleReorder;
import com.android.launcher3.celllayout.testcases.MultipleCellLayoutsSimpleReorder;
import com.android.launcher3.tapl.Widget;
import com.android.launcher3.tapl.Widget;
import com.android.launcher3.tapl.WidgetResizeFrame;
import com.android.launcher3.tapl.WidgetResizeFrame;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.ui.TaplTestsLauncher3;
import com.android.launcher3.ui.TaplTestsLauncher3;
import com.android.launcher3.util.rule.ShellCommandRule;
import com.android.launcher3.util.rule.ShellCommandRule;
@@ -114,8 +115,11 @@ public class ReorderWidgets extends AbstractLauncherUiTest {
        // resetLoaderState triggers the launcher to start loading the workspace which allows
        // resetLoaderState triggers the launcher to start loading the workspace which allows
        // waitForLauncherCondition to wait for that condition, otherwise the condition would
        // waitForLauncherCondition to wait for that condition, otherwise the condition would
        // always be true and it wouldn't wait for the changes to be applied.
        // always be true and it wouldn't wait for the changes to be applied.
        Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "before resetLoaderState");
        resetLoaderState();
        resetLoaderState();
        Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "after resetLoaderState");
        waitForLauncherCondition("Workspace didn't finish loading", l -> !l.isWorkspaceLoading());
        waitForLauncherCondition("Workspace didn't finish loading", l -> !l.isWorkspaceLoading());
        Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "after waitForLauncherCondition");
        Widget widget = mLauncher.getWorkspace().getWidgetAtCell(mainWidgetCellPos.getCellX(),
        Widget widget = mLauncher.getWorkspace().getWidgetAtCell(mainWidgetCellPos.getCellX(),
                mainWidgetCellPos.getCellY());
                mainWidgetCellPos.getCellY());
        assertNotNull(widget);
        assertNotNull(widget);