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

Commit d5d8866c authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "Add content description for gear behind notifications" into nyc-dev

parents 7b0864cc 3fd273e6
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
@@ -1527,6 +1527,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
@@ -110,6 +110,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;
@@ -287,6 +288,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);
    }
@@ -566,6 +574,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);

@@ -683,6 +692,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;
    }