From e5557a972ca190cb82026a5dd0c53f4d119fa05a Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 15 Aug 2014 19:59:23 +0200 Subject: [PATCH] Fixed accessibility issues with quick settings The dual mode tiles now have better accessibility descriptions, where the label is now seperate from the clickable button. Also fixed an anouncment problem with the battery indicators. Finally fixed an issue where GPRS null was anounced when no signal was available. Bug: 15682124 Bug: 15696954 Change-Id: Ica2b70173e64d51747b100d0b686875fc8076e6f --- packages/SystemUI/res/layout/keyguard_status_bar.xml | 3 ++- .../SystemUI/res/layout/status_bar_expanded_header.xml | 3 ++- packages/SystemUI/res/values/strings.xml | 9 ++++++++- .../SystemUI/src/com/android/systemui/qs/QSPanel.java | 2 +- .../SystemUI/src/com/android/systemui/qs/QSTile.java | 7 ++++++- .../SystemUI/src/com/android/systemui/qs/QSTileView.java | 6 ++++++ .../src/com/android/systemui/qs/tiles/BluetoothTile.java | 6 ++++++ .../src/com/android/systemui/qs/tiles/WifiTile.java | 8 ++++++-- .../systemui/statusbar/policy/NetworkControllerImpl.java | 5 +++-- 9 files changed, 40 insertions(+), 9 deletions(-) diff --git a/packages/SystemUI/res/layout/keyguard_status_bar.xml b/packages/SystemUI/res/layout/keyguard_status_bar.xml index fcc0f4aaf4593..faa2820aae354 100644 --- a/packages/SystemUI/res/layout/keyguard_status_bar.xml +++ b/packages/SystemUI/res/layout/keyguard_status_bar.xml @@ -60,7 +60,8 @@ android:paddingEnd="@dimen/battery_level_padding_end" android:textColor="#ffffff" android:visibility="gone" - android:textSize="@dimen/battery_level_text_size"/> + android:textSize="@dimen/battery_level_text_size" + android:importantForAccessibility="noHideDescendants"/> + android:textSize="@dimen/battery_level_text_size" + android:importantForAccessibility="noHideDescendants"/> Wifi signal full. + + Connected to %s. + + + Connected to %s. + + No WiMAX. @@ -398,7 +405,7 @@ User %s. - %1$s. %2$s + %1$s. Mobile %1$s. %2$s. %3$s. diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index c3144c12d58b2..aec5c2175f76c 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -345,8 +345,8 @@ public class QSPanel extends ViewGroup { } for (TileRecord record : mRecords) { - if (record.tileView.getVisibility() == GONE) continue; record.tileView.setDual(record.tile.supportsDualTargets()); + if (record.tileView.getVisibility() == GONE) continue; final int cw = record.row == 0 ? mLargeCellWidth : mCellWidth; final int ch = record.row == 0 ? mLargeCellHeight : mCellHeight; record.tileView.measure(exactly(cw), exactly(ch)); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java index 6975541a48392..409cc461e4e20 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java @@ -286,6 +286,7 @@ public abstract class QSTile implements Listenable { public Drawable icon; public String label; public String contentDescription; + public String dualLabelContentDescription; public boolean copyTo(State other) { if (other == null) throw new IllegalArgumentException(); @@ -294,12 +295,15 @@ public abstract class QSTile implements Listenable { || other.iconId != iconId || !Objects.equals(other.icon, icon) || !Objects.equals(other.label, label) - || !Objects.equals(other.contentDescription, contentDescription); + || !Objects.equals(other.contentDescription, contentDescription) + || !Objects.equals(other.dualLabelContentDescription, + dualLabelContentDescription); other.visible = visible; other.iconId = iconId; other.icon = icon; other.label = label; other.contentDescription = contentDescription; + other.dualLabelContentDescription = dualLabelContentDescription; return changed; } @@ -315,6 +319,7 @@ public abstract class QSTile implements Listenable { sb.append(",icon=").append(icon); sb.append(",label=").append(label); sb.append(",contentDescription=").append(contentDescription); + sb.append(",dualLabelContentDescription=").append(dualLabelContentDescription); return sb.append(']'); } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java index 597bb937b9568..2cc1f07f34ee0 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java @@ -87,6 +87,7 @@ public class QSTileView extends ViewGroup { private void recreateLabel() { CharSequence labelText = null; + CharSequence labelDescription = null; if (mLabel != null) { labelText = mLabel.getText(); removeView(mLabel); @@ -94,6 +95,7 @@ public class QSTileView extends ViewGroup { } if (mDualLabel != null) { labelText = mDualLabel.getText(); + labelDescription = mLabel.getContentDescription(); removeView(mDualLabel); mDualLabel = null; } @@ -113,6 +115,9 @@ public class QSTileView extends ViewGroup { if (labelText != null) { mDualLabel.setText(labelText); } + if (labelDescription != null) { + mDualLabel.setContentDescription(labelDescription); + } addView(mDualLabel); } else { mLabel = new TextView(mContext); @@ -228,6 +233,7 @@ public class QSTileView extends ViewGroup { } if (mDual) { mDualLabel.setText(state.label); + mDualLabel.setContentDescription(state.dualLabelContentDescription); } else { mLabel.setText(state.label); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java index 1b2c0b005a1a7..19b9ec183d949 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java @@ -114,6 +114,12 @@ public class BluetoothTile extends QSTile { } state.contentDescription = mContext.getString( R.string.accessibility_quick_settings_bluetooth, stateContentDescription); + String bluetoothName = state.label; + if (connected) { + bluetoothName = state.dualLabelContentDescription = mContext.getString( + R.string.accessibility_bluetooth_name, state.label); + } + state.dualLabelContentDescription = bluetoothName; } private final BluetoothController.Callback mCallback = new BluetoothController.Callback() { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java index 5651d4933d1d3..a8bf0268d4668 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -132,8 +132,12 @@ public class WifiTile extends QSTile { } state.contentDescription = mContext.getString( R.string.accessibility_quick_settings_wifi, - signalContentDescription, - state.connected ? state.label : ""); + signalContentDescription); + String wifiName = state.label; + if (state.connected) { + wifiName = r.getString(R.string.accessibility_wifi_name, state.label); + } + state.dualLabelContentDescription = wifiName; } private static String removeDoubleQuotes(String string) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index 4e9f37daf9608..15a7047973941 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -602,6 +602,8 @@ public class NetworkControllerImpl extends BroadcastReceiver mPhoneSignalIconId = R.drawable.stat_sys_signal_null; mQSPhoneSignalIconId = R.drawable.ic_qs_signal_no_signal; mDataSignalIconId = R.drawable.stat_sys_signal_null; + mContentDescriptionPhoneSignal = mContext.getString( + AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0]); } else { if (mSignalStrength == null) { if (CHATTY) Log.d(TAG, "updateTelephonySignalStrength: mSignalStrength == null"); @@ -665,8 +667,7 @@ public class NetworkControllerImpl extends BroadcastReceiver mDataIconList = TelephonyIcons.DATA_G[mInetCondition]; mDataTypeIconId = 0; mQSDataTypeIconId = 0; - mContentDescriptionDataType = mContext.getString( - R.string.accessibility_data_connection_gprs); + mContentDescriptionDataType = ""; break; } else { // fall through