Remove redundant a11y announcement upon removal of workspace item.

When a workspace item is removed, launcher currently shows a Snackbar which contains a message saying "item removed". This renders the a11y announcement in DeleteDropTarget#onAccessibilityDrop redundant since it's saying exactly the same string.


Bug: 378032433
Change-Id: Iaf3b42404ecd382b1ee15f670cc4ebe0124218d2
Test: manual
Flag: EXEMPT bugfix
This commit is contained in:
Pinyao Ting
2024-11-22 00:34:03 +00:00
parent d4fb56f36b
commit 604ae3283c
2 changed files with 10 additions and 6 deletions
@@ -130,7 +130,6 @@ public class DeleteDropTarget extends ButtonDropTarget {
public void completeDrop(DragObject d) {
ItemInfo item = d.dragInfo;
if (canRemove(item)) {
onAccessibilityDrop(null, item);
mDropTargetHandler.onDeleteComplete(item);
}
}
+10 -5
View File
@@ -65,6 +65,7 @@ class DropTargetHandler(launcher: Launcher) {
}
fun onDeleteComplete(item: ItemInfo) {
removeItemAndStripEmptyScreens(null /* view */, item)
var pageItem: ItemInfo = item
if (item.container <= 0) {
val v = mLauncher.workspace.getHomescreenIconByItemId(item.container)
@@ -90,11 +91,7 @@ class DropTargetHandler(launcher: Launcher) {
}
fun onAccessibilityDelete(view: View?, item: ItemInfo, announcement: CharSequence) {
// Remove the item from launcher and the db, we can ignore the containerInfo in this call
// because we already remove the drag view from the folder (if the drag originated from
// a folder) in Folder.beginDrag()
mLauncher.removeItem(view, item, true /* deleteFromDb */, "removed by accessibility drop")
mLauncher.workspace.stripEmptyScreens()
removeItemAndStripEmptyScreens(view, item)
mLauncher.dragLayer.announceForAccessibility(announcement)
}
@@ -105,4 +102,12 @@ class DropTargetHandler(launcher: Launcher) {
fun onClick(buttonDropTarget: ButtonDropTarget) {
mLauncher.accessibilityDelegate.handleAccessibleDrop(buttonDropTarget, null, null)
}
private fun removeItemAndStripEmptyScreens(view: View?, item: ItemInfo) {
// Remove the item from launcher and the db, we can ignore the containerInfo in this call
// because we already remove the drag view from the folder (if the drag originated from
// a folder) in Folder.beginDrag()
mLauncher.removeItem(view, item, true /* deleteFromDb */, "removed by accessibility drop")
mLauncher.workspace.stripEmptyScreens()
}
}