setStayAwake
Keeps the screen on while the device is plugged in (USB, AC or wireless), or lets it time out again, until detach, see setAnimations: what Developer options › Stay awake sets. A device on ADB over USB is plugged in, so a long test does not find the screen off. Read back with DeviceInfo.stayAwake.