Is there an app to disable the lock when the phone is charging and headphones plugged in?

When listening to music in my car I plug in the phone as well as the audio cable. I would like it not to turn off when this is the case but just dim the display. (This is how the iphone's player does it and it's very convenient)

Thanks