My phone is Samsung Galaxy S7 with Android 8, and any phone specific answers are welcome but I am looking for a general solution
A few days ago my phone screen went crazy and started detecting touch events all over the place when it was just left alone on a table. The home button seemed to be unaffected and brought the phone to the home screen, but it didn't stay there long enough for me to be able to do anything. Long pressing the power button brought up the (power off, restart, emergency mode) interface, but it turns out touching anywhere on the screen other than the three specific buttons causes the buttons to disappear, and since touch events were getting auto generated, the shutdown option kept disappearing. Eventually I managed to stay on the shutdown interface long enough to press the shutdown button.
Is there any way to forcefully cause a hard shutdown on a phone that does not have a removable battery? I am looking for a general solution that works on all phones, if such a thing is possible. I would also like to know if this is possible from adb on an unrooted phone.