I dim the background of a DialogFragment using this code:
Window window = getDialog().getWindow();
WindowManager.LayoutParams windowParams = window.getAttributes();
windowParams.dimAmount = 0.75f;
windowParams.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
window.setAttributes(windowParams);
This works fine on Kitkat and below, but stopped working on Lollipop. I suspect it has to do with the fact that my Activity is using the style Theme.AppCompat.Light.DarkActionBar, which uses the Material Theme on 5.x, and something in that theme prevents the DIM flag from working. I tried messing with the various theme flags, but to no avail so far.
Apparently this was caused by Lux Dash app I had installed, that controls the brightness of the screen. Geesh. Took me a while to figure this out! I uninstalled it and the dimming came back. [Not a bug]