Loading core/java/android/view/View.java +14 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.graphics.Shader; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.hardware.display.DisplayManagerGlobal; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; Loading Loading @@ -688,6 +689,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ public static final int NO_ID = -1; private static boolean sUseBrokenMakeMeasureSpec = false; /** * This view does not want keystrokes. Use with TAKES_FOCUS_MASK when * calling setFlags. Loading Loading @@ -3234,6 +3237,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, setOverScrollMode(OVER_SCROLL_IF_CONTENT_SCROLLS); mUserPaddingStart = UNDEFINED_PADDING; mUserPaddingEnd = UNDEFINED_PADDING; if (!sUseBrokenMakeMeasureSpec && context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1 ) { // Older apps may need this compatibility hack for measurement. sUseBrokenMakeMeasureSpec = true; } } /** Loading Loading @@ -17328,8 +17337,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @return the measure specification based on size and mode */ public static int makeMeasureSpec(int size, int mode) { if (sUseBrokenMakeMeasureSpec) { return size + mode; } else { return (size & ~MODE_MASK) | (mode & MODE_MASK); } } /** * Extracts the mode from the supplied measure specification. core/java/android/widget/ImageView.java +8 −2 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.graphics.RectF; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; Loading Loading @@ -93,6 +94,9 @@ public class ImageView extends View { private int mBaseline = -1; private boolean mBaselineAlignBottom = false; // AdjustViewBounds behavior will be in compatibility mode for older apps. private boolean mAdjustViewBoundsCompat = false; private static final ScaleType[] sScaleTypeArray = { ScaleType.MATRIX, ScaleType.FIT_XY, Loading Loading @@ -167,6 +171,8 @@ public class ImageView extends View { private void initImageView() { mMatrix = new Matrix(); mScaleType = ScaleType.FIT_CENTER; mAdjustViewBoundsCompat = mContext.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; } @Override Loading Loading @@ -801,7 +807,7 @@ public class ImageView extends View { pleft + pright; // Allow the width to outgrow its original estimate if height is fixed. if (!resizeHeight) { if (!resizeHeight && !mAdjustViewBoundsCompat) { widthSize = resolveAdjustedSize(newWidth, mMaxWidth, widthMeasureSpec); } Loading @@ -817,7 +823,7 @@ public class ImageView extends View { ptop + pbottom; // Allow the height to outgrow its original estimate if width is fixed. if (!resizeWidth) { if (!resizeWidth && !mAdjustViewBoundsCompat) { heightSize = resolveAdjustedSize(newHeight, mMaxHeight, heightMeasureSpec); } Loading core/java/android/widget/RelativeLayout.java +14 −2 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Rect; import android.os.Build; import android.util.AttributeSet; import android.util.Pools.SimplePool; import android.util.SparseArray; Loading Loading @@ -199,18 +200,29 @@ public class RelativeLayout extends ViewGroup { private View[] mSortedVerticalChildren = new View[0]; private final DependencyGraph mGraph = new DependencyGraph(); // Compatibility hack. Old versions of the platform had problems // with MeasureSpec value overflow and RelativeLayout was one source of them. // Some apps came to rely on them. :( private boolean mAllowBrokenMeasureSpecs = false; public RelativeLayout(Context context) { super(context); mAllowBrokenMeasureSpecs = context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; } public RelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); initFromAttributes(context, attrs); mAllowBrokenMeasureSpecs = context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; } public RelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); initFromAttributes(context, attrs); mAllowBrokenMeasureSpecs = context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; } private void initFromAttributes(Context context, AttributeSet attrs) { Loading Loading @@ -670,7 +682,7 @@ public class RelativeLayout extends ViewGroup { mPaddingLeft, mPaddingRight, myWidth); int childHeightMeasureSpec; if (myHeight < 0) { if (myHeight < 0 && !mAllowBrokenMeasureSpecs) { // Negative values in a mySize/myWidth/myWidth value in RelativeLayout measurement // is code for, "we got an unspecified mode in the RelativeLayout's measurespec." // Carry it forward. Loading Loading @@ -702,7 +714,7 @@ public class RelativeLayout extends ViewGroup { private int getChildMeasureSpec(int childStart, int childEnd, int childSize, int startMargin, int endMargin, int startPadding, int endPadding, int mySize) { if (mySize < 0) { if (mySize < 0 && !mAllowBrokenMeasureSpecs) { // Negative values in a mySize/myWidth/myWidth value in RelativeLayout measurement // is code for, "we got an unspecified mode in the RelativeLayout's measurespec." // Carry it forward. Loading Loading
core/java/android/view/View.java +14 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.graphics.Shader; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.hardware.display.DisplayManagerGlobal; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; Loading Loading @@ -688,6 +689,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ public static final int NO_ID = -1; private static boolean sUseBrokenMakeMeasureSpec = false; /** * This view does not want keystrokes. Use with TAKES_FOCUS_MASK when * calling setFlags. Loading Loading @@ -3234,6 +3237,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, setOverScrollMode(OVER_SCROLL_IF_CONTENT_SCROLLS); mUserPaddingStart = UNDEFINED_PADDING; mUserPaddingEnd = UNDEFINED_PADDING; if (!sUseBrokenMakeMeasureSpec && context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1 ) { // Older apps may need this compatibility hack for measurement. sUseBrokenMakeMeasureSpec = true; } } /** Loading Loading @@ -17328,8 +17337,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @return the measure specification based on size and mode */ public static int makeMeasureSpec(int size, int mode) { if (sUseBrokenMakeMeasureSpec) { return size + mode; } else { return (size & ~MODE_MASK) | (mode & MODE_MASK); } } /** * Extracts the mode from the supplied measure specification.
core/java/android/widget/ImageView.java +8 −2 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.graphics.RectF; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; Loading Loading @@ -93,6 +94,9 @@ public class ImageView extends View { private int mBaseline = -1; private boolean mBaselineAlignBottom = false; // AdjustViewBounds behavior will be in compatibility mode for older apps. private boolean mAdjustViewBoundsCompat = false; private static final ScaleType[] sScaleTypeArray = { ScaleType.MATRIX, ScaleType.FIT_XY, Loading Loading @@ -167,6 +171,8 @@ public class ImageView extends View { private void initImageView() { mMatrix = new Matrix(); mScaleType = ScaleType.FIT_CENTER; mAdjustViewBoundsCompat = mContext.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; } @Override Loading Loading @@ -801,7 +807,7 @@ public class ImageView extends View { pleft + pright; // Allow the width to outgrow its original estimate if height is fixed. if (!resizeHeight) { if (!resizeHeight && !mAdjustViewBoundsCompat) { widthSize = resolveAdjustedSize(newWidth, mMaxWidth, widthMeasureSpec); } Loading @@ -817,7 +823,7 @@ public class ImageView extends View { ptop + pbottom; // Allow the height to outgrow its original estimate if width is fixed. if (!resizeWidth) { if (!resizeWidth && !mAdjustViewBoundsCompat) { heightSize = resolveAdjustedSize(newHeight, mMaxHeight, heightMeasureSpec); } Loading
core/java/android/widget/RelativeLayout.java +14 −2 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Rect; import android.os.Build; import android.util.AttributeSet; import android.util.Pools.SimplePool; import android.util.SparseArray; Loading Loading @@ -199,18 +200,29 @@ public class RelativeLayout extends ViewGroup { private View[] mSortedVerticalChildren = new View[0]; private final DependencyGraph mGraph = new DependencyGraph(); // Compatibility hack. Old versions of the platform had problems // with MeasureSpec value overflow and RelativeLayout was one source of them. // Some apps came to rely on them. :( private boolean mAllowBrokenMeasureSpecs = false; public RelativeLayout(Context context) { super(context); mAllowBrokenMeasureSpecs = context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; } public RelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); initFromAttributes(context, attrs); mAllowBrokenMeasureSpecs = context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; } public RelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); initFromAttributes(context, attrs); mAllowBrokenMeasureSpecs = context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR1; } private void initFromAttributes(Context context, AttributeSet attrs) { Loading Loading @@ -670,7 +682,7 @@ public class RelativeLayout extends ViewGroup { mPaddingLeft, mPaddingRight, myWidth); int childHeightMeasureSpec; if (myHeight < 0) { if (myHeight < 0 && !mAllowBrokenMeasureSpecs) { // Negative values in a mySize/myWidth/myWidth value in RelativeLayout measurement // is code for, "we got an unspecified mode in the RelativeLayout's measurespec." // Carry it forward. Loading Loading @@ -702,7 +714,7 @@ public class RelativeLayout extends ViewGroup { private int getChildMeasureSpec(int childStart, int childEnd, int childSize, int startMargin, int endMargin, int startPadding, int endPadding, int mySize) { if (mySize < 0) { if (mySize < 0 && !mAllowBrokenMeasureSpecs) { // Negative values in a mySize/myWidth/myWidth value in RelativeLayout measurement // is code for, "we got an unspecified mode in the RelativeLayout's measurespec." // Carry it forward. Loading