Merge "Fix a11y announcements in DND duration dialogs" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
59ec8d18ee
@@ -65,7 +65,7 @@ android_library {
|
||||
"src/**/*.kt",
|
||||
],
|
||||
|
||||
min_sdk_version: "29",
|
||||
min_sdk_version: "30",
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -224,6 +224,9 @@ public class EnableZenModeDialog {
|
||||
mMetricsLogger.logOnConditionSelected();
|
||||
updateAlarmWarningText(tag.condition);
|
||||
}
|
||||
tag.line1.setStateDescription(
|
||||
isChecked ? buttonView.getContext().getString(
|
||||
com.android.internal.R.string.selected) : null);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -196,6 +196,9 @@ public class ZenDurationDialog {
|
||||
if (isChecked) {
|
||||
tag.rb.setChecked(true);
|
||||
}
|
||||
tag.line1.setStateDescription(
|
||||
isChecked ? buttonView.getContext().getString(
|
||||
com.android.internal.R.string.selected) : null);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settingslib.notification;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
@@ -78,6 +80,8 @@ public class EnableZenModeDialogTest {
|
||||
mController.mForeverId = Condition.newId(mContext).appendPath("forever").build();
|
||||
when(mContext.getString(com.android.internal.R.string.zen_mode_forever))
|
||||
.thenReturn("testSummary");
|
||||
when(mContext.getString(com.android.internal.R.string.selected))
|
||||
.thenReturn("selected");
|
||||
NotificationManager.Policy alarmsEnabledPolicy = new NotificationManager.Policy(
|
||||
NotificationManager.Policy.PRIORITY_CATEGORY_ALARMS, 0, 0, 0);
|
||||
doReturn(alarmsEnabledPolicy).when(mNotificationManager).getNotificationPolicy();
|
||||
@@ -190,4 +194,25 @@ public class EnableZenModeDialogTest {
|
||||
// alarm warning should NOT be null
|
||||
assertNotNull(mController.computeAlarmWarningText(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAccessibility() {
|
||||
mController.bindConditions(null);
|
||||
EnableZenModeDialog.ConditionTag forever = mController.getConditionTagAt(
|
||||
ZenDurationDialog.FOREVER_CONDITION_INDEX);
|
||||
EnableZenModeDialog.ConditionTag countdown = mController.getConditionTagAt(
|
||||
ZenDurationDialog.COUNTDOWN_CONDITION_INDEX);
|
||||
EnableZenModeDialog.ConditionTag alwaysAsk = mController.getConditionTagAt(
|
||||
ZenDurationDialog.ALWAYS_ASK_CONDITION_INDEX);
|
||||
|
||||
forever.rb.setChecked(true);
|
||||
assertThat(forever.line1.getStateDescription().toString()).isEqualTo("selected");
|
||||
assertThat(countdown.line1.getStateDescription()).isNull();
|
||||
assertThat(alwaysAsk.line1.getStateDescription()).isNull();
|
||||
|
||||
alwaysAsk.rb.setChecked(true);
|
||||
assertThat(forever.line1.getStateDescription()).isNull();
|
||||
assertThat(countdown.line1.getStateDescription()).isNull();
|
||||
assertThat(alwaysAsk.line1.getStateDescription().toString()).isEqualTo("selected");
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settingslib.notification;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
@@ -205,4 +207,27 @@ public class ZenDurationDialogTest {
|
||||
ZenDurationDialog.COUNTDOWN_CONDITION_INDEX);
|
||||
assertEquals(120, tag.countdownZenDuration);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAccessibility() {
|
||||
Settings.Secure.putInt(mContentResolver, Settings.Secure.ZEN_DURATION,
|
||||
Settings.Secure.ZEN_DURATION_FOREVER);
|
||||
mController.setupDialog(mBuilder);
|
||||
ZenDurationDialog.ConditionTag forever = mController.getConditionTagAt(
|
||||
ZenDurationDialog.FOREVER_CONDITION_INDEX);
|
||||
ZenDurationDialog.ConditionTag countdown = mController.getConditionTagAt(
|
||||
ZenDurationDialog.COUNTDOWN_CONDITION_INDEX);
|
||||
ZenDurationDialog.ConditionTag alwaysAsk = mController.getConditionTagAt(
|
||||
ZenDurationDialog.ALWAYS_ASK_CONDITION_INDEX);
|
||||
|
||||
forever.rb.setChecked(true);
|
||||
assertThat(forever.line1.getStateDescription().toString()).isEqualTo("selected");
|
||||
assertThat(countdown.line1.getStateDescription()).isNull();
|
||||
assertThat(alwaysAsk.line1.getStateDescription()).isNull();
|
||||
|
||||
alwaysAsk.rb.setChecked(true);
|
||||
assertThat(forever.line1.getStateDescription()).isNull();
|
||||
assertThat(countdown.line1.getStateDescription()).isNull();
|
||||
assertThat(alwaysAsk.line1.getStateDescription().toString()).isEqualTo("selected");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user