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

Commit 3fd273e6 authored by Mady Mellor's avatar Mady Mellor
Browse files

Add content description for gear behind notifications

Bug: 27498876
Change-Id: I244286e3eaff04268b25e40f1031b5ff7d0b3aee
parent 466b702c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1261,6 +1261,9 @@
    <!-- Notification: Control panel: Label for button that dismisses control panel. [CHAR LIMIT=NONE] -->
    <string name="notification_done">Done</string>

    <!-- Notification: Gear: Content description for the gear. [CHAR LIMIT=NONE] -->
    <string name="notification_gear_accessibility"><xliff:g id="app_name" example="YouTube">%1$s</xliff:g> notification controls</string>

    <!-- SysUI Tuner: Color and appearance screen title [CHAR LIMIT=50] -->
    <string name="color_and_appearance">Color and appearance</string>

+15 −0
Original line number Diff line number Diff line
@@ -1498,6 +1498,21 @@ public abstract class BaseStatusBar extends SystemUI implements
            row.setHeadsUpManager(mHeadsUpManager);
            row.setRemoteInputController(mRemoteInputController);
            row.setOnExpandClickListener(this);

            // Get the app name
            final String pkg = sbn.getPackageName();
            String appname = pkg;
            try {
                final ApplicationInfo info = pmUser.getApplicationInfo(pkg,
                        PackageManager.GET_UNINSTALLED_PACKAGES
                                | PackageManager.GET_DISABLED_COMPONENTS);
                if (info != null) {
                    appname = String.valueOf(pmUser.getApplicationLabel(info));
                }
            } catch (NameNotFoundException e) {
                // Do nothing
            }
            row.setAppName(appname);
        }

        workAroundBadLayerDrawableOpacity(row);
+10 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    private NotificationGuts mGuts;
    private NotificationData.Entry mEntry;
    private StatusBarNotification mStatusBarNotification;
    private String mAppName;
    private boolean mIsHeadsUp;
    private boolean mLastChronometerRunning = true;
    private NotificationHeaderView mNotificationHeader;
@@ -285,6 +286,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        mPrivateLayout.setRemoteInputController(r);
    }

    public void setAppName(String appName) {
        mAppName = appName;
        if (mSettingsIconRow != null) {
            mSettingsIconRow.setAppName(mAppName);
        }
    }

    public void addChildNotification(ExpandableNotificationRow row) {
        addChildNotification(row, -1);
    }
@@ -564,6 +572,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
            mSettingsIconRow = (NotificationSettingsIconRow) LayoutInflater.from(mContext).inflate(
                    R.layout.notification_settings_icon_row, this, false);
            mSettingsIconRow.setNotificationRowParent(ExpandableNotificationRow.this);
            mSettingsIconRow.setAppName(mAppName);
            mSettingsIconRow.setVisibility(oldSettings.getVisibility());
            addView(mSettingsIconRow, settingsIndex);

@@ -653,6 +662,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
            public void onInflate(ViewStub stub, View inflated) {
                mSettingsIconRow = (NotificationSettingsIconRow) inflated;
                mSettingsIconRow.setNotificationRowParent(ExpandableNotificationRow.this);
                mSettingsIconRow.setAppName(mAppName);
            }
        });
        mGutsStub = (ViewStub) findViewById(R.id.notification_guts_stub);
+8 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
@@ -105,6 +106,13 @@ public class NotificationSettingsIconRow extends FrameLayout implements View.OnC
        mParent = parent;
    }

    public void setAppName(String appName) {
        Resources res = getResources();
        String description = String.format(res.getString(R.string.notification_gear_accessibility),
                appName);
        mGearIcon.setContentDescription(description);
    }

    public ExpandableNotificationRow getNotificationParent() {
        return mParent;
    }