From dfe0b4df7eb6ac3fc8dee5ad4a07af7ae4237b63 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Fri, 8 Apr 2016 17:14:15 -0400 Subject: [PATCH] Improve content descriptions for volume dialog icons. Bug: 27971063 Change-Id: I9282083f68a5cd607fe0cb2893829675559acb6d --- packages/SystemUI/res/values/strings.xml | 4 +++ .../android/systemui/volume/VolumeDialog.java | 32 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index c536c1aa4eb27..a33b7a3cce294 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1082,6 +1082,10 @@ %s — Priority only %s vibrate — Priority only + %1$s. Tap to unmute. + %1$s. Tap to set to vibrate. Accessibility services may be muted. + %1$s. Tap to mute. Accessibility services may be muted. + System UI Tuner diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java index 1d5ca04243a0e..91a8493b97c65 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java @@ -761,7 +761,37 @@ public class VolumeDialog implements TunerService.Tunable { : (iconRes == R.drawable.ic_volume_media_bt || iconRes == row.iconRes) ? Events.ICON_STATE_UNMUTE : Events.ICON_STATE_UNKNOWN; - row.icon.setContentDescription(ss.name); + if (iconEnabled) { + if (isRingStream) { + if (isRingVibrate) { + row.icon.setContentDescription(mContext.getString( + R.string.volume_stream_content_description_unmute, + ss.name)); + } else { + if (mController.hasVibrator()) { + row.icon.setContentDescription(mContext.getString( + R.string.volume_stream_content_description_vibrate, + ss.name)); + } else { + row.icon.setContentDescription(mContext.getString( + R.string.volume_stream_content_description_mute, + ss.name)); + } + } + } else { + if (ss.muted || mAutomute && ss.level == 0) { + row.icon.setContentDescription(mContext.getString( + R.string.volume_stream_content_description_unmute, + ss.name)); + } else { + row.icon.setContentDescription(mContext.getString( + R.string.volume_stream_content_description_mute, + ss.name)); + } + } + } else { + row.icon.setContentDescription(ss.name); + } // update slider final boolean enableSlider = !zenMuted;