Skip to content

Commit 58d807f

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge "Fix contentDescriptions in status bar."
2 parents b11d09c + bcf6ef0 commit 58d807f

File tree

5 files changed

+33
-13
lines changed

5 files changed

+33
-13
lines changed

packages/SystemUI/res/layout-sw600dp/status_bar_notification_panel.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
android:paddingRight="15dp"
3535
android:src="@drawable/ic_notify_clear"
3636
android:visibility="invisible"
37+
android:contentDescription="@string/accessibility_clear_all"
3738
/>
3839

3940
<RelativeLayout

packages/SystemUI/res/layout/status_bar_expanded.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
android:paddingLeft="8dp"
6666
android:paddingRight="8dp"
6767
android:src="@drawable/ic_notify_quicksettings"
68+
android:contentDescription="@string/accessibility_settings_button"
6869
/>
6970

7071
<ImageView android:id="@+id/clear_all_button"
@@ -74,6 +75,7 @@
7475
android:paddingLeft="8dp"
7576
android:paddingRight="8dp"
7677
android:src="@drawable/ic_notify_clear"
78+
android:contentDescription="@string/accessibility_clear_all"
7779
/>
7880
</RelativeLayout>
7981

packages/SystemUI/res/values/strings.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,13 @@
282282
<string name="accessibility_battery_level">Battery <xliff:g id="number">%d</xliff:g> percent.</string>
283283

284284
<!-- Content description of the button for showing a settings panel in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
285-
<string name="accessibility_settings_button">Settings button.</string>
285+
<string name="accessibility_settings_button">System settings.</string>
286286

287287
<!-- Content description of the button for showing a notifications panel in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
288-
<string name="accessibility_notifications_button">Notifications button.</string>
288+
<string name="accessibility_notifications_button">Notifications.</string>
289289

290290
<!-- Content description of the button for removing a notification in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
291-
<string name="accessibility_remove_notification">Remove notification.</string>
291+
<string name="accessibility_remove_notification">Clear notification.</string>
292292

293293
<!-- Content description of the enabled GPS icon in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
294294
<string name="accessibility_gps_enabled">GPS enabled.</string>
@@ -336,4 +336,6 @@
336336
<!-- Notification text: when GPS has found a fix [CHAR LIMIT=50] -->
337337
<string name="gps_notification_found_text">Location set by GPS</string>
338338

339+
<!-- Content description of the clear button in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
340+
<string name="accessibility_clear_all">Clear all notifications.</string>
339341
</resources>

packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class SignalClusterView
4444
private boolean mMobileVisible = false;
4545
private int mMobileStrengthId = 0, mMobileActivityId = 0, mMobileTypeId = 0;
4646
private boolean mIsAirplaneMode = false;
47+
private String mWifiDescription, mMobileDescription, mMobileTypeDescription;
4748

4849
ViewGroup mWifiGroup, mMobileGroup;
4950
ImageView mWifi, mMobile, mWifiActivity, mMobileActivity, mMobileType;
@@ -95,20 +96,24 @@ protected void onDetachedFromWindow() {
9596
super.onDetachedFromWindow();
9697
}
9798

98-
public void setWifiIndicators(boolean visible, int strengthIcon, int activityIcon) {
99+
public void setWifiIndicators(boolean visible, int strengthIcon, int activityIcon,
100+
String contentDescription) {
99101
mWifiVisible = visible;
100102
mWifiStrengthId = strengthIcon;
101103
mWifiActivityId = activityIcon;
104+
mWifiDescription = contentDescription;
102105

103106
apply();
104107
}
105108

106109
public void setMobileDataIndicators(boolean visible, int strengthIcon, int activityIcon,
107-
int typeIcon) {
110+
int typeIcon, String contentDescription, String typeContentDescription) {
108111
mMobileVisible = visible;
109112
mMobileStrengthId = strengthIcon;
110113
mMobileActivityId = activityIcon;
111114
mMobileTypeId = typeIcon;
115+
mMobileDescription = contentDescription;
116+
mMobileTypeDescription = typeContentDescription;
112117

113118
apply();
114119
}
@@ -125,6 +130,7 @@ private void apply() {
125130
mWifiGroup.setVisibility(View.VISIBLE);
126131
mWifi.setImageResource(mWifiStrengthId);
127132
mWifiActivity.setImageResource(mWifiActivityId);
133+
mWifiGroup.setContentDescription(mWifiDescription);
128134
} else {
129135
mWifiGroup.setVisibility(View.GONE);
130136
}
@@ -139,6 +145,7 @@ private void apply() {
139145
mMobile.setImageResource(mMobileStrengthId);
140146
mMobileActivity.setImageResource(mMobileActivityId);
141147
mMobileType.setImageResource(mMobileTypeId);
148+
mMobileGroup.setContentDescription(mMobileTypeDescription + " " + mMobileDescription);
142149
} else {
143150
mMobileGroup.setVisibility(View.GONE);
144151
}

packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,10 @@ public class NetworkController extends BroadcastReceiver {
139139
IBatteryStats mBatteryStats;
140140

141141
public interface SignalCluster {
142-
void setWifiIndicators(boolean visible, int strengthIcon, int activityIcon);
142+
void setWifiIndicators(boolean visible, int strengthIcon, int activityIcon,
143+
String contentDescription);
143144
void setMobileDataIndicators(boolean visible, int strengthIcon, int activityIcon,
144-
int typeIcon);
145+
int typeIcon, String contentDescription, String typeContentDescription);
145146
void setIsAirplaneMode(boolean is);
146147
}
147148

@@ -235,12 +236,16 @@ public void addSignalCluster(SignalCluster cluster) {
235236
cluster.setWifiIndicators(
236237
mWifiConnected, // only show wifi in the cluster if connected
237238
mWifiIconId,
238-
mWifiActivityIconId);
239+
mWifiActivityIconId,
240+
mContentDescriptionWifi);
239241
cluster.setMobileDataIndicators(
240242
mHasMobileDataFeature,
241243
mPhoneSignalIconId,
242244
mMobileActivityIconId,
243-
mDataTypeIconId);
245+
mDataTypeIconId,
246+
mContentDescriptionPhoneSignal,
247+
mContentDescriptionDataType);
248+
244249
}
245250

246251
public void setStackedMode(boolean stacked) {
@@ -807,8 +812,8 @@ void refreshViews() {
807812
(mServiceState == null || (!hasService() && !mServiceState.isEmergencyOnly()))) {
808813
// Only display the flight-mode icon if not in "emergency calls only" mode.
809814
label = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
810-
mContentDescriptionCombinedSignal = mContext.getString(
811-
R.string.accessibility_airplane_mode);
815+
mContentDescriptionCombinedSignal = mContentDescriptionPhoneSignal
816+
= mContext.getString(R.string.accessibility_airplane_mode);
812817

813818
// look again; your radios are now airplanes
814819
mPhoneSignalIconId = mDataSignalIconId = R.drawable.stat_sys_signal_flightmode;
@@ -863,12 +868,15 @@ else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered) {
863868
cluster.setWifiIndicators(
864869
mWifiConnected, // only show wifi in the cluster if connected
865870
mWifiIconId,
866-
mWifiActivityIconId);
871+
mWifiActivityIconId,
872+
mContentDescriptionWifi);
867873
cluster.setMobileDataIndicators(
868874
mHasMobileDataFeature,
869875
mPhoneSignalIconId,
870876
mMobileActivityIconId,
871-
mDataTypeIconId);
877+
mDataTypeIconId,
878+
mContentDescriptionPhoneSignal,
879+
mContentDescriptionDataType);
872880
cluster.setIsAirplaneMode(mAirplaneMode);
873881
}
874882
}

0 commit comments

Comments
 (0)