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

Commit e120fcfa authored by Nicolo' Mazzucato's avatar Nicolo' Mazzucato Committed by Nicolò Mazzucato
Browse files

Add better logging around long launcher operations during unfold

This logging helps understanding what's going on in Launcher main thread
 during unfold from perfetto traces.

Test: Perfetto trace after unfolding
Bug: 292472402
Change-Id: I7a037d9a129deb4bfe4310fdba664b87164ef2ca
parent 99f30cb1
Loading
Loading
Loading
Loading
+28 −19
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.hardware.display.DisplayManager;
import android.net.Uri;
import android.os.Handler;
import android.os.SystemProperties;
import android.os.Trace;
import android.provider.Settings;
import android.util.Log;
import android.view.Display;
@@ -180,6 +181,8 @@ public class TaskbarManager {

            @Override
            public void onConfigurationChanged(Configuration newConfig) {
                Trace.instantForTrack(Trace.TRACE_TAG_APP, "TaskbarManager",
                        "onConfigurationChanged: " + newConfig);
                debugWhyTaskbarNotDestroyed(
                        "TaskbarManager#mComponentCallbacks.onConfigurationChanged: " + newConfig);
                DeviceProfile dp = mUserUnlocked
@@ -347,6 +350,8 @@ public class TaskbarManager {
     */
    @VisibleForTesting
    public void recreateTaskbar() {
        Trace.beginSection("recreateTaskbar");
        try {
            DeviceProfile dp = mUserUnlocked ?
                LauncherAppState.getIDP(mContext).getDeviceProfile(mContext) : null;

@@ -364,7 +369,8 @@ public class TaskbarManager {
            }

            if (mTaskbarActivityContext == null) {
            mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp, mNavButtonController,
                mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp,
                    mNavButtonController,
                    mUnfoldProgressProvider);
            } else {
                mTaskbarActivityContext.updateDeviceProfile(dp);
@@ -379,6 +385,9 @@ public class TaskbarManager {
            // We to wait until user unlocks the device to attach listener.
            LauncherPrefs.get(mContext).addListener(mTaskbarPinningPreferenceChangeListener,
                TASKBAR_PINNING);
        } finally {
            Trace.endSection();
        }
    }

    public void onSystemUiFlagsChanged(int systemUiStateFlags) {
+15 −10
Original line number Diff line number Diff line
@@ -725,6 +725,8 @@ public class Launcher extends StatefulActivity<LauncherState>

    @Override
    protected void onHandleConfigurationChanged() {
        Trace.beginSection("Launcher#onHandleconfigurationChanged");
        try {
            if (!initDeviceProfile(mDeviceProfile.inv)) {
                return;
            }
@@ -737,6 +739,9 @@ public class Launcher extends StatefulActivity<LauncherState>
            // initialized properly.
            onSaveInstanceState(new Bundle());
            mModel.rebindCallbacks();
        } finally {
            Trace.endSection();
        }
    }

    public void onAssistantVisibilityChanged(float visibility) {
+3 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.content.Context;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Trace;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -182,6 +183,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        Trace.beginSection("ShortcutAndWidgetConteiner#onLayout");
        int count = getChildCount();
        for (int i = 0; i < count; i++) {
            final View child = getChildAt(i);
@@ -189,6 +191,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup implements FolderIcon.
                layoutChild(child);
            }
        }
        Trace.endSection();
    }

    /**
+12 −6
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static com.android.launcher3.model.ModelUtils.filterCurrentWorkspaceItems
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;

import android.os.Process;
import android.os.Trace;
import android.util.Log;

import com.android.launcher3.InvariantDeviceProfile;
@@ -83,6 +84,8 @@ public abstract class BaseLauncherBinder {
     * Binds all loaded data to actual views on the main thread.
     */
    public void bindWorkspace(boolean incrementBindId, boolean isBindSync) {
        Trace.beginSection("BaseLauncherBinder#bindWorkspace");
        try {
            if (FeatureFlags.ENABLE_WORKSPACE_LOADING_OPTIMIZATION.get()) {
                DisjointWorkspaceBinder workspaceBinder =
                    initWorkspaceBinder(incrementBindId, mBgDataModel.collectWorkspaceScreens());
@@ -91,6 +94,9 @@ public abstract class BaseLauncherBinder {
            } else {
                bindWorkspaceAllAtOnce(incrementBindId, isBindSync);
            }
        } finally {
            Trace.endSection();
        }
    }

    /**