Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3359fa7f authored by vinayjoglekar's avatar vinayjoglekar
Browse files

Fix talkback in split mode

1. Announce description of both snapshot in GroupedTaskView.
2. Announce them in correct order.

After setting right content description for both the apps in split mode, announcement order was reverse. Seems that order of the node tree which android sees was wrong. Also order did not change even in RTL mode.

see here https://paste.googleplex.com/6492038621298688.

The correct order is manually set using addChildrenForAccessibility in GroupedTaskView. (similarly being used in RecentsView since we use reverse order for overview). Also considered RTL.
See order after fix here
https://paste.googleplex.com/6492038621298688

https://drive.google.com/file/d/1BA1YKkcNsovEu4us9cvq5xOdXviTR1OV/view?usp=drive_link

Other alternatives tried were fixing order using android:accessibilityTraversalAfter and android:accessibilityTraversalBefore, both in layout and programatically which doesn't seem to work.

Test: Manual - Using Node tree debugging of talkback developer options.(Print and filter by tag TreeDebug)
BUG: 330424779
Flag: EXEMPT bugfix
Change-Id: If3c360277bd951d2d2b223bab7844e078e9c7d27
parent ba6c9f06
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ filegroup {
        "tests/src/com/android/quickstep/TaplOverviewIconTest.java",
        "tests/src/com/android/quickstep/TaplTestsQuickstep.java",
        "tests/src/com/android/quickstep/TaplTestsSplitscreen.java",
        "tests/src/com/android/quickstep/util/SplitScreenTestUtils.kt",
        "tests/src/com/android/launcher3/testcomponent/ExcludeFromRecentsTestActivity.java",
    ],
}
+7 −2
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ class DigitalWellBeingToast(

    private fun setNoLimit() {
        hasLimit = false
        taskView.contentDescription = task.titleDescription
        setContentDescription(appUsageLimitTimeMs = -1, appRemainingTimeMs = -1)
        replaceBanner(null)
        appRemainingTimeMs = -1
    }
@@ -110,9 +110,14 @@ class DigitalWellBeingToast(
                    setOnClickListener(::openAppUsageSettings)
                }
        replaceBanner(toast)
        setContentDescription(appUsageLimitTimeMs, appRemainingTimeMs)
    }

        taskView.contentDescription =
    private fun setContentDescription(appUsageLimitTimeMs: Long, appRemainingTimeMs: Long) {
        val taskContainer: TaskContainer = taskView.getTaskContainerById(task.key.id) ?: return
        val contentDescription =
            getContentDescriptionForTask(task, appUsageLimitTimeMs, appRemainingTimeMs)
        taskContainer.snapshotView.contentDescription = contentDescription
    }

    fun initialize(task: Task) {
+14 −0
Original line number Diff line number Diff line
@@ -171,4 +171,18 @@ class TaskContainer(
            thumbnailViewDeprecated.setOverlayEnabled(enabled)
        }
    }

    fun addChildForAccessibility(outChildren: ArrayList<View>) {
        addAccessibleChildToList(iconView.asView(), outChildren)
        addAccessibleChildToList(snapshotView, outChildren)
        showWindowsView?.let { addAccessibleChildToList(it, outChildren) }
    }

    private fun addAccessibleChildToList(view: View, outChildren: ArrayList<View>) {
        if (view.includeForAccessibility()) {
            outChildren.add(view)
        } else {
            view.addChildrenForAccessibility(outChildren)
        }
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -1662,6 +1662,12 @@ constructor(
        return thumbnailBounds.contains(x.toInt(), y.toInt())
    }

    override fun addChildrenForAccessibility(outChildren: ArrayList<View>) {
        (if (isLayoutRtl) taskContainers.reversed() else taskContainers).forEach {
            it.addChildForAccessibility(outChildren)
        }
    }

    companion object {
        private const val TAG = "TaskView"
        const val FLAG_UPDATE_ICON = 1
+6 −30
Original line number Diff line number Diff line
@@ -15,20 +15,18 @@
 */
package com.android.quickstep;

import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import android.content.Intent;
import android.platform.test.annotations.PlatinumTest;

import com.android.launcher3.tapl.Overview;
import com.android.launcher3.tapl.OverviewTask.OverviewSplitTask;
import com.android.launcher3.tapl.OverviewTaskMenu;
import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.util.rule.TestStabilityRule;
import com.android.quickstep.util.SplitScreenTestUtils;

import org.junit.Test;

@@ -70,39 +68,17 @@ public class TaplOverviewIconTest extends AbstractLauncherUiTest<QuickstepLaunch

    @Test
    public void testSplitTaskTapBothIconMenus() {
        createAndLaunchASplitPair();
        Overview overview = SplitScreenTestUtils.createAndLaunchASplitPairInOverview(mLauncher);

        OverviewTaskMenu taskMenu =
                mLauncher.goHome().switchToOverview().getCurrentTask().tapMenu();
        OverviewTaskMenu taskMenu = overview.getCurrentTask().tapMenu();
        assertTrue("App info item not appearing in expanded task menu.",
                taskMenu.hasMenuItem("App info"));
        taskMenu.touchOutsideTaskMenuToDismiss();

        OverviewTaskMenu splitMenu =
                mLauncher.goHome().switchToOverview().getCurrentTask().tapMenu(
        OverviewTaskMenu splitMenu = overview.getCurrentTask().tapMenu(
                        OverviewSplitTask.SPLIT_BOTTOM_OR_RIGHT);
        assertTrue("App info item not appearing in expanded split task's menu.",
                splitMenu.hasMenuItem("App info"));
        splitMenu.touchOutsideTaskMenuToDismiss();
    }

    private void createAndLaunchASplitPair() {
        clearAllRecentTasks();

        startTestActivity(2);
        startTestActivity(3);

        if (mLauncher.isTablet() && !mLauncher.isGridOnlyOverviewEnabled()) {
            mLauncher.goHome().switchToOverview().getOverviewActions()
                    .clickSplit()
                    .getTestActivityTask(2)
                    .open();
        } else {
            mLauncher.goHome().switchToOverview().getCurrentTask()
                    .tapMenu()
                    .tapSplitMenuItem()
                    .getCurrentTask()
                    .open();
        }
    }
}
 No newline at end of file
Loading