mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Add logging when item not added due to insufficient space.
Bug: 194061824 Test: manual Change-Id: Ib6f6b9ab4a8e1b59b1dbd1c7c137962efa3e880e
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user