[Android Apps and Games] mmotti:
[MENTION=6183103]NeedleGames[/MENTION] - I'm just having a look through some of the code now. Spotted a couple of things so I am going to suggest some changes.

Will edit this post to reflect changes when finished.

Fantastic work on the UI btw. First time actually installing.

Edit:

OK - So i took your code from revision back (before whitelist changes and sublist splitting).

I have made a few changes but don't have time this morning to look into this in great detail. I will outline those changes that I remember making, though!

I went a revision back because I am not sure the fits boolean was required as the whitelist check works OK on the code before. Also, as I am remember this, you'll need to change the pattern matching again for the wildcard add custom deny rule as I forgot to do this. Just bear in mind that if the user puts in an invalid URL in a custom block url, it will cause serious problems. Updated pattern matching too which you could add to the custom block url input.

1) Port 53 general

Moved port blocking to the top to be executed first - Separating the code out a little.

Also adjusted try / catch slightly, adding for each. Some output for this process also added (as mentioned below).

2) Chrome firewall rules

Your firewall rule was being added outside of the for-loop so it would have likely only added one package; whatever was grabbed on the last run through of the loop. I've moved this to sit inside the loop.

There is also now some output in logcat during this process - It will now show which rules were added / not added.

02-23 09:59:59.792 31653-32399/com.layoutxml.sabs007 D/com.layoutxml.sabs.blocker.ContentBlocker56: BLOCKING PORT 53 on Chrome only
02-23 09:59:59.827 31653-32399/com.layoutxml.sabs007 I/com.layoutxml.sabs.blocker.ContentBlocker56: IPv4/6 Rule Added:com.android.chrome
02-23 09:59:59.847 31653-32399/com.layoutxml.sabs007 D/com.layoutxml.sabs.blocker.ContentBlocker56: IPv4/6 Rule NOT added:com.chrome.beta
02-23 09:59:59.883 31653-32399/com.layoutxml.sabs007 D/com.layoutxml.sabs.blocker.ContentBlocker56: IPv4/6 Rule NOT added:com.chrome.dev
02-23 09:59:59.898 31653-32399/com.layoutxml.sabs007 D/com.layoutxml.sabs.blocker.ContentBlocker56: IPv4/6 Rule NOT added:com.chrome.canary
02-23 10:00:42.090 31653-32399/com.layoutxml.sabs007 I/com.layoutxml.sabs.blocker.ContentBlocker56: SABS enabled successfully.

3) Updated regex now so the deny domain must match *test.com test.com* *test.com*; previously the *'s were optional on each side which could have caused issues.

4) Added some debug output for when SABS has been successfully enabled / disabled.

Those are the main things but I have probably forgotten something! I wouldn't advise putting in the list splitting just yet until we have fixed the UI bug to accommodate for the additional time to activate a larger list. I would like to add, though, that I believe we should keep the 15K limit as that should be more than enough domains - I'm in agreement with [MENTION=4343728]Mike B.[/MENTION] for this. But this is your project, so I won't stick my nose in :)

I'll post these updates to your github now for you to look through [MENTION=6183103]NeedleGames[/MENTION]

ALSO - Perhaps we should add the deny domains to a hashset or something until the very end. If i remember correctly, these only allow unique domains. Then we could add the hash set to the denylist array at the very end. It could cut processing time in half if somebody were to, for example, use both of our lists. Rather than processing 18,000 entries it may only have to process 9,000 (depending on how similar the lists are).