Skip to content

Commit 1728c07

Browse files
committed
CheckBox should not populate AccessibilityEvent with text.
1. Accessibility services are the ones that choose how to announces the checked state of a checkable control, so CheckBox should not add strings for its state to access events. 2. Removed some unused accessibility related strings. bug:6241115 Change-Id: I572b961191da4b3537fb6cad529d9764d39161ec
1 parent a379eec commit 1728c07

File tree

3 files changed

+0
-44
lines changed

3 files changed

+0
-44
lines changed

core/java/android/widget/CheckBox.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import android.view.accessibility.AccessibilityEvent;
2222
import android.view.accessibility.AccessibilityNodeInfo;
2323

24-
import com.android.internal.R;
25-
2624

2725
/**
2826
* <p>
@@ -70,16 +68,6 @@ public CheckBox(Context context, AttributeSet attrs, int defStyle) {
7068
super(context, attrs, defStyle);
7169
}
7270

73-
@Override
74-
public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
75-
super.onPopulateAccessibilityEvent(event);
76-
if (isChecked()) {
77-
event.getText().add(mContext.getString(R.string.checkbox_checked));
78-
} else {
79-
event.getText().add(mContext.getString(R.string.checkbox_not_checked));
80-
}
81-
}
82-
8371
@Override
8472
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
8573
super.onInitializeAccessibilityEvent(event);

core/res/res/values/public.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,6 @@
398398
<java-symbol type="string" name="cfTemplateNotForwarded" />
399399
<java-symbol type="string" name="cfTemplateRegistered" />
400400
<java-symbol type="string" name="cfTemplateRegisteredTime" />
401-
<java-symbol type="string" name="checkbox_checked" />
402-
<java-symbol type="string" name="checkbox_not_checked" />
403401
<java-symbol type="string" name="chooseActivity" />
404402
<java-symbol type="string" name="config_default_dns_server" />
405403
<java-symbol type="string" name="config_ethernet_iface_regex" />
@@ -699,8 +697,6 @@
699697
<java-symbol type="string" name="preposition_for_time" />
700698
<java-symbol type="string" name="progress_erasing" />
701699
<java-symbol type="string" name="progress_unmounting" />
702-
<java-symbol type="string" name="radiobutton_not_selected" />
703-
<java-symbol type="string" name="radiobutton_selected" />
704700
<java-symbol type="string" name="relationTypeAssistant" />
705701
<java-symbol type="string" name="relationTypeBrother" />
706702
<java-symbol type="string" name="relationTypeChild" />
@@ -795,8 +791,6 @@
795791
<java-symbol type="string" name="sms_control_title" />
796792
<java-symbol type="string" name="sms_control_yes" />
797793
<java-symbol type="string" name="submit" />
798-
<java-symbol type="string" name="switch_off" />
799-
<java-symbol type="string" name="switch_on" />
800794
<java-symbol type="string" name="sync_binding_label" />
801795
<java-symbol type="string" name="sync_do_nothing" />
802796
<java-symbol type="string" name="sync_really_delete" />
@@ -818,8 +812,6 @@
818812
<java-symbol type="string" name="time_wday" />
819813
<java-symbol type="string" name="time_wday_date" />
820814
<java-symbol type="string" name="today" />
821-
<java-symbol type="string" name="togglebutton_not_pressed" />
822-
<java-symbol type="string" name="togglebutton_pressed" />
823815
<java-symbol type="string" name="tomorrow" />
824816
<java-symbol type="string" name="twelve_hour_time_format" />
825817
<java-symbol type="string" name="twenty_four_hour_time_format" />

core/res/res/values/strings.xml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3231,30 +3231,6 @@
32313231
<!-- Description of the button to decrease the DatePicker's year value. [CHAR LIMIT=NONE] -->
32323232
<string name="date_picker_decrement_year_button">Decrease year</string>
32333233

3234-
<!-- CheckBox - accessibility support -->
3235-
<!-- Description of the checked state of a CheckBox. [CHAR LIMIT=NONE] -->
3236-
<string name="checkbox_checked">checked</string>
3237-
<!-- Description of the not checked state of a CheckBox. [CHAR LIMIT=NONE] -->
3238-
<string name="checkbox_not_checked">not checked</string>
3239-
3240-
<!-- RadioButton/CheckedTextView - accessibility support -->
3241-
<!-- Description of the selected state of a RadioButton. [CHAR LIMIT=NONE] -->
3242-
<string name="radiobutton_selected">selected</string>
3243-
<!-- Description of the not selected state of a RadioButton. [CHAR LIMIT=NONE] -->
3244-
<string name="radiobutton_not_selected">not selected</string>
3245-
3246-
<!-- Switch - accessibility support -->
3247-
<!-- Description of the on state of a Switch. [CHAR LIMIT=NONE] -->
3248-
<string name="switch_on">on</string>
3249-
<!-- Description of the off state of a Switch. [CHAR LIMIT=NONE] -->
3250-
<string name="switch_off">off</string>
3251-
3252-
<!-- ToggleButton - accessibility support -->
3253-
<!-- Description of the pressed state of a ToggleButton. [CHAR LIMIT=NONE] -->
3254-
<string name="togglebutton_pressed">pressed</string>
3255-
<!-- Description of the not pressed state of a ToggleButton. [CHAR LIMIT=NONE] -->
3256-
<string name="togglebutton_not_pressed">not pressed</string>
3257-
32583234
<!-- KeyboardView - accessibility support -->
32593235
<!-- Description of the Alt button in a KeyboardView. [CHAR LIMIT=NONE] -->
32603236
<string name="keyboardview_keycode_alt">Alt</string>

0 commit comments

Comments
 (0)