[Samsung Galaxy S 5 Unified Development] curiousrom:
System Wide Ad Blocking via Hosts File - AdAway & No Root Alternative

Thanks :good: for reporting back. :cool: Feedback is important so we can learn if our suggestions work or not or if you found a better solution.

The marvelous system wide ad blocking via the Hosts file AdAway (requieres root & now maintained by [MENTION=2822685]PerfectSlayer[/MENTION]) does not use any RAM & CPU resources if in Privacy Guard > AdAway > Start at power up is set to Ignored.

AdAway was working fine when I was running S5 LineageOS 16.0 w/ Magisk v18.1 & now with the LineageOS 16.0 Addonsu after a S5 LineageOS Super Clean Install as seen in the screenshot. I am using AdAway v4.2.3 @ the present.

View attachment 4729502

Note that with Privacy Guard > AdAway > Start at power up: Ignored then the AdAway > Settings > Check for updates daily will not work but that's fine with me as I have it disabled & just check manually once every 1-2 weeks for hosts files updates & I did not see any ads since a long while.

In Magisk on S5 LineageOS 16.0 I did not have to install the Systemless Hosts module as described by [MENTION=8126387]martyfender[/MENTION] in his post here to make AdAway work but that could be necessary for you depending on your setup.

"Do I have to uninstall the su extras addon after I install magisk?" - :eek: You have to uninstall a root su method BEFORE installing an other one! So if you installed addonsu-16.0-arm-signed.zip from https://download.lineageos.org/extras you need to run addonsu-remove-16.0-arm-signed.zip from that same page & reboot to System before doing anything else.

I have read some posts saying that using Magisk Manager > Uninstall > Completely uninstall or TWRP flashing the Latest Uninstaller from the XDA Magisk thread does not restore the System to exactly 100% how it was before you installed Magisk as it leaves some files behind but I did not find an authoritative post about it.

I asked the question to Magisk expert [MENTION=4667597]Didgeridoohan[/MENTION] in this post here but did not get a reply so far. :crying:

Having installed both root su methods your system may be messed up which may explain why you are having AdAway problems. The best would be to restore a TWRP backup made before you installed Magisk on top of Addonsu. If you don't have one then you could try uninstalling Magisk then flash addonsu-remove-16.0-arm-signed.zip, reboot & install Magisk again but that's not very clean & may cause future problems.

***

System Wide Ad Blocking via Hosts File & Whitelist - No Root Alternative

If your not rooted device has a custom Recovery like TWRP it's very easy to create a flashable adblocking hosts file with the free AdfreeZip - TWRP flashable hosts file, reboot to Recovery & flash it.

In AdfreeZip's settings you can add additional hosts lists & URL's to the whitelist as seen in the screenshots.

View attachment 4729521 View attachment 4729522 View attachment 4729523

I attached a TWRP flashable AdfreeZip_hosts_2019-03-23_curiousrom.zip that AdfreeZip created in less than a minute with the hosts lists seen in the attached screenshot. :eek:

To spot the URLs to whitelist it's a little more complicated than the AdAway method that [MENTION=8531988]ngshixuan[/MENTION] described here.

You could use OS Monitor found on F-Droid and some of ngshixuan's steps to capture the connections & export it in .csv format. Then copy/paste the URLs you want to a .txt doc > copy back to device & copy/paste each URL into AdfreeZip.

The F-Droid page says "OS Monitor won't support Android 7.0 and following versions" but that's not true for the Connection & export the connections log part at least as it works fine on my S5 16.0, S3 LineageOS 14.1 (7.1.2) & S5 LOS 15.1 Oreo.

To monitor connections you can also use for example Connection List Free (requieres paid version to export) or Network Connections: the free version has some limitations. I like it very much & have the Pro version.

You can also use wildcards for the URLs.

***

Thanks :good: for the Thanks & reporting back. :cool:

***