Lisandro is right. The mobile data wasn't an official API and Google took it away and put it under a permission that only system apps can get.
What we did on 5 is that we hide the option to set the optimization period and leave the internet ON the whole time, because we don't want to offload what-would-be wifi traffic to mobile data, because that costs money. Now only automatic wifi works (switches OFF wifi when there's no known wifi network around).