Fix focusability of web suggest via talkback
The reasson is due to shortcut flow not having sent an accessibility
event. Shortcuts adding to home can use the same flow of how apps are
added to home by using bindInflatedItems() with an animation
endCallback(). This change should be fine since addInScreen() is called
in bindInflatedItems() too.
Bug:383461209
Test:Manually video- https://drive.google.com/file/d/1y3CslaIvRQMsODlQCYnGtG0Im4t7p4rR/view?usp=sharing
Flag: EXEMPT bug fix
Change-Id: I3b88b5ee40b4bcd43a83d362b6cbb0925120b700
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 647d2ad..4a29b86 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -70,6 +70,7 @@
import static com.android.launcher3.LauncherState.NO_SCALE;
import static com.android.launcher3.LauncherState.SPRING_LOADED;
import static com.android.launcher3.Utilities.postAsyncCallback;
+import static com.android.launcher3.anim.AnimatorListeners.forEndCallback;
import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE;
import static com.android.launcher3.config.FeatureFlags.MULTI_SELECT_EDIT_MODE;
import static com.android.launcher3.logging.KeyboardStateManager.KeyboardState.HIDE;
@@ -1459,7 +1460,10 @@
}
getModelWriter().addItemToDatabase(info, container, screenId, cellXY[0], cellXY[1]);
- mWorkspace.addInScreen(view, info);
+ AnimatorSet anim = new AnimatorSet();
+ anim.addListener(forEndCallback(() ->
+ view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED)));
+ bindInflatedItems(Collections.singletonList(Pair.create(info, view)), anim);
} else {
// Adding a shortcut to a Folder.
FolderIcon folderIcon = findFolderIcon(container);