unrelated to the OP but a suggestion for your problem:
Waveup has a setting to lock the screen after X seconds with the proximity sensor covered, it's not very sophisticated and thus it can be a bit over-eager, but if the phone being interacted with by your leg while in the pocket is driving you up the wall then this should fix that.