summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Rob Carr <racarr@google.com> 2017-06-22 22:23:19 +0000
committer android-build-merger <android-build-merger@google.com> 2017-06-22 22:23:19 +0000
commit9e391f9f86a76528f31fa85e150a435dead2e528 (patch)
tree7f574295bd76d3392d2612fcc51eed87b3137877
parent745bbf758d3b86f924d8e16eb8ed1674ef56ddba (diff)
parent82b41e460cc588835657386de66e538e0bae04a7 (diff)
Merge "ListPopupWindow: Wrap new bounds checking in targetSdk check." into oc-dev
am: 82b41e460c Change-Id: I47c8e096ccd513eb65fa9fd2a34fc75fa222a42c
-rw-r--r--core/java/android/widget/ListPopupWindow.java11
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;
}