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

Commit af980cf5 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Android (Google) Code Review
Browse files

Merge "Move HUN a11y events to view layer; make sure chip HUNs get announced" into main

parents 5dafa9d6 b76f48ff
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -178,6 +178,16 @@ flag {
    }
}

flag {
    name: "notifications_hun_accessibility_refactor"
    namespace: "systemui"
    description: "Refactors where notification HUN accessibility events happen"
    bug: "397507681"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "notifications_hun_shared_animation_values"
    namespace: "systemui"
+3 −0
Original line number Diff line number Diff line
@@ -642,6 +642,9 @@ public final class NotificationEntry extends ListEntry {
    }

    public void sendAccessibilityEvent(int eventType) {
        if (com.android.systemui.Flags.notificationsHunAccessibilityRefactor()) {
            return;
        }
        if (row != null) {
            row.sendAccessibilityEvent(eventType);
        }
+8 −6
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.internal.logging.UiEvent;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.policy.SystemBarUtils;
import com.android.systemui.EventLogTags;
import com.android.systemui.Flags;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -332,8 +333,9 @@ public class HeadsUpManagerImpl
            // Add new entry and begin managing it
            mHeadsUpEntryMap.put(entry.getKey(), headsUpEntry);
            onEntryAdded(headsUpEntry, requestedPinnedStatus);
            // TODO(b/328390331) move accessibility events to the view layer
            if (!Flags.notificationsHunAccessibilityRefactor()) {
                entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
            }
            if (!NotificationBundleUi.isEnabled()) {
                entry.setIsHeadsUpEntry(true);
            }
@@ -408,8 +410,7 @@ public class HeadsUpManagerImpl
            // with the groupmanager
            return;
        }
        // TODO(b/328390331) move accessibility events to the view layer
        if (headsUpEntry.mEntry != null) {
        if (headsUpEntry.mEntry != null && !Flags.notificationsHunAccessibilityRefactor()) {
            headsUpEntry.mEntry.sendAccessibilityEvent(
                    AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        }
@@ -663,8 +664,9 @@ public class HeadsUpManagerImpl
            entry.demoteStickyHun();
            mHeadsUpEntryMap.remove(key);
            onEntryRemoved(finalHeadsUpEntry, reason);
            // TODO(b/328390331) move accessibility events to the view layer
            if (!Flags.notificationsHunAccessibilityRefactor()) {
                entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
            }
            if (NotificationThrottleHun.isEnabled()) {
                finalHeadsUpEntry.cancelAutoRemovalCallbacks("removeEntry");
            } else {
+20 −0
Original line number Diff line number Diff line
@@ -1359,6 +1359,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        if (intrinsicHeight != getIntrinsicHeight()) {
            notifyHeightChanged(/* needsAnimation= */ false);
        }
        if (Flags.notificationsHunAccessibilityRefactor() && !pinnedStatus.isPinned()) {
            setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_NONE);
        }
        if (pinnedStatus.isPinned()) {
            setAnimationRunning(true);
            mExpandedWhenPinned = false;
@@ -3794,6 +3797,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    @Override
    protected void onAppearAnimationStarted(boolean isAppear) {
        mLogger.logAppearAnimationStarted(mLoggingKey, /* isAppear = */ isAppear);

        if (Flags.notificationsHunAccessibilityRefactor() && !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);
    }

@@ -3810,6 +3819,17 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
                /* isAppear = */ wasAppearing,
                /* cancelled = */ cancelled
        );
        if (Flags.notificationsHunAccessibilityRefactor()
                && 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