Is this the definitive answer? Or at least A definitive answer if the battery is just plain dead or something similar?
I came across this issue with my bro-in-law's HP 250 G4 notebook. It was given to him on his retirement 4 years previously. Apart from having been set-up by his company, it had never been used and had just sat in a cupboard for 4 years.
On going to use it after those 4 years he could not remember the password and so I decided easiest thing to do was re-install Windows 10 Home (v1909) from scratch (which would give him a clean install of the latest Win10 and avoid catching up on 4 years
of updates). All worked fine, but I noticed that the battery was dead (0% charge and just would not charge no matter what I tried). Whilst installing apps (and connected to AC power) I noticed the "Locking" screen that others have mentioned momentarily flash
up and the unit going into sleep.
Obviously I investigated and tried various things (as have many others).
Eventually what I discovered is buried deeper in Advanced Power Settings - you get there by Control Panel, [then System and Security if you are using the Category view in Control Panel], Power Options, Change Plan Settings (for the current power plan),
then click on Change Advanced Power Settings underneath the power plan details. Scroll down in the dialogue box that opens and expand Battery and then expand Critical Battery Action. There should be both "On Battery" and "Plugged In" settings. Under Plugged
In you may well find that Hibernate or Sleep is selected. Under normal circumstances that seems wrong, it should be Do Nothing. So set it as Do Nothing. There is not a Do Nothing" option for On Battery (and rightly so).
Then when the situation arises, when on AC power you should still get a Critical Battery Notification on the screen (these are turned on by default), but you can just close that. So far, I've just had one (or maybe two) Notifications, but Windows appears
to learn that you've taken note of the warning notification and so not keep pestering you. If you do get repeated notifications you might like to consider one of the workarounds below.
So what seems to be happening is that in some cases Windows 10 is setting the default Critical Battery Action for both On Battery and Plugged In to Hibernate (or Sleep). I found that if I re-applied the defaults that is exactly what happened. So both my
clean install and re-applying defaults got it wrong. "How do I know it is wrong?" I hear you ask. Firstly, in the circumstances it just does not make any sense to just instantly Hibernate/Sleep when AC power is available. Secondly I checked two other Win10
Home (v1909) laptop installs, both had Plugged In set as Do Nothing as did a Win7 Home Premium laptop.
Workarounds - IF THE ABOVE DOES NOT WORK FOR YOU
===============================================
Firstly, is simply to remove the battery (whilst the laptop is powered off).
The alternative is to disable the battery driver in Device Manager (under the Batteries entry disable Microsoft ACPI-Compliant Control Method Battery). Microsoft ACPI-Compliant Control Method Battery is the driver software that enables Windows to recognise
and work with the battery. In effect, without the driver it won't know that the battery exists (so has a similar effect as removing the battery). If you choose this route, don't forget to re-enable the driver if you fix the battery problem (e.g. by installing
a new battery).
Both workarounds will cause the Power Plans not to have a Battery option (and so the Critical Battery Action will never get invoked).