Loading core/java/android/view/View.java +15 −2 Original line number Original line Diff line number Diff line Loading @@ -13240,6 +13240,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)) { /* /* Loading Loading @@ -13304,7 +13307,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) { Loading Loading @@ -13332,7 +13340,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(); } } } } core/java/android/view/ViewGroup.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -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 { Loading Loading
core/java/android/view/View.java +15 −2 Original line number Original line Diff line number Diff line Loading @@ -13240,6 +13240,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)) { /* /* Loading Loading @@ -13304,7 +13307,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) { Loading Loading @@ -13332,7 +13340,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(); } } } }
core/java/android/view/ViewGroup.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -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 { Loading