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

Commit a8ee8ff4 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Android Build Coastguard Worker
Browse files

[Notif] Don't use LIVE_REGION_POLITE for pinned-by-user HUNs.

If a promoted notification updates itself every second, using a
LIVE_REGION_POLITE causes the pinned-by-user HUN to queue accessibility
announcements for every second, since the content has changed.

Fixes: 437277095
Bug: 397507681
Flag: EXEMPT BUGFIX
Test: Trigger a notification with a status bar chip then tap chip ->
verify "Notification shade" is announced but the whole notification
content is not announced
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:406194957d323d1837bf1afc615ff652edc552a4
Merged-In: I853500ee55290f6144909d1081fae8d123b45ae8
Change-Id: I853500ee55290f6144909d1081fae8d123b45ae8
parent b42e2db3
Loading
Loading
Loading
Loading
+0 −19
Original line number Diff line number Diff line
@@ -1352,9 +1352,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        if (intrinsicHeight != getIntrinsicHeight()) {
            notifyHeightChanged(/* needsAnimation= */ false);
        }
        if (!pinnedStatus.isPinned()) {
            setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_NONE);
        }
        if (pinnedStatus.isPinned()) {
            setAnimationRunning(true);
            mExpandedWhenPinned = false;
@@ -3866,12 +3863,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    @Override
    protected void onAppearAnimationStarted(boolean isAppear) {
        mLogger.logAppearAnimationStarted(mLoggingKey, /* isAppear = */ isAppear);

        if (!isAppear) {
            // Stop using a live region as soon as a disappear animation starts so that we don't
            // re-announce the notification as it's animating away.
            setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_NONE);
        }
        super.onAppearAnimationStarted(isAppear);
    }

@@ -3888,16 +3879,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
                /* isAppear = */ wasAppearing,
                /* cancelled = */ cancelled
        );
        if (PromotedNotificationUi.isEnabled()
                && !cancelled
                && wasAppearing
                && mPinnedStatus == PinnedStatus.PinnedByUser) {
            // Announce pinned-by-user HUNs once they're done animating in.
            // For some reason, the default HUN accessibility announcement isn't triggering for
            // pinned-by-user HUNS and we also need a live region for the HUN to be announced.
            // See b/397507681.
            setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE);
        }
        super.onAppearAnimationFinished(wasAppearing, cancelled);
        if (wasAppearing) {
            // During the animation the visible view might have changed, so let's make sure all