Check in setting - display - smart screen. if it Is on then your screen is stay on until you are looking at it or hold device in upright position. Make sure to turn it off in settings. Also if you enable developers option , check if you enable never lock screen when charging. Turn if off