Android OS2.2 used to have an option under Settings/Applications/Development to disable screen lock during USB debugging. After upgrading my Samsung Galaxy S to OS2.3.3 this
Tell PowerManager to keep the screen on (it will still dim):
adb shell settings put global stay_on_while_plugged_in 3
The value 3 is the following two types OR'd together:
BatteryManager#BATTERY_PLUGGED_AC and BatteryManager#BATTERY_PLUGGED_USB.
Use adb shell dumpsys power | grep mStayOnWhilePluggedInSetting to see the current value.
To revert to normal behavior set the value to zero like so:
adb shell settings put global stay_on_while_plugged_in 0
Verified working on Android 4.4 through 9.0.