Click the Lock All Pixels icon in the Layers panel to lock all layer properties.
Click the icon again to unlock them.
In the Layers panel, click the Lock Transparency icon to lockout transparent areas of the layer and not draw on them.
Click the icon again to unlock it.