The camera will have an optical image stablization.
This means the lens will move in it's housing.
When not in use, it will move a bit and shaking it, you will hear a little tapping.
It's not recommended to shake the phone too much.
When the camera is in use, the lens will activate and move around to help with stablizing the image or video
It's quite normal for this