From 672c8a10e4da8bd8a6599864749c65b3b491a9d0 Mon Sep 17 00:00:00 2001 From: Schneider Victor-Tulias Date: Mon, 2 Jun 2025 11:38:52 -0400 Subject: [PATCH] Fix incorrect talkback announcement for app -> home This change removes the talkback announcement for the background app LauncherState, which defaulted to "Recent apps". Flag: EXEMPT bug fix Fixes: 418854152 Test: attempted home/overview/quick switch gestures from home and app Change-Id: I1f390902dfddd2e8576743dbbddce65121690f14 --- .../launcher3/uioverrides/QuickstepLauncher.java | 10 ++++++++++ .../uioverrides/states/BackgroundAppState.java | 3 ++- src/com/android/launcher3/Launcher.java | 3 +++ src/com/android/launcher3/LauncherState.java | 3 +++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 636f16754a..a3c8b3baaa 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -35,6 +35,7 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; import static com.android.launcher3.LauncherState.ALL_APPS; +import static com.android.launcher3.LauncherState.FLAG_SKIP_STATE_ANNOUNCEMENT; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.NO_OFFSET; import static com.android.launcher3.LauncherState.OVERVIEW; @@ -671,6 +672,15 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer, } } + @Override + protected void setTitle(@NonNull LauncherState state) { + if (state.hasFlag(FLAG_SKIP_STATE_ANNOUNCEMENT)) { + // Prevent accessibility title update announcement + getWindow().getAttributes().accessibilityTitle = getString(state.getTitle()); + } + super.setTitle(state); + } + @Override public TouchController[] createTouchControllers() { NavigationMode mode = DisplayController.getNavigationMode(this); diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java index a2c69167de..508643afd7 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java @@ -35,7 +35,8 @@ import com.android.quickstep.views.RecentsView; public class BackgroundAppState extends OverviewState { private static final int STATE_FLAGS = FLAG_DISABLE_RESTORE | FLAG_RECENTS_VIEW_VISIBLE - | FLAG_WORKSPACE_INACCESSIBLE | FLAG_NON_INTERACTIVE | FLAG_CLOSE_POPUPS; + | FLAG_WORKSPACE_INACCESSIBLE | FLAG_NON_INTERACTIVE | FLAG_CLOSE_POPUPS + | FLAG_SKIP_STATE_ANNOUNCEMENT; public BackgroundAppState(int id) { this(id, LAUNCHER_STATE_BACKGROUND); diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index c0e746d9e9..30eb900050 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1172,7 +1172,10 @@ public class Launcher extends StatefulActivity getAllAppsExitEvent().ifPresent(getStatsLogManager().logger()::log); mAllAppsSessionLogId = null; } + setTitle(state); + } + protected void setTitle(@NonNull LauncherState state) { // Set screen title for Talkback setTitle(state.getTitle()); } diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java index da26b88d9a..78696a5ce8 100644 --- a/src/com/android/launcher3/LauncherState.java +++ b/src/com/android/launcher3/LauncherState.java @@ -91,6 +91,9 @@ public abstract class LauncherState implements BaseState { // Flag indicating that hotseat and its contents are not accessible. public static final int FLAG_HOTSEAT_INACCESSIBLE = BaseState.getFlag(7); + // Flag indicating that this state should not be announced by Talkback when reached + public static final int FLAG_SKIP_STATE_ANNOUNCEMENT = BaseState.getFlag(8); + public static final float NO_OFFSET = 0; public static final float NO_SCALE = 1;