Samsung App Power Monitor and Android Accessibility Services
For Samsung devices like Galaxy S7 with Android 7.0 OS, a function called App power monitor is offered, which extends battery life by putting background apps to sleep.
However, for apps optimized by App power monitor, their accessibility services (if any) will also be turned off when getting optimized.
As a result, if you want any of your app have its accessibility service remained on, you need to select it in Unmonitored apps.