[HTC Sensation] R3dox:
I had and again have this as well.

The annoying thing is that it used to happen infrenquently on another ROM (virtuous inquisition) and I thought it was somehow app-related. Because it was so infrequent, I thought at various times that I "fixed it". Then I tried this JB ROM, just to try JB, a few months ago and it started happening like crazy, completely unusable. It also seemed to happen more when I went back to the VI ROM (through a nandroid backup) so I got fed up with it and reverted completely back to stock (S-ON and all) to see if it would still happen.

I sort of found out how to trigger this behaviour and managed to get the same thing to happen with stock Sense, though not nearly as easily as with the JB ROM. It seemed to be a matter of stressing the system (by normal use, no special benchmarks or anything) when the battery is not quite full anymore (<80%) and then switching between apps/screens. Usually the phone would also get a bit warm (around 40 degrees C) and, most prominently, the voltage of the battery would plummet to around 3400 mV. It would then turn off (have to press power for it to start up again) and usually crash before completing the boot again. I'd have to wait and/or pull the battery for it to start normally again, after which the voltage is much higher again (3600mV+). The battery % jumps up and down like crazy when this happens, going from 70%+ to <30% and finally ending up somewhere around 10-20% below what it was before. As you noted before, it never happens when plugged in AC.

Because of this, I contacted HTC and the helpdesk asked me to do a battery test (charge O/N to full, set it to airplane mode, then set brightness to 100% and screen-off timer to never and see how the battery % drops over 1.5 hours). The result of this test (to below 75% in 1 hour) was apparently considered "not normal" and I was asked to send in the phone. I got it back 2 weeks later with the battery replaced (they even gave me the higher capacity XE version, hehe). This test was done using safe mode (hold vol down when starting up) so no 3rd party apps were loaded.

Then, at first, the problem seemed to be solved even in this JB ROM, but nowadays (on 19th build currently) it's back almost as bad as it used to be before I sent in the phone. An added problem I have now is that sometimes the phone gets stuck with the backlight of the buttons on, screen black and not responding to anything (except the reset combo of vol up/down + power). The previous build I tested, of the 15th, seemed much less prone to this problem.

The system becomes quite stuttery (or it is stuttery) around the time it happens, and as it seemed to happen often when trying to wake from standby, I increased the min frequency to 384MHz, but that didn't help. Unless I simply have broken hardware (CPU instability under certain conditions, poor battery control, w/e), the one other thing that the HTC helpdesk mentioned at the time was the Sim card. Apparently this can also be a problem and this is the next thing I want to test. Unfortunately that won't be easy (I don't have another one), this is maybe something you could try.

All in all this is driving me completely nuts and to those who keep repeating the business card "fix": I can see the pins being depressed a few mm when I insert the battery.. unless I completely remove the battery the pins are definitely making contact. My fresh battery is already showing those pressure marks on the contacts so bad contact seems hardly the issue.