From fc9ea846803aa6184d440a3f0726da40b77d6ca0 Mon Sep 17 00:00:00 2001 From: Andrei Stingaceanu Date: Tue, 21 Feb 2017 11:23:42 +0000 Subject: [PATCH] CalendarView Material - fix exception if date is out of range Due to not cherry-picking this change into N_MR1 fix the version check to reflect this. Bug: 28019187 Test: run cts-dev -m CtsWidgetTestCases -t \ android.widget.cts.CalendarViewTest Change-Id: I128d25c3ed949729e2afaeefad381bfb58d89ccd --- core/java/android/widget/DayPickerView.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/java/android/widget/DayPickerView.java b/core/java/android/widget/DayPickerView.java index 919c1e2c4a4cf..0f0e6c30979d6 100644 --- a/core/java/android/widget/DayPickerView.java +++ b/core/java/android/widget/DayPickerView.java @@ -294,14 +294,15 @@ class DayPickerView extends ViewGroup { * @param animate whether to smooth scroll to the new position * @param setSelected whether to set the specified day as selected * - * @throws IllegalArgumentException as of {@link android.os.Build.VERSION_CODES#N_MR1} if the - * provided timeInMillis is before the range start or after the range end. + * @throws IllegalArgumentException if the build version is greater than + * {@link android.os.Build.VERSION_CODES#N_MR1} and the provided timeInMillis is before + * the range start or after the range end. */ private void setDate(long timeInMillis, boolean animate, boolean setSelected) { getTempCalendarForTime(timeInMillis); final int targetSdkVersion = mContext.getApplicationInfo().targetSdkVersion; - if (targetSdkVersion >= N_MR1) { + if (targetSdkVersion > N_MR1) { if (mTempCalendar.before(mMinDate) || mTempCalendar.after(mMaxDate)) { throw new IllegalArgumentException("timeInMillis must be between the values of " + "getMinDate() and getMaxDate()");