Here's my problem: I used to run Lineage 16 on my Pixel3a, which still had the "profile" option where I could do things like "When my home network is not within reach, switch to another profile". I used this to turn off wifi when leaving the house and it worked very well. Important: This did not need my location services to be on to work.
Now I've upgraded to Lineage 17.1 (Android 10) and this option is gone. I am now looking into how to rebuild that functionality. My phone is rooted (via Magisk), and as a software developer I am ready to use all tools I have available.
What I've tried: I've built an app that periodically checks if I am connected to one specific SSID (since that is all I can see on Android 10 anymore - "Am I connected to "my-ssid"?) and then turns of wifi using the shell and
sudo("svc wifi disable").
sudo() is my function that opens a process and talks to the shell.
The problem is I don't think there is a way I can guarantee my app always runs, and I'd like this to also work when the app is off? It doesn't even need to be a specific SSID, I'd be happy if my result is: "If we're not connected to a wifi network for more than 3min, turn wifi off.
so what other options do I have?
Tasker, just like my own attempt, kind of works but only with location services on, which I'd like to avoid. What else can I do. Can I run some kind of script or a job just on the shell or so?
Is there anything I can do with Magisk or Xposed?
Happy for any help here - the internet is full of links and tips, but they all target older OS versions. Btw the source for my (extremely rough draft) app is here if anyone is curious.