Able to choose future date when setting max date in datepicker

I am using this and its working correctly

Call this function to open date picker

public void openDatePicker() {
        DatePickerDialog dpd = new DatePickerDialog(this, mDateSetListener, mYear, mMonth, mDay);
        dpd.getDatePicker().setMaxDate(System.currentTimeMillis());
        dpd.show();
    }

Here is the mDateSetListener

private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            mYear = year;
            mMonth = monthOfYear;
            mDay = dayOfMonth;
            date.setText(dayOfMonth + " / " + (monthOfYear + 1) + " / " + year); // Here date is a TextView to display date
            date.setVisibility(View.VISIBLE);
        }
    };

So to answer my own question:

I've looked at the Android source of DatePickerCalendarDelegate.java at grepcode, specifically at public void setMaxDate(long maxDate) for both Android versions 5.0 and 5.1.

What's new in 5.1 in setMaxDate() is that

mDayPickerView.goTo(getSelectedDay(), false, true, true);

has been changed to:

mDayPickerView.setMaxDate(maxDate);

It seems they fixed it there, which corresponds with my observation that it works as expected in 5.1 but not in 5.0.

And so it seems we're stuck with dealing with the fact that it doesn't work properly in Android 5.0 (days after max date are greyed out but can still be chosen).