The noise is most likely caused by wires and components touching the internal shell when shaking the device in some cases. It’s safe and normal if the device is charging normally.