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
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index b89d05e..7f72526 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1268,11 +1268,7 @@
         }
 
         // Set screen title for Talkback
-        if (state == ALL_APPS) {
-            setTitle(R.string.all_apps_label);
-        } else {
-            setTitle(R.string.home_screen);
-        }
+        setTitle(state.getTitle());
     }
 
     /**
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 72a3c53..d2d56f2 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -38,6 +38,7 @@
 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 @@
         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()) {