f[x_] := Piecewise[{{1, -0.5 <= x <= 0.5}}, 0];
ProbabilityDistribution[
Integrate[f[a], {a, x - 0.5, x + 0.5}], {x, -2, 2}]
output: "Unable to prove that integration limits {-(1/2)+x,1/2+x} are real. \ Adding assumptions may help. !(*ButtonBox[\">>\", Appearance->{Automatic, None}, BaseStyle->\"Link\", ButtonData:>\"paclet:ref/Integrate\", ButtonNote->\"Integrate::pwrl\"])"