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

Commit 0d2ed528 authored by Hiroki Sato's avatar Hiroki Sato Committed by Android (Google) Code Review
Browse files

Merge "Improve window content change events merging from multiple views" into main

parents 91367a7d 331300d5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -15015,6 +15015,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    }
    /** @hide */
    @Nullable
    View getSelfOrParentImportantForA11y() {
        if (isImportantForAccessibility()) return this;
        ViewParent parent = getParentForAccessibility();
+33 −8
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_SANDBOXING_VIEW_B
import static android.view.WindowManagerGlobal.RELAYOUT_RES_CANCEL_AND_REDRAW;
import static android.view.WindowManagerGlobal.RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS;
import static android.view.WindowManagerGlobal.RELAYOUT_RES_SURFACE_CHANGED;
import static android.view.accessibility.Flags.fixMergedContentChangeEvent;
import static android.view.accessibility.Flags.forceInvertColor;
import static android.view.accessibility.Flags.reduceWindowContentChangedEventThrottle;
import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodClientsTraceProto.ClientSideProto.IME_FOCUS_CONTROLLER;
@@ -11509,6 +11510,15 @@ public final class ViewRootImpl implements ViewParent,
                event.setContentChangeTypes(mChangeTypes);
                if (mAction.isPresent()) event.setAction(mAction.getAsInt());
                if (AccessibilityEvent.DEBUG_ORIGIN) event.originStackTrace = mOrigin;
                if (fixMergedContentChangeEvent()) {
                    if ((mChangeTypes & AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE) != 0) {
                        final View importantParent = source.getSelfOrParentImportantForA11y();
                        if (importantParent != null) {
                            source = importantParent;
                        }
                    }
                }
                source.sendAccessibilityEventUnchecked(event);
            } else {
                mLastEventTimeMillis = 0;
@@ -11543,6 +11553,20 @@ public final class ViewRootImpl implements ViewParent,
            }
            if (mSource != null) {
                if (fixMergedContentChangeEvent()) {
                    View newSource = getCommonPredecessor(mSource, source);
                    if (newSource == null) {
                        // If there is no common predecessor, then mSource points to
                        // a removed view, hence in this case always prefer the source.
                        newSource = source;
                    }
                    mChangeTypes |= changeType;
                    if (mSource != newSource) {
                        mChangeTypes |= AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE;
                        mSource = newSource;
                    }
                } else {
                    // If there is no common predecessor, then mSource points to
                    // a removed view, hence in this case always prefer the source.
                    View predecessor = getCommonPredecessor(mSource, source);
@@ -11551,6 +11575,7 @@ public final class ViewRootImpl implements ViewParent,
                    }
                    mSource = (predecessor != null) ? predecessor : source;
                    mChangeTypes |= changeType;
                }
                final int performingAction = mAccessibilityManager.getPerformingAction();
                if (performingAction != 0) {
+7 −0
Original line number Diff line number Diff line
@@ -51,6 +51,13 @@ flag {
    bug: "280130713"
}

flag {
    namespace: "accessibility"
    name: "fix_merged_content_change_event"
    description: "Fixes event type and source of content change event merged in ViewRootImpl"
    bug: "277305460"
}

flag {
    namespace: "accessibility"
    name: "flash_notification_system_api"