From 6284b233bff8ebc28fdaf1e67c86e5d35abc14cf Mon Sep 17 00:00:00 2001 From: Stefan Andonian Date: Mon, 6 Jan 2025 16:25:25 -0800 Subject: [PATCH] Maintain Talkback / Voice Access / etc. focus after moving item in Workspace. Bug: 383456105 Test: Verified this works well manually. Flag: EXEMPT bug fix Change-Id: I35377443c4800a53cfa539c7061d5ef1b8b27837 --- src/com/android/launcher3/Workspace.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index bc751d9365..0d050b2ca8 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -109,6 +109,7 @@ import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pageindicators.PageIndicator; import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.statemanager.StateManager.StateHandler; +import com.android.launcher3.statemanager.StateManager.StateListener; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.touch.WorkspaceTouchListener; import com.android.launcher3.util.EdgeEffectCompat; @@ -2241,6 +2242,23 @@ public class Workspace extends PagedView } mStatsLogManager.logger().withItemInfo(d.dragInfo).withInstanceId(d.logInstanceId) .log(LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED); + + if (mAccessibilityDragListener != null) { + // This code needs to be called after StateManager.cancelAnimation. Before changing + // the order of operations in this method related to the StateListener below, please + // test that accessibility moves retain focus after accessibility dropping an item. + // Accessibility focus must be requested after launcher is back to a normal state + mLauncher.getStateManager().addStateListener(new StateListener() { + @Override + public void onStateTransitionComplete(LauncherState finalState) { + if (finalState == NORMAL) { + cell.performAccessibilityAction( + AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null); + mLauncher.getStateManager().removeStateListener(this); + } + } + }); + } } if (d.stateAnnouncer != null && !droppedOnOriginalCell) {