Add accessibility actions for "REMOVE", "UNINSTALL" & "Widget Settings"

Bug: 279800472
Flag: EXEMPT BUGFIX
Test: Talkback & VoiceAccess
Change-Id: I78387020cf23910fad5f7b98f9501bc1eb410a72
This commit is contained in:
Shamali P committed 2025-04-15 15:05:52 +00:00
1 parent dbf9dee5a6
commit a8afda25da
5 files changed
+44 -21

No files matched your search

@@ -32,6 +32,7 @@ import com.android.launcher3.model.data.CollectionInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.util.Preconditions;
public class DeleteDropTarget extends ButtonDropTarget {
@@ -68,8 +69,7 @@ public class DeleteDropTarget extends ButtonDropTarget {
/**
* @return true for items that should have a "Remove" action in accessibility.
*/
@Override
public boolean supportsAccessibilityDrop(ItemInfo info, View view) {
private boolean supportsAccessibilityDrop(ItemInfo info, View view) {
if (info instanceof WorkspaceItemInfo) {
// Support the action unless the item is in a context menu.
return canRemove(info);
@@ -79,6 +79,14 @@ public class DeleteDropTarget extends ButtonDropTarget {
|| (info instanceof CollectionInfo);
}
@Override
public int getSupportedAccessibilityAction(ItemInfo info, View view) {
if (supportsAccessibilityDrop(info, view)) {
return getAccessibilityAction();
}
return LauncherAccessibilityDelegate.INVALID;
}
@Override
public int getAccessibilityAction() {
return LauncherAccessibilityDelegate.REMOVE;
@@ -143,7 +151,8 @@ public class DeleteDropTarget extends ButtonDropTarget {
* Removes the item from the workspace. If the view is not null, it also removes the view.
*/
@Override
public void onAccessibilityDrop(View view, ItemInfo item) {
public void onAccessibilityDrop(View view, ItemInfo item, int action) {
Preconditions.assertTrue(action == getAccessibilityAction());
// 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()