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

Commit 104d09f1 authored by Yogisha Dixit's avatar Yogisha Dixit
Browse files

Add logging when item not added due to insufficient space.

Bug: 194061824
Test: manual
Change-Id: Ib6f6b9ab4a8e1b59b1dbd1c7c137962efa3e880e
parent 6f12fc09
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1298,7 +1298,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
            }

            if (!foundCellSpan) {
                mWorkspace.onNoCellFound(layout);
                mWorkspace.onNoCellFound(layout, info, /* logInstanceId= */ null);
                return;
            }

+12 −3
Original line number Diff line number Diff line
@@ -63,6 +63,8 @@ import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.Toast;

import androidx.annotation.Nullable;

import com.android.launcher3.accessibility.AccessibleDragListenerAdapter;
import com.android.launcher3.accessibility.WorkspaceAccessibilityHelper;
import com.android.launcher3.anim.Interpolators;
@@ -82,6 +84,7 @@ import com.android.launcher3.graphics.DragPreviewProvider;
import com.android.launcher3.icons.BitmapRenderer;
import com.android.launcher3.icons.FastBitmapDrawable;
import com.android.launcher3.logger.LauncherAtom;
import com.android.launcher3.logging.InstanceId;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.logging.StatsLogManager.LauncherEvent;
import com.android.launcher3.model.data.AppInfo;
@@ -1604,7 +1607,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator>

            // Don't accept the drop if there's no room for the item
            if (!foundCell) {
                onNoCellFound(dropTargetLayout);
                onNoCellFound(dropTargetLayout, d.dragInfo, d.logInstanceId);
                return false;
            }
        }
@@ -1906,7 +1909,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
                            lp.cellX, lp.cellY, item.spanX, item.spanY);
                } else {
                    if (!returnToOriginalCellToPreventShuffling) {
                        onNoCellFound(dropTargetLayout);
                        onNoCellFound(dropTargetLayout, d.dragInfo, d.logInstanceId);
                    }
                    if (mDragInfo.cell instanceof LauncherAppWidgetHostView) {
                        d.dragView.detachContentView(/* reattachToPreviousParent= */ true);
@@ -1974,10 +1977,16 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
        }
    }

    public void onNoCellFound(View dropTargetLayout) {
    public void onNoCellFound(
            View dropTargetLayout, ItemInfo itemInfo, @Nullable InstanceId logInstanceId) {
        int strId = mLauncher.isHotseatLayout(dropTargetLayout)
                ? R.string.hotseat_out_of_space : R.string.out_of_space;
        Toast.makeText(mLauncher, mLauncher.getString(strId), Toast.LENGTH_SHORT).show();
        StatsLogManager.StatsLogger logger = mStatsLogManager.logger().withItemInfo(itemInfo);
        if (logInstanceId != null) {
            logger = logger.withInstanceId(logInstanceId);
        }
        logger.log(LauncherEvent.LAUNCHER_ITEM_DROP_FAILED_INSUFFICIENT_SPACE);
    }

    /**
+4 −1
Original line number Diff line number Diff line
@@ -486,7 +486,10 @@ public class StatsLogManager implements ResourceBasedOverride {
        LAUNCHER_TURN_ON_WORK_APPS_TAP(838),

        @UiEvent(doc = "User tapped on 'Turn off work apps' button in all apps window.")
        LAUNCHER_TURN_OFF_WORK_APPS_TAP(839)
        LAUNCHER_TURN_OFF_WORK_APPS_TAP(839),

        @UiEvent(doc = "Launcher item drop failed since there was not enough room on the screen.")
        LAUNCHER_ITEM_DROP_FAILED_INSUFFICIENT_SPACE(872)
        ;

        // ADD MORE