See How Long Your Android Has Before Automatically Shutting Down from a Low Battery
Even if my phone has only 1% of battery life left, I'll keep using it until I can get to a power source somewhere. Most times I never make it to a charger, and my device eventually powers down on its own.
Yes, there is a low battery warning, but it'd be more helpful if we could know exactly how much time is left before the device initiates its shutdown process. Now, thanks to developer TonyP, there's a way to do this.
In order for this app to work properly, you will need to be rooted and running Xposed Framework. The app will work for AOSP devices (Nexus and Google Play Edition) running Android 4.2 and above.
Although designed for Nexus devices, the developer is working on Samsung compatibility. You can keep up with the progress on the developer's thread.
With your device rooted and running Xposed, enter the Google Play Store to install Battery Shutdown Manager by TonyP. It is free, but there is a premium version available (more on that later).
Once the app is installed, make sure to enter Xposed Installer and properly enable the mod so that you can start using it. Simply check "Battery Shutdown Manager," then perform a "Soft reboot."
When you enter Battery Shutdown Manager, the first thing to do is enable "Freeload." As you can imagine, this enables the premium features, allowing you to be a freeloader. If you find it useful, consider purchasing the Pro version ($2.79) after testing it out.
Now select when you want to receive the countdown. You can have it anywhere from sixty seconds to a quick five seconds before your device shuts off.
Now whenever you approach that critical moment, your device will show you a countdown timer, which hopefully will give you enough time to plug it in. The time will remain persistent until you plug in or the device shuts down, persisting even on the lock screen.
Battery Shutdown Manager can save you from unexpected power downs. Of course, there are ways to avoid ever getting to this point—lower your brightness, employ a power-saving mode, or use Sony's Stamina Mode port.