Add logging when item not added due to insufficient space.

Bug: 194061824
Test: manual
Change-Id: Ib6f6b9ab4a8e1b59b1dbd1c7c137962efa3e880e
This commit is contained in:
Yogisha Dixit
2021-07-19 14:05:17 +01:00
parent 6f12fc09d9
commit 104d09f143
3 changed files with 17 additions and 5 deletions

View File

@@ -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);
}
/**