Loading core/java/android/view/View.java +23 −13 Original line number Diff line number Diff line Loading @@ -1766,6 +1766,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * Indicates that we should awaken scroll bars once attached * * PLEASE NOTE: This flag is now unused as we now send onVisibilityChanged * during window attachment and it is no longer needed. Feel free to repurpose it. * * @hide */ private static final int PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH = 0x08000000; Loading Loading @@ -9524,12 +9527,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ protected void onVisibilityChanged(@NonNull View changedView, @Visibility int visibility) { final boolean visible = visibility == VISIBLE && getVisibility() == VISIBLE; if (visible) { if (mAttachInfo != null) { if (visible && mAttachInfo != null) { initialAwakenScrollBars(); } else { mPrivateFlags |= PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH; } } final Drawable dr = mBackground; Loading Loading @@ -10585,10 +10584,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } else if (mParent != null) { mParent.invalidateChild(this, null); } dispatchVisibilityChanged(this, newVisibility); if (mAttachInfo != null) { dispatchVisibilityChanged(this, newVisibility); notifySubtreeAccessibilityStateChangedIfNeeded(); } } if ((changed & WILL_NOT_CACHE_DRAWING) != 0) { destroyDrawingCache(); Loading Loading @@ -13984,11 +13985,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mParent.requestTransparentRegion(this); } if ((mPrivateFlags & PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) { initialAwakenScrollBars(); mPrivateFlags &= ~PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH; } mPrivateFlags3 &= ~PFLAG3_IS_LAID_OUT; jumpDrawablesToCurrentState(); Loading Loading @@ -14432,6 +14428,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return mAttachInfo != null ? mAttachInfo.mSession : null; } /** * Return the visibility value of the least visible component passed. */ int combineVisibility(int vis1, int vis2) { // This works because VISIBLE < INVISIBLE < GONE. return Math.max(vis1, vis2); } /** * @param info the {@link android.view.View.AttachInfo} to associated with * this view Loading Loading @@ -14473,6 +14477,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if (vis != GONE) { onWindowVisibilityChanged(vis); } // Send onVisibilityChanged directly instead of dispatchVisibilityChanged. // As all views in the subtree will already receive dispatchAttachedToWindow // traversing the subtree again here is not desired. onVisibilityChanged(this, visibility); if ((mPrivateFlags&PFLAG_DRAWABLE_STATE_DIRTY) != 0) { // If nobody has evaluated the drawable state yet, then do it now. refreshDrawableState(); core/java/android/view/ViewGroup.java +3 −2 Original line number Diff line number Diff line Loading @@ -2830,12 +2830,13 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager for (int i = 0; i < count; i++) { final View child = children[i]; child.dispatchAttachedToWindow(info, visibility | (child.mViewFlags & VISIBILITY_MASK)); combineVisibility(visibility, child.getVisibility())); } final int transientCount = mTransientIndices == null ? 0 : mTransientIndices.size(); for (int i = 0; i < transientCount; ++i) { View view = mTransientViews.get(i); view.dispatchAttachedToWindow(info, visibility | (view.mViewFlags & VISIBILITY_MASK)); view.dispatchAttachedToWindow(info, combineVisibility(visibility, view.getVisibility())); } } Loading Loading
core/java/android/view/View.java +23 −13 Original line number Diff line number Diff line Loading @@ -1766,6 +1766,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * Indicates that we should awaken scroll bars once attached * * PLEASE NOTE: This flag is now unused as we now send onVisibilityChanged * during window attachment and it is no longer needed. Feel free to repurpose it. * * @hide */ private static final int PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH = 0x08000000; Loading Loading @@ -9524,12 +9527,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ protected void onVisibilityChanged(@NonNull View changedView, @Visibility int visibility) { final boolean visible = visibility == VISIBLE && getVisibility() == VISIBLE; if (visible) { if (mAttachInfo != null) { if (visible && mAttachInfo != null) { initialAwakenScrollBars(); } else { mPrivateFlags |= PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH; } } final Drawable dr = mBackground; Loading Loading @@ -10585,10 +10584,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } else if (mParent != null) { mParent.invalidateChild(this, null); } dispatchVisibilityChanged(this, newVisibility); if (mAttachInfo != null) { dispatchVisibilityChanged(this, newVisibility); notifySubtreeAccessibilityStateChangedIfNeeded(); } } if ((changed & WILL_NOT_CACHE_DRAWING) != 0) { destroyDrawingCache(); Loading Loading @@ -13984,11 +13985,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mParent.requestTransparentRegion(this); } if ((mPrivateFlags & PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) { initialAwakenScrollBars(); mPrivateFlags &= ~PFLAG_AWAKEN_SCROLL_BARS_ON_ATTACH; } mPrivateFlags3 &= ~PFLAG3_IS_LAID_OUT; jumpDrawablesToCurrentState(); Loading Loading @@ -14432,6 +14428,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return mAttachInfo != null ? mAttachInfo.mSession : null; } /** * Return the visibility value of the least visible component passed. */ int combineVisibility(int vis1, int vis2) { // This works because VISIBLE < INVISIBLE < GONE. return Math.max(vis1, vis2); } /** * @param info the {@link android.view.View.AttachInfo} to associated with * this view Loading Loading @@ -14473,6 +14477,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if (vis != GONE) { onWindowVisibilityChanged(vis); } // Send onVisibilityChanged directly instead of dispatchVisibilityChanged. // As all views in the subtree will already receive dispatchAttachedToWindow // traversing the subtree again here is not desired. onVisibilityChanged(this, visibility); if ((mPrivateFlags&PFLAG_DRAWABLE_STATE_DIRTY) != 0) { // If nobody has evaluated the drawable state yet, then do it now. refreshDrawableState();
core/java/android/view/ViewGroup.java +3 −2 Original line number Diff line number Diff line Loading @@ -2830,12 +2830,13 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager for (int i = 0; i < count; i++) { final View child = children[i]; child.dispatchAttachedToWindow(info, visibility | (child.mViewFlags & VISIBILITY_MASK)); combineVisibility(visibility, child.getVisibility())); } final int transientCount = mTransientIndices == null ? 0 : mTransientIndices.size(); for (int i = 0; i < transientCount; ++i) { View view = mTransientViews.get(i); view.dispatchAttachedToWindow(info, visibility | (view.mViewFlags & VISIBILITY_MASK)); view.dispatchAttachedToWindow(info, combineVisibility(visibility, view.getVisibility())); } } Loading