Since I installed Android 9 my phone will randomly power off at any amount of battery, and will not power on unless connected to a power supply. It tends to show the Google logo, and then power down again.
Recent examples, such as just now, the phone turns off at 45% battery. When I connect it to a power supply, it will turn power up again, but the battery shows as 2%.
The highest amount of battery it has done this with is 75% battery.
The handset is a Google Pixel, running Android 9.
What techniques can I use to debut this issue, and ideally resolve it? Could this be a hardware failure or a failed battery?