I'm on a UleFone Armor X7 (cheap waterproof/rugged thing) running Android 10. I'm trying to use Tasker to conserve power for multi-day bike rides with no charging*, and one thing I'd like to do is turn off as much communication as possible for several minutes, then on briefly to pick up messages, then off again in a loop.
I know aeroplane mode requires root (edit: or ADB Wifi), and I don't want to lose Google Pay, but I should be able to toggle mobile data without it according to the following screenshot:
This says either root, or ADB WiFi, or Write Secure Settings should be enough. ADB WiFi isn't an option, because it needs a PC at every boot, which is incompatible with turning the phone off overnight - to save power. So I've installed ADB, granted the permission, and it still doesn't work. I can test that the permission is set: adb shell dumpsys package net.dinglisch.android.taskerm |grep SECURE_SETTINGS returns android.permission.WRITE_SECURE_SETTINGS: granted=true but when I try to test the task I get
Error: 1
Couldn't toggle mobile data on this device
I suspect a semantic error, meaning that ((ADB Wifi or root) and (Write secure settings)) is needed. Enabling ADB Wifi does indeed allow Tasker to toggle aeroplane mode - but while Tasker can keep ADB Wifi alive (even apparently with Wifi itself off), this doesn't persist over a reboot, such as shutting down overnight to save battery, and a PC is needed again on restart. Enabling battery save mode overnight may be an option.
I'm thinking of trying something with AutoInput, but I'm not keen, as it (i) requires the screen to be unlocked, and (ii) can on toggle, not set a state. I also don't want to pay even a little (on principle) to test something with these issues.
I've seen a few similar questions for very old Android versions, but nothing recent.
* I will have an external battery, and a dynamo, but just assume they're not enough to keep everything charged, especially as I navigate on my phone.

svc data enable|disabledoesn't work even with root (neither with UID 2000 alone). It works only onadb shell. So there have some changes occured at API level (it's not even SELinux, I checked). But I haven't looked into it deeply yet. – Irfan Latif Jul 07 '20 at 15:09