yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] Mike B.:
You have a list of only 500 hosts?? Dec 20 would be a rather old (obsolete?) AdHell version, depending on where you downloaded it from, but let's concentrate on SABS. Compile the current version and install as instructed. Use the default packages (standard package and mmotti's package should be offered as options), update all, enable. It should take about a minute at the very most and end up showing 9610 blocked hosts. If you have an older SABS without the "enabling" spinner, just quit SABS and select "turn ON" right away, before going to any other screen. Maybe reading recent posts in this thread might give you additional insight.

---------- Post added at 08:40 AM ---------- Previous post was at 08:27 AM ----------

Nice! See if you can allow external storage locations ("/storage/FFFF-FFFF/SABS/Hosts/"?) if it doesn't yet.

FYI I'm currently running with an input file of 150 entries (mostly wildcards) + a 1-line whitelist and still looking for my first ad. I still wonder how many domains the users actually block in real life use. Maybe "social media", games, and porn sites use a lot of different domains but probably a lot less than often assumed. Some log ("recent activity") analysis might be interesting...
[Android Apps and Games] mmotti:
See attached!!! :)

It should pick up the SD card - I just don't have one lol.

// Construct the local path
String localfilePath = Environment.getExternalStorageDirectory() + "/SABS/Hosts/" + urlProvider;

It depends on how many sites / services one uses. Most 'dodgey' ones seem to include the most unique ads requiring larger host files.
[Android Apps and Games] Mike B.:
You cheap &^%$, get an SD Card! ;) Don't tell me that you don't have at least a USB thumb drive. Same thing as far as testing goes, but it should work with your current code. Any reason why you force "/SABS/Hosts" instead of simply making it the dialog default?

One often overlooked way to avoid ads is to avoid ads-filled crappy sites and apps, indeed!

Ok, enough chatter, hurry and commit, commit! (in the SABS repo) ;)
[Android Apps and Games] mmotti:
Haha - Believe it or not, money is that tight that I can't make any unnecessary spends lol. Internal storage has always been enough for me :)

The reason really is for simplicity at this point and just to prove that we can get it working. I was looking yesterday and I saw several people saying that it was a bit of a pig to put in a file chooser, so I've just put this in for now as a proof of concept really.
[Android Apps and Games] Mike B.:
I'm testing it as we speak.
[Android Apps and Games] Mike B.:
No workee so far ("Invalid URL") for either internal (sdcard) or external. Will look closer in a little while.
[Android Apps and Games] mmotti:
Bugger. Haha.

What were you entering in the URL box? The regex is quite specific
[Android Apps and Games] Mike B.:
"/storage/emulated/0/SABS/Hosts/blacklist.txt", "/storage/FFFF-FFFF/SABS/Hosts/blacklist.txt", etc. Do I need the hosts.txt name too? Be nice, let me pick my own location/name! ;)
[Android Apps and Games] mmotti:
Ah, that's the issue.

I promise in future I will let you choose your location name ;) haha. It's just to make it as easy as possible until such time as we can have a file chooser or auto import.

So you want to add your host file to your SD card @ /SABS/Hosts/ (e.g. /SABS/Hosts/blacklist.txt).

Then you simply wanted to enter blacklist.txt in the URL field :)
[Android Apps and Games] Mike B.:
OIC. it work that way, but then I'm stuck using internal storage. One small step in the right direction, though, congrats!

I know our devices have lots of internal storage, but the reason I like to put as much as possible on an external SD is that it makes it much easier to switch devices, recover from a reset, etc.

Spouse called. Must obey. Will sort it out later.
[Android Apps and Games] NeedleGames:
[MENTION=6150682]mmotti[/MENTION] Thanks for doing this. I had some issues with compiling when I tried to do it myself.
[Android Apps and Games] mmotti:
That is interesting - I thought the code snippet above would grab the external sd card dir not internal storage. Will investigate.

At least we know it works.
[Android Apps and Games] Mike B.:
Quick update: if I use a file name that's in /SABS/Hosts/ on the SD Card, it won't accept it but it doesn't trigger the "Invalid URL", it just stays there in the dialog. Weird.
[Android Apps and Games] mmotti:
That'll be me not including an 'else' statement to the 'if' file exists - I'll add it now.

Also I am going to allow entry of the path. It will make it more complicated, but until I can test code with an SD card inserted I can't find a reliable way to pragmatically determine a method to grab both internal and external mounted.

Brb ;)
[Android Apps and Games] thejackalsmark:
Ok. Slightly off-topic but you guys know the ad blocking scene better than anyone on Earth. Fixing (very soon I hope?) to Root n Flash Custom ROM (PartCyborgROM) on my Galaxy S8. Currently using ORIGINAL Adhell to Disable packages and Adguard (Paid) to ad block.

I know once I'm done, the "Edge-Of-My-Seat time I've spent following the Progress of SABS will be purely academic. (Wish I'd seen SABS before paying for Adguard ?) Will Adguard be a done deal for me also? No idea for sure, if it relies on Knox or not.

Thx for all your time and hard work on this, guys! If for any reason, rooting falls through and I stick to stock, once my subscription is up for Adguard, I'll be switching from it and adhell 1 to SABS, for sure. ?
[Android Apps and Games] NeedleGames:
If you root your device Adguard will still work because it creates VPN, SABS won't work. There are better alternatives to adguard on rooted devices that don't need to be constantly running in the background.
[Android Apps and Games] mmotti:
[MENTION=4343728]Mike B.[/MENTION]

I have added further commits - Would you mind testing?

In a nutshell, because I can't accurately determine programmatically (because I don't have an SD card myself) between internal and external storage (at this time), I have:

Updated the regex to allow for /storage/, /sdcard/, /sdcard1/

Removed the hardcoded /SABS/Hosts/

Changed the determining factor for local URLs; any string passed that starts with "/" will be considered local

This does mean that you now can choose to sit the file wherever you see fit within the confines of point #1, providing you can get the appropriate address for it. It seems there are a few different paths that go to the same place, notably /storage/ and /sdcard/.

I found the /sdcard/ entry within Root Explorer.

For now, I'll need to know how you guys find the 'location' of your local host files, and what these locations are so I can be sure that the regex allows them.

Example URL 1: /storage/emulated/0/SABS/Hosts/Hosts.txt

Example URL 2: /sdcard/SABS/Hosts/Hosts.txt
[Android Apps and Games] Mike B.:
I'll test as soon as I can but maybe the regexp checking should be more lenient since most anything under "/storage" is theoretically acceptable. On our devices, "/sdcard/" is merely a link to "/storage/emulaed/0/" (and the corresponding "/mnt/" location. Try looking as whatever USB drive you have (check your PM!), and you'll see that its location is "/storage/FFFF-FFFF/", where the "FFFF-FFFF" is the device's unique ID. Root explorer can show you that easily.
[Android Apps and Games] thejackalsmark:
Thx a bunch! Great point about background. ? On my last rooted device with Xposed, I was using Unbeloved Hosts.
[Android Apps and Games] mmotti:
Cheers :)

It's fairly lenient now; so long as the URL starts with /storage/ or /sdcard/|/sdcard1/ and ends with .txt, it'll be accepted. Oh, and the path / host file has to be a sensible name with no funny characters lol.

I have literally nothing in the way of external storage here haha. I looked top to bottom :silly:

Replied to your PM - Sorry, don't always get notified.
[Android Apps and Games] thejackalsmark:
[MENTION=6150682]mmotti[/MENTION]

Thx for the time and trouble to make the locations customizable.

Locations can be confusing/vary alot per device and file manager.

On my S8 default MyFiles says "Internal" and "SDCard". ES File Explorer says "0" for internal and "45B1-181B" for extetrnal card. ?
[Android Apps and Games] mmotti:
Thanks for the details, mate.

Have you tried to use a local host file with the new build? I'm interested to know if this works for others too.

Could you let me know the full path to a folder on both your internal and external storage?

Edit: Actually, I don't think this is visible in Samsung My Files.

I assume your path would be something like /storage/45B1-181B/Downloads/Hosts.txt or /sdcard1/Downloads/Hosts.txt

---------- Post added at 06:54 PM ---------- Previous post was at 06:43 PM ----------

Just seen this after my last post - I'd strongly recommend considering staying stock. Obviously it depends a lot on personal preference, but you lose a lot more than you gain these days by tripping knox.
[Android Apps and Games] thejackalsmark:
Don't have SABS installed because already sadly paid for AG and hate wasting $ lol But using AG folder locations as example…

using ES File Explorer:

Internal:

/storage/emulated/0/Android/data/com.adguard.android

External:

/storage/45B1-181B/Android/data/com.adguard.android

(Same for MyFiles is in Screenshots. I hope it's useful.?)

btw, is XDA Labs being extremely sluggish and finicky for anyone else today?
[Android Apps and Games] mmotti:
I saw your post after my original one but it was too late lol.

Excellent - Thank you very much. Hopefully that means the regex should work providing users are able to get the locations of their host files :)

I use the XDA forums app and it's FOREVER hanging on me.
[Android Apps and Games] thejackalsmark:
No worries. I don't use any of the "X-Pay" apps etc. and Snapdragon S8 has locked bootloader so using Samfail Root, Knox e-fuse isn't tripped.?

PartCyborgROM removes Knox features which other than for adblocking etc. I don't really use anyway. ?
[Android Apps and Games] mmotti:
The only reason it should take more than a couple of minutes to activate now even with ~9000 hosts, would be because of the UI bug in the older versions of SABS / Adhell.

I'd recommend that you update if you haven't already. Coincidently, the latest version of SABS includes my host file as standard. You may have to select it, but it will appear in the custom host providers automatically.
[Android Apps and Games] Mike B.:
<RANT>You're lucky we''re in the SABS thread where those matters are irrelevant, else I'd chastise you for confusing SamFail (or even "systemless SuperSU") with a proper root. If I root a device I want to have access to all privileged operations, including the ability to freely edit

anything

I want in /system without any trickery or limitations. </RANT> ;)
[Android Apps and Games] Yanchev:
Don't want to sound like I am pressing anyone but when is the ETA of the new apk version? Looking forward to the new changes. Don't have access to pc to use android studio.
[Android Apps and Games] thejackalsmark:
lol. Oh I understand the diff, and while I would love to have TWRP, custom kernel, etc., sadly not lookin like that will ever happen for us snapdragon owners.

The S8 IS a damn good device, stock ROM and non-rooted. In spite of how much I miss Xposed, etc., I also haven't felt a "Rush" to root either.

(I DO miss "Full" root privs on my old LG phone, tho. I had 4.1.2 JB for 5 yrs, till hardware began to fail and didn't complain. ? lol)

(Man I miss the PRE "Safety Net/Knox Days".
[Android Apps and Games] Mike B.:
Creating downloadable apks is actually a fairly low priority while the app is under (very!) active development. Keep in mind that as soon as a new version (0.0.8?) is posted, it'll become obsolete with the next commit to the source. I you don't have access to a computer, try not to get too excited about any of the changes we discuss here, keeping in mind that some of those are temporary. Maybe you can convince a friend, neighbor, employer, or school to let you use their computer (Mac, Linux, even that Microsoft thing) for a quick compile?
[Android Apps and Games] NeedleGames:
I'm having a very important exam in two weeks from now so expect me to be less active on SABS project during this time.
[Android Apps and Games] thejackalsmark:
☝️☝️☝️ Lol. Nice glitch XDA! ? [MENTION=6183103]NeedleGames[/MENTION] seems ya got an extra freebie. ??

Good luck on the exam. ?
[Android Apps and Games] Mike B.:
[MENTION=6150682]mmotti[/MENTION]:

SUCCESS!

/storage/SABS/Hosts/hosts.txt

/storage/SABS/Hosts/something.txt

/storage/FFFF-FFFF/SABS/Hosts/hosts.txt

/storage/FFFF-FFFF/somewhere/something.txt (external SD card)

/storage/AAAA-AAAA/somewhere/something.txt (external USB drive)

etc...

All accepted and successfully processed. Nice!!!

[MENTION=6183103]NeedleGames[/MENTION]:

With those new locations, the Ui is a bit clumsy, truncating the URL, but that's trivial cosmetic tweaks that can wait. Maybe allow viewing/ editing and re-validating?
[Android Apps and Games] NeedleGames:
Yeah, sure. Will do it.
[Android Apps and Games] mmotti:
:victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory: :victory:
[Android Apps and Games] Mike B.:
We're not done. We're never done. Now the next logical step would be to allow exporting/importing the generated hosts list to any /storage location, proper file chooser, etc. You guys wanted to be devs, so now you have to pay the price! Users are never satisfied, even if they get a great app for free. That's why I'm long retired. ;)
[Android Apps and Games] thejackalsmark:
Grrr. Was hoping it would glitch again and give you 2 thx for the price of 1 as well. ????
[Android Apps and Games] mmotti:
But it's hardddddd :crying::silly:
[Android Apps and Games] khaisttj92:
here the link i compile for you.change the package name.

https://drive.google.com/file/d/1X9NnO0IGK2163mF_iPDyc2F_mcipSTID/view?usp=drivesdk
[Android Apps and Games] thejackalsmark:
First World Dev Problems ???
[Android Apps and Games] eXPerience1983:
File chooser would be great to export/import host list (maybe just to import it), but it would be great if you add it to package disabler list.

And I open a ticket because I have some problems with Samsung Members (I can't login to access promos), and Samsung Pay (I can't access promos) if I don't whitelist it. I'm just asking to whitelist some apps by default.

Thank you!!
[Android Apps and Games] Mike B.:
It's simple enough for you to whitelist those few apps for which you specifically want to access otherwise blocked domains, but making it a default might annoy some users, myself included, who use Samsung Pay regularly but hate to see all the ads and promotions. A lot of those things are simply matters of personal preference. The fewer assumptions SABS makes the better. You get to choose what to block, and you get to choose which apps you want to whitelist. The documentation currently suggests whitelisting Duo/Allo and that should be sufficient. Most features of the Google Music player work fine with the default list, but it too can be easily whitelisted by the user if he/she so desires. Let's remember that not everybody uses the same functions of the same apps in the same manner.
[Android Apps and Games] eXPerience1983:
Of course, but SABS interfere by default with that apps. For advanced users are easy to remove it from white list. Or maybe is better to add an extra option on miscellaneous to whitelist default apps just like the block port 53 option.
[Android Apps and Games] hk5354:
App white list not work. App List app still blocked after added in the white list. =[
[Android Apps and Games] mmotti:
Works for me. Did you disable / enable sabs after whitelisting the app?
[Android Apps and Games] hk5354:
Sure, i need to disable the SABS to run the app. the app with ads block checking. :rolleyes:
[Android Apps and Games] Nastrahl:
Sorry if it was already answered but is there a drawback of globally blocking the port 53 ?
[Android Apps and Games] DukeNuggets:
APK Editor doesn't let me ****ing edit the package name and can't ****ing find the gradle script on android studio on my mac, how the **** can i edit the package name ?
[Android Apps and Games] mmotti:
I am not quite sure how to read in to your reply, but I think I detect a hint of sarcasm.

Anyway, if you aren't aware, if you whitelist an app, the change will not be applied until you add the firewall rules again (i.e. disabling and enabling SABS after choosing an app in "manage blocking in apps".

---------- Post added at 08:25 AM ---------- Previous post was at 08:22 AM ----------

Honestly it causes more problems than it is worth. More and more apps need to use their own DNS servers to work properly (e.g. Netflix). Best to keep the Chrome specific port 53 block.

There are some apps that will likely circumvent blocking without blanket blocking port 53, but for now it's only Chrome that's hardcoded.
[Android Apps and Games] mmotti:
[MENTION=1228651]fusionjack[/MENTION]

Have you done any work with the Storage Access Framework (https://developer.android.com/guide/topics/providers/document-provider.html) ?

The native file chooser seems to output Uri's which have a path of something like: /document/216

I think it's possible to still open an inputstream with a Uri but I can't find any way to get the actual file path to add to the SABS database in String form.

The only way I can get the correct path is by using 'Root Explorer' that appears at the bottom of the file chooser which is not ideal.
[Android Apps and Games] thejackalsmark:
Are you using APK Editor ****ing "PRO"? 0.o

(just fyi, no matter how much it upsets you, you might want to come in asking for help a little more calmly. These guys work pretty damn hard on this to make you and everyone else happy for FREE. A calm and polite attitude towards them when asking for help, isn't asking too much, is it?)
[Android Apps and Games] meduza:
Exactly! And if he just would ****ing read a little that would help a lot ;)

m.
[Android Apps and Games] eXPerience1983:
It works for mi, instantaneously. Without needing to disable/enable SABS
[Android Apps and Games] Mike B.:
No, SABS doesn't interfere with any apps, it merely blocks domains, a separate issue. Not everybody uses or cares about the apps in question, and they DO work fine with the default list. For example, what some see as valuable promotions are merely yet more annoying ads to others. SABS should do as little guesssing as possible about what users want. For example, most people would assume that all those Google ads should be automatically blocked, but we see several serious request from people who specifically want to see the "sponsored" entries in a search result. Let's assume as little as possible and let the user customize his/her settings.
[Android Apps and Games] NeedleGames:
[MENTION=4343728]Mike B.[/MENTION] changed the layout of custom packaged screen - put the textbox in a dialog so that it was wider, added loading screen while the package is being downloaded, allowed the url in list to be two lines instead of one (wanted to make it unlimited length but then the last item gets squeezed for some reason).
[Android Apps and Games] Mike B.:
Very nice! I like your UI decisions. Those are the enhancements that matter, much more than trying to guess which ads someone want to see where...

That said, quit working on SABS and study for your test! ;)

EDIT: it seems that the 2nd URL line covers the number of entries.
[Android Apps and Games] gschroer:
How would I block the sponsored ads that are returned with a google search? I'm using a complied version of SABS version 0.7 with the standard package and still getting the sponsored ads.
[Android Apps and Games] eldervamp17:
I noticed that www.pandora.com, desktop mode on mobile browser is being blocked by this entry on the standard package list. *analytics.*

Sure it can be whitelisted but then other stuff that should get blocked like doubleclick.net, others would be allowed on that site.
[Android Apps and Games] Mike B.:
Ah, those (in)famous Google Sponsored Ads. There are several types, all equally annoying. Some people want to see them, other do not. Within the scope of SABS, the issue would be simple to address: block the domain that generates those links. The problem is that the domain is google.com and it's actually domainS (plural) and it depends on which browser/location/settings you use. AFAIK, the bottom line is that NO, using only domain blocking (the only thing SABS can realistically do) or DNS trickery, you cannot [

B]dependably[/B]

get rid of those ads without also crippling other search results. Of course, you could use another search engine besides Google and there are some tools that have the ability to selectively hide web page components, disable some scripts, etc., but those are not functions of the Knox firewall.

SABS will happily block any domains you tell it to block, but it can't alter the contents of a web page or patch an app. Remember, there is no such thing as "ad blocking", it's merely a shortcut for "block domains serving content that I don't like". No "ad blocking" scheme actually blocks ads because "ads" are simply Internet packets, just like the valuable information you want to see, and the distinction is a subjective one that can't be codified without serious advanced AI tools. IBM's Watson doesn't run on Android yet... ;)

---------- Post added at 12:24 PM ---------- Previous post was at 12:16 PM ----------

No, a "*analytics.*" entry doesn't block "www.pandora.com". What I think you mean if that the Pandora page in question apparently requires access to a specific link or links that match "*analytics.*". If it's currently blocked by Knox in your configuration, look for the actual domain name(s) under the "Recent activity" SABS tab and whitelist it/them. With any luck, that won't bring in ads in other pages and apps but if it does you'll have to decide which is the worse evil.
[Android Apps and Games] LegendM:
Is anyone having problems with google play? I can't download any apps with SABS running. It's annoying and whitelisting Google Play Store not working.
[Android Apps and Games] NeedleGames:
Are you using dns? There was only one person with the smae bug but got it fixed by disabling dns
[Android Apps and Games] NeedleGames:
I have moved all domains from experimental package to standard one because with it my number of domains blocked was 3 times bigger (from usual 1000 domains blocked to 3000 per 24 hours). It's now quite big and needs some optimising.
[Android Apps and Games] LegendM:
Yes I was using it now it's working again. But.. DNS is kinda mandatory thing for me because imgur is blocked in my country and I have to use Google DNS or something. İ dont wanna use any 3rd party app for just DNS..

Long story short, is there any fix for this issue without disabling DNS ;) I can provide logcat or something if you want
[Android Apps and Games] Mike B.:
The other user reporting Play Store issues with a custom DNS was also using Google's DNS. Others talked about SMS/MMS trouble with the AdGuard DNS. You may want to try another DNS server and see what works for you. Those are not issues that SABS can fix (or even control - it merely sets the DNS).
[Android Apps and Games] NeedleGames:
This is simply an issue with your dns and there is nothing I can do. When SABS is disabled, so is your DNS that's why Google Play is working. You would have to disable it when you want to download something or update the apps. I am using openNIC DNS (and dns.watch as a fallback) and Google Play is working great.
[Android Apps and Games] Mike B.:
Is optimising the same as getting rid of all those many domains that very few people will ever need? ;)

(still happily running with a TINY input list, mostly wildcards, still no ads in sight)

Did you see my earlier comment about the 2nd URL line hiding the number of entries for a custom provider?