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

Commit 7007e794 authored by tmfang's avatar tmfang
Browse files

Fix talkback issue on bar chart

We set content description on icon view,
so this is why talkback speaks the permission name twice.

Test: open talkback, and click bar chart.
Fixes: 130842756
Change-Id: I2ed4916de0a249f61d97dc00fa95193560b3d74c
parent 0cab8dc0
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.settingslib.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -73,8 +74,13 @@ public class BarView extends LinearLayout {
        mIcon.setImageDrawable(barViewInfo.getIcon());
        mBarTitle.setText(barViewInfo.getTitle());
        mBarSummary.setText(barViewInfo.getSummary());

        final CharSequence barViewInfoContent = barViewInfo.getContentDescription();
        if (!TextUtils.isEmpty(barViewInfoContent)
                && !TextUtils.equals((barViewInfo.getTitle()), barViewInfoContent)) {
            mIcon.setContentDescription(barViewInfo.getContentDescription());
        }
    }

    @VisibleForTesting
    CharSequence getTitle() {