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

Commit 144d4055 authored by Justin Ho's avatar Justin Ho Committed by Android (Google) Code Review
Browse files

Merge "Revert "This restores JB MR0 behavior where the framework throws an...

Merge "Revert "This restores JB MR0 behavior where the framework throws an exception for improper layouts that are missing layout_width and/or layout_height."" into jb-mr1-dev
parents dec9e164 57fca90a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -7094,7 +7094,7 @@ package android.content.res {
    method public int getIndexCount();
    method public int getInt(int, int);
    method public int getInteger(int, int);
    method public int getLayoutDimension(int, java.lang.String);
    method public deprecated int getLayoutDimension(int, java.lang.String);
    method public int getLayoutDimension(int, int);
    method public java.lang.String getNonResourceString(int);
    method public java.lang.String getPositionDescription();
@@ -16151,7 +16151,7 @@ package android.os {
  public class Looper {
    method public void dump(android.util.Printer, java.lang.String);
    method public static synchronized android.os.Looper getMainLooper();
    method public static android.os.Looper getMainLooper();
    method public java.lang.Thread getThread();
    method public static void loop();
    method public static android.os.Looper myLooper();
+8 −1
Original line number Diff line number Diff line
@@ -475,7 +475,14 @@ public class TypedArray {
     * 
     * @return Attribute dimension value multiplied by the appropriate 
     * metric and truncated to integer pixels.
     *
     * @throws RuntimeException
     *             if this TypedArray does not contain an entry for <code>index</code>
     *
     * @deprecated Use {@link #getLayoutDimension(int, int)} instead.
     *
     */
    @Deprecated
    public int getLayoutDimension(int index, String name) {
        index *= AssetManager.STYLE_NUM_ENTRIES;
        final int[] data = mData;
+47 −53
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.graphics.Canvas;
import android.os.Handler;
import android.os.Message;
import android.widget.FrameLayout;
import com.android.internal.R;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

@@ -810,21 +811,14 @@ public abstract class LayoutInflater {
                        // We try to load the layout params set in the <include /> tag. If
                        // they don't exist, we will rely on the layout params set in the
                        // included XML file.
                        // During a layoutparams generation, a runtime exception is thrown
                        // if either layout_width or layout_height is missing. We catch
                        // this exception and set localParams accordingly: true means we
                        // successfully loaded layout params from the <include /> tag,
                        // false means we need to rely on the included layout params.
                        ViewGroup.LayoutParams params = null;
                        try {
                            params = group.generateLayoutParams(attrs);
                        } catch (RuntimeException e) {
                            params = group.generateLayoutParams(childAttrs);
                        } finally {
                            if (params != null) {
                                view.setLayoutParams(params);
                            }
                        }
                        TypedArray ta = getContext().obtainStyledAttributes(attrs,
                                                            R.styleable.ViewGroup_Layout);
                        boolean definesBothWidthAndHeight =
                                ta.hasValue(R.styleable.ViewGroup_Layout_layout_width) &&
                                ta.hasValue(R.styleable.ViewGroup_Layout_layout_height);
                        AttributeSet attributes = definesBothWidthAndHeight ? attrs : childAttrs;
                        view.setLayoutParams(group.generateLayoutParams(attributes));
                        ta.recycle();

                        // Inflate all children.
                        rInflate(childParser, view, childAttrs, true);
+7 −3
Original line number Diff line number Diff line
@@ -5611,15 +5611,19 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        }

        /**
         * Extracts the layout parameters from the supplied attributes.
         * Extracts the <code>width</code> and <code>height</code> layout parameters
         * from the supplied TypedArray, <code>a</code>, and assigns them
         * to the appropriate fields. If, <code>a</code>, does not contain an
         * entry for either attribute, the value, {@link ViewGroup.LayoutParams#WRAP_CONTENT},
         * is used as a default.
         *
         * @param a the style attributes to extract the parameters from
         * @param widthAttr the identifier of the width attribute
         * @param heightAttr the identifier of the height attribute
         */
        protected void setBaseAttributes(TypedArray a, int widthAttr, int heightAttr) {
            width = a.getLayoutDimension(widthAttr, "layout_width");
            height = a.getLayoutDimension(heightAttr, "layout_height");
            width = a.getLayoutDimension(widthAttr, WRAP_CONTENT);
            height = a.getLayoutDimension(heightAttr, WRAP_CONTENT);
        }

        /**
+6 −0
Original line number Diff line number Diff line
@@ -608,6 +608,12 @@ public class FrameLayout extends ViewGroup {
         */
        public int gravity = -1;

        @Override
        protected void setBaseAttributes(TypedArray a, int widthAttr, int heightAttr) {
            width = a.getLayoutDimension(widthAttr, MATCH_PARENT);
            height = a.getLayoutDimension(heightAttr, MATCH_PARENT);
        }

        /**
         * {@inheritDoc}
         */
Loading