afwall icon indicating copy to clipboard operation
afwall copied to clipboard

Separated screen on/off rules support

Open baongoc124 opened this issue 10 years ago • 24 comments

Could AFWall+ supports separated rules based on screen state (on/off)? That would be great since there're many apps I only want to have Internet connection when screen is on.

baongoc124 avatar Feb 01 '16 17:02 baongoc124

You know, that's a real interesting idea. I have to agree: For most apps, I only want them to communicate when the screen is on. I would take it even one step further: I only want them to communicate when the screen is on and they are the foreground app.

Gitoffthelawn avatar Feb 02 '16 11:02 Gitoffthelawn

@CHEF-KOCH I think you misunderstood here. I want to have more strict rules when the screen is off, which means more apps cannot connect to Internet in that condition. Not the other way around.

baongoc124 avatar Feb 02 '16 11:02 baongoc124

Facebook for example. I don't care about notification when screen is off anyway. I know that it can be Greenified but it will kill the process and launch it again is slow.

baongoc124 avatar Feb 02 '16 11:02 baongoc124

You're right, @CHEF-KOCH . I actually want to block all traffics, not just notifications. Maybe we can disable push service of target app but that'll make the solution depends on other app. Looks like it stucks here. Anyway, Facebook messenger also uses polling as fallback. I'm not sure about Facebook either.

baongoc124 avatar Feb 02 '16 15:02 baongoc124

Well, as I can see that we have no acceptable solution for this, it's 'wontfix' then. Thank you for your elaboration! Btw, this feature I saw NetGuard has, and I read somewhere that they implement it by change set of rules when screen turn on/off. But it cannot block push notification as you said.

baongoc124 avatar Feb 02 '16 15:02 baongoc124

:+1: Perhaps this or many other limitations now (if has any) could be implemented as extra features that only can be activated if Xposed is available like Greenify does with some of their experimental features. I tried Xposed once and its power is addictive. Cannot use any phone without it now. :-)

baongoc124 avatar Feb 02 '16 15:02 baongoc124

An option to block all (including GCM) internet traffic once the screen is off would definitely be useful. Per app is a plus, but blocking all internet traffic would still be very useful. It would save battery significantly. Ideally, it would wait 10-30 seconds after the screen is off, to make sure you aren't going to turn it right back on.

This is a different compromise from automatically turning off WiFi / data when the screen is off. When an app turns off WiFi / data, and then turns it back on, more battery is conserved, but credentials must be authenticated each time, which takes time (and a little power). Blocking all internet traffic maintains the established connection, but just blocks the transmission/reception of data. Thus, WiFi / data will be available immediately when the screen it turned back on.

Gitoffthelawn avatar Feb 03 '16 06:02 Gitoffthelawn

I've just logged in to create a feature request to block/enable network while screen off/on on per-app basis as it's realised in NetGuard. With NetGuard this feature is extremely useful. With AFWall+ I've created two separated profiles for different screen states. It's not very comfortable to switch them manually.

SkyWheel avatar Jun 28 '16 14:06 SkyWheel

Most likely not a wise idea to add. Resyncing when screen comes back on will most definitely eat more traffic than keeping an idle connection. If you want to get rid of an app that possibly does problematic stuff, just uninstall it.

someone-somenet-org avatar Aug 10 '16 11:08 someone-somenet-org

That is a big generalization without any evidence to support it.

Also, it's a gross oversimplification to "just uninstall it".

Every app can be considered "problematic", as an app with internet access can transmit or receive any data. Also, apps can work in conjunction with each other to transmit or receive data that a single app may not have access to.

Gitoffthelawn avatar Aug 11 '16 09:08 Gitoffthelawn

You need to be able to trust apps you have installed. If you cant, uninstall them. If you cannot trust any app... well throw away your device. This goes for all apps, not only apps with internet access. There are many more weaknesses on a rooted android, than internet access.

"Also, apps can work in conjunction with each other to transmit or receive data" cannot be solved by iptables. You will need an intent filter, which has nothing to do with iptables and should therefore be out of scope for this app.

This app is a great iptables manager, and imho should stay that way and not try to grow into a failing wannabe-all-security-solution. Why not add an anti-virus part too? It has to do something with security too. Also some crypto-helper stuff, because well ... security has to do with crypto no? Also bundle tor for privacy! ... NOT

someone-somenet-org avatar Aug 11 '16 10:08 someone-somenet-org

@somenet

It's not problem to trust an app or not to trust. Actually some apps should not have access to internet while it's standby mode. If some app is trusted but I use it only while screen is on, this option could be very helpful. You forgot very simple thing: not all mobile plans are unlimited. As for me I need only three apps have access to internet on background: mail app and two messengers

SkyWheel avatar Aug 11 '16 14:08 SkyWheel

The app "NoRoot Data Firewall" allows easily to block depending on screen state (on/off) per app and much more comfortable than NetGuard. It is highly comfortable to configure the app. I suggest to adapt this kind of feature. It's up to you.

antomonte avatar Aug 14 '16 14:08 antomonte

NoRoot Data Firewall is not FOSS. That's it.

SkyWheel avatar Aug 23 '16 02:08 SkyWheel

@ukanth , so, as far as I understood you won't implement the feature, please clarify.

SkyWheel avatar Oct 10 '17 06:10 SkyWheel

@SkyWheel , No, not yet. I'm working on few core level design changes. If that goes well, I might support this.

ukanth avatar Oct 10 '17 08:10 ukanth

I would love to see this implemented!

GnaXi avatar Oct 10 '17 20:10 GnaXi

Isn't it better you get an app catching on/off events (and other events you like) and sending profile switch command (aka intent) to Af wall?

ildar avatar Oct 11 '17 00:10 ildar

Easer (Auto operation performer) - https://f-droid.org/app/ryey.easer could be a good candidate but needs your desired screen on/off event. Ask the developer, he'll help

ildar avatar Oct 11 '17 00:10 ildar

@ildar IIRC, switching profiles requires rewriting iptables, which is slow.

Gitoffthelawn avatar Oct 11 '17 04:10 Gitoffthelawn

@ildar, easer constantly crashes on my latest nightly LineageOS build :cry:

SkyWheel avatar Apr 12 '18 06:04 SkyWheel

it shouldn't. Please file it at https://github.com/renyuneyun/Easer/issues/

ildar avatar Apr 12 '18 06:04 ildar

@SkyWheel , No, not yet. I'm working on few core level design changes. If that goes well, I might support this.

@ukanth Any progress on this feature? Would be very useful. Thank you for your work!

ka223 avatar Aug 28 '20 12:08 ka223

Is there any update?

toas-koas avatar Oct 11 '22 17:10 toas-koas