Skip to content

Commit d8357ce

Browse files
sganovAndroid (Google) Code Review
authored andcommitted
Merge "Sets accessibility importance for the home/up button. Bug: 7196985 Change-Id: I4d27470eccb8933f751db892218a8032a80df3da" into jb-mr1-dev
2 parents b97d876 + 4aeb961 commit d8357ce

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

core/java/com/android/internal/widget/ActionBarView.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -556,12 +556,16 @@ public void setHomeButtonEnabled(boolean enable) {
556556
// Make sure the home button has an accurate content description for accessibility.
557557
if (!enable) {
558558
mHomeLayout.setContentDescription(null);
559-
} else if ((mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
560-
mHomeLayout.setContentDescription(mContext.getResources().getText(
561-
R.string.action_bar_up_description));
559+
mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
562560
} else {
563-
mHomeLayout.setContentDescription(mContext.getResources().getText(
564-
R.string.action_bar_home_description));
561+
mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_AUTO);
562+
if ((mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
563+
mHomeLayout.setContentDescription(mContext.getResources().getText(
564+
R.string.action_bar_up_description));
565+
} else {
566+
mHomeLayout.setContentDescription(mContext.getResources().getText(
567+
R.string.action_bar_home_description));
568+
}
565569
}
566570
}
567571

@@ -624,12 +628,16 @@ public void setDisplayOptions(int options) {
624628
// Make sure the home button has an accurate content description for accessibility.
625629
if (!mHomeLayout.isEnabled()) {
626630
mHomeLayout.setContentDescription(null);
627-
} else if ((options & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
628-
mHomeLayout.setContentDescription(mContext.getResources().getText(
629-
R.string.action_bar_up_description));
631+
mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
630632
} else {
631-
mHomeLayout.setContentDescription(mContext.getResources().getText(
632-
R.string.action_bar_home_description));
633+
mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_AUTO);
634+
if ((options & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
635+
mHomeLayout.setContentDescription(mContext.getResources().getText(
636+
R.string.action_bar_up_description));
637+
} else {
638+
mHomeLayout.setContentDescription(mContext.getResources().getText(
639+
R.string.action_bar_home_description));
640+
}
633641
}
634642
}
635643

0 commit comments

Comments
 (0)