Fix Talkback wrong label announced going from App to Overview

To fix the incorrect title information being spoken after a transition state ends, a new function named getTitle is introduced in the LauncherState. This function provides the correct title for the transition state. The default accessibility label is set to R.string.home_screen. All Apps and Overview states override the getTitle function to ensure the correct accessibility label for their respective states.

Fix: 265892510
Flag: EXEMPT bugfix
Test: Manual with Talkback. With Talkback enabled, navigate from App to Overview.
Change-Id: I96b820f310f8b778a149709bca687a5912386246
This commit is contained in:
Jordan Silva
2024-05-29 14:40:46 +01:00
parent 1d9f23b1ad
commit 8181dfdf92
6 changed files with 24 additions and 5 deletions

View File

@@ -101,6 +101,11 @@ public class AllAppsState extends LauncherState {
return launcher.getAppsView().getDescription();
}
@Override
public int getTitle() {
return R.string.all_apps_label;
}
@Override
public float getVerticalProgress(Launcher launcher) {
return 0f;

View File

@@ -182,6 +182,11 @@ public class OverviewState extends LauncherState {
return launcher.getString(R.string.accessibility_recent_apps);
}
@Override
public int getTitle() {
return R.string.accessibility_recent_apps;
}
public static float getDefaultSwipeHeight(Launcher launcher) {
return LayoutUtils.getDefaultSwipeHeight(launcher, launcher.getDeviceProfile());
}

View File

@@ -371,6 +371,9 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> implem
getSystemUiController().updateUiState(SystemUiController.UI_STATE_BASE_WINDOW,
Themes.getAttrBoolean(this, R.attr.isWorkspaceDarkText));
ACTIVITY_TRACKER.handleCreate(this);
// Set screen title for Talkback
setTitle(R.string.accessibility_recent_apps);
}
@Override

View File

@@ -1268,11 +1268,7 @@ public class Launcher extends StatefulActivity<LauncherState>
}
// Set screen title for Talkback
if (state == ALL_APPS) {
setTitle(R.string.all_apps_label);
} else {
setTitle(R.string.home_screen);
}
setTitle(state.getTitle());
}
/**

View File

@@ -38,6 +38,7 @@ import android.view.View;
import android.view.animation.Interpolator;
import androidx.annotation.FloatRange;
import androidx.annotation.StringRes;
import com.android.launcher3.statemanager.BaseState;
import com.android.launcher3.statemanager.StateManager;
@@ -369,6 +370,10 @@ public abstract class LauncherState implements BaseState<LauncherState> {
return launcher.getWorkspace().getCurrentPageDescription();
}
public @StringRes int getTitle() {
return R.string.home_screen;
}
public PageAlphaProvider getWorkspacePageAlphaProvider(Launcher launcher) {
if ((this != NORMAL && this != HINT_STATE)
|| !launcher.getDeviceProfile().shouldFadeAdjacentWorkspaceScreens()) {

View File

@@ -52,6 +52,11 @@ public class AllAppsState extends LauncherState {
return launcher.getString(R.string.all_apps_button_label);
}
@Override
public int getTitle() {
return R.string.all_apps_label;
}
@Override
public int getVisibleElements(Launcher launcher) {
return ALL_APPS_CONTENT;