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

Commit 0615026b authored by Jon Miranda's avatar Jon Miranda Committed by Android (Google) Code Review
Browse files

Merge "Exposed getLocationOnScreen, added formatToHexString method." into lmp-dev

parents 9469cdde 4597e980
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -2904,7 +2904,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        @ViewDebug.FlagToString(mask = PFLAG_DRAWN, equals = PFLAG_DRAWN, name = "NOT_DRAWN", outputIf = false),
        @ViewDebug.FlagToString(mask = PFLAG_DIRTY_MASK, equals = PFLAG_DIRTY_OPAQUE, name = "DIRTY_OPAQUE"),
        @ViewDebug.FlagToString(mask = PFLAG_DIRTY_MASK, equals = PFLAG_DIRTY, name = "DIRTY")
    })
    }, formatToHexString = true)
    int mPrivateFlags;
    int mPrivateFlags2;
    int mPrivateFlags3;
@@ -2923,7 +2923,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        @ViewDebug.FlagToString(mask = PUBLIC_STATUS_BAR_VISIBILITY_MASK,
                                equals = SYSTEM_UI_FLAG_VISIBLE,
                                name = "SYSTEM_UI_FLAG_VISIBLE", outputIf = true)
    })
    }, formatToHexString = true)
    int mSystemUiVisibility;
    /**
@@ -2949,7 +2949,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * The view flags hold various views states.
     * {@hide}
     */
    @ViewDebug.ExportedProperty
    @ViewDebug.ExportedProperty(formatToHexString = true)
    int mViewFlags;
    static class TransformationInfo {
@@ -16457,6 +16457,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
    }
    /**
     * @hide
     */
    @ViewDebug.ExportedProperty(category = "layout", indexMapping = {
            @ViewDebug.IntToString(from = 0, to = "x"),
            @ViewDebug.IntToString(from = 1, to = "y")
    })
    public int[] getLocationOnScreen() {
        int[] location = new int[2];
        getLocationOnScreen(location);
        return location;
    }
    /**
     * <p>Computes the coordinates of this view on the screen. The argument
     * must be an array of two integers. After the method returns, the array
+100 −81
Original line number Diff line number Diff line
@@ -180,6 +180,13 @@ public class ViewDebug {
         * @return the category as String
         */
        String category() default "";

        /**
         * Indicates whether or not to format an {@code int} or {@code byte} value as a hex string.
         *
         * @return true if the supported values should be formatted as a hex string.
         */
        boolean formatToHexString() default false;
    }

    /**
@@ -1041,6 +1048,10 @@ public class ViewDebug {
        }
    }

    private static String formatIntToHexString(int value) {
        return "0x" + Integer.toHexString(value).toUpperCase();
    }

    private static void exportMethods(Context context, Object view, BufferedWriter out,
            Class<?> klass, String prefix) throws IOException {

@@ -1058,7 +1069,6 @@ public class ViewDebug {
                        property.category().length() != 0 ? property.category() + ":" : "";

                if (returnType == int.class) {

                    if (property.resolveId() && context != null) {
                        final int id = (Integer) methodValue;
                        methodValue = resolveId(context, id);
@@ -1160,6 +1170,15 @@ public class ViewDebug {
                                fieldValue = intValue;
                            }
                        }

                        if (property.formatToHexString()) {
                            fieldValue = field.get(view);
                            if (type == int.class) {
                                fieldValue = formatIntToHexString((Integer) fieldValue);
                            } else if (type == byte.class) {
                                fieldValue = "0x" + Byte.toHexString((Byte) fieldValue, true);
                            }
                        }
                    }
                } else if (type == int[].class) {
                    final int[] array = (int[]) field.get(view);
@@ -1210,7 +1229,7 @@ public class ViewDebug {
            final boolean test = maskResult == flagMapping.equals();
            if ((test && ifTrue) || (!test && !ifTrue)) {
                final String name = flagMapping.name();
                final String value = "0x" + Integer.toHexString(maskResult);
                final String value = formatIntToHexString(maskResult);
                writeEntry(out, prefix, name, "", value);
            }
        }
@@ -1276,7 +1295,7 @@ public class ViewDebug {
                fieldValue = resources.getResourceTypeName(id) + '/' +
                        resources.getResourceEntryName(id);
            } catch (Resources.NotFoundException e) {
                fieldValue = "id/0x" + Integer.toHexString(id);
                fieldValue = "id/" + formatIntToHexString(id);
            }
        } else {
            fieldValue = "NO_ID";
+2 −2
Original line number Diff line number Diff line
@@ -203,7 +203,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                    name = "CLIP_TO_PADDING"),
            @ViewDebug.FlagToString(mask = FLAG_PADDING_NOT_NULL, equals = FLAG_PADDING_NOT_NULL,
                    name = "PADDING_NOT_NULL")
    })
    }, formatToHexString = true)
    protected int mGroupFlags;

    /**
@@ -6430,7 +6430,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                        equals = RTL_COMPATIBILITY_MODE_MASK, name = "RTL_COMPATIBILITY_MODE_MASK"),
                @ViewDebug.FlagToString(mask = NEED_RESOLUTION_MASK,
                        equals = NEED_RESOLUTION_MASK, name = "NEED_RESOLUTION_MASK")
        })
        }, formatToHexString = true)
        byte mMarginFlags;

        private static final int LAYOUT_DIRECTION_MASK = 0x00000003;
+1 −1
Original line number Diff line number Diff line
@@ -1020,7 +1020,7 @@ public interface WindowManager extends ViewManager {
                    name = "FLAG_TRANSLUCENT_NAVIGATION"),
            @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
                    name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS")
        })
        }, formatToHexString = true)
        public int flags;

        /**
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ public class LinearLayout extends ViewGroup {
                equals = Gravity.FILL, name = "FILL"),
            @ViewDebug.FlagToString(mask = Gravity.RELATIVE_LAYOUT_DIRECTION,
                equals = Gravity.RELATIVE_LAYOUT_DIRECTION, name = "RELATIVE")
        })
        }, formatToHexString = true)
    private int mGravity = Gravity.START | Gravity.TOP;

    @ViewDebug.ExportedProperty(category = "measurement")