Skip to content

Commit bac221f

Browse files
Accessibility enhancements within quick settings and notification shade.
Change-Id: I377c389abe3ce2285a620e60f4c8de4727f4f5c9 Bug: 7229886
1 parent 847b122 commit bac221f

File tree

9 files changed

+156
-28
lines changed

9 files changed

+156
-28
lines changed

packages/SystemUI/res/values/strings.xml

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,18 @@
256256
<!-- Content description of the data signal when it is full for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
257257
<string name="accessibility_data_signal_full">Data signal full.</string>
258258

259+
<!-- Content description of the WIFI signal when WIFI is disabled for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
260+
<string name="accessibility_wifi_off">Wifi off.</string>
259261
<!-- Content description of the WIFI signal when no signal for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
260-
<string name="accessibility_no_wifi">No Wi-Fi.</string>
262+
<string name="accessibility_no_wifi">Wifi disconnected.</string>
261263
<!-- Content description of the WIFI signal when it is one bar for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
262-
<string name="accessibility_wifi_one_bar">Wi-Fi one bar.</string>
264+
<string name="accessibility_wifi_one_bar">Wifi one bar.</string>
263265
<!-- Content description of the WIFI signal when it is two bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
264-
<string name="accessibility_wifi_two_bars">Wi-Fi two bars.</string>
266+
<string name="accessibility_wifi_two_bars">Wifi two bars.</string>
265267
<!-- Content description of the WIFI signal when it is three bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
266-
<string name="accessibility_wifi_three_bars">Wi-Fi three bars.</string>
268+
<string name="accessibility_wifi_three_bars">Wifi three bars.</string>
267269
<!-- Content description of the WIFI signal when it is full for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
268-
<string name="accessibility_wifi_signal_full">Wi-Fi signal full.</string>
270+
<string name="accessibility_wifi_signal_full">Wifi signal full.</string>
269271

270272
<!-- Content description of the WiMAX signal when no signal for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
271273
<string name="accessibility_no_wimax">No WiMAX.</string>
@@ -278,9 +280,37 @@
278280
<!-- Content description of the WiMAX signal when it is full for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
279281
<string name="accessibility_wimax_signal_full">WiMAX signal full.</string>
280282

283+
<!-- Content description of an item with no signal for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
284+
<string name="accessibility_no_signal">No signal.</string>
285+
<!-- Content description of an item with no signal and no connection for accessibility (not shown on the screen) [CHAR LIMIT=NONE] -->
286+
<string name="accessibility_not_connected">Not connected.</string>
287+
<!-- Content description of an item with zero signal bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
288+
<string name="accessibility_zero_bars">Zero bars.</string>
289+
<!-- Content description of an item with one signal bar for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
290+
<string name="accessibility_one_bar">One bar.</string>
291+
<!-- Content description of an item with two signal bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
292+
<string name="accessibility_two_bars">Two bars.</string>
293+
<!-- Content description of an item with three signal bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
294+
<string name="accessibility_three_bars">Three bars.</string>
295+
<!-- Content description of an item with full signal for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
296+
<string name="accessibility_signal_full">Signal full.</string>
297+
298+
<!-- Content description of an item that is turned on for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
299+
<string name="accessibility_desc_on">On.</string>
300+
<!-- Content description of an item that is turned off for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
301+
<string name="accessibility_desc_off">Off.</string>
302+
<!-- Content description of an item that is connected for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
303+
<string name="accessibility_desc_connected">Connected.</string>
304+
281305
<!-- Content description of the data connection type GPRS for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
282306
<string name="accessibility_data_connection_gprs">GPRS</string>
283307

308+
<!-- Content description of the data connection type 1x for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
309+
<string name="accessibility_data_connection_1x">1 X</string>
310+
311+
<!-- Content description of the data connection type HSPA and its variants for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
312+
<string name="accessibility_data_connection_hspa">HSPA</string>
313+
284314
<!-- Content description of the data connection type 3G for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
285315
<string name="accessibility_data_connection_3g">3G</string>
286316

@@ -293,6 +323,9 @@
293323
<!-- Content description of the data connection type CDMA for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
294324
<string name="accessibility_data_connection_cdma">CDMA</string>
295325

326+
<!-- Content description of the roaming data connection type for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
327+
<string name="accessibility_data_connection_roaming">Roaming</string>
328+
296329
<!-- Content description of the data connection type Edge for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
297330
<string name="accessibility_data_connection_edge">Edge</string>
298331

@@ -337,6 +370,28 @@
337370

338371
<!-- Content description to tell the user an application has been removed from recents -->
339372
<string name="accessibility_recents_item_dismissed"><xliff:g id="app" example="Calendar">%s</xliff:g> dismissed.</string>
373+
<!-- Content description to tell the user a notification has been removed from the notification shade -->
374+
<string name="accessibility_notification_dismissed">Notification dismissed.</string>
375+
376+
<!-- Content description for the notification shade panel (not shown on the screen). [CHAR LIMIT=NONE] -->
377+
<string name="accessibility_desc_notification_shade">Notification shade.</string>
378+
<!-- Content description for the quick settings panel (not shown on the screen). [CHAR LIMIT=NONE] -->
379+
<string name="accessibility_desc_quick_settings">Quick settings.</string>
380+
381+
<!-- Content description of the user tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] -->
382+
<string name="accessibility_quick_settings_user">User <xliff:g id="user" example="John Doe">%s</xliff:g>.</string>
383+
<!-- Content description of the wifi tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] -->
384+
<string name="accessibility_quick_settings_wifi"><xliff:g id="signal" example="Three bars">%1$s</xliff:g>. <xliff:g id="network" example="MyWifiNetwork">%2$s</xliff:g></string>
385+
<!-- Content description of the mobile data tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] -->
386+
<string name="accessibility_quick_settings_mobile">Mobile <xliff:g id="signal" example="Three bars">%1$s</xliff:g>. <xliff:g id="type" example="4G">%2$s</xliff:g>. <xliff:g id="network" example="T-Mobile">%3$s</xliff:g>.</string>
387+
<!-- Content description of the battery tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] -->
388+
<string name="accessibility_quick_settings_battery">Battery <xliff:g id="state" example="50% charging">%s</xliff:g>.</string>
389+
<!-- Content description of the airplane mode tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] -->
390+
<string name="accessibility_quick_settings_airplane">Airplane Mode <xliff:g id="state" example="Off">%s</xliff:g>.</string>
391+
<!-- Content description of the bluetooth tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] -->
392+
<string name="accessibility_quick_settings_bluetooth">Bluetooth <xliff:g id="state" example="Off">%s</xliff:g>.</string>
393+
<!-- Content description of the alarm tile in quick settings (not shown on the screen). [CHAR LIMIT=NONE] -->
394+
<string name="accessibility_quick_settings_alarm">Alarm set for <xliff:g id="time" example="Wed 3:30 PM">%s</xliff:g>.</string>
340395

341396
<!-- Title of dialog shown when 2G-3G data usage has exceeded limit and has been disabled. [CHAR LIMIT=48] -->
342397
<string name="data_usage_disabled_dialog_3g_title">2G-3G data disabled</string>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,12 @@ protected View updateNotificationVetoButton(View row, StatusBarNotification n) {
301301
final int _id = n.id;
302302
vetoButton.setOnClickListener(new View.OnClickListener() {
303303
public void onClick(View v) {
304+
// Accessibility feedback
305+
v.announceForAccessibility(
306+
mContext.getString(R.string.accessibility_notification_dismissed));
304307
try {
305308
mBarService.onNotificationClear(_pkg, _tag, _id);
309+
306310
} catch (RemoteException ex) {
307311
// system process is dead if we're here.
308312
}
@@ -312,6 +316,7 @@ public void onClick(View v) {
312316
} else {
313317
vetoButton.setVisibility(View.GONE);
314318
}
319+
vetoButton.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
315320
return vetoButton;
316321
}
317322

packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ protected void onFinishInflate() {
4444
mHandleBar = resources.getDrawable(R.drawable.status_bar_close);
4545
mHandleBarHeight = resources.getDimension(R.dimen.close_handle_height);
4646
mHandleView = findViewById(R.id.handle);
47+
48+
setContentDescription(resources.getString(R.string.accessibility_desc_notification_shade));
4749
}
4850

4951
@Override

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class PhoneStatusBarView extends PanelBar {
3939

4040
boolean mFullWidthNotifications;
4141
PanelView mFadingPanel = null;
42+
PanelView mLastFullyOpenedPanel = null;
4243
PanelView mNotificationPanel, mSettingsPanel;
4344
private boolean mShouldFade;
4445

@@ -145,12 +146,17 @@ public void onAllPanelsCollapsed() {
145146
super.onAllPanelsCollapsed();
146147
mBar.makeExpandedInvisible();
147148
mFadingPanel = null;
149+
mLastFullyOpenedPanel = null;
148150
}
149151

150152
@Override
151153
public void onPanelFullyOpened(PanelView openPanel) {
152154
super.onPanelFullyOpened(openPanel);
155+
if (openPanel != mLastFullyOpenedPanel) {
156+
openPanel.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
157+
}
153158
mFadingPanel = openPanel;
159+
mLastFullyOpenedPanel = openPanel;
154160
mShouldFade = true; // now you own the fade, mister
155161
}
156162

packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
import com.android.internal.view.RotationPolicy;
2020
import com.android.internal.widget.LockPatternUtils;
2121
import com.android.systemui.R;
22+
23+
import com.android.systemui.statusbar.phone.QuickSettingsModel.BluetoothState;
2224
import com.android.systemui.statusbar.phone.QuickSettingsModel.RSSIState;
2325
import com.android.systemui.statusbar.phone.QuickSettingsModel.State;
2426
import com.android.systemui.statusbar.phone.QuickSettingsModel.UserState;
27+
import com.android.systemui.statusbar.phone.QuickSettingsModel.WifiState;
2528
import com.android.systemui.statusbar.policy.BatteryController;
2629
import com.android.systemui.statusbar.policy.BluetoothController;
2730
import com.android.systemui.statusbar.policy.BrightnessController;
@@ -90,7 +93,7 @@ class QuickSettings {
9093
private DisplayManager mDisplayManager;
9194
private WifiDisplayStatus mWifiDisplayStatus;
9295
private PhoneStatusBar mStatusBarService;
93-
private QuickSettingsModel.BluetoothState mBluetoothState;
96+
private BluetoothState mBluetoothState;
9497

9598
private BrightnessController mBrightnessController;
9699
private BluetoothController mBluetoothController;
@@ -305,6 +308,8 @@ public void refreshView(QuickSettingsTileView view, State state) {
305308
if (us.avatar != null) {
306309
iv.setImageDrawable(us.avatar);
307310
}
311+
view.setContentDescription(mContext.getString(
312+
R.string.accessibility_quick_settings_user, state.label));
308313
}
309314
});
310315
parent.addView(userTile);
@@ -363,9 +368,14 @@ public void onClick(View v) {
363368
mModel.addWifiTile(wifiTile, new QuickSettingsModel.RefreshCallback() {
364369
@Override
365370
public void refreshView(QuickSettingsTileView view, State state) {
371+
WifiState wifiState = (WifiState) state;
366372
TextView tv = (TextView) view.findViewById(R.id.wifi_textview);
367-
tv.setCompoundDrawablesWithIntrinsicBounds(0, state.iconId, 0, 0);
368-
tv.setText(state.label);
373+
tv.setCompoundDrawablesWithIntrinsicBounds(0, wifiState.iconId, 0, 0);
374+
tv.setText(wifiState.label);
375+
view.setContentDescription(mContext.getString(
376+
R.string.accessibility_quick_settings_wifi,
377+
wifiState.signalContentDescription,
378+
(wifiState.connected) ? wifiState.label : ""));
369379
}
370380
});
371381
parent.addView(wifiTile);
@@ -393,12 +403,17 @@ public void refreshView(QuickSettingsTileView view, State state) {
393403
ImageView iov = (ImageView) view.findViewById(R.id.rssi_overlay_image);
394404
TextView tv = (TextView) view.findViewById(R.id.rssi_textview);
395405
iv.setImageResource(rssiState.signalIconId);
406+
396407
if (rssiState.dataTypeIconId > 0) {
397408
iov.setImageResource(rssiState.dataTypeIconId);
398409
} else {
399410
iov.setImageDrawable(null);
400411
}
401412
tv.setText(state.label);
413+
view.setContentDescription(mContext.getResources().getString(
414+
R.string.accessibility_quick_settings_mobile,
415+
rssiState.signalContentDescription, rssiState.dataContentDescription,
416+
state.label));
402417
}
403418
});
404419
parent.addView(rssiTile);
@@ -460,6 +475,8 @@ public void refreshView(QuickSettingsTileView view, State state) {
460475
iv.setImageDrawable(d);
461476
iv.setImageLevel(batteryState.batteryLevel);
462477
tv.setText(t);
478+
view.setContentDescription(
479+
mContext.getString(R.string.accessibility_quick_settings_battery, t));
463480
}
464481
});
465482
parent.addView(batteryTile);
@@ -473,6 +490,12 @@ public void refreshView(QuickSettingsTileView view, State state) {
473490
public void refreshView(QuickSettingsTileView view, State state) {
474491
TextView tv = (TextView) view.findViewById(R.id.airplane_mode_textview);
475492
tv.setCompoundDrawablesWithIntrinsicBounds(0, state.iconId, 0, 0);
493+
494+
String airplaneState = mContext.getString(
495+
(state.enabled) ? R.string.accessibility_desc_on
496+
: R.string.accessibility_desc_off);
497+
view.setContentDescription(
498+
mContext.getString(R.string.accessibility_quick_settings_airplane, airplaneState));
476499
tv.setText(state.label);
477500
}
478501
});
@@ -492,6 +515,7 @@ public void onClick(View v) {
492515
mModel.addBluetoothTile(bluetoothTile, new QuickSettingsModel.RefreshCallback() {
493516
@Override
494517
public void refreshView(QuickSettingsTileView view, State state) {
518+
BluetoothState bluetoothState = (BluetoothState) state;
495519
TextView tv = (TextView) view.findViewById(R.id.bluetooth_textview);
496520
tv.setCompoundDrawablesWithIntrinsicBounds(0, state.iconId, 0, 0);
497521

@@ -510,6 +534,9 @@ public void refreshView(QuickSettingsTileView view, State state) {
510534
btDevices.size());
511535
}
512536
*/
537+
view.setContentDescription(mContext.getString(
538+
R.string.accessibility_quick_settings_bluetooth,
539+
bluetoothState.stateContentDescription));
513540
tv.setText(label);
514541
}
515542
});
@@ -561,6 +588,8 @@ public void refreshView(QuickSettingsTileView view, State alarmState) {
561588
TextView tv = (TextView) view.findViewById(R.id.alarm_textview);
562589
tv.setText(alarmState.label);
563590
view.setVisibility(alarmState.enabled ? View.VISIBLE : View.GONE);
591+
view.setContentDescription(mContext.getString(
592+
R.string.accessibility_quick_settings_alarm, alarmState.label));
564593
}
565594
});
566595
parent.addView(alarmTile);
@@ -697,7 +726,7 @@ void updateResources() {
697726
showBrightnessDialog();
698727
}
699728
}
700-
729+
701730
private void removeAllBrightnessDialogCallbacks() {
702731
mHandler.removeCallbacks(mDismissBrightnessDialogRunnable);
703732
}
@@ -717,7 +746,7 @@ private void showBrightnessDialog() {
717746
mBrightnessDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
718747
mBrightnessDialog.setContentView(R.layout.quick_settings_brightness_dialog);
719748
mBrightnessDialog.setCanceledOnTouchOutside(true);
720-
749+
721750
mBrightnessController = new BrightnessController(mContext,
722751
(ToggleSlider) mBrightnessDialog.findViewById(R.id.brightness_slider));
723752
mBrightnessController.addStateChangedCallback(mModel);
@@ -727,7 +756,7 @@ public void onDismiss(DialogInterface dialog) {
727756
mBrightnessController = null;
728757
}
729758
});
730-
759+
731760
mBrightnessDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
732761
mBrightnessDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
733762
}
@@ -831,6 +860,7 @@ public void onReceive(Context context, Intent intent) {
831860
Log.e(TAG, "Couldn't get current user id for profile change", e);
832861
}
833862
}
863+
834864
}
835865
};
836866
}

0 commit comments

Comments
 (0)