My phone doesn't always charge at full speed, even with certain 2-amp chargers. What are the necessary conditions for it to charge at full speed? I've noticed that my Samsung Galaxy S4 doesn't always charge at its maximum rate of charge, even when it seemingly should.  For example, car DC adapters that claim to provide up to 2.0A current only provides 500mA.  I've also tried connecting the OEM AC adapter to a car inverter**, with the same result of a ~500mA charge rate.  On the other hand, when connected to an AC outlet through the same charger, the device draws 1200mA*.

I previously owned an Galaxy S3 which I think started having similar issues at some point, possibly after a system update.

What conditions are required for Android devices to draw greater than the 500mA current provided by a USB 2 data connection?  Have these conditions changed with successive versions of the Android OS?

*: Measurements of current draw made by Ampere

**: I asked this question a few days ago and it has attracted very little attention, so I'm now asking a more general question.
The OS isn't relevant to charging speed, but the internal hardware differs heavily between phones. One thing you'll experience is that nearly all chargers that advertise themselves as 2.1A are optimized for iProducts, which require a different grounding scheme in the charger to reach their full speed, and that same scheme limits Android devices to 500mA. So counter-productively you'll find that most 1A chargers will charge your Android device FASTER than 2.1A chargers. You'll also see a lot of multi-chargers that have one port dedicated to 2.1A, and if you move your phone to the other port it'll charge faster. Most label these ports as A and NA, for Apple and Non-Apple.

The way around this is to buy a charger that's specifically designed to adapt to whatever device you're using. One example, which I've used myself, is the Anker 4.8A 2-port charger. Unlike most two-port chargers which dedicate one port to Apple and one to non-Apple, this uses Anker's PowerIQ tech to sense, on either port, what your device wants from it and adjust accordingly. This charged my device at full speed quite easily. I've since switched to one from Choetech that's a 4-port simply because my Nexus 6 supports Quick Charge 2.0, and that one had a port for that, but it advertises their own version of the same concept as PowerIQ for the other ports. Both companies make a ton of wall/desk chargers with the same technologies in them, and I have multiple Anker chargers and external batteries. Aukey seems to be another supplier who's probably using the same OEM as those other two companies, with similar results. And they all seem to give good warranty support via Amazon.

The other factor, as mentioned in the other answer, is the cable. I used to think "USB is USB," and that's true for data, but not for power. Cable quality, and unknown factors, will change what you can pull off. I've had two cables of the same length produce as much as an 800mA difference from the same charger. Also, some just combine with certain chargers better. The cable I've had the most consistent luck with, across all devices, is the Cable Matters Premium Gold-Plated cable. I used to buy the MonoPrice-branded ones, but they stopped making them, and I found these identical ones on Amazon. They're quite cheap, and they've worked exceptionally well for me. They give me over 2A on Quick Charge 2.0, and 1.2 on everything else when all other conditions are optimal and I'm using a good charger. Length matters, too. The shorter the cable, the better it can hold onto its current.