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
This commit is contained in:
Stefan Andonian
2025-01-06 16:25:25 -08:00
parent 239745aae9
commit 6284b233bf
+18
View File
@@ -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<T extends View & PageIndicator> extends PagedView<T>
}
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<LauncherState>() {
@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) {