This is a simple app that has one purpose: Automatically enable/dissable the “Stay Awake” Developer Options setting as you connect/disconnect to ADB.
The android.permission.WRITE_SECURE_SETTINGS is a System permission that is not granted to any non-System app. So to get around this, after installing the app, you have to connect the device to an ADB console and run this command to grant the permission:
adb shell pm grant com.duck.stayawakeadb android.permission.WRITE_SECURE_SETTINGS
For those that are not able, or willing, to build this app themselves I have put up a compiled APK in the APK folder.
The APK is also available on IzzyOnDroid