Try starting it up in "Safe Mode' and see if it happens when in there. Granted, you will have limited access, but this will let you know if it is software or hardware. If it doesn't happen while in "Safe Mode" then it is software. I would then check the device for bad apps, malware, viruses, etc. If, however, it still happens in "Safe Mode" then it is more likely hardware.
To get into "Safe Mode" please do the following.
1. First turn off the phone.
2. Next press and hold "Power" until you see the manufacturers logo on the screen, then release the power button.
3. "Quickly" press "Volume Down" and hold it for few seconds until you see the message "Safe mode: ON" or something similar.
4. If you wanted disable it, simply repeat the...