Lately my iPhone 4 has been getting to 19% battery and then dropping straight to 1% and shutting off. Once I plug it back in and start it up it immediately shows up at 19%. Is this a battery or software issue?
Might be a battery calibration aka battery hardware to software communication issue where the iPhone's thinks there is more power than the battery can provide. When was the last time (before the iPhone started to just shut down at 19% battery) that you did a battery calibration as recommended by Apple.
Use iPhone Regularly
For proper maintenance of a lithium-based battery, it’s important to keep the electrons in it moving occasionally. Be sure to go through at least one charge cycle per month (charging the battery to 100% and then completely running it down).
If you don't then what you are describing above may happen where the phone just shuts down with a random non 0% battery percentage left. If the problem still persists after doing a couple of battery calibrations then it may be that the battery or other hardware is failing, and that the iPhone should be taken to a Authorized Services provider / Apple for more attention.
That is a typical failure mode for a battery where the voltage level drops faster than expected and the device enters sleep mode or shuts off entirely.
Of course, it could be a calibration issue, but if this happens even after a few full charge / discharge to the point where the device shuts off, I would seek service for the battery.
On macs, there is a
pmset -g batt tool to log the charge level periodically so you can leave the device alone and detect / document this to confirm that you have a voltage drop at a specific point in the charge capacity.
Imagine the opposite. Say you have a water tower and there is a hole in the side at the 75% full mark. You won't detect that hole when filling it up between 0 and 74% - but if you graphed the rate at which water is being added and the rise of the level, you could detect holes by seeing a change in the curve. The analogy is a bit strained since the chemistry of electron storage is a bit more complicated than a water tower, but hopefully it helps illuminate the idea that you can have an issue at a specific point in the discharge cycle.
I don't have a jailbroken phone to test if the
pmset command is part of iOS, but you can also look for LowBattery log entries on your iPhone or synced from iTunes to your computer to see if the run times are getting shorter over time.