From 2bad402275c1ee8e1836ef929632e3bb8de26e92 Mon Sep 17 00:00:00 2001 From: Sihua Ma Date: Thu, 2 Jan 2025 23:58:49 +0000 Subject: [PATCH] Change home screen state description to manifest page change Bug: 383247157 Test: Manual Flag: EXEMPT bug fix Change-Id: I1c2d3aa90d2b4ee9a1beaa4fbe7db57e79ae49dc --- res/layout/launcher.xml | 1 + src/com/android/launcher3/Launcher.java | 4 ++++ src/com/android/launcher3/Workspace.java | 12 ++++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/res/layout/launcher.xml b/res/layout/launcher.xml index 83c8d6cba5..adf45979a8 100644 --- a/res/layout/launcher.xml +++ b/res/layout/launcher.xml @@ -29,6 +29,7 @@ android:importantForAccessibility="no"> return new ColdRebootStartupLatencyLogger(); } + @NonNull View getAccessibilityActionView() { + return findViewById(R.id.accessibility_action_view); + } + /** * Provide {@link OnBackAnimationCallback} in below order: *
    diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index a064c880c1..c3e42e988f 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -70,6 +70,7 @@ import android.widget.Toast; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; +import androidx.core.view.ViewCompat; import com.android.app.animation.Interpolators; import com.android.launcher3.accessibility.AccessibleDragListenerAdapter; @@ -3519,8 +3520,15 @@ public class Workspace extends PagedView @Override protected boolean canAnnouncePageDescription() { - // b/383247157: Disable disruptive home screen page announcement - return false; + return Float.compare(mOverlayProgress, 0f) == 0; + } + + @Override + protected void announcePageForAccessibility() { + // Talkback focuses on AccessibilityActionView by default, so we need to modify the state + // description there in order for the change in page scroll to be announced. + ViewCompat.setStateDescription(mLauncher.getAccessibilityActionView(), + getCurrentPageDescription()); } @Override