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

Commit 2af60378 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Clear focused-in-cluster on focusability changes" into...

Merge "Merge "Clear focused-in-cluster on focusability changes" into oc-mr1-dev am: 102520f8" into oc-mr1-dev-plus-aosp
parents 77effe95 9a2bebcd
Loading
Loading
Loading
Loading
+15 −2
Original line number Original line Diff line number Diff line
@@ -13249,6 +13249,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                    && ((privateFlags & PFLAG_FOCUSED) != 0)) {
                    && ((privateFlags & PFLAG_FOCUSED) != 0)) {
                /* Give up focus if we are no longer focusable */
                /* Give up focus if we are no longer focusable */
                clearFocus();
                clearFocus();
                if (mParent instanceof ViewGroup) {
                    ((ViewGroup) mParent).clearFocusedInCluster();
                }
            } else if (((old & FOCUSABLE) == NOT_FOCUSABLE)
            } else if (((old & FOCUSABLE) == NOT_FOCUSABLE)
                    && ((privateFlags & PFLAG_FOCUSED) == 0)) {
                    && ((privateFlags & PFLAG_FOCUSED) == 0)) {
                /*
                /*
@@ -13296,7 +13299,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            requestLayout();
            requestLayout();
            if (((mViewFlags & VISIBILITY_MASK) == GONE)) {
            if (((mViewFlags & VISIBILITY_MASK) == GONE)) {
                if (hasFocus()) clearFocus();
                if (hasFocus()) {
                    clearFocus();
                    if (mParent instanceof ViewGroup) {
                        ((ViewGroup) mParent).clearFocusedInCluster();
                    }
                }
                clearAccessibilityFocus();
                clearAccessibilityFocus();
                destroyDrawingCache();
                destroyDrawingCache();
                if (mParent instanceof View) {
                if (mParent instanceof View) {
@@ -13324,7 +13332,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            if (((mViewFlags & VISIBILITY_MASK) == INVISIBLE)) {
            if (((mViewFlags & VISIBILITY_MASK) == INVISIBLE)) {
                // root view becoming invisible shouldn't clear focus and accessibility focus
                // root view becoming invisible shouldn't clear focus and accessibility focus
                if (getRootView() != this) {
                if (getRootView() != this) {
                    if (hasFocus()) clearFocus();
                    if (hasFocus()) {
                        clearFocus();
                        if (mParent instanceof ViewGroup) {
                            ((ViewGroup) mParent).clearFocusedInCluster();
                        }
                    }
                    clearAccessibilityFocus();
                    clearAccessibilityFocus();
                }
                }
            }
            }
+7 −0
Original line number Original line Diff line number Diff line
@@ -818,6 +818,13 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        if (mFocusedInCluster != child) {
        if (mFocusedInCluster != child) {
            return;
            return;
        }
        }
        clearFocusedInCluster();
    }

    /**
     * Removes the focusedInCluster chain from this up to the cluster containing it.
     */
    void clearFocusedInCluster() {
        View top = findKeyboardNavigationCluster();
        View top = findKeyboardNavigationCluster();
        ViewParent parent = this;
        ViewParent parent = this;
        do {
        do {