Hi all, I, for a very short period of time was suffering from the problem of my phone DISCHARGING while it was charging. This made no logical sense to me until I did some research, which I will detail below.
How USB Power works (Roughly)
Firstly let's discuss USB power provisioning. Strictly speaking, the specifications say that any given USB port should provide a maximum of 500mA (or 0.5A) at 5 volts. *Don't shoot me electronics guys, I'm simplifying for ease of explanations sake*. Imagine that ampage as the actual force of the charger, how quickly it can ram power into your phone. Like the rate of flow on a pipe.
The beginning of the problem
This was all fine and dandy when all USB was really used for was Keyboards, Mice, Memory, etc, low current draw devices. Something else I should mention here is that the Ampage that a port CAN provide is not the Ampage it DOES provide - the device draws a certain Ampage and if the USB controller agrees it outputs said Ampage. Later, when USB was beginning to be used for more power hungry applications, ie External hard drives, these required more power than the port could (In theory) provide. However, most more modern motherboards/USB controllers were more than capable of supplying plenty more Ampage if it was requested. This was breaking the specification but not in any massively dangerous way so as such nothing bad happens.
This is where we get to the actual issue people are experiencing here. The Nexus 4 is a standards compliant device in the respect that it seems to only draw 500mA from any USB port no matter what it's potential, unless it's an AC Wall wart. If you're experiencing problems with wakelocks (see XDA) and other things, this causes your phone to draw more than 500mA which means your phone actually discharges while it's charging! Terrible!
This is quite easy to get around, but again I'm going into detail so let's explain how the phone tells the difference between a dumb wall wart and a USB controller. Easily! The USB controller obviously makes use of the data pins found within the USB cable, whereas a wallwart just (almost always) shorts them out. The Nexus 4 can detect this short, and as such draw more power *While still in quotation marks staying in spec*.
The root problem is not with how the N4 is charging, it's with the wakelock you're experiencing which is causing the phone to draw so much power while the screen is off. While the screen is off and the phone is in Deepsleep (A CPU state where it uses very little power) - it should draw no more than 50mA leaving 450mA for charging the battery, but you guys are probably experiencing a wakelock of some sort.
Solutions to the problem or How to break a specification for the good of mankind
The simple solution is to install this app: https://play.google.com/store/apps/d...ller.batrsaver
This forces the device into a Deep sleep when the screen goes off by killing applications and turning off all internal chipsets that have wakelock capability, most commonly networking on the Nexus 4. This will allow your phone to charge (slowly) off USB without an issue. Another common wakelock is when the device is picked up by your desktop as a media device. The USB controller inside the Nexus 4 forces a wakelock which keeps it from charging. Stupid design, I know.
* A more hackish solution is to install Francos kernel, buy his app, and tick the Fast charging option in the kernel settings dialog. This will force the phone to think that everything is an AC adaptor and will force the phone to draw as much current as it can from the USB port (which on most modern motherboards is fine, and results in extremely quick charging).
* An even simpler solution than all this is to just use a 'USB Charging cable' - this is simply a cable that does not have the Data pins, and as such does exactly the same as what enabling USB fast charge above does. http://www.ebay.co.uk/itm/Micro-USB-...item51a465d124
If you live near a Poundland store here in the UK they sell a 4 in one USB cable type thing which turns 1 USB port into Ipod sync connector, Nokia connector, MicroUSB and MiniUSB, and this doesn't have the data pins and as such is excellent.
One final point, an excellent app for monitoring whether your device is actually charging or not and how quickly is Current widget: https://play.google.com/store/apps/d...ntwidget&hl=en
This widget will tell you how much Ampage is going into or leaving your battery. If the battery icon is green, then it's discharging, if it's black/white then it's charging. The bigger the number, the faster the discharge/charge. This is an extremely easy way to test speed of chargers too.
Another solution, just use an AC Wall wart - they're cheap as hell and the one supplied with the Nexus 4 is an extremely fast charging one. Shame I've gone and lost mine.
A way to roughly monitor charging current draw
I'd also recommend you install https://play.google.com/store/apps/d...ntwidget&hl=en and monitor, if the battery is green while charging it's discharging and you need a more powerful charger/to figure out what's causing your phone to use so much power.
General good values in Current Widget
I generally saw a max draw of about 750mA for charging (not including draw for powering the device, the Nexus 4 can draw more power to charge and power the device) on my old Rev10 first generation Nexus 4. On my new Rev12 board I'm noticing this increase to about 850mA.
Are higher amperage chargers any benefit to anyone?
Yes and no. You will not notice faster charging unless you use your device while charging. Your nexus will draw as much power as it needs to power the phone while charging at the fastest rate. For example on the stock 1.2a charger
1200mA | 800mA goes to charging 400mA goes to powering the phone idling
Let's say you start a stability test. Your phone will obviously be using a lot more power so this will happen
1200mA | -600mA goes to charging and 1800mA goes to powering the phone stability testing
That minus value above may look strange! Let me explain. If the phone needs more power than the charger can supply, it will draw from the battery. That's the minus number.
If you have a higher ampage charger like for example a 2.5a charger
2500mA | 800mA goes to charging 400mA goes to powering the device
2500mA | 700mA goes to charging 1800mA goes to powering the device
Can you see the difference?
DISCLAIMER: I am not an electronics engineer nor do I claim to be, I am simply a hobbyist and this is what I've found to be the case. Please correct me if I've made any mistakes, I want to learn.