I think, in lieu of the above this might be:

`final int layerType = layer && useHardwareAcceleration ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE;`