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

Commit bea95162 authored by Konstantin Lopyrev's avatar Konstantin Lopyrev
Browse files

Categorizing exported view properties.

Change-Id: I79c42019836973d80662c21d195d088ae01537a0
parent 5e7833a5
Loading
Loading
Loading
Loading
+27 −27
Original line number Diff line number Diff line
@@ -1358,14 +1358,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * Width as measured during measure pass.
     * {@hide}
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "measurement")
    protected int mMeasuredWidth;

    /**
     * Height as measured during measure pass.
     * {@hide}
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "measurement")
    protected int mMeasuredHeight;

    /**
@@ -1575,28 +1575,28 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * to the left edge of this view.
     * {@hide}
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "layout")
    protected int mLeft;
    /**
     * The distance in pixels from the left edge of this view's parent
     * to the right edge of this view.
     * {@hide}
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "layout")
    protected int mRight;
    /**
     * The distance in pixels from the top edge of this view's parent
     * to the top edge of this view.
     * {@hide}
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "layout")
    protected int mTop;
    /**
     * The distance in pixels from the top edge of this view's parent
     * to the bottom edge of this view.
     * {@hide}
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "layout")
    protected int mBottom;

    /**
@@ -1604,14 +1604,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * horizontally.
     * {@hide}
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "scrolling")
    protected int mScrollX;
    /**
     * The offset, in pixels, by which the content of this view is scrolled
     * vertically.
     * {@hide}
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "scrolling")
    protected int mScrollY;

    /**
@@ -1619,28 +1619,28 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * left edge of this view and the left edge of its content.
     * {@hide}
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "padding")
    protected int mPaddingLeft;
    /**
     * The right padding in pixels, that is the distance in pixels between the
     * right edge of this view and the right edge of its content.
     * {@hide}
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "padding")
    protected int mPaddingRight;
    /**
     * The top padding in pixels, that is the distance in pixels between the
     * top edge of this view and the top edge of its content.
     * {@hide}
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "padding")
    protected int mPaddingTop;
    /**
     * The bottom padding in pixels, that is the distance in pixels between the
     * bottom edge of this view and the bottom edge of its content.
     * {@hide}
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "padding")
    protected int mPaddingBottom;

    /**
@@ -1651,13 +1651,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
    /**
     * Cache the paddingRight set by the user to append to the scrollbar's size.
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "padding")
    int mUserPaddingRight;

    /**
     * Cache the paddingBottom set by the user to append to the scrollbar's size.
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "padding")
    int mUserPaddingBottom;

    /**
@@ -1764,14 +1764,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * The minimum height of the view. We'll try our best to have the height
     * of this view to at least this amount.
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "measurement")
    private int mMinHeight;

    /**
     * The minimum width of the view. We'll try our best to have the width
     * of this view to at least this amount.
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "measurement")
    private int mMinWidth;

    /**
@@ -2602,7 +2602,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     *
     * @return True if this view has or contains focus, false otherwise.
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "focus")
    public boolean hasFocus() {
        return (mPrivateFlags & FOCUSED) != 0;
    }
@@ -2780,7 +2780,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     *
     * @return True if this view has focus, false otherwise.
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "focus")
    public boolean isFocused() {
        return (mPrivateFlags & FOCUSED) != 0;
    }
@@ -3191,7 +3191,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     *
     * @return true if this view has nothing to draw, false otherwise
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "drawing")
    public boolean willNotDraw() {
        return (mViewFlags & DRAW_MASK) == WILL_NOT_DRAW;
    }
@@ -3214,7 +3214,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     *
     * @return true if this view does not cache its drawing, false otherwise
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "drawing")
    public boolean willNotCacheDrawing() {
        return (mViewFlags & WILL_NOT_CACHE_DRAWING) == WILL_NOT_CACHE_DRAWING;
    }
@@ -3357,7 +3357,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * @return True if this view can take focus, or false otherwise.
     * @attr ref android.R.styleable#View_focusable
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "focus")
    public final boolean isFocusable() {
        return FOCUSABLE == (mViewFlags & FOCUSABLE_MASK);
    }
@@ -4666,7 +4666,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     *
     * @return The width of your view, in pixels.
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "layout")
    public final int getWidth() {
        return mRight - mLeft;
    }
@@ -4676,7 +4676,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     *
     * @return The height of your view, in pixels.
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "layout")
    public final int getHeight() {
        return mBottom - mTop;
    }
@@ -4848,7 +4848,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * of ViewGroup that are responsible for arranging their children.
     * @return The LayoutParams associated with this view
     */
    @ViewDebug.ExportedProperty(deepExport = true, prefix = "layout_")
    @ViewDebug.ExportedProperty(deepExport = true, category = "layout")
    public ViewGroup.LayoutParams getLayoutParams() {
        return mLayoutParams;
    }
@@ -5162,7 +5162,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     *
     * @return True if this View is guaranteed to be fully opaque, false otherwise.
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "drawing")
    public boolean isOpaque() {
        return (mPrivateFlags & OPAQUE_MASK) == OPAQUE_MASK;
    }
@@ -6247,7 +6247,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * @see #setDrawingCacheEnabled(boolean)
     * @see #getDrawingCache()
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "drawing")
    public boolean isDrawingCacheEnabled() {
        return (mViewFlags & DRAWING_CACHE_ENABLED) == DRAWING_CACHE_ENABLED;
    }
@@ -8116,7 +8116,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * @return the offset of the baseline within the widget's bounds or -1
     *         if baseline alignment is not supported
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "layout")
    public int getBaseline() {
        return -1;
    }
+27 −12
Original line number Diff line number Diff line
@@ -255,6 +255,14 @@ public class ViewDebug {
         * @see #deepExport()
         */
        String prefix() default "";

        /**
         * Specifies the category the property falls into, such as measurement,
         * layout, drawing, etc.
         *
         * @return the category as String
         */
        String category() default "";
    }

    /**
@@ -1368,9 +1376,13 @@ public class ViewDebug {
                // TODO: This should happen on the UI thread
                Object methodValue = method.invoke(view, (Object[]) null);
                final Class<?> returnType = method.getReturnType();
                final ExportedProperty property = sAnnotations.get(method);
                String fullName = (property.category().length() == 0) ?
                        method.getName() :
                        (property.category() + ":" + method.getName());

                if (returnType == int.class) {
                    final ExportedProperty property = sAnnotations.get(method);

                    if (property.resolveId() && context != null) {
                        final int id = (Integer) methodValue;
                        methodValue = resolveId(context, id);
@@ -1378,7 +1390,7 @@ public class ViewDebug {
                        final FlagToString[] flagsMapping = property.flagMapping();
                        if (flagsMapping.length > 0) {
                            final int intValue = (Integer) methodValue;
                            final String valuePrefix = prefix + method.getName() + '_';
                            final String valuePrefix = prefix + fullName + '_';
                            exportUnrolledFlags(out, flagsMapping, intValue, valuePrefix);
                        }

@@ -1402,21 +1414,22 @@ public class ViewDebug {
                        }
                    }
                } else if (returnType == int[].class) {
                    final ExportedProperty property = sAnnotations.get(method);
                    final int[] array = (int[]) methodValue;
                    final String valuePrefix = prefix + method.getName() + '_';
                    final String valuePrefix = prefix + fullName + '_';
                    final String suffix = "()";

                    exportUnrolledArray(context, out, property, array, valuePrefix, suffix);

                    // Probably want to return here, same as for fields.
                    return;
                } else if (!returnType.isPrimitive()) {
                    final ExportedProperty property = sAnnotations.get(method);
                    if (property.deepExport()) {
                        dumpViewProperties(context, methodValue, out, prefix + property.prefix());
                        continue;
                    }
                }

                writeEntry(out, prefix, method.getName(), "()", methodValue);
                writeEntry(out, prefix, fullName, "()", methodValue);
            } catch (IllegalAccessException e) {
            } catch (InvocationTargetException e) {
            }
@@ -1436,9 +1449,13 @@ public class ViewDebug {
            try {
                Object fieldValue = null;
                final Class<?> type = field.getType();
                final ExportedProperty property = sAnnotations.get(field);
                String fullName = (property.category().length() == 0) ?
                        field.getName() :
                        (property.category() + ":" + field.getName());

                if (type == int.class) {
                    final ExportedProperty property = sAnnotations.get(field);

                    if (property.resolveId() && context != null) {
                        final int id = field.getInt(view);
                        fieldValue = resolveId(context, id);
@@ -1446,7 +1463,7 @@ public class ViewDebug {
                        final FlagToString[] flagsMapping = property.flagMapping();
                        if (flagsMapping.length > 0) {
                            final int intValue = field.getInt(view);
                            final String valuePrefix = prefix + field.getName() + '_';
                            final String valuePrefix = prefix + fullName + '_';
                            exportUnrolledFlags(out, flagsMapping, intValue, valuePrefix);
                        }

@@ -1468,9 +1485,8 @@ public class ViewDebug {
                        }
                    }
                } else if (type == int[].class) {
                    final ExportedProperty property = sAnnotations.get(field);
                    final int[] array = (int[]) field.get(view);
                    final String valuePrefix = prefix + field.getName() + '_';
                    final String valuePrefix = prefix + fullName + '_';
                    final String suffix = "";

                    exportUnrolledArray(context, out, property, array, valuePrefix, suffix);
@@ -1478,7 +1494,6 @@ public class ViewDebug {
                    // We exit here!
                    return;
                } else if (!type.isPrimitive()) {
                    final ExportedProperty property = sAnnotations.get(field);
                    if (property.deepExport()) {
                        dumpViewProperties(context, field.get(view), out,
                                prefix + property.prefix());
@@ -1490,7 +1505,7 @@ public class ViewDebug {
                    fieldValue = field.get(view);
                }

                writeEntry(out, prefix, field.getName(), "", fieldValue);
                writeEntry(out, prefix, fullName, "", fieldValue);
            } catch (IllegalAccessException e) {
            }
        }
+11 −11
Original line number Diff line number Diff line
@@ -363,7 +363,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * @return one of {@link #FOCUS_BEFORE_DESCENDANTS}, {@link #FOCUS_AFTER_DESCENDANTS},
     *   {@link #FOCUS_BLOCK_DESCENDANTS}.
     */
    @ViewDebug.ExportedProperty(mapping = {
    @ViewDebug.ExportedProperty(category = "focus", mapping = {
        @ViewDebug.IntToString(from = FOCUS_BEFORE_DESCENDANTS, to = "FOCUS_BEFORE_DESCENDANTS"),
        @ViewDebug.IntToString(from = FOCUS_AFTER_DESCENDANTS, to = "FOCUS_AFTER_DESCENDANTS"),
        @ViewDebug.IntToString(from = FOCUS_BLOCK_DESCENDANTS, to = "FOCUS_BLOCK_DESCENDANTS")
@@ -2764,7 +2764,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * @see #setChildrenDrawnWithCacheEnabled(boolean)
     * @see View#setDrawingCacheEnabled(boolean)
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "drawing")
    public boolean isAlwaysDrawnWithCacheEnabled() {
        return (mGroupFlags & FLAG_ALWAYS_DRAWN_WITH_CACHE) == FLAG_ALWAYS_DRAWN_WITH_CACHE;
    }
@@ -2799,7 +2799,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * @see #setAlwaysDrawnWithCacheEnabled(boolean)
     * @see #setChildrenDrawnWithCacheEnabled(boolean)
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "drawing")
    protected boolean isChildrenDrawnWithCacheEnabled() {
        return (mGroupFlags & FLAG_CHILDREN_DRAWN_WITH_CACHE) == FLAG_CHILDREN_DRAWN_WITH_CACHE;
    }
@@ -2831,7 +2831,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * @see #setChildrenDrawingOrderEnabled(boolean)
     * @see #getChildDrawingOrder(int, int)
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "drawing")
    protected boolean isChildrenDrawingOrderEnabled() {
        return (mGroupFlags & FLAG_USE_CHILD_DRAWING_ORDER) == FLAG_USE_CHILD_DRAWING_ORDER;
    }
@@ -2868,7 +2868,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     *         {@link #PERSISTENT_ANIMATION_CACHE}, {@link #PERSISTENT_SCROLLING_CACHE}
     *         and {@link #PERSISTENT_ALL_CACHES}
     */
    @ViewDebug.ExportedProperty(mapping = {
    @ViewDebug.ExportedProperty(category = "drawing", mapping = {
        @ViewDebug.IntToString(from = PERSISTENT_NO_CACHE,        to = "NONE"),
        @ViewDebug.IntToString(from = PERSISTENT_ALL_CACHES,      to = "ANIMATION"),
        @ViewDebug.IntToString(from = PERSISTENT_SCROLLING_CACHE, to = "SCROLLING"),
@@ -3501,7 +3501,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
         * constants FILL_PARENT (replaced by MATCH_PARENT ,
         * in API Level 8) or WRAP_CONTENT. or an exact size.
         */
        @ViewDebug.ExportedProperty(mapping = {
        @ViewDebug.ExportedProperty(category = "layout", mapping = {
            @ViewDebug.IntToString(from = MATCH_PARENT, to = "MATCH_PARENT"),
            @ViewDebug.IntToString(from = WRAP_CONTENT, to = "WRAP_CONTENT")
        })
@@ -3512,7 +3512,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
         * constants FILL_PARENT (replaced by MATCH_PARENT ,
         * in API Level 8) or WRAP_CONTENT. or an exact size.
         */
        @ViewDebug.ExportedProperty(mapping = {
        @ViewDebug.ExportedProperty(category = "layout", mapping = {
            @ViewDebug.IntToString(from = MATCH_PARENT, to = "MATCH_PARENT"),
            @ViewDebug.IntToString(from = WRAP_CONTENT, to = "WRAP_CONTENT")
        })
@@ -3637,25 +3637,25 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        /**
         * The left margin in pixels of the child.
         */
        @ViewDebug.ExportedProperty
        @ViewDebug.ExportedProperty(category = "layout")
        public int leftMargin;

        /**
         * The top margin in pixels of the child.
         */
        @ViewDebug.ExportedProperty
        @ViewDebug.ExportedProperty(category = "layout")
        public int topMargin;

        /**
         * The right margin in pixels of the child.
         */
        @ViewDebug.ExportedProperty
        @ViewDebug.ExportedProperty(category = "layout")
        public int rightMargin;

        /**
         * The bottom margin in pixels of the child.
         */
        @ViewDebug.ExportedProperty
        @ViewDebug.ExportedProperty(category = "layout")
        public int bottomMargin;

        /**
+3 −3
Original line number Diff line number Diff line
@@ -3830,7 +3830,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
         * View type for this view, as returned by
         * {@link android.widget.Adapter#getItemViewType(int) }
         */
        @ViewDebug.ExportedProperty(mapping = {
        @ViewDebug.ExportedProperty(category = "list", mapping = {
            @ViewDebug.IntToString(from = ITEM_VIEW_TYPE_IGNORE, to = "ITEM_VIEW_TYPE_IGNORE"),
            @ViewDebug.IntToString(from = ITEM_VIEW_TYPE_HEADER_OR_FOOTER, to = "ITEM_VIEW_TYPE_HEADER_OR_FOOTER")
        })
@@ -3842,7 +3842,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
         * been added to the list view and whether they should be treated as
         * recycled views or not.
         */
        @ViewDebug.ExportedProperty
        @ViewDebug.ExportedProperty(category = "list")
        boolean recycledHeaderFooter;

        /**
@@ -3853,7 +3853,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
         * view to be attached to the window rather than just attached to the
         * parent.
         */
        @ViewDebug.ExportedProperty
        @ViewDebug.ExportedProperty(category = "list")
        boolean forceAdd;

        public LayoutParams(Context c, AttributeSet attrs) {
+4 −4
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup {
    /**
     * The position of the first child displayed
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "scrolling")
    int mFirstPosition = 0;

    /**
@@ -141,7 +141,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup {
     * The position within the adapter's data set of the item to select
     * during the next layout.
     */
    @ViewDebug.ExportedProperty    
    @ViewDebug.ExportedProperty(category = "list")
    int mNextSelectedPosition = INVALID_POSITION;

    /**
@@ -152,7 +152,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup {
    /**
     * The position within the adapter's data set of the currently selected item.
     */
    @ViewDebug.ExportedProperty    
    @ViewDebug.ExportedProperty(category = "list")
    int mSelectedPosition = INVALID_POSITION;

    /**
@@ -168,7 +168,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup {
    /**
     * The number of items in the current adapter.
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(category = "list")
    int mItemCount;

    /**
Loading