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

Commit eb082d6a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow Talkback to speak the permission name."

parents e575787c 562a2842
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.packageinstaller.permission.ui.handheld;

import android.content.Context;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -24,6 +25,7 @@ import android.widget.ImageView;

import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.preference.Preference;
import androidx.preference.PreferenceGroup;
import androidx.preference.PreferenceViewHolder;
@@ -39,7 +41,7 @@ import java.util.List;
public class ExpandablePreferenceGroup extends PreferenceGroup {
    private @NonNull Context mContext;
    private @NonNull List<Preference> mPreferences;
    private @NonNull List<Integer> mSummaryIcons;
    private @NonNull List<Pair<Integer, CharSequence>> mSummaryIcons;
    private boolean mExpanded;

    public ExpandablePreferenceGroup(@NonNull Context context) {
@@ -100,7 +102,11 @@ public class ExpandablePreferenceGroup extends PreferenceGroup {
                ViewGroup group = (ViewGroup) inflater.inflate(R.layout.title_summary_image_view,
                        null);
                ImageView imageView = group.requireViewById(R.id.icon);
                imageView.setImageResource(mSummaryIcons.get(i));
                Pair<Integer, CharSequence> summaryIcons = mSummaryIcons.get(i);
                imageView.setImageResource(summaryIcons.first);
                if (summaryIcons.second != null) {
                    imageView.setContentDescription(summaryIcons.second);
                }
                summaryFrame.addView(group);
            }
        }
@@ -117,7 +123,7 @@ public class ExpandablePreferenceGroup extends PreferenceGroup {
     *
     * @param resId the resourceId of the drawable to use as the icon.
     */
    public void addSummaryIcon(@DrawableRes int resId) {
        mSummaryIcons.add(resId);
    public void addSummaryIcon(@DrawableRes int resId, @Nullable CharSequence contentDescription) {
        mSummaryIcons.add(Pair.create(resId, contentDescription));
    }
}
+3 −2
Original line number Diff line number Diff line
@@ -492,7 +492,8 @@ public class PermissionUsageFragment extends SettingsWithButtonHeader implements

                parent.addPreference(createPermissionUsagePreference(context, appPermissionUsage,
                        groupUsage, accessTimeString));
                parent.addSummaryIcon(groupUsage.getGroup().getIconResId());
                parent.addSummaryIcon(groupUsage.getGroup().getIconResId(),
                        groupUsage.getGroup().getLabel());
            }

            setLoading(false, true);
@@ -591,7 +592,7 @@ public class PermissionUsageFragment extends SettingsWithButtonHeader implements
                    Utils.applyTint(context, icon, android.R.attr.colorControlNormal),
                    // The cast should not be a prob in practice
                    groupToAppCount.get(group.getName()),
                    R.string.app_permission_usage_bar_label);
                    R.string.app_permission_usage_bar_label, group.getLabel());

            barViewInfo.setClickListener(v -> {
                mFilterGroup = group.getName();