My phones screen will remain backlit and on while plugged in after getting a text or something that would pop up.
Even if nothing popped up, if I just unlock it while plugged in, it will never re-lock on its own.
This wasn't always the case but I didn't notice it for a while and am not sure what might be causing it. Maybe a background app?
Works normally when not plugged in.