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

Commit 504a10f2 authored by Adam Powell's avatar Adam Powell
Browse files

Un-hide all ViewParent methods

Make it possible for code outside the framework to implement the
ViewParent interface.

Change-Id: Ic1b4eb15a4b3da1d16c92b59e039d89861d893e4
parent 713412fd
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -26541,6 +26541,9 @@ package android.view {
    method public void buildDrawingCache(boolean);
    method public void buildLayer();
    method public boolean callOnClick();
    method public boolean canResolveLayoutDirection();
    method public boolean canResolveTextAlignment();
    method public boolean canResolveTextDirection();
    method public boolean canScrollHorizontally(int);
    method public boolean canScrollVertically(int);
    method public void cancelLongPress();
@@ -26745,6 +26748,7 @@ package android.view {
    method public boolean isInEditMode();
    method public boolean isInLayout();
    method public boolean isInTouchMode();
    method public boolean isLayoutDirectionResolved();
    method public boolean isLayoutRequested();
    method public boolean isLongClickable();
    method public boolean isOpaque();
@@ -26758,6 +26762,8 @@ package android.view {
    method public boolean isSelected();
    method public boolean isShown();
    method public boolean isSoundEffectsEnabled();
    method public boolean isTextAlignmentResolved();
    method public boolean isTextDirectionResolved();
    method public boolean isVerticalFadingEdgeEnabled();
    method public boolean isVerticalScrollBarEnabled();
    method public void jumpDrawablesToCurrentState();
@@ -27261,7 +27267,9 @@ package android.view {
    method public void bringChildToFront(android.view.View);
    method protected boolean canAnimate();
    method protected boolean checkLayoutParams(android.view.ViewGroup.LayoutParams);
    method public void childAccessibilityStateChanged(android.view.View);
    method public void childDrawableStateChanged(android.view.View);
    method public void childHasTransientStateChanged(android.view.View, boolean);
    method protected void cleanupLayoutState(android.view.View);
    method public void clearChildFocus(android.view.View);
    method public void clearDisappearingChildren();
@@ -27422,17 +27430,28 @@ package android.view {
  public abstract interface ViewParent {
    method public abstract void bringChildToFront(android.view.View);
    method public abstract boolean canResolveLayoutDirection();
    method public abstract boolean canResolveTextAlignment();
    method public abstract boolean canResolveTextDirection();
    method public abstract void childAccessibilityStateChanged(android.view.View);
    method public abstract void childDrawableStateChanged(android.view.View);
    method public abstract void childHasTransientStateChanged(android.view.View, boolean);
    method public abstract void clearChildFocus(android.view.View);
    method public abstract void createContextMenu(android.view.ContextMenu);
    method public abstract android.view.View focusSearch(android.view.View, int);
    method public abstract void focusableViewAvailable(android.view.View);
    method public abstract boolean getChildVisibleRect(android.view.View, android.graphics.Rect, android.graphics.Point);
    method public abstract int getLayoutDirection();
    method public abstract android.view.ViewParent getParent();
    method public abstract android.view.ViewParent getParentForAccessibility();
    method public abstract int getTextAlignment();
    method public abstract int getTextDirection();
    method public abstract void invalidateChild(android.view.View, android.graphics.Rect);
    method public abstract android.view.ViewParent invalidateChildInParent(int[], android.graphics.Rect);
    method public abstract boolean isLayoutDirectionResolved();
    method public abstract boolean isLayoutRequested();
    method public abstract boolean isTextAlignmentResolved();
    method public abstract boolean isTextDirectionResolved();
    method public abstract void recomputeViewAttributes(android.view.View);
    method public abstract void requestChildFocus(android.view.View, android.view.View);
    method public abstract boolean requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean);
+78 −28
Original line number Diff line number Diff line
@@ -7051,7 +7051,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        if ((mPrivateFlags2 & PFLAG2_SUBTREE_ACCESSIBILITY_STATE_CHANGED) == 0) {
            mPrivateFlags2 |= PFLAG2_SUBTREE_ACCESSIBILITY_STATE_CHANGED;
            if (mParent != null) {
                try {
                    mParent.childAccessibilityStateChanged(this);
                } catch (AbstractMethodError e) {
                    Log.e(VIEW_LOG_TAG, mParent.getClass().getSimpleName() +
                            " does not fully implement ViewParent", e);
                }
            }
        }
    }
@@ -11944,11 +11949,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                    if (!canResolveLayoutDirection()) return false;
                    // Parent has not yet resolved, LTR is still the default
                    try {
                        if (!mParent.isLayoutDirectionResolved()) return false;
                        if (mParent.getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
                            mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
                        }
                    } catch (AbstractMethodError e) {
                        Log.e(VIEW_LOG_TAG, mParent.getClass().getSimpleName() +
                                " does not fully implement ViewParent", e);
                    }
                    break;
                case LAYOUT_DIRECTION_RTL:
                    mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
@@ -11973,13 +11983,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * Check if layout direction resolution can be done.
     *
     * @return true if layout direction resolution can be done otherwise return false.
     *
     * @hide
     */
    public boolean canResolveLayoutDirection() {
        switch (getRawLayoutDirection()) {
            case LAYOUT_DIRECTION_INHERIT:
                return (mParent != null) && mParent.canResolveLayoutDirection();
                if (mParent != null) {
                    try {
                        return mParent.canResolveLayoutDirection();
                    } catch (AbstractMethodError e) {
                        Log.e(VIEW_LOG_TAG, mParent.getClass().getSimpleName() +
                                " does not fully implement ViewParent", e);
                    }
                }
                return false;
            default:
                return true;
        }
@@ -12007,7 +12024,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    /**
     * @return true if layout direction has been resolved.
     * @hide
     */
    public boolean isLayoutDirectionResolved() {
        return (mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED) == PFLAG2_LAYOUT_DIRECTION_RESOLVED;
@@ -17181,14 +17197,26 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                    }
                    // Parent has not yet resolved, so we still return the default
                    try {
                        if (!mParent.isTextDirectionResolved()) {
                            mPrivateFlags2 |= PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
                            // Resolution will need to happen again later
                            return false;
                        }
                    } catch (AbstractMethodError e) {
                        Log.e(VIEW_LOG_TAG, mParent.getClass().getSimpleName() +
                                " does not fully implement ViewParent", e);
                    }
                    // Set current resolved direction to the same value as the parent's one
                    final int parentResolvedDirection = mParent.getTextDirection();
                    int parentResolvedDirection;
                    try {
                        parentResolvedDirection = mParent.getTextDirection();
                    } catch (AbstractMethodError e) {
                        Log.e(VIEW_LOG_TAG, mParent.getClass().getSimpleName() +
                                " does not fully implement ViewParent", e);
                        parentResolvedDirection = TEXT_DIRECTION_LTR;
                    }
                    switch (parentResolvedDirection) {
                        case TEXT_DIRECTION_FIRST_STRONG:
                        case TEXT_DIRECTION_ANY_RTL:
@@ -17229,13 +17257,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * Check if text direction resolution can be done.
     *
     * @return true if text direction resolution can be done otherwise return false.
     *
     * @hide
     */
    public boolean canResolveTextDirection() {
        switch (getRawTextDirection()) {
            case TEXT_DIRECTION_INHERIT:
                return (mParent != null) && mParent.canResolveTextDirection();
                if (mParent != null) {
                    try {
                        return mParent.canResolveTextDirection();
                    } catch (AbstractMethodError e) {
                        Log.e(VIEW_LOG_TAG, mParent.getClass().getSimpleName() +
                                " does not fully implement ViewParent", e);
                    }
                }
                return false;
            default:
                return true;
        }
@@ -17265,8 +17300,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    /**
     * @return true if text direction is resolved.
     *
     * @hide
     */
    public boolean isTextDirectionResolved() {
        return (mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_RESOLVED) == PFLAG2_TEXT_DIRECTION_RESOLVED;
@@ -17393,13 +17426,25 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                    }
                    // Parent has not yet resolved, so we still return the default
                    try {
                        if (!mParent.isTextAlignmentResolved()) {
                            mPrivateFlags2 |= PFLAG2_TEXT_ALIGNMENT_RESOLVED_DEFAULT;
                            // Resolution will need to happen again later
                            return false;
                        }
                    } catch (AbstractMethodError e) {
                        Log.e(VIEW_LOG_TAG, mParent.getClass().getSimpleName() +
                                " does not fully implement ViewParent", e);
                    }
                    final int parentResolvedTextAlignment = mParent.getTextAlignment();
                    int parentResolvedTextAlignment;
                    try {
                        parentResolvedTextAlignment = mParent.getTextAlignment();
                    } catch (AbstractMethodError e) {
                        Log.e(VIEW_LOG_TAG, mParent.getClass().getSimpleName() +
                                " does not fully implement ViewParent", e);
                        parentResolvedTextAlignment = TEXT_ALIGNMENT_GRAVITY;
                    }
                    switch (parentResolvedTextAlignment) {
                        case TEXT_ALIGNMENT_GRAVITY:
                        case TEXT_ALIGNMENT_TEXT_START:
@@ -17444,13 +17489,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * Check if text alignment resolution can be done.
     *
     * @return true if text alignment resolution can be done otherwise return false.
     *
     * @hide
     */
    public boolean canResolveTextAlignment() {
        switch (getRawTextAlignment()) {
            case TEXT_DIRECTION_INHERIT:
                return (mParent != null) && mParent.canResolveTextAlignment();
                if (mParent != null) {
                    try {
                        return mParent.canResolveTextAlignment();
                    } catch (AbstractMethodError e) {
                        Log.e(VIEW_LOG_TAG, mParent.getClass().getSimpleName() +
                                " does not fully implement ViewParent", e);
                    }
                }
                return false;
            default:
                return true;
        }
@@ -17480,8 +17532,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    /**
     * @return true if text alignment is resolved.
     *
     * @hide
     */
    public boolean isTextAlignmentResolved() {
        return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) == PFLAG2_TEXT_ALIGNMENT_RESOLVED;
+6 −9
Original line number Diff line number Diff line
@@ -742,8 +742,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager

    /**
     * Called when a child view has changed whether or not it is tracking transient state.
     *
     * @hide
     */
    public void childHasTransientStateChanged(View child, boolean childHasTransientState) {
        final boolean oldHasTransientState = hasTransientState();
@@ -764,9 +762,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        }
    }

    /**
     * @hide
     */
    @Override
    public boolean hasTransientState() {
        return mChildCountWithTransientState > 0 || super.hasTransientState();
@@ -2530,13 +2525,15 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        event.setClassName(ViewGroup.class.getName());
    }

    /**
     * @hide
     */
    @Override
    public void childAccessibilityStateChanged(View root) {
        if (mParent != null) {
            try {
                mParent.childAccessibilityStateChanged(root);
            } catch (AbstractMethodError e) {
                Log.e(VIEW_LOG_TAG, mParent.getClass().getSimpleName() +
                        " does not fully implement ViewParent", e);
            }
        }
    }

+1 −23
Original line number Diff line number Diff line
@@ -271,8 +271,6 @@ public interface ViewParent {
     *
     * @param child Child view whose state has changed
     * @param hasTransientState true if this child has transient state
     *
     * @hide
     */
    public void childHasTransientStateChanged(View child, boolean hasTransientState);

@@ -295,9 +293,7 @@ public interface ViewParent {
     * A child notifies its parent that the accessibility state of a subtree rooted
     * at a given node changed. That is the structure of the subtree is different.
     *
     * @param The root of the changed subtree.
     *
     * @hide
     * @param root The root of the changed subtree.
     */
    public void childAccessibilityStateChanged(View root);

@@ -306,8 +302,6 @@ public interface ViewParent {
     * See {@link View#setLayoutDirection(int)}
     *
     * @return True if this view parent can resolve the layout direction.
     *
     * @hide
     */
    public boolean canResolveLayoutDirection();

@@ -316,8 +310,6 @@ public interface ViewParent {
     * See {@link View#setLayoutDirection(int)}
     *
     * @return True if this view parent layout direction is resolved.
     *
     * @hide
     */
    public boolean isLayoutDirectionResolved();

@@ -326,8 +318,6 @@ public interface ViewParent {
     *
     * @return {@link View#LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns
     * {@link View#LAYOUT_DIRECTION_LTR} if the layout direction is not RTL.
     *
     * @hide
     */
    public int getLayoutDirection();

@@ -336,8 +326,6 @@ public interface ViewParent {
     * See {@link View#setTextDirection(int)}
     *
     * @return True if this view parent can resolve the text direction.
     *
     * @hide
     */
    public boolean canResolveTextDirection();

@@ -346,8 +334,6 @@ public interface ViewParent {
     * See {@link View#setTextDirection(int)}
     *
     * @return True if this view parent text direction is resolved.
     *
     * @hide
     */
    public boolean isTextDirectionResolved();

@@ -361,8 +347,6 @@ public interface ViewParent {
     * {@link View#TEXT_DIRECTION_LTR},
     * {@link View#TEXT_DIRECTION_RTL},
     * {@link View#TEXT_DIRECTION_LOCALE}
     *
     * @hide
     */
    public int getTextDirection();

@@ -371,8 +355,6 @@ public interface ViewParent {
     * See {@link View#setTextAlignment(int)}
     *
     * @return True if this view parent can resolve the text alignment.
     *
     * @hide
     */
    public boolean canResolveTextAlignment();

@@ -381,8 +363,6 @@ public interface ViewParent {
     * See {@link View#setTextAlignment(int)}
     *
     * @return True if this view parent text alignment is resolved.
     *
     * @hide
     */
    public boolean isTextAlignmentResolved();

@@ -397,8 +377,6 @@ public interface ViewParent {
     * {@link View#TEXT_ALIGNMENT_TEXT_END},
     * {@link View#TEXT_ALIGNMENT_VIEW_START},
     * {@link View#TEXT_ALIGNMENT_VIEW_END}
     *
     * @hide
     */
    public int getTextAlignment();
}