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

Commit 7c8bf0f5 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Adding content description for app-info button when talkback is enabled." into nyc-dev

parents e15fb017 b92dd635
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -417,6 +417,8 @@
    <string name="accessibility_recents_item_dismissed"><xliff:g id="app" example="Calendar">%s</xliff:g> dismissed.</string>
    <!-- Content description to tell the user all applications has been removed from recents -->
    <string name="accessibility_recents_all_items_dismissed">All recent applications dismissed.</string>
    <!-- Content description to tell the user that this button will open application info for an application in recents -->
    <string name="accessibility_recents_item_open_app_info">Open <xliff:g id="app" example="Calendar">%s</xliff:g> application info.</string>
    <!-- Content description to tell the user an application has been launched from recents -->
    <string name="accessibility_recents_item_launched">Starting <xliff:g id="app" example="Calendar">%s</xliff:g>.</string>
    <!-- Content description of individual recents task. -->
+8 −5
Original line number Diff line number Diff line
@@ -132,6 +132,8 @@ public class RecentsTaskLoadPlan {
        SparseIntArray affiliatedTaskCounts = new SparseIntArray();
        String dismissDescFormat = mContext.getString(
                R.string.accessibility_recents_item_will_be_dismissed);
        String appInfoDescFormat = mContext.getString(
                R.string.accessibility_recents_item_open_app_info);
        long lastStackActiveTime = Prefs.getLong(mContext,
                Prefs.Key.OVERVIEW_LAST_STACK_TASK_ACTIVE_TIME, 0);
        if (RecentsDebugFlags.Static.EnableMockTasks) {
@@ -188,8 +190,9 @@ public class RecentsTaskLoadPlan {
            // Load the title, icon, and color
            ActivityInfo info = loader.getAndUpdateActivityInfo(taskKey);
            String title = loader.getAndUpdateActivityTitle(taskKey, t.taskDescription);
            String contentDescription = loader.getAndUpdateContentDescription(taskKey, res);
            String dismissDescription = String.format(dismissDescFormat, contentDescription);
            String titleDescription = loader.getAndUpdateContentDescription(taskKey, res);
            String dismissDescription = String.format(dismissDescFormat, titleDescription);
            String appInfoDescription = String.format(appInfoDescFormat, titleDescription);
            Drawable icon = isStackTask
                    ? loader.getAndUpdateActivityIcon(taskKey, t.taskDescription, res, false)
                    : null;
@@ -201,9 +204,9 @@ public class RecentsTaskLoadPlan {

            // Add the task to the stack
            Task task = new Task(taskKey, t.affiliatedTaskId, t.affiliatedTaskColor, icon,
                    thumbnail, title, contentDescription, dismissDescription, activityColor,
                    backgroundColor, isLaunchTarget, isStackTask, isSystemApp, t.isDockable,
                    t.bounds, t.taskDescription);
                    thumbnail, title, titleDescription, dismissDescription, appInfoDescription,
                    activityColor, backgroundColor, isLaunchTarget, isStackTask, isSystemApp,
                    t.isDockable, t.bounds, t.taskDescription);

            allTasks.add(task);
            affiliatedTaskCounts.put(taskKey.id, affiliatedTaskCounts.get(taskKey.id, 0) + 1);
+9 −5
Original line number Diff line number Diff line
@@ -134,10 +134,12 @@ public class Task {
    @ViewDebug.ExportedProperty(category="recents")
    public String title;
    @ViewDebug.ExportedProperty(category="recents")
    public String contentDescription;
    public String titleDescription;
    @ViewDebug.ExportedProperty(category="recents")
    public String dismissDescription;
    @ViewDebug.ExportedProperty(category="recents")
    public String appInfoDescription;
    @ViewDebug.ExportedProperty(category="recents")
    public int colorPrimary;
    @ViewDebug.ExportedProperty(category="recents")
    public int colorBackground;
@@ -174,8 +176,8 @@ public class Task {
    }

    public Task(TaskKey key, int affiliationTaskId, int affiliationColor, Drawable icon,
                Bitmap thumbnail, String title, String contentDescription,
                String dismissDescription, int colorPrimary, int colorBackground,
                Bitmap thumbnail, String title, String titleDescription, String dismissDescription,
                String appInfoDescription, int colorPrimary, int colorBackground,
                boolean isLaunchTarget, boolean isStackTask, boolean isSystemApp,
                boolean isDockable, Rect bounds, ActivityManager.TaskDescription taskDescription) {
        boolean isInAffiliationGroup = (affiliationTaskId != key.id);
@@ -186,8 +188,9 @@ public class Task {
        this.icon = icon;
        this.thumbnail = thumbnail;
        this.title = title;
        this.contentDescription = contentDescription;
        this.titleDescription = titleDescription;
        this.dismissDescription = dismissDescription;
        this.appInfoDescription = appInfoDescription;
        this.colorPrimary = hasAffiliationGroupColor ? affiliationColor : colorPrimary;
        this.colorBackground = colorBackground;
        this.useLightOnPrimaryColor = Utilities.computeContrastBetweenColors(this.colorPrimary,
@@ -211,8 +214,9 @@ public class Task {
        this.icon = o.icon;
        this.thumbnail = o.thumbnail;
        this.title = o.title;
        this.contentDescription = o.contentDescription;
        this.titleDescription = o.titleDescription;
        this.dismissDescription = o.dismissDescription;
        this.appInfoDescription = o.appInfoDescription;
        this.colorPrimary = o.colorPrimary;
        this.colorBackground = o.colorBackground;
        this.useLightOnPrimaryColor = o.useLightOnPrimaryColor;
+2 −1
Original line number Diff line number Diff line
@@ -459,7 +459,7 @@ public class TaskViewHeader extends FrameLayout
        if (!mTitleView.getText().toString().equals(t.title)) {
            mTitleView.setText(t.title);
        }
        mTitleView.setContentDescription(t.contentDescription);
        mTitleView.setContentDescription(t.titleDescription);
        mTitleView.setTextColor(t.useLightOnPrimaryColor ?
                mTaskBarViewLightTextColor : mTaskBarViewDarkTextColor);
        if (!t.isDockable && ssp.hasDockedTask()) {
@@ -501,6 +501,7 @@ public class TaskViewHeader extends FrameLayout

        // In accessibility, a single click on the focused app info button will show it
        if (touchExplorationEnabled) {
            mIconView.setContentDescription(t.appInfoDescription);
            mIconView.setOnClickListener(this);
        }
    }