diff options
| author | 2017-06-22 22:32:07 +0000 | |
|---|---|---|
| committer | 2017-06-22 22:32:07 +0000 | |
| commit | 9a8971fabbb32456b855be18cb201eb6d1346b15 (patch) | |
| tree | f9d8d70c84ebc2f89142cc09c5a191fe08f8e66d | |
| parent | 9b28a61fcfff0363899effdd4682790e6c489b9f (diff) | |
| parent | 874b6402af4a950aaa75c398fd7cd9e55f741df8 (diff) | |
Merge "ListPopupWindow: Wrap new bounds checking in targetSdk check." into oc-dev am: 82b41e460c
am: 874b6402af
Change-Id: I3db14694bc27e9fed16b5efec6aba99570b89675
| -rw-r--r-- | core/java/android/widget/ListPopupWindow.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java index 2e8faeec6f13..0d676153b288 100644 --- a/core/java/android/widget/ListPopupWindow.java +++ b/core/java/android/widget/ListPopupWindow.java @@ -25,6 +25,7 @@ import android.content.res.TypedArray; import android.database.DataSetObserver; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.os.Build; import android.os.Handler; import android.util.AttributeSet; import android.util.Log; @@ -532,8 +533,14 @@ public class ListPopupWindow implements ShowableListMenu { public void setHeight(int height) { if (height < 0 && ViewGroup.LayoutParams.WRAP_CONTENT != height && ViewGroup.LayoutParams.MATCH_PARENT != height) { - throw new IllegalArgumentException( - "Invalid height. Must be a positive value, MATCH_PARENT, or WRAP_CONTENT."); + if (mContext.getApplicationInfo().targetSdkVersion + < Build.VERSION_CODES.O) { + Log.e(TAG, "Negative value " + height + " passed to ListPopupWindow#setHeight" + + " produces undefined results"); + } else { + throw new IllegalArgumentException( + "Invalid height. Must be a positive value, MATCH_PARENT, or WRAP_CONTENT."); + } } mDropDownHeight = height; } |