Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8de93a4 authored by Matías Hernández's avatar Matías Hernández Committed by Automerger Merge Worker
Browse files

Merge "Fix a11y announcements in DND duration dialogs" into tm-qpr-dev am:...

Merge "Fix a11y announcements in DND duration dialogs" into tm-qpr-dev am: 59ec8d18 am: 77b5a8d6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21521305



Change-Id: I93186474d8aa1c1e628affe8c61e7063adf0ea31
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c07813be 77b5a8d6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ android_library {
        "src/**/*.kt",
    ],

    min_sdk_version: "29",
    min_sdk_version: "30",

}

+3 −0
Original line number Diff line number Diff line
@@ -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);
            }
        });

+3 −0
Original line number Diff line number Diff line
@@ -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);
            }
        });

+25 −0
Original line number Diff line number Diff line
@@ -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");
    }
}
 No newline at end of file
+25 −0
Original line number Diff line number Diff line
@@ -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");
    }
}
 No newline at end of file