]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Create a blocklists loading splash screen. https://redmine.stoutner.com/issues/285
authorSoren Stoutner <soren@stoutner.com>
Thu, 23 May 2019 03:48:49 +0000 (20:48 -0700)
committerSoren Stoutner <soren@stoutner.com>
Thu, 23 May 2019 03:48:49 +0000 (20:48 -0700)
12 files changed:
app/src/free/assets/tr/about_permissions_dark.html
app/src/free/assets/tr/about_permissions_light.html
app/src/free/assets/tr/about_privacy_policy_dark.html
app/src/free/assets/tr/about_privacy_policy_light.html
app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java
app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.java
app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.java
app/src/main/java/com/stoutner/privacybrowser/asynctasks/PopulateBlocklists.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java
app/src/main/java/com/stoutner/privacybrowser/helpers/BlockListHelper.java [deleted file]
app/src/main/java/com/stoutner/privacybrowser/helpers/BlocklistHelper.java [new file with mode: 0644]
app/src/main/res/layout/main_framelayout.xml

index 8fdc87a7f7f0e24ca99e91ebbc6a8f17e698597d..daf42d8e0d8640e24fabc8fb10d9274769b77c5a 100644 (file)
         <hr/>
         <br/>
 
         <hr/>
         <br/>
 
-        <p>In addition, Privacy Browser Free displays ads from Google’s AdMob network using the Firebase backend.
-            For the free flavor, Firebase adds the following permissions even though they are not listed in the source code
-            <a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=blob;f=app/src/main/AndroidManifest.xml;hb=HEAD">manifest file</a>.</p>
+        <p>Ek olarak, Privacy Browser Ücretsiz, Firebase backend kullanarak Google'ın AdMob ağından reklamlar görüntüler.
+            Ücretsiz sürüm için Firebase, kaynak kod <a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=blob;f=app/src/main/AndroidManifest.xml;hb=HEAD">bildirim dosyası</a>nda
+            listelenmemiş olsalar bile aşağıdaki izinleri ilave eder.</p>
 
 
-        <h3>View network connections</h3>
+        <h3>Ağ bağlantılarını görüntüle</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#ACCESS_NETWORK_STATE">android.permission.ACCESS_NETWORK_STATE</a></p>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#ACCESS_NETWORK_STATE">android.permission.ACCESS_NETWORK_STATE</a></p>
-        <p>Allows the ads to tell when you are connected to the internet and when you aren’t (presumably so they don’t try to reload an ad when you are disconnected).
-            They can also tell if you are connected via Wi-Fi, 2G, 3G, 4G, etc.</p>
+        <p>Reklamların, internet erişimine ne zaman sahip olup olmadığınızı bilmesine izin verir (internet erişiminiz yoksa muhtemelen reklamı tekrar yüklemeyi denemezler).
+            Ayrıca internete Wi-Fi, 2g, 3g, 4g vs. bağlantı şekillerinden hangisiyle bağlandığınızı da anlayabilirler.</p>
 
 
-        <h3>Prevent phone from sleeping</h3>
+        <h3>Telefonun uyku moduna geçmesini engelleme</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#WAKE_LOCK">android.permission.WAKE_LOCK</a></p>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#WAKE_LOCK">android.permission.WAKE_LOCK</a></p>
-        <p>Allows the ads to keep the processor from sleeping and the screen from dimming, although in my testing I don’t think the ads actually do this.</p>
+        <p>Reklamların, işlemcinin uyku moduna geçmesini ve ekranın kararmasını engellemesine izin verir. Kişisel deneyimime göre reklamların bunu yapabileceğini sanmıyorum.</p>
 
         <h3>Play Install Referrer API</h3>
         <p><a href="https://android-developers.googleblog.com/2017/11/google-play-referrer-api-track-and.html">com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE</a></p>
 
         <h3>Play Install Referrer API</h3>
         <p><a href="https://android-developers.googleblog.com/2017/11/google-play-referrer-api-track-and.html">com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE</a></p>
-        <p>Allows other apps to tell if their installation was launched from an ad in Privacy Browser Free.</p>
+        <p>Diğer uygulamaların, kurulumlarının Privacy Browser Ücretsizde görüntülenen bir reklamdan başlatılıp başlatılmadığını anlamasına izin verir.</p>
 
 
-        <h3>Receive data from Internet</h3>
+        <h3>İnternetten veri alma</h3>
         <p><a href="http://androidpermissions.com/permission/com.google.android.c2dm.permission.RECEIVE">com.google.android.c2dm.permission.RECEIVE</a></p>
         <p><a href="http://androidpermissions.com/permission/com.google.android.c2dm.permission.RECEIVE">com.google.android.c2dm.permission.RECEIVE</a></p>
-        <p>Allows Google to send information directly to the AdView without having to receive a request first (cloud-to-device messaging).</p>
+        <p>Google'ın, öncesinde bir istek almasına gerek duymadan, AdView'e doğrudan bilgi göndermesine izin verir (buluttan cihaza iletişim).</p>
 
 
-        <h3>Receive data from Internet</h3>
+        <h3>İnternetten veri alma</h3>
         <p><a href="https://developers.google.com/cloud-messaging/android/client">com.stoutner.privacybrowser.free.permission.C2D_MESSAGE</a></p>
         <p><a href="https://developers.google.com/cloud-messaging/android/client">com.stoutner.privacybrowser.free.permission.C2D_MESSAGE</a></p>
-        <p>Secures the cloud-to-device messages so that only Privacy Browser Free can receive them.</p>
+        <p>Buluttan cihaza iletişimi güvence altına alır, böylece sadece Privacy Browser Ücretsiz onları alabilir.</p>
     </body>
 </html>
\ No newline at end of file
     </body>
 </html>
\ No newline at end of file
index e7b1b5a2b94a2843ddb8e3c0ff42f5b28a7b9e09..b67075a8bba569594b2efcf5d14d27aec810db0a 100644 (file)
         <hr/>
         <br/>
 
         <hr/>
         <br/>
 
-        <p>In addition, Privacy Browser Free displays ads from Google’s AdMob network using the Firebase backend.
-            For the free flavor, Firebase adds the following permissions even though they are not listed in the source code
-            <a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=blob;f=app/src/main/AndroidManifest.xml;hb=HEAD">manifest file</a>.</p>
+        <p>Ek olarak, Privacy Browser Ücretsiz, Firebase backend kullanarak Google'ın AdMob ağından reklamlar görüntüler.
+            Ücretsiz sürüm için Firebase, kaynak kod <a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=blob;f=app/src/main/AndroidManifest.xml;hb=HEAD">bildirim dosyası</a>nda
+            listelenmemiş olsalar bile aşağıdaki izinleri ilave eder.</p>
 
 
-        <h3>View network connections</h3>
+        <h3>Ağ bağlantılarını görüntüle</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#ACCESS_NETWORK_STATE">android.permission.ACCESS_NETWORK_STATE</a></p>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#ACCESS_NETWORK_STATE">android.permission.ACCESS_NETWORK_STATE</a></p>
-        <p>Allows the ads to tell when you are connected to the internet and when you aren’t (presumably so they don’t try to reload an ad when you are disconnected).
-            They can also tell if you are connected via Wi-Fi, 2G, 3G, 4G, etc.</p>
+        <p>Reklamların, internet erişimine ne zaman sahip olup olmadığınızı bilmesine izin verir (internet erişiminiz yoksa muhtemelen reklamı tekrar yüklemeyi denemezler).
+            Ayrıca internete Wi-Fi, 2g, 3g, 4g vs. bağlantı şekillerinden hangisiyle bağlandığınızı da anlayabilirler.</p>
 
 
-        <h3>Prevent phone from sleeping</h3>
+        <h3>Telefonun uyku moduna geçmesini engelleme</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#WAKE_LOCK">android.permission.WAKE_LOCK</a></p>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#WAKE_LOCK">android.permission.WAKE_LOCK</a></p>
-        <p>Allows the ads to keep the processor from sleeping and the screen from dimming, although in my testing I don’t think the ads actually do this.</p>
+        <p>Reklamların, işlemcinin uyku moduna geçmesini ve ekranın kararmasını engellemesine izin verir. Kişisel deneyimime göre reklamların bunu yapabileceğini sanmıyorum.</p>
 
         <h3>Play Install Referrer API</h3>
         <p><a href="https://android-developers.googleblog.com/2017/11/google-play-referrer-api-track-and.html">com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE</a></p>
 
         <h3>Play Install Referrer API</h3>
         <p><a href="https://android-developers.googleblog.com/2017/11/google-play-referrer-api-track-and.html">com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE</a></p>
-        <p>Allows other apps to tell if their installation was launched from an ad in Privacy Browser Free.</p>
+        <p>Diğer uygulamaların, kurulumlarının Privacy Browser Ücretsizde görüntülenen bir reklamdan başlatılıp başlatılmadığını anlamasına izin verir.</p>
 
 
-        <h3>Receive data from Internet</h3>
+        <h3>İnternetten veri alma</h3>
         <p><a href="http://androidpermissions.com/permission/com.google.android.c2dm.permission.RECEIVE">com.google.android.c2dm.permission.RECEIVE</a></p>
         <p><a href="http://androidpermissions.com/permission/com.google.android.c2dm.permission.RECEIVE">com.google.android.c2dm.permission.RECEIVE</a></p>
-        <p>Allows Google to send information directly to the AdView without having to receive a request first (cloud-to-device messaging).</p>
+        <p>Google'ın, öncesinde bir istek almasına gerek duymadan, AdView'e doğrudan bilgi göndermesine izin verir (buluttan cihaza iletişim).</p>
 
 
-        <h3>Receive data from Internet</h3>
+        <h3>İnternetten veri alma</h3>
         <p><a href="https://developers.google.com/cloud-messaging/android/client">com.stoutner.privacybrowser.free.permission.C2D_MESSAGE</a></p>
         <p><a href="https://developers.google.com/cloud-messaging/android/client">com.stoutner.privacybrowser.free.permission.C2D_MESSAGE</a></p>
-        <p>Secures the cloud-to-device messages so that only Privacy Browser Free can receive them.</p>
+        <p>Buluttan cihaza iletişimi güvence altına alır, böylece sadece Privacy Browser Ücretsiz onları alabilir.</p>
     </body>
 </html>
\ No newline at end of file
     </body>
 </html>
\ No newline at end of file
index 0f11ef9f5a6977605239003043091dc900e152c7..3cdc3ae580720b176e390d5803d579fd3e5cfef3 100644 (file)
         </ul>
 
 
         </ul>
 
 
-        <h3>Advertisements</h3>
-        <p>Privacy Browser Free displays a banner ad across the bottom of the screen using Google's AdMob network,
-            which has its <a href="https://www.google.com/intl/en/policies/privacy/">own privacy policy</a>.
-            These ads are set to be <a href="https://developers.google.com/admob/android/eu-consent#update_consent_status">non-personalized</a>.
-            AdMob reports <em>anonymized summaries</em> of the following information to developers.</p>
+        <<h3>Reklamlar</h3>
+        <p>Privacy Browser Ücretsiz, Google'ın, <a href="https://www.google.com/intl/en/policies/privacy/">kendisine özgü gizlilik politikası olan</a>
+            AdMob ağını kullanarak ekranın alt kısmında bir banner reklam gösterir.
+            Bu reklamlar <a href="https://developers.google.com/admob/android/eu-consent#update_consent_status">kişiselleştirilmemiş</a> olarak ayarlanmıştır.
+            AdMob, geliştiricilere aşağıdaki bilgilerin <em>anonimleştirilmiş özetlerini</em> rapor eder.</p>
         <ul>
         <ul>
-            <li><item>Total impressions</item></li>
-            <li><item>Total clicks</item></li>
-            <li><item>Platforms</item> (eg. high-end mobile devices, tablets)</li>
-            <li><item>Activity by country</item></li>
+            <li><item>Toplam gösterimler</item></li>
+            <li><item>Toplam tıklamalar</item></li>
+            <li><item>Platformlar</item> (örn. en üst seviye mobil cihazlar, tabletler)</li>
+            <li><item>Ülkeye göre etkinlik</item></li>
         </ul>
 
 
         </ul>
 
 
index 4dd34ce64b2ffa8d4dee29659ea956359b04e595..afcd8a65fa9d96a53dc6fb5906473abfcd29f4c3 100644 (file)
         </ul>
 
 
         </ul>
 
 
-        <h3>Advertisements</h3>
-        <p>Privacy Browser Free displays a banner ad across the bottom of the screen using Google's AdMob network,
-            which has its <a href="https://www.google.com/intl/en/policies/privacy/">own privacy policy</a>.
-            These ads are set to be <a href="https://developers.google.com/admob/android/eu-consent#update_consent_status">non-personalized</a>.
-            AdMob reports <em>anonymized summaries</em> of the following information to developers.</p>
+        <h3>Reklamlar</h3>
+        <p>Privacy Browser Ücretsiz, Google'ın, <a href="https://www.google.com/intl/en/policies/privacy/">kendisine özgü gizlilik politikası olan</a> 
+            AdMob ağını kullanarak ekranın alt kısmında bir banner reklam gösterir.
+            Bu reklamlar <a href="https://developers.google.com/admob/android/eu-consent#update_consent_status">kişiselleştirilmemiş</a> olarak ayarlanmıştır.
+            AdMob, geliştiricilere aşağıdaki bilgilerin <em>anonimleştirilmiş özetlerini</em> rapor eder.</p>
         <ul>
         <ul>
-            <li><item>Total impressions</item></li>
-            <li><item>Total clicks</item></li>
-            <li><item>Platforms</item> (eg. high-end mobile devices, tablets)</li>
-            <li><item>Activity by country</item></li>
+            <li><item>Toplam gösterimler</item></li>
+            <li><item>Toplam tıklamalar</item></li>
+            <li><item>Platformlar</item> (örn. en üst seviye mobil cihazlar, tabletler)</li>
+            <li><item>Ülkeye göre etkinlik</item></li>
         </ul>
 
 
         </ul>
 
 
index 33687f9a48512202c96d3a5a5086fc49cee92d0b..a90f85c7f93162eea307d38bb34700a0e91e966b 100644 (file)
@@ -131,7 +131,7 @@ import com.stoutner.privacybrowser.dialogs.UrlHistoryDialog;
 import com.stoutner.privacybrowser.dialogs.ViewSslCertificateDialog;
 import com.stoutner.privacybrowser.fragments.WebViewTabFragment;
 import com.stoutner.privacybrowser.helpers.AdHelper;
 import com.stoutner.privacybrowser.dialogs.ViewSslCertificateDialog;
 import com.stoutner.privacybrowser.fragments.WebViewTabFragment;
 import com.stoutner.privacybrowser.helpers.AdHelper;
-import com.stoutner.privacybrowser.helpers.BlockListHelper;
+import com.stoutner.privacybrowser.helpers.BlocklistHelper;
 import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
 import com.stoutner.privacybrowser.helpers.CheckPinnedMismatchHelper;
 import com.stoutner.privacybrowser.helpers.DomainsDatabaseHelper;
 import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
 import com.stoutner.privacybrowser.helpers.CheckPinnedMismatchHelper;
 import com.stoutner.privacybrowser.helpers.DomainsDatabaseHelper;
@@ -456,6 +456,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         FloatingActionButton createBookmarkFab = findViewById(R.id.create_bookmark_fab);
         EditText findOnPageEditText = findViewById(R.id.find_on_page_edittext);
 
         FloatingActionButton createBookmarkFab = findViewById(R.id.create_bookmark_fab);
         EditText findOnPageEditText = findViewById(R.id.find_on_page_edittext);
 
+        // Initially disable the sliding drawers.  They will be enabled once the blocklists are loaded.
+        drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
+
         // Listen for touches on the navigation menu.
         navigationView.setNavigationItemSelectedListener(this);
 
         // Listen for touches on the navigation menu.
         navigationView.setNavigationItemSelectedListener(this);
 
@@ -757,14 +760,16 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                         bookmarksHeaderTextView.setPadding(drawerHeaderPaddingLeftAndRight, drawerHeaderPaddingTop, drawerHeaderPaddingLeftAndRight, drawerHeaderPaddingBottom);
                     }
 
                         bookmarksHeaderTextView.setPadding(drawerHeaderPaddingLeftAndRight, drawerHeaderPaddingTop, drawerHeaderPaddingLeftAndRight, drawerHeaderPaddingBottom);
                     }
 
-                    // Update the navigation menu items.
-                    navigationBackMenuItem.setEnabled(currentWebView.canGoBack());
-                    navigationForwardMenuItem.setEnabled(currentWebView.canGoForward());
-                    navigationHistoryMenuItem.setEnabled((currentWebView.canGoBack() || currentWebView.canGoForward()));
-                    navigationRequestsMenuItem.setTitle(getString(R.string.requests) + " - " + currentWebView.getRequestsCount(NestedScrollWebView.BLOCKED_REQUESTS));
+                    // Update the navigation menu items if the WebView is not null.
+                    if (currentWebView != null) {
+                        navigationBackMenuItem.setEnabled(currentWebView.canGoBack());
+                        navigationForwardMenuItem.setEnabled(currentWebView.canGoForward());
+                        navigationHistoryMenuItem.setEnabled((currentWebView.canGoBack() || currentWebView.canGoForward()));
+                        navigationRequestsMenuItem.setTitle(getString(R.string.requests) + " - " + currentWebView.getRequestsCount(NestedScrollWebView.BLOCKED_REQUESTS));
 
 
-                    // Hide the keyboard (if displayed).
-                    inputMethodManager.hideSoftInputFromWindow(currentWebView.getWindowToken(), 0);
+                        // Hide the keyboard (if displayed).
+                        inputMethodManager.hideSoftInputFromWindow(currentWebView.getWindowToken(), 0);
+                    }
 
                     // Clear the focus from from the URL text box and the WebView.  This removes any text selection markers and context menus, which otherwise draw above the open drawers.
                     urlEditText.clearFocus();
 
                     // Clear the focus from from the URL text box and the WebView.  This removes any text selection markers and context menus, which otherwise draw above the open drawers.
                     urlEditText.clearFocus();
@@ -4399,7 +4404,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
 
         // Instantiate the blocklist helper.
         InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
 
         // Instantiate the blocklist helper.
-        BlockListHelper blockListHelper = new BlockListHelper();
+        BlocklistHelper blocklistHelper = new BlocklistHelper();
 
         // Remove the lint warning below that the input method manager might be null.
         assert inputMethodManager != null;
 
         // Remove the lint warning below that the input method manager might be null.
         assert inputMethodManager != null;
@@ -4986,7 +4991,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 // Block third-party requests if enabled.
                 if (isThirdPartyRequest && nestedScrollWebView.isBlocklistEnabled(NestedScrollWebView.THIRD_PARTY_REQUESTS)) {
                     // Add the result to the resource requests.
                 // Block third-party requests if enabled.
                 if (isThirdPartyRequest && nestedScrollWebView.isBlocklistEnabled(NestedScrollWebView.THIRD_PARTY_REQUESTS)) {
                     // Add the result to the resource requests.
-                    nestedScrollWebView.addResourceRequest(new String[]{BlockListHelper.REQUEST_THIRD_PARTY, url});
+                    nestedScrollWebView.addResourceRequest(new String[]{BlocklistHelper.REQUEST_THIRD_PARTY, url});
 
                     // Increment the blocked requests counters.
                     nestedScrollWebView.incrementRequestsCount(NestedScrollWebView.BLOCKED_REQUESTS);
 
                     // Increment the blocked requests counters.
                     nestedScrollWebView.incrementRequestsCount(NestedScrollWebView.BLOCKED_REQUESTS);
@@ -5015,10 +5020,10 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 // Check UltraPrivacy if it is enabled.
                 if (nestedScrollWebView.isBlocklistEnabled(NestedScrollWebView.ULTRA_PRIVACY)) {
                     // Check the URL against UltraPrivacy.
                 // Check UltraPrivacy if it is enabled.
                 if (nestedScrollWebView.isBlocklistEnabled(NestedScrollWebView.ULTRA_PRIVACY)) {
                     // Check the URL against UltraPrivacy.
-                    String[] ultraPrivacyResults = blockListHelper.checkBlocklist(currentDomain, url, isThirdPartyRequest, ultraPrivacy);
+                    String[] ultraPrivacyResults = blocklistHelper.checkBlocklist(currentDomain, url, isThirdPartyRequest, ultraPrivacy);
 
                     // Process the UltraPrivacy results.
 
                     // Process the UltraPrivacy results.
-                    if (ultraPrivacyResults[0].equals(BlockListHelper.REQUEST_BLOCKED)) {  // The resource request matched UltraPrivacy's blacklist.
+                    if (ultraPrivacyResults[0].equals(BlocklistHelper.REQUEST_BLOCKED)) {  // The resource request matched UltraPrivacy's blacklist.
                         // Add the result to the resource requests.
                         nestedScrollWebView.addResourceRequest(new String[] {ultraPrivacyResults[0], ultraPrivacyResults[1], ultraPrivacyResults[2], ultraPrivacyResults[3], ultraPrivacyResults[4],
                                 ultraPrivacyResults[5]});
                         // Add the result to the resource requests.
                         nestedScrollWebView.addResourceRequest(new String[] {ultraPrivacyResults[0], ultraPrivacyResults[1], ultraPrivacyResults[2], ultraPrivacyResults[3], ultraPrivacyResults[4],
                                 ultraPrivacyResults[5]});
@@ -5044,7 +5049,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
 
                         // The resource request was blocked.  Return an empty web resource response.
                         return emptyWebResourceResponse;
 
                         // The resource request was blocked.  Return an empty web resource response.
                         return emptyWebResourceResponse;
-                    } else if (ultraPrivacyResults[0].equals(BlockListHelper.REQUEST_ALLOWED)) {  // The resource request matched UltraPrivacy's whitelist.
+                    } else if (ultraPrivacyResults[0].equals(BlocklistHelper.REQUEST_ALLOWED)) {  // The resource request matched UltraPrivacy's whitelist.
                         // Add a whitelist entry to the resource requests array.
                         nestedScrollWebView.addResourceRequest(new String[] {ultraPrivacyResults[0], ultraPrivacyResults[1], ultraPrivacyResults[2], ultraPrivacyResults[3], ultraPrivacyResults[4],
                                 ultraPrivacyResults[5]});
                         // Add a whitelist entry to the resource requests array.
                         nestedScrollWebView.addResourceRequest(new String[] {ultraPrivacyResults[0], ultraPrivacyResults[1], ultraPrivacyResults[2], ultraPrivacyResults[3], ultraPrivacyResults[4],
                                 ultraPrivacyResults[5]});
@@ -5057,10 +5062,10 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 // Check EasyList if it is enabled.
                 if (nestedScrollWebView.isBlocklistEnabled(NestedScrollWebView.EASY_LIST)) {
                     // Check the URL against EasyList.
                 // Check EasyList if it is enabled.
                 if (nestedScrollWebView.isBlocklistEnabled(NestedScrollWebView.EASY_LIST)) {
                     // Check the URL against EasyList.
-                    String[] easyListResults = blockListHelper.checkBlocklist(currentDomain, url, isThirdPartyRequest, easyList);
+                    String[] easyListResults = blocklistHelper.checkBlocklist(currentDomain, url, isThirdPartyRequest, easyList);
 
                     // Process the EasyList results.
 
                     // Process the EasyList results.
-                    if (easyListResults[0].equals(BlockListHelper.REQUEST_BLOCKED)) {  // The resource request matched EasyList's blacklist.
+                    if (easyListResults[0].equals(BlocklistHelper.REQUEST_BLOCKED)) {  // The resource request matched EasyList's blacklist.
                         // Add the result to the resource requests.
                         nestedScrollWebView.addResourceRequest(new String[] {easyListResults[0], easyListResults[1], easyListResults[2], easyListResults[3], easyListResults[4], easyListResults[5]});
 
                         // Add the result to the resource requests.
                         nestedScrollWebView.addResourceRequest(new String[] {easyListResults[0], easyListResults[1], easyListResults[2], easyListResults[3], easyListResults[4], easyListResults[5]});
 
@@ -5085,7 +5090,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
 
                         // The resource request was blocked.  Return an empty web resource response.
                         return emptyWebResourceResponse;
 
                         // The resource request was blocked.  Return an empty web resource response.
                         return emptyWebResourceResponse;
-                    } else if (easyListResults[0].equals(BlockListHelper.REQUEST_ALLOWED)) {  // The resource request matched EasyList's whitelist.
+                    } else if (easyListResults[0].equals(BlocklistHelper.REQUEST_ALLOWED)) {  // The resource request matched EasyList's whitelist.
                         // Update the whitelist result string array tracker.
                         whitelistResultStringArray = new String[] {easyListResults[0], easyListResults[1], easyListResults[2], easyListResults[3], easyListResults[4], easyListResults[5]};
                     }
                         // Update the whitelist result string array tracker.
                         whitelistResultStringArray = new String[] {easyListResults[0], easyListResults[1], easyListResults[2], easyListResults[3], easyListResults[4], easyListResults[5]};
                     }
@@ -5094,10 +5099,10 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 // Check EasyPrivacy if it is enabled.
                 if (nestedScrollWebView.isBlocklistEnabled(NestedScrollWebView.EASY_PRIVACY)) {
                     // Check the URL against EasyPrivacy.
                 // Check EasyPrivacy if it is enabled.
                 if (nestedScrollWebView.isBlocklistEnabled(NestedScrollWebView.EASY_PRIVACY)) {
                     // Check the URL against EasyPrivacy.
-                    String[] easyPrivacyResults = blockListHelper.checkBlocklist(currentDomain, url, isThirdPartyRequest, easyPrivacy);
+                    String[] easyPrivacyResults = blocklistHelper.checkBlocklist(currentDomain, url, isThirdPartyRequest, easyPrivacy);
 
                     // Process the EasyPrivacy results.
 
                     // Process the EasyPrivacy results.
-                    if (easyPrivacyResults[0].equals(BlockListHelper.REQUEST_BLOCKED)) {  // The resource request matched EasyPrivacy's blacklist.
+                    if (easyPrivacyResults[0].equals(BlocklistHelper.REQUEST_BLOCKED)) {  // The resource request matched EasyPrivacy's blacklist.
                         // Add the result to the resource requests.
                         nestedScrollWebView.addResourceRequest(new String[] {easyPrivacyResults[0], easyPrivacyResults[1], easyPrivacyResults[2], easyPrivacyResults[3], easyPrivacyResults[4],
                                 easyPrivacyResults[5]});
                         // Add the result to the resource requests.
                         nestedScrollWebView.addResourceRequest(new String[] {easyPrivacyResults[0], easyPrivacyResults[1], easyPrivacyResults[2], easyPrivacyResults[3], easyPrivacyResults[4],
                                 easyPrivacyResults[5]});
@@ -5123,7 +5128,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
 
                         // The resource request was blocked.  Return an empty web resource response.
                         return emptyWebResourceResponse;
 
                         // The resource request was blocked.  Return an empty web resource response.
                         return emptyWebResourceResponse;
-                    } else if (easyPrivacyResults[0].equals(BlockListHelper.REQUEST_ALLOWED)) {  // The resource request matched EasyPrivacy's whitelist.
+                    } else if (easyPrivacyResults[0].equals(BlocklistHelper.REQUEST_ALLOWED)) {  // The resource request matched EasyPrivacy's whitelist.
                         // Update the whitelist result string array tracker.
                         whitelistResultStringArray = new String[] {easyPrivacyResults[0], easyPrivacyResults[1], easyPrivacyResults[2], easyPrivacyResults[3], easyPrivacyResults[4], easyPrivacyResults[5]};
                     }
                         // Update the whitelist result string array tracker.
                         whitelistResultStringArray = new String[] {easyPrivacyResults[0], easyPrivacyResults[1], easyPrivacyResults[2], easyPrivacyResults[3], easyPrivacyResults[4], easyPrivacyResults[5]};
                     }
@@ -5132,10 +5137,10 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 // Check Fanboy’s Annoyance List if it is enabled.
                 if (nestedScrollWebView.isBlocklistEnabled(NestedScrollWebView.FANBOYS_ANNOYANCE_LIST)) {
                     // Check the URL against Fanboy's Annoyance List.
                 // Check Fanboy’s Annoyance List if it is enabled.
                 if (nestedScrollWebView.isBlocklistEnabled(NestedScrollWebView.FANBOYS_ANNOYANCE_LIST)) {
                     // Check the URL against Fanboy's Annoyance List.
-                    String[] fanboysAnnoyanceListResults = blockListHelper.checkBlocklist(currentDomain, url, isThirdPartyRequest, fanboysAnnoyanceList);
+                    String[] fanboysAnnoyanceListResults = blocklistHelper.checkBlocklist(currentDomain, url, isThirdPartyRequest, fanboysAnnoyanceList);
 
                     // Process the Fanboy's Annoyance List results.
 
                     // Process the Fanboy's Annoyance List results.
-                    if (fanboysAnnoyanceListResults[0].equals(BlockListHelper.REQUEST_BLOCKED)) {  // The resource request matched Fanboy's Annoyance List's blacklist.
+                    if (fanboysAnnoyanceListResults[0].equals(BlocklistHelper.REQUEST_BLOCKED)) {  // The resource request matched Fanboy's Annoyance List's blacklist.
                         // Add the result to the resource requests.
                         nestedScrollWebView.addResourceRequest(new String[] {fanboysAnnoyanceListResults[0], fanboysAnnoyanceListResults[1], fanboysAnnoyanceListResults[2], fanboysAnnoyanceListResults[3],
                                 fanboysAnnoyanceListResults[4], fanboysAnnoyanceListResults[5]});
                         // Add the result to the resource requests.
                         nestedScrollWebView.addResourceRequest(new String[] {fanboysAnnoyanceListResults[0], fanboysAnnoyanceListResults[1], fanboysAnnoyanceListResults[2], fanboysAnnoyanceListResults[3],
                                 fanboysAnnoyanceListResults[4], fanboysAnnoyanceListResults[5]});
@@ -5162,17 +5167,17 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
 
                         // The resource request was blocked.  Return an empty web resource response.
                         return emptyWebResourceResponse;
 
                         // The resource request was blocked.  Return an empty web resource response.
                         return emptyWebResourceResponse;
-                    } else if (fanboysAnnoyanceListResults[0].equals(BlockListHelper.REQUEST_ALLOWED)){  // The resource request matched Fanboy's Annoyance List's whitelist.
+                    } else if (fanboysAnnoyanceListResults[0].equals(BlocklistHelper.REQUEST_ALLOWED)){  // The resource request matched Fanboy's Annoyance List's whitelist.
                         // Update the whitelist result string array tracker.
                         whitelistResultStringArray = new String[] {fanboysAnnoyanceListResults[0], fanboysAnnoyanceListResults[1], fanboysAnnoyanceListResults[2], fanboysAnnoyanceListResults[3],
                                 fanboysAnnoyanceListResults[4], fanboysAnnoyanceListResults[5]};
                     }
                 } else if (nestedScrollWebView.isBlocklistEnabled(NestedScrollWebView.FANBOYS_SOCIAL_BLOCKING_LIST)) {  // Only check Fanboy’s Social Blocking List if Fanboy’s Annoyance List is disabled.
                     // Check the URL against Fanboy's Annoyance List.
                         // Update the whitelist result string array tracker.
                         whitelistResultStringArray = new String[] {fanboysAnnoyanceListResults[0], fanboysAnnoyanceListResults[1], fanboysAnnoyanceListResults[2], fanboysAnnoyanceListResults[3],
                                 fanboysAnnoyanceListResults[4], fanboysAnnoyanceListResults[5]};
                     }
                 } else if (nestedScrollWebView.isBlocklistEnabled(NestedScrollWebView.FANBOYS_SOCIAL_BLOCKING_LIST)) {  // Only check Fanboy’s Social Blocking List if Fanboy’s Annoyance List is disabled.
                     // Check the URL against Fanboy's Annoyance List.
-                    String[] fanboysSocialListResults = blockListHelper.checkBlocklist(currentDomain, url, isThirdPartyRequest, fanboysSocialList);
+                    String[] fanboysSocialListResults = blocklistHelper.checkBlocklist(currentDomain, url, isThirdPartyRequest, fanboysSocialList);
 
                     // Process the Fanboy's Social Blocking List results.
 
                     // Process the Fanboy's Social Blocking List results.
-                    if (fanboysSocialListResults[0].equals(BlockListHelper.REQUEST_BLOCKED)) {  // The resource request matched Fanboy's Social Blocking List's blacklist.
+                    if (fanboysSocialListResults[0].equals(BlocklistHelper.REQUEST_BLOCKED)) {  // The resource request matched Fanboy's Social Blocking List's blacklist.
                         // Add the result to the resource requests.
                         nestedScrollWebView.addResourceRequest(new String[] {fanboysSocialListResults[0], fanboysSocialListResults[1], fanboysSocialListResults[2], fanboysSocialListResults[3],
                                 fanboysSocialListResults[4], fanboysSocialListResults[5]});
                         // Add the result to the resource requests.
                         nestedScrollWebView.addResourceRequest(new String[] {fanboysSocialListResults[0], fanboysSocialListResults[1], fanboysSocialListResults[2], fanboysSocialListResults[3],
                                 fanboysSocialListResults[4], fanboysSocialListResults[5]});
@@ -5199,7 +5204,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
 
                         // The resource request was blocked.  Return an empty web resource response.
                         return emptyWebResourceResponse;
 
                         // The resource request was blocked.  Return an empty web resource response.
                         return emptyWebResourceResponse;
-                    } else if (fanboysSocialListResults[0].equals(BlockListHelper.REQUEST_ALLOWED)) {  // The resource request matched Fanboy's Social Blocking List's whitelist.
+                    } else if (fanboysSocialListResults[0].equals(BlocklistHelper.REQUEST_ALLOWED)) {  // The resource request matched Fanboy's Social Blocking List's whitelist.
                         // Update the whitelist result string array tracker.
                         whitelistResultStringArray = new String[] {fanboysSocialListResults[0], fanboysSocialListResults[1], fanboysSocialListResults[2], fanboysSocialListResults[3],
                                 fanboysSocialListResults[4], fanboysSocialListResults[5]};
                         // Update the whitelist result string array tracker.
                         whitelistResultStringArray = new String[] {fanboysSocialListResults[0], fanboysSocialListResults[1], fanboysSocialListResults[2], fanboysSocialListResults[3],
                                 fanboysSocialListResults[4], fanboysSocialListResults[5]};
@@ -5210,7 +5215,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 if (whitelistResultStringArray != null) {  // The request was processed by a whitelist.
                     nestedScrollWebView.addResourceRequest(whitelistResultStringArray);
                 } else {  // The request didn't match any blocklist entry.  Log it as a default request.
                 if (whitelistResultStringArray != null) {  // The request was processed by a whitelist.
                     nestedScrollWebView.addResourceRequest(whitelistResultStringArray);
                 } else {  // The request didn't match any blocklist entry.  Log it as a default request.
-                    nestedScrollWebView.addResourceRequest(new String[]{BlockListHelper.REQUEST_DEFAULT, url});
+                    nestedScrollWebView.addResourceRequest(new String[]{BlocklistHelper.REQUEST_DEFAULT, url});
                 }
 
                 // The resource request has not been blocked.  `return null` loads the requested resource.
                 }
 
                 // The resource request has not been blocked.  `return null` loads the requested resource.
index 8a97e5259e3ed011af68fd9e390508a5bc9a877f..f69b75f6737e18dd99cb7704275fadc402e678ab 100644 (file)
@@ -43,7 +43,7 @@ import androidx.fragment.app.DialogFragment;
 import com.stoutner.privacybrowser.R;
 import com.stoutner.privacybrowser.adapters.RequestsArrayAdapter;
 import com.stoutner.privacybrowser.dialogs.ViewRequestDialog;
 import com.stoutner.privacybrowser.R;
 import com.stoutner.privacybrowser.adapters.RequestsArrayAdapter;
 import com.stoutner.privacybrowser.dialogs.ViewRequestDialog;
-import com.stoutner.privacybrowser.helpers.BlockListHelper;
+import com.stoutner.privacybrowser.helpers.BlocklistHelper;
 
 import java.util.ArrayList;
 import java.util.List;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -112,8 +112,8 @@ public class RequestsActivity extends AppCompatActivity implements ViewRequestDi
 
         // Populate the resource array lists.
         for (String[] request : resourceRequests) {
 
         // Populate the resource array lists.
         for (String[] request : resourceRequests) {
-            switch (request[BlockListHelper.REQUEST_DISPOSITION]) {
-                case BlockListHelper.REQUEST_DEFAULT:
+            switch (request[BlocklistHelper.REQUEST_DISPOSITION]) {
+                case BlocklistHelper.REQUEST_DEFAULT:
                     // Add the request to the list of all requests.
                     allResourceRequests.add(request);
 
                     // Add the request to the list of all requests.
                     allResourceRequests.add(request);
 
@@ -121,7 +121,7 @@ public class RequestsActivity extends AppCompatActivity implements ViewRequestDi
                     defaultResourceRequests.add(request);
                     break;
 
                     defaultResourceRequests.add(request);
                     break;
 
-                case BlockListHelper.REQUEST_ALLOWED:
+                case BlocklistHelper.REQUEST_ALLOWED:
                     // Add the request to the list of all requests.
                     allResourceRequests.add(request);
 
                     // Add the request to the list of all requests.
                     allResourceRequests.add(request);
 
@@ -129,7 +129,7 @@ public class RequestsActivity extends AppCompatActivity implements ViewRequestDi
                     allowedResourceRequests.add(request);
                     break;
 
                     allowedResourceRequests.add(request);
                     break;
 
-                case BlockListHelper.REQUEST_THIRD_PARTY:
+                case BlocklistHelper.REQUEST_THIRD_PARTY:
                     // Add the request to the list of all requests.
                     allResourceRequests.add(request);
 
                     // Add the request to the list of all requests.
                     allResourceRequests.add(request);
 
@@ -137,7 +137,7 @@ public class RequestsActivity extends AppCompatActivity implements ViewRequestDi
                     thirdPartyResourceRequests.add(request);
                     break;
 
                     thirdPartyResourceRequests.add(request);
                     break;
 
-                case BlockListHelper.REQUEST_BLOCKED:
+                case BlocklistHelper.REQUEST_BLOCKED:
                     // Add the request to the list of all requests.
                     allResourceRequests.add(request);
 
                     // Add the request to the list of all requests.
                     allResourceRequests.add(request);
 
index 5bb6b0a4033bae5ce07511977532eaa2adada42a..edc64f810678699d612d953d91e31ecb689444af 100644 (file)
@@ -32,7 +32,7 @@ import android.widget.TextView;
 import androidx.annotation.NonNull;
 
 import com.stoutner.privacybrowser.R;
 import androidx.annotation.NonNull;
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.helpers.BlockListHelper;
+import com.stoutner.privacybrowser.helpers.BlocklistHelper;
 
 import java.util.List;
 
 
 import java.util.List;
 
@@ -75,7 +75,7 @@ public class RequestsArrayAdapter extends ArrayAdapter<String[]> {
 
         // Set the action text and the background color.
         switch (entryStringArray[0]) {
 
         // Set the action text and the background color.
         switch (entryStringArray[0]) {
-            case BlockListHelper.REQUEST_DEFAULT:
+            case BlocklistHelper.REQUEST_DEFAULT:
                 // Create the disposition string.
                 String requestDefault = id + ". " + context.getResources().getString(R.string.allowed);
 
                 // Create the disposition string.
                 String requestDefault = id + ". " + context.getResources().getString(R.string.allowed);
 
@@ -86,7 +86,7 @@ public class RequestsArrayAdapter extends ArrayAdapter<String[]> {
                 linearLayout.setBackgroundColor(context.getResources().getColor(R.color.transparent));
                 break;
 
                 linearLayout.setBackgroundColor(context.getResources().getColor(R.color.transparent));
                 break;
 
-            case BlockListHelper.REQUEST_ALLOWED:
+            case BlocklistHelper.REQUEST_ALLOWED:
                 // Create the disposition string.
                 String requestAllowed = id + ". " + context.getResources().getString(R.string.allowed);
 
                 // Create the disposition string.
                 String requestAllowed = id + ". " + context.getResources().getString(R.string.allowed);
 
@@ -101,7 +101,7 @@ public class RequestsArrayAdapter extends ArrayAdapter<String[]> {
                 }
                 break;
 
                 }
                 break;
 
-            case BlockListHelper.REQUEST_THIRD_PARTY:
+            case BlocklistHelper.REQUEST_THIRD_PARTY:
                 // Create the disposition string.
                 String requestThirdParty = id + ". " + context.getResources().getString(R.string.blocked);
 
                 // Create the disposition string.
                 String requestThirdParty = id + ". " + context.getResources().getString(R.string.blocked);
 
@@ -117,7 +117,7 @@ public class RequestsArrayAdapter extends ArrayAdapter<String[]> {
                 break;
 
 
                 break;
 
 
-            case BlockListHelper.REQUEST_BLOCKED:
+            case BlocklistHelper.REQUEST_BLOCKED:
                 // Create the disposition string.
                 String requestBlocked = id + ". " + context.getResources().getString(R.string.blocked);
 
                 // Create the disposition string.
                 String requestBlocked = id + ". " + context.getResources().getString(R.string.blocked);
 
index f732f47534aadcf354cf089bbe160755ba6ec137..f7fa50886569b72c544afe3dac3adca794c61850 100644 (file)
@@ -27,15 +27,16 @@ import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
+import androidx.appcompat.widget.Toolbar;
+import androidx.drawerlayout.widget.DrawerLayout;
+
 import com.stoutner.privacybrowser.R;
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.helpers.BlockListHelper;
+import com.stoutner.privacybrowser.helpers.BlocklistHelper;
 
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.List;
 
 
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.List;
 
-import androidx.appcompat.widget.Toolbar;
-
 public class PopulateBlocklists extends AsyncTask<Void, String, ArrayList<ArrayList<List<String[]>>>> {
     // The public interface is used to send information back to the parent activity.
     public interface PopulateBlocklistsListener {
 public class PopulateBlocklists extends AsyncTask<Void, String, ArrayList<ArrayList<List<String[]>>>> {
     // The public interface is used to send information back to the parent activity.
     public interface PopulateBlocklistsListener {
@@ -66,7 +67,7 @@ public class PopulateBlocklists extends AsyncTask<Void, String, ArrayList<ArrayL
         Context context = contextWeakReference.get();
 
         // Instantiate the blocklist helper.
         Context context = contextWeakReference.get();
 
         // Instantiate the blocklist helper.
-        BlockListHelper blockListHelper = new BlockListHelper();
+        BlocklistHelper blocklistHelper = new BlocklistHelper();
 
         // Create a combined array list.
         ArrayList<ArrayList<List<String[]>>> combinedBlocklists = new ArrayList<>();
 
         // Create a combined array list.
         ArrayList<ArrayList<List<String[]>>> combinedBlocklists = new ArrayList<>();
@@ -77,35 +78,35 @@ public class PopulateBlocklists extends AsyncTask<Void, String, ArrayList<ArrayL
             publishProgress(context.getString(R.string.loading_easylist));
 
             // Populate EasyList.
             publishProgress(context.getString(R.string.loading_easylist));
 
             // Populate EasyList.
-            ArrayList<List<String[]>> easyList = blockListHelper.parseBlockList(context.getAssets(), "blocklists/easylist.txt");
+            ArrayList<List<String[]>> easyList = blocklistHelper.parseBlocklist(context.getAssets(), "blocklists/easylist.txt");
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_easyprivacy));
 
             // Populate EasyPrivacy.
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_easyprivacy));
 
             // Populate EasyPrivacy.
-            ArrayList<List<String[]>> easyPrivacy = blockListHelper.parseBlockList(context.getAssets(), "blocklists/easyprivacy.txt");
+            ArrayList<List<String[]>> easyPrivacy = blocklistHelper.parseBlocklist(context.getAssets(), "blocklists/easyprivacy.txt");
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_fanboys_annoyance_list));
 
             // Populate Fanboy's Annoyance List.
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_fanboys_annoyance_list));
 
             // Populate Fanboy's Annoyance List.
-            ArrayList<List<String[]>> fanboysAnnoyanceList = blockListHelper.parseBlockList(context.getAssets(), "blocklists/fanboy-annoyance.txt");
+            ArrayList<List<String[]>> fanboysAnnoyanceList = blocklistHelper.parseBlocklist(context.getAssets(), "blocklists/fanboy-annoyance.txt");
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_fanboys_social_blocking_list));
 
             // Populate Fanboy's Social Blocking List.
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_fanboys_social_blocking_list));
 
             // Populate Fanboy's Social Blocking List.
-            ArrayList<List<String[]>> fanboysSocialList = blockListHelper.parseBlockList(context.getAssets(), "blocklists/fanboy-social.txt");
+            ArrayList<List<String[]>> fanboysSocialList = blocklistHelper.parseBlocklist(context.getAssets(), "blocklists/fanboy-social.txt");
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_ultraprivacy));
 
             // Populate UltraPrivacy.
 
 
             // Update the progress.
             publishProgress(context.getString(R.string.loading_ultraprivacy));
 
             // Populate UltraPrivacy.
-            ArrayList<List<String[]>> ultraPrivacy = blockListHelper.parseBlockList(context.getAssets(), "blocklists/ultraprivacy.txt");
+            ArrayList<List<String[]>> ultraPrivacy = blocklistHelper.parseBlocklist(context.getAssets(), "blocklists/ultraprivacy.txt");
 
 
             // Populate the combined array list.
 
 
             // Populate the combined array list.
@@ -149,6 +150,7 @@ public class PopulateBlocklists extends AsyncTask<Void, String, ArrayList<ArrayL
 
         // Get handles for the views.
         Toolbar toolbar = activity.findViewById(R.id.toolbar);
 
         // Get handles for the views.
         Toolbar toolbar = activity.findViewById(R.id.toolbar);
+        DrawerLayout drawerLayout = activity.findViewById(R.id.drawerlayout);
         LinearLayout tabsLinearLayout = activity.findViewById(R.id.tabs_linearlayout);
         RelativeLayout loadingBlocklistsRelativeLayout = activity.findViewById(R.id.loading_blocklists_relativelayout);
 
         LinearLayout tabsLinearLayout = activity.findViewById(R.id.tabs_linearlayout);
         RelativeLayout loadingBlocklistsRelativeLayout = activity.findViewById(R.id.loading_blocklists_relativelayout);
 
@@ -159,7 +161,10 @@ public class PopulateBlocklists extends AsyncTask<Void, String, ArrayList<ArrayL
         // Hide the loading blocklists screen.
         loadingBlocklistsRelativeLayout.setVisibility(View.GONE);
 
         // Hide the loading blocklists screen.
         loadingBlocklistsRelativeLayout.setVisibility(View.GONE);
 
+        // Enable the sliding drawers.
+        drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
+
         // Add the first tab.
         populateBlocklistsListener.finishedPopulatingBlocklists(combinedBlocklists);
     }
         // Add the first tab.
         populateBlocklistsListener.finishedPopulatingBlocklists(combinedBlocklists);
     }
-}
+}
\ No newline at end of file
index 87719ea02405405758f3fb383aebe587f29ec090..e4c2bbc74808edc89ef35a35c93157df8176ef0c 100644 (file)
@@ -36,7 +36,7 @@ import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;
 
 import com.stoutner.privacybrowser.R;
 import androidx.fragment.app.DialogFragment;
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.helpers.BlockListHelper;
+import com.stoutner.privacybrowser.helpers.BlocklistHelper;
 
 public class ViewRequestDialog extends DialogFragment {
     // The public interface is used to send information back to the parent activity.
 
 public class ViewRequestDialog extends DialogFragment {
     // The public interface is used to send information back to the parent activity.
@@ -172,8 +172,8 @@ public class ViewRequestDialog extends DialogFragment {
         nextButton.setEnabled(!isLastRequest);
 
         // Set the request action text.
         nextButton.setEnabled(!isLastRequest);
 
         // Set the request action text.
-        switch (requestDetails[BlockListHelper.REQUEST_DISPOSITION]) {
-            case BlockListHelper.REQUEST_DEFAULT:
+        switch (requestDetails[BlocklistHelper.REQUEST_DISPOSITION]) {
+            case BlocklistHelper.REQUEST_DEFAULT:
                 // Set the text.
                 requestDisposition.setText(R.string.default_allowed);
 
                 // Set the text.
                 requestDisposition.setText(R.string.default_allowed);
 
@@ -181,7 +181,7 @@ public class ViewRequestDialog extends DialogFragment {
                 requestDisposition.setBackgroundColor(getResources().getColor(R.color.transparent));
                 break;
 
                 requestDisposition.setBackgroundColor(getResources().getColor(R.color.transparent));
                 break;
 
-            case BlockListHelper.REQUEST_ALLOWED:
+            case BlocklistHelper.REQUEST_ALLOWED:
                 // Set the text.
                 requestDisposition.setText(R.string.allowed);
 
                 // Set the text.
                 requestDisposition.setText(R.string.allowed);
 
@@ -193,7 +193,7 @@ public class ViewRequestDialog extends DialogFragment {
                 }
                 break;
 
                 }
                 break;
 
-            case BlockListHelper.REQUEST_THIRD_PARTY:
+            case BlocklistHelper.REQUEST_THIRD_PARTY:
                 // Set the text.
                 requestDisposition.setText(R.string.third_party_blocked);
 
                 // Set the text.
                 requestDisposition.setText(R.string.third_party_blocked);
 
@@ -205,7 +205,7 @@ public class ViewRequestDialog extends DialogFragment {
                 }
                 break;
 
                 }
                 break;
 
-            case BlockListHelper.REQUEST_BLOCKED:
+            case BlocklistHelper.REQUEST_BLOCKED:
                 // Set the text.
                 requestDisposition.setText(R.string.blocked);
 
                 // Set the text.
                 requestDisposition.setText(R.string.blocked);
 
@@ -219,7 +219,7 @@ public class ViewRequestDialog extends DialogFragment {
         }
 
         // Display the request URL.
         }
 
         // Display the request URL.
-        requestUrl.setText(requestDetails[BlockListHelper.REQUEST_URL]);
+        requestUrl.setText(requestDetails[BlocklistHelper.REQUEST_URL]);
 
         // Modify the dialog based on the request action.
         if (requestDetails.length == 2) {  // A default request.
 
         // Modify the dialog based on the request action.
         if (requestDetails.length == 2) {  // A default request.
@@ -234,97 +234,97 @@ public class ViewRequestDialog extends DialogFragment {
             requestBlockListOriginalEntry.setVisibility(View.GONE);
         } else {  // A blocked or allowed request.
             // Set the text on the text views.
             requestBlockListOriginalEntry.setVisibility(View.GONE);
         } else {  // A blocked or allowed request.
             // Set the text on the text views.
-            requestBlockList.setText(requestDetails[BlockListHelper.REQUEST_BLOCKLIST]);
-            requestBlockListEntries.setText(requestDetails[BlockListHelper.REQUEST_BLOCKLIST_ENTRIES]);
-            requestBlockListOriginalEntry.setText(requestDetails[BlockListHelper.REQUEST_BLOCKLIST_ORIGINAL_ENTRY]);
+            requestBlockList.setText(requestDetails[BlocklistHelper.REQUEST_BLOCKLIST]);
+            requestBlockListEntries.setText(requestDetails[BlocklistHelper.REQUEST_BLOCKLIST_ENTRIES]);
+            requestBlockListOriginalEntry.setText(requestDetails[BlocklistHelper.REQUEST_BLOCKLIST_ORIGINAL_ENTRY]);
 
             // Set the sublist text.
 
             // Set the sublist text.
-            switch (requestDetails[BlockListHelper.REQUEST_SUBLIST]) {
-                case BlockListHelper.MAIN_WHITELIST:
+            switch (requestDetails[BlocklistHelper.REQUEST_SUBLIST]) {
+                case BlocklistHelper.MAIN_WHITELIST:
                     requestSubList.setText(R.string.main_whitelist);
                     break;
 
                     requestSubList.setText(R.string.main_whitelist);
                     break;
 
-                case BlockListHelper.FINAL_WHITELIST:
+                case BlocklistHelper.FINAL_WHITELIST:
                     requestSubList.setText(R.string.final_whitelist);
                     break;
 
                     requestSubList.setText(R.string.final_whitelist);
                     break;
 
-                case BlockListHelper.DOMAIN_WHITELIST:
+                case BlocklistHelper.DOMAIN_WHITELIST:
                     requestSubList.setText(R.string.domain_whitelist);
                     break;
 
                     requestSubList.setText(R.string.domain_whitelist);
                     break;
 
-                case BlockListHelper.DOMAIN_INITIAL_WHITELIST:
+                case BlocklistHelper.DOMAIN_INITIAL_WHITELIST:
                     requestSubList.setText(R.string.domain_initial_whitelist);
                     break;
 
                     requestSubList.setText(R.string.domain_initial_whitelist);
                     break;
 
-                case BlockListHelper.DOMAIN_FINAL_WHITELIST:
+                case BlocklistHelper.DOMAIN_FINAL_WHITELIST:
                     requestSubList.setText(R.string.domain_final_whitelist);
                     break;
 
                     requestSubList.setText(R.string.domain_final_whitelist);
                     break;
 
-                case BlockListHelper.THIRD_PARTY_WHITELIST:
+                case BlocklistHelper.THIRD_PARTY_WHITELIST:
                     requestSubList.setText(R.string.third_party_whitelist);
                     break;
 
                     requestSubList.setText(R.string.third_party_whitelist);
                     break;
 
-                case BlockListHelper.THIRD_PARTY_DOMAIN_WHITELIST:
+                case BlocklistHelper.THIRD_PARTY_DOMAIN_WHITELIST:
                     requestSubList.setText(R.string.third_party_domain_whitelist);
                     break;
 
                     requestSubList.setText(R.string.third_party_domain_whitelist);
                     break;
 
-                case BlockListHelper.THIRD_PARTY_DOMAIN_INITIAL_WHITELIST:
+                case BlocklistHelper.THIRD_PARTY_DOMAIN_INITIAL_WHITELIST:
                     requestSubList.setText(R.string.third_party_domain_initial_whitelist);
                     break;
 
                     requestSubList.setText(R.string.third_party_domain_initial_whitelist);
                     break;
 
-                case BlockListHelper.MAIN_BLACKLIST:
+                case BlocklistHelper.MAIN_BLACKLIST:
                     requestSubList.setText(R.string.main_blacklist);
                     break;
 
                     requestSubList.setText(R.string.main_blacklist);
                     break;
 
-                case BlockListHelper.INITIAL_BLACKLIST:
+                case BlocklistHelper.INITIAL_BLACKLIST:
                     requestSubList.setText(R.string.initial_blacklist);
                     break;
 
                     requestSubList.setText(R.string.initial_blacklist);
                     break;
 
-                case BlockListHelper.FINAL_BLACKLIST:
+                case BlocklistHelper.FINAL_BLACKLIST:
                     requestSubList.setText(R.string.final_blacklist);
                     break;
 
                     requestSubList.setText(R.string.final_blacklist);
                     break;
 
-                case BlockListHelper.DOMAIN_BLACKLIST:
+                case BlocklistHelper.DOMAIN_BLACKLIST:
                     requestSubList.setText(R.string.domain_blacklist);
                     break;
 
                     requestSubList.setText(R.string.domain_blacklist);
                     break;
 
-                case BlockListHelper.DOMAIN_INITIAL_BLACKLIST:
+                case BlocklistHelper.DOMAIN_INITIAL_BLACKLIST:
                     requestSubList.setText(R.string.domain_initial_blacklist);
                     break;
 
                     requestSubList.setText(R.string.domain_initial_blacklist);
                     break;
 
-                case BlockListHelper.DOMAIN_FINAL_BLACKLIST:
+                case BlocklistHelper.DOMAIN_FINAL_BLACKLIST:
                     requestSubList.setText(R.string.domain_final_blacklist);
                     break;
 
                     requestSubList.setText(R.string.domain_final_blacklist);
                     break;
 
-                case BlockListHelper.DOMAIN_REGULAR_EXPRESSION_BLACKLIST:
+                case BlocklistHelper.DOMAIN_REGULAR_EXPRESSION_BLACKLIST:
                     requestSubList.setText(R.string.domain_regular_expression_blacklist);
                     break;
 
                     requestSubList.setText(R.string.domain_regular_expression_blacklist);
                     break;
 
-                case BlockListHelper.THIRD_PARTY_BLACKLIST:
+                case BlocklistHelper.THIRD_PARTY_BLACKLIST:
                     requestSubList.setText(R.string.third_party_blacklist);
                     break;
 
                     requestSubList.setText(R.string.third_party_blacklist);
                     break;
 
-                case BlockListHelper.THIRD_PARTY_INITIAL_BLACKLIST:
+                case BlocklistHelper.THIRD_PARTY_INITIAL_BLACKLIST:
                     requestSubList.setText(R.string.third_party_initial_blacklist);
                     break;
 
                     requestSubList.setText(R.string.third_party_initial_blacklist);
                     break;
 
-                case BlockListHelper.THIRD_PARTY_DOMAIN_BLACKLIST:
+                case BlocklistHelper.THIRD_PARTY_DOMAIN_BLACKLIST:
                     requestSubList.setText(R.string.third_party_domain_blacklist);
                     break;
 
                     requestSubList.setText(R.string.third_party_domain_blacklist);
                     break;
 
-                case BlockListHelper.THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST:
+                case BlocklistHelper.THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST:
                     requestSubList.setText(R.string.third_party_domain_initial_blacklist);
                     break;
 
                     requestSubList.setText(R.string.third_party_domain_initial_blacklist);
                     break;
 
-                case BlockListHelper.THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST:
+                case BlocklistHelper.THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST:
                     requestSubList.setText(R.string.third_party_regular_expression_blacklist);
                     break;
 
                     requestSubList.setText(R.string.third_party_regular_expression_blacklist);
                     break;
 
-                case BlockListHelper.THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST:
+                case BlocklistHelper.THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST:
                     requestSubList.setText(R.string.third_party_domain_regular_expression_blacklist);
                     break;
 
                     requestSubList.setText(R.string.third_party_domain_regular_expression_blacklist);
                     break;
 
-                case BlockListHelper.REGULAR_EXPRESSION_BLACKLIST:
+                case BlocklistHelper.REGULAR_EXPRESSION_BLACKLIST:
                     requestSubList.setText(R.string.regular_expression_blacklist);
                     break;
             }
                     requestSubList.setText(R.string.regular_expression_blacklist);
                     break;
             }
diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/BlockListHelper.java b/app/src/main/java/com/stoutner/privacybrowser/helpers/BlockListHelper.java
deleted file mode 100644 (file)
index 3337a96..0000000
+++ /dev/null
@@ -1,2121 +0,0 @@
-/*
- * Copyright © 2018-2019 Soren Stoutner <soren@stoutner.com>.
- *
- * This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
- *
- * Privacy Browser is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Privacy Browser is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-package com.stoutner.privacybrowser.helpers;
-
-import android.content.res.AssetManager;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Pattern;
-
-public class BlockListHelper {
-    // Describe the schema of the string array in each entry of the resource requests array list.
-    public final static int REQUEST_DISPOSITION = 0;
-    public final static int REQUEST_URL = 1;
-    public final static int REQUEST_BLOCKLIST = 2;
-    public final static int REQUEST_SUBLIST = 3;
-    public final static int REQUEST_BLOCKLIST_ENTRIES = 4;
-    public final static int REQUEST_BLOCKLIST_ORIGINAL_ENTRY = 5;
-
-    // The request disposition options.
-    public final static String REQUEST_DEFAULT = "0";
-    public final static String REQUEST_ALLOWED = "1";
-    public final static String REQUEST_THIRD_PARTY = "2";
-    public final static String REQUEST_BLOCKED = "3";
-
-    // The whitelists.
-    public final static String MAIN_WHITELIST = "1";
-    public final static String FINAL_WHITELIST = "2";
-    public final static String DOMAIN_WHITELIST = "3";
-    public final static String DOMAIN_INITIAL_WHITELIST = "4";
-    public final static String DOMAIN_FINAL_WHITELIST = "5";
-    public final static String THIRD_PARTY_WHITELIST = "6";
-    public final static String THIRD_PARTY_DOMAIN_WHITELIST = "7";
-    public final static String THIRD_PARTY_DOMAIN_INITIAL_WHITELIST = "8";
-
-    // The blacklists.
-    public final static String MAIN_BLACKLIST = "9";
-    public final static String INITIAL_BLACKLIST = "10";
-    public final static String FINAL_BLACKLIST = "11";
-    public final static String DOMAIN_BLACKLIST = "12";
-    public final static String DOMAIN_INITIAL_BLACKLIST = "13";
-    public final static String DOMAIN_FINAL_BLACKLIST = "14";
-    public final static String DOMAIN_REGULAR_EXPRESSION_BLACKLIST = "15";
-    public final static String THIRD_PARTY_BLACKLIST = "16";
-    public final static String THIRD_PARTY_INITIAL_BLACKLIST = "17";
-    public final static String THIRD_PARTY_DOMAIN_BLACKLIST = "18";
-    public final static String THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST = "19";
-    public final static String THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST = "20";
-    public final static String THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST = "21";
-    public final static String REGULAR_EXPRESSION_BLACKLIST = "22";
-
-    public ArrayList<List<String[]>> parseBlockList(AssetManager assets, String blockListName) {
-        // Initialize the header list.
-        List<String[]> headers = new ArrayList<>();  // 0.
-
-        // Initialize the whitelists.
-        List<String[]> mainWhiteList = new ArrayList<>();  // 1.
-        List<String[]> finalWhiteList = new ArrayList<>();  // 2.
-        List<String[]> domainWhiteList = new ArrayList<>();  // 3.
-        List<String[]> domainInitialWhiteList = new ArrayList<>();  // 4.
-        List<String[]> domainFinalWhiteList = new ArrayList<>();  // 5.
-        List<String[]> thirdPartyWhiteList = new ArrayList<>();  // 6.
-        List<String[]> thirdPartyDomainWhiteList = new ArrayList<>();  // 7.
-        List<String[]> thirdPartyDomainInitialWhiteList = new ArrayList<>();  // 8.
-
-        // Initialize the blacklists
-        List<String[]> mainBlackList = new ArrayList<>();  // 9.
-        List<String[]> initialBlackList = new ArrayList<>();  // 10.
-        List<String[]> finalBlackList = new ArrayList<>();  // 11.
-        List<String[]> domainBlackList = new ArrayList<>();  // 12.
-        List<String[]> domainInitialBlackList = new ArrayList<>();  // 13.
-        List<String[]> domainFinalBlackList = new ArrayList<>();  // 14.
-        List<String[]> domainRegularExpressionBlackList = new ArrayList<>();  // 15.
-        List<String[]> thirdPartyBlackList = new ArrayList<>();  // 16.
-        List<String[]> thirdPartyInitialBlackList = new ArrayList<>();  // 17.
-        List<String[]> thirdPartyDomainBlackList = new ArrayList<>();  // 18.
-        List<String[]> thirdPartyDomainInitialBlackList = new ArrayList<>();  // 19.
-        List<String[]> regularExpressionBlackList = new ArrayList<>();  // 20.
-        List<String[]> thirdPartyRegularExpressionBlackList = new ArrayList<>();  // 21.
-        List<String[]> thirdPartyDomainRegularExpressionBlackList = new ArrayList<>();  // 22.
-
-
-        // Populate the block lists.  The `try` is required by `InputStreamReader`.
-        try {
-            // Load the block list into a `BufferedReader`.
-            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(assets.open(blockListName)));
-
-            // Create a string for storing the block list entries.
-            String blockListEntry;
-
-            // Parse the block list.
-            while ((blockListEntry = bufferedReader.readLine()) != null) {
-                // Store the original block list entry.
-                String originalBlockListEntry = blockListEntry;
-
-                // Remove any `^` from the block list entry.  Privacy Browser does not process them in the interest of efficiency.
-                blockListEntry = blockListEntry.replace("^", "");
-
-                //noinspection StatementWithEmptyBody
-                if (blockListEntry.contains("##") || blockListEntry.contains("#?#") || blockListEntry.contains("#@#") || blockListEntry.startsWith("[")) {
-                    // Entries that contain `##`, `#?#`, and `#@#` are for hiding elements in the main page's HTML.  Entries that start with `[` describe the AdBlock compatibility level.
-                    // Do nothing.  Privacy Browser does not currently use these entries.
-
-                    //Log.i("BlockLists", "Not added: " + blockListEntry);
-                } else //noinspection StatementWithEmptyBody
-                    if (blockListEntry.contains("$csp=script-src")) {  // Ignore entries that contain `$csp=script-src`.
-                        // Do nothing.  It is uncertain what this directive is even supposed to mean, and it is blocking entire websites like androidcentral.com.  https://redmine.stoutner.com/issues/306.
-
-                        //Log.i("BlockLists", headers.get(1)[0] + " not added: " + originalBlockListEntry);
-                } else //noinspection StatementWithEmptyBody
-                    if (blockListEntry.contains("$websocket") || blockListEntry.contains("$third-party,websocket") || blockListEntry.contains("$script,websocket")) {  // Ignore entries with `websocket`.
-                        // Do nothing.  Privacy Browser does not differentiate between websocket requests and other requests and these entries cause a lot of false positives.
-
-                        //Log.i("BlockLists", headers.get(1)[0] + " not added: " + originalBlockListEntry);
-                } else if (blockListEntry.startsWith("!")) {  //  Comment entries.
-                    if (blockListEntry.startsWith("! Version:")) {
-                        // Get the list version number.
-                        String[] listVersion = {blockListEntry.substring(11)};
-
-                        // Store the list version in the headers list.
-                        headers.add(listVersion);
-                    }
-
-                    if (blockListEntry.startsWith("! Title:")) {
-                        // Get the list title.
-                        String[] listTitle = {blockListEntry.substring(9)};
-
-                        // Store the list title in the headers list.
-                        headers.add(listTitle);
-                    }
-
-                    //Log.i("BlockLists", "Not added: " + blockListEntry);
-                } else if (blockListEntry.startsWith("@@")) {  // Entries that begin with `@@` are whitelists.
-                    // Remove the `@@`
-                    blockListEntry = blockListEntry.substring(2);
-
-                    // Strip out any initial `||`.  Privacy Browser doesn't differentiate items that only match against the end of the domain name.
-                    if (blockListEntry.startsWith("||")) {
-                        blockListEntry = blockListEntry.substring(2);
-                    }
-
-                    if (blockListEntry.contains("$")) {  // Filter entries.
-                        //noinspection StatementWithEmptyBody
-                        if (blockListEntry.contains("~third-party")) {  // Ignore entries that contain `~third-party`.
-                            // Do nothing.
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " not added: " + originalBlockListEntry);
-                        } else if (blockListEntry.contains("third-party")) {  // Third-party white list entries.
-                            if (blockListEntry.contains("domain=")) {  // Third-party domain white list entries.
-                                // Parse the entry.
-                                String entry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-                                String filters = blockListEntry.substring(blockListEntry.indexOf("$") + 1);
-                                String domains = filters.substring(filters.indexOf("domain=") + 7);
-
-                                //noinspection StatementWithEmptyBody
-                                if (domains.contains("~")) {  // It is uncertain what a `~` domain means inside an `@@` entry.
-                                    // Do Nothing
-
-                                    //Log.i("BlockLists", headers.get(1)[0] + " not added: " + originalBlockListEntry);
-                                } else if (blockListEntry.startsWith("|")) {  // Third-party domain initial white list entries.
-                                    // Strip out the initial `|`.
-                                    entry = entry.substring(1);
-
-                                    //noinspection StatementWithEmptyBody
-                                    if (entry.equals("http://") || entry.equals("https://")) {  // Ignore generic entries.
-                                        // Do nothing.  These entries are designed for filter options that Privacy Browser does not use.
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " not added: " + originalBlockListEntry);
-                                    } else {  // Process third-party domain initial white list entries.
-                                        // Process each domain.
-                                        do {
-                                            // Create a string to keep track of the current domain.
-                                            String domain;
-
-                                            if (domains.contains("|")) {  // There is more than one domain in the list.
-                                                // Get the first domain from the list.
-                                                domain = domains.substring(0, domains.indexOf("|"));
-
-                                                // Remove the first domain from the list.
-                                                domains = domains.substring(domains.indexOf("|") + 1);
-                                            } else {  // There is only one domain in the list.
-                                                domain = domains;
-                                            }
-
-                                            if (entry.contains("*")) {  // Process a third-party domain initial white list double entry.
-                                                // Get the index of the wildcard.
-                                                int wildcardIndex = entry.indexOf("*");
-
-                                                // Split the entry into components.
-                                                String firstEntry = entry.substring(0, wildcardIndex);
-                                                String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                                // Create an entry string array.
-                                                String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry};
-
-                                                // Add the entry to the white list.
-                                                thirdPartyDomainInitialWhiteList.add(domainDoubleEntry);
-
-                                                //Log.i("BlockLists", headers.get(1)[0] + " third-party domain initial white list added: " + domain + " , " + firstEntry + " , " + secondEntry +
-                                                //        "  -  " + originalBlockListEntry);
-                                            } else {  // Process a third-party domain initial white list single entry.
-                                                // Create a domain entry string array.
-                                                String[] domainEntry = {domain, entry, originalBlockListEntry};
-
-                                                // Add the entry to the third party domain initial white list.
-                                                thirdPartyDomainInitialWhiteList.add(domainEntry);
-
-                                                //Log.i("BlockLists", headers.get(1)[0] + " third-party domain initial white list added: " + domain + " , " + entry + "  -  " + originalBlockListEntry);
-                                            }
-                                        } while (domains.contains("|"));
-                                    }
-                                } else {  // Third-party domain entries.
-                                    // Process each domain.
-                                    do {
-                                        // Create a string to keep track of the current domain.
-                                        String domain;
-
-                                        if (domains.contains("|")) {  // three is more than one domain in the list.
-                                            // Get the first domain from the list.
-                                            domain = domains.substring(0, domains.indexOf("|"));
-
-                                            // Remove the first domain from the list.
-                                            domains = domains.substring(domains.indexOf("|") + 1);
-                                        } else {  // There is only one domain in the list.
-                                            domain = domains;
-                                        }
-
-                                        // Remove any trailing `*` from the entry.
-                                        if (entry.endsWith("*")) {
-                                            entry = entry.substring(0, entry.length() - 1);
-                                        }
-
-                                        if (entry.contains("*")) {  // Process a third-party domain double entry.
-                                            // Get the index of the wildcard.
-                                            int wildcardIndex = entry.indexOf("*");
-
-                                            // Split the entry into components.
-                                            String firstEntry = entry.substring(0, wildcardIndex);
-                                            String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                            // Create an entry string array.
-                                            String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry};
-
-                                            // Add the entry to the white list.
-                                            thirdPartyDomainWhiteList.add(domainDoubleEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " third-party domain white list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
-                                            //        originalBlockListEntry);
-                                        } else {  // Process a third-party domain single entry.
-                                            // Create an entry string array.
-                                            String[] domainEntry = {domain, entry, originalBlockListEntry};
-
-                                            // Add the entry to the white list.
-                                            thirdPartyDomainWhiteList.add(domainEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " third-party domain white list added: " + domain + " , " + entry + "  -  " + originalBlockListEntry);
-                                        }
-                                    } while (domains.contains("|"));
-                                }
-                            } else {  // Process third-party white list entries.
-                                // Parse the entry
-                                String entry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-
-                                if (entry.contains("*")) {  // There are two or more entries.
-                                    // Get the index of the wildcard.
-                                    int wildcardIndex = entry.indexOf("*");
-
-                                    // Split the entry into components.
-                                    String firstEntry = entry.substring(0, wildcardIndex);
-                                    String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                    if (secondEntry.contains("*")) {  // There are three or more entries.
-                                        // Get the index of the wildcard.
-                                        int secondWildcardIndex = secondEntry.indexOf("*");
-
-                                        // Split the entry into components.
-                                        String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
-                                        String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
-
-                                        if (thirdEntry.contains("*")) {  // There are four or more entries.
-                                            // Get the index of the wildcard.
-                                            int thirdWildcardIndex = thirdEntry.indexOf("*");
-
-                                            // Split the entry into components.
-                                            String realThirdEntry = thirdEntry.substring(0, thirdWildcardIndex);
-                                            String fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1);
-
-                                            if (fourthEntry.contains("*")) {  // Process a third-party white list quintuple entry.
-                                                // Get the index of the wildcard.
-                                                int fourthWildcardIndex = fourthEntry.indexOf("*");
-
-                                                // Split the entry into components.
-                                                String realFourthEntry = fourthEntry.substring(0, fourthWildcardIndex);
-                                                String fifthEntry = fourthEntry.substring(fourthWildcardIndex + 1);
-
-                                                // Create an entry string array.
-                                                String[] quintupleEntry = {firstEntry, realSecondEntry, realThirdEntry, realFourthEntry, fifthEntry, originalBlockListEntry};
-
-                                                // Add the entry to the white list.
-                                                thirdPartyWhiteList.add(quintupleEntry);
-
-                                                //Log.i("BlockLists", headers.get(1)[0] + " third-party white list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " +
-                                                //        realFourthEntry + " , " + fifthEntry + "  -  " + originalBlockListEntry);
-                                            } else {  // Process a third-party white list quadruple entry.
-                                                // Create an entry string array.
-                                                String[] quadrupleEntry = {firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlockListEntry};
-
-                                                // Add the entry to the white list.
-                                                thirdPartyWhiteList.add(quadrupleEntry);
-
-                                                //Log.i("BlockLists", headers.get(1)[0] + " third-party white list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " +
-                                                //        fourthEntry + "  -  " + originalBlockListEntry);
-                                            }
-                                        } else {  // Process a third-party white list triple entry.
-                                            // Create an entry string array.
-                                            String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry};
-
-                                            // Add the entry to the white list.
-                                            thirdPartyWhiteList.add(tripleEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " third-party white list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " +
-                                            //        originalBlockListEntry);
-                                        }
-                                    } else {  // Process a third-party white list double entry.
-                                        // Create an entry string array.
-                                        String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                                        // Add the entry to the white list.
-                                        thirdPartyWhiteList.add(doubleEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " third-party white list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                                    }
-                                } else {  // Process a third-party white list single entry.
-                                    // Create an entry string array.
-                                    String[] singleEntry = {entry, originalBlockListEntry};
-
-                                    // Add the entry to the white list.
-                                    thirdPartyWhiteList.add(singleEntry);
-
-                                    //Log.i("BlockLists", headers.get(1)[0] + " third-party domain white list added: " + entry + "  -  " + originalBlockListEntry);
-                                }
-                            }
-                        } else if (blockListEntry.contains("domain=")) {  // Process domain white list entries.
-                            // Parse the entry
-                            String entry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-                            String filters = blockListEntry.substring(blockListEntry.indexOf("$") + 1);
-                            String domains = filters.substring(filters.indexOf("domain=") + 7);
-
-                            if (entry.startsWith("|")) {  // Initial domain white list entries.
-                                // Strip the initial `|`.
-                                entry = entry.substring(1);
-
-                                //noinspection StatementWithEmptyBody
-                                if (entry.equals("http://") || entry.equals("https://")) {  // Ignore generic entries.
-                                    // Do nothing.  These entries are designed for filter options that Privacy Browser does not use.
-
-                                    //Log.i("BlockLists", headers.get(1)[0] + " not added: " + originalBlockListEntry);
-                                } else {  // Initial domain white list entry.
-                                    // Process each domain.
-                                    do {
-                                        // Create a string to keep track of the current domain.
-                                        String domain;
-
-                                        if (domains.contains("|")) {  // There is more than one domain in the list.
-                                            // Get the first domain from the list.
-                                            domain = domains.substring(0, domains.indexOf("|"));
-
-                                            // Remove the first domain from the list.
-                                            domains = domains.substring(domains.indexOf("|") + 1);
-                                        } else {  // There is only one domain in the list.
-                                            domain = domains;
-                                        }
-
-                                        if (entry.contains("*")) {  // There are two or more entries.
-                                            // Get the index of the wildcard.
-                                            int wildcardIndex = entry.indexOf("*");
-
-                                            // Split the entry into components.
-                                            String firstEntry = entry.substring(0, wildcardIndex);
-                                            String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                            if (secondEntry.contains("*")) {  // Process a domain initial triple entry.
-                                                // Get the index of the wildcard.
-                                                int secondWildcardIndex = secondEntry.indexOf("*");
-
-                                                // Split the entry into components.
-                                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
-                                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
-
-                                                // Create an entry string array.
-                                                String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry};
-
-                                                // Add the entry to the white list.
-                                                domainInitialWhiteList.add(domainTripleEntry);
-
-                                                //Log.i("BlockLists", headers.get(1)[0] + " domain initial white list entry added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " +
-                                                //        thirdEntry + "  -  " + originalBlockListEntry);
-                                            } else {  // Process a domain initial double entry.
-                                                // Create an entry string array.
-                                                String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry};
-
-                                                // Add the entry to the white list.
-                                                domainInitialWhiteList.add(domainDoubleEntry);
-
-                                                //Log.i("BlockLists", headers.get(1)[0] + " domain initial white list entry added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
-                                                //        originalBlockListEntry);
-                                            }
-                                        } else {  // Process a domain initial single entry.
-                                            // Create an entry string array.
-                                            String[] domainEntry = {domain, entry, originalBlockListEntry};
-
-                                            // Add the entry to the white list.
-                                            domainInitialWhiteList.add(domainEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " domain initial white list entry added: " + domain + " , " + entry + "  -  " + originalBlockListEntry);
-                                        }
-                                    } while (domains.contains("|"));
-                                }
-                            } else if (entry.endsWith("|")) {  // Final domain white list entries.
-                                // Strip the `|` from the end of the entry.
-                                entry = entry.substring(0, entry.length() - 1);
-
-                                // Process each domain.
-                                do {
-                                    // Create a string to keep track of the current domain.
-                                    String domain;
-
-                                    if (domains.contains("|")) {  // There is more than one domain in the list.
-                                        // Get the first domain from the list.
-                                        domain = domains.substring(0, domains.indexOf("|"));
-
-                                        // Remove the first domain from the list.
-                                        domains = domains.substring(domains.indexOf("|") + 1);
-                                    } else {  // There is only one domain in the list.
-                                        domain = domains;
-                                    }
-
-                                    if (entry.contains("*")) {  // Process a domain final white list double entry.
-                                        // Get the index of the wildcard.
-                                        int wildcardIndex = entry.indexOf("*");
-
-                                        // Split the entry into components.
-                                        String firstEntry = entry.substring(0, wildcardIndex);
-                                        String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                        // Create an entry string array.
-                                        String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry};
-
-                                        // Add the entry to the white list.
-                                        domainFinalWhiteList.add(domainDoubleEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " domain final white list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
-                                        //        originalBlockListEntry);
-                                    } else {  // Process a domain final white list single entry.
-                                        // create an entry string array.
-                                        String[] domainEntry = {domain, entry, originalBlockListEntry};
-
-                                        // Add the entry to the white list.
-                                        domainFinalWhiteList.add(domainEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " domain final white list added: " + domain + " , " + entry + "  -  " + originalBlockListEntry);
-                                    }
-                                } while (domains.contains("|"));
-
-                            } else {  // Standard domain white list entries with filters.
-                                //noinspection StatementWithEmptyBody
-                                if (domains.contains("~")) {  // It is uncertain what a `~` domain means inside an `@@` entry.
-                                    // Do Nothing
-
-                                    //Log.i("BlockLists", headers.get(1)[0] + " not added: " + originalBlockListEntry);
-                                } else {
-                                    // Process each domain.
-                                    do {
-                                        // Create a string to keep track of the current domain.
-                                        String domain;
-
-                                        if (domains.contains("|")) {  // There is more than one domain in the list.
-                                            // Get the first domain from the list.
-                                            domain = domains.substring(0, domains.indexOf("|"));
-
-                                            // Remove the first domain from the list.
-                                            domains = domains.substring(domains.indexOf("|") + 1);
-                                        } else {  // There is only one domain in the list.
-                                            domain = domains;
-                                        }
-
-                                        if (entry.contains("*")) {  // There are two or more entries.
-                                            // Get the index of the wildcard.
-                                            int wildcardIndex = entry.indexOf("*");
-
-                                            // Split the entry into components.
-                                            String firstEntry = entry.substring(0, wildcardIndex);
-                                            String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                            if (secondEntry.contains("*")) {  // There are three or more entries.
-                                                // Get the index of the wildcard.
-                                                int secondWildcardIndex = secondEntry.indexOf("*");
-
-                                                // Split the entry into components.
-                                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
-                                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
-
-                                                if (thirdEntry.contains("*")) {  // Process a domain white list quadruple entry.
-                                                    // Get the index of the wildcard.
-                                                    int thirdWildcardIndex = thirdEntry.indexOf("*");
-
-                                                    // Split the entry into components.
-                                                    String realThirdEntry = thirdEntry.substring(0, thirdWildcardIndex);
-                                                    String fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1);
-
-                                                    // Create an entry string array.
-                                                    String[] domainQuadrupleEntry = {domain, firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlockListEntry};
-
-                                                    // Add the entry to the white list.
-                                                    domainWhiteList.add(domainQuadrupleEntry);
-
-                                                    //Log.i("BlockLists", headers.get(1)[0] + " domain white list added : " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " +
-                                                    //        realThirdEntry + " , " + fourthEntry + "  -  " + originalBlockListEntry);
-                                                } else {  // Process a domain white list triple entry.
-                                                    // Create an entry string array.
-                                                    String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry};
-
-                                                    // Add the entry to the white list.
-                                                    domainWhiteList.add(domainTripleEntry);
-
-                                                    //Log.i("BlockLists", headers.get(1)[0] + " domain white list added : " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " +
-                                                    //        thirdEntry + "  -  " + originalBlockListEntry);
-                                                }
-                                            } else {  // Process a domain white list double entry.
-                                                // Create an entry string array.
-                                                String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry};
-
-                                                // Add the entry to the white list.
-                                                domainWhiteList.add(domainDoubleEntry);
-
-                                                //Log.i("BlockLists", headers.get(1)[0] + " domain white list added : " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
-                                                //        originalBlockListEntry);
-                                            }
-                                        } else {  // Process a domain white list single entry.
-                                            // Create an entry string array.
-                                            String[] domainEntry = {domain, entry, originalBlockListEntry};
-
-                                            // Add the entry to the white list.
-                                            domainWhiteList.add(domainEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " domain white list added : " + domain + " , " + entry + "  -  " + originalBlockListEntry);
-                                        }
-                                    } while (domains.contains("|"));
-                                }
-                            }
-                        }  // Ignore all other filter entries.
-                    } else if (blockListEntry.endsWith("|")) {  // Final white list entries.
-                        // Remove the final `|` from the entry.
-                        String entry = blockListEntry.substring(0, blockListEntry.length() - 1);
-
-                        if (entry.contains("*")) {  // Process a final white list double entry
-                            // Get the index of the wildcard.
-                            int wildcardIndex = entry.indexOf("*");
-
-                            // split the entry into components.
-                            String firstEntry = entry.substring(0, wildcardIndex);
-                            String secondEntry = entry.substring(wildcardIndex + 1);
-
-                            // Create an entry string array.
-                            String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                            // Add the entry to the white list.
-                            finalWhiteList.add(doubleEntry);
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " final white list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                        } else {  // Process a final white list single entry.
-                            // Create an entry string array.
-                            String[] singleEntry = {entry, originalBlockListEntry};
-
-                            // Add the entry to the white list.
-                            finalWhiteList.add(singleEntry);
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " final white list added: " + entry + "  -  " + originalBlockListEntry);
-                        }
-                    } else {  // Main white list entries.
-                        if (blockListEntry.contains("*")) {  // There are two or more entries.
-                            // Get the index of the wildcard.
-                            int wildcardIndex = blockListEntry.indexOf("*");
-
-                            // Split the entry into components.
-                            String firstEntry = blockListEntry.substring(0, wildcardIndex);
-                            String secondEntry = blockListEntry.substring(wildcardIndex + 1);
-
-                            if (secondEntry.contains("*")) {  // Process a main white list triple entry.
-                                // Get the index of the wildcard.
-                                int secondWildcardIndex = secondEntry.indexOf("*");
-
-                                // Split the entry into components.
-                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
-                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
-
-                                // Create an entry string array.
-                                String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry};
-
-                                // Add the entry to the white list.
-                                mainWhiteList.add(tripleEntry);
-
-                                //Log.i("BlockLists", headers.get(1)[0] + " main white list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " + originalBlockListEntry);
-                            } else {  // Process a main white list double entry.
-                                // Create an entry string array.
-                                String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                                // Add the entry to the white list.
-                                mainWhiteList.add(doubleEntry);
-
-                                //Log.i("BlockLists", headers.get(1)[0] + " main white list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                            }
-                        } else {  // Process a main white list single entry.
-                            // Create an entry string array.
-                            String[] singleEntry = {blockListEntry, originalBlockListEntry};
-
-                            // Add the entry to the white list.
-                            mainWhiteList.add(singleEntry);
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " main white list added: " + blockListEntry + "  -  " + originalBlockListEntry);
-                        }
-                    }
-                } else if (blockListEntry.endsWith("|")) {  // Final black list entries.
-                    // Strip out the final "|"
-                    String entry = blockListEntry.substring(0, blockListEntry.length() - 1);
-
-                    // Strip out any initial `||`.  They are redundant in this case because the block list entry is being matched against the end of the URL.
-                    if (entry.startsWith("||")) {
-                        entry = entry.substring(2);
-                    }
-
-                    if (entry.contains("*")) {  // Process a final black list double entry.
-                        // Get the index of the wildcard.
-                        int wildcardIndex = entry.indexOf("*");
-
-                        // Split the entry into components.
-                        String firstEntry = entry.substring(0, wildcardIndex);
-                        String secondEntry = entry.substring(wildcardIndex + 1);
-
-                        // Create an entry string array.
-                        String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                        // Add the entry to the black list.
-                        finalBlackList.add(doubleEntry);
-
-                        //Log.i("BlockLists", headers.get(1)[0] + " final black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                    } else {  // Process a final black list single entry.
-                        // create an entry string array.
-                        String[] singleEntry = {entry, originalBlockListEntry};
-
-                        // Add the entry to the black list.
-                        finalBlackList.add(singleEntry);
-
-                        //Log.i("BlockLists", headers.get(1)[0] + " final black list added: " + entry + "  -  " + originalBlockListEntry);
-                    }
-                } else if (blockListEntry.contains("$")) {  // Entries with filter options.
-                    // Strip out any initial `||`.  These will be treated like any other entry.
-                    if (blockListEntry.startsWith("||")) {
-                        blockListEntry = blockListEntry.substring(2);
-                    }
-
-                    if (blockListEntry.contains("third-party")) {  // Third-party entries.
-                        //noinspection StatementWithEmptyBody
-                        if (blockListEntry.contains("~third-party")) {  // Third-party filter white list entries.
-                            // Do not process these white list entries.  They are designed to combine with block filters that Privacy Browser doesn't use, like `subdocument` and `xmlhttprequest`.
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " not added: " + originalBlockListEntry);
-                        } else if (blockListEntry.contains("domain=")) {  // Third-party domain entries.
-                            if (blockListEntry.startsWith("|")) {  // Third-party domain initial entries.
-                                // Strip the initial `|`.
-                                blockListEntry = blockListEntry.substring(1);
-
-                                // Parse the entry
-                                String entry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-                                String filters = blockListEntry.substring(blockListEntry.indexOf("$") + 1);
-                                String domains = filters.substring(filters.indexOf("domain=") + 7);
-
-                                //noinspection StatementWithEmptyBody
-                                if (entry.equals("http:") || entry.equals("https:") || entry.equals("http://") || entry.equals("https://")) {  // Ignore generic entries.
-                                    // Do nothing.  These entries will almost entirely disable the website.
-                                    // Often the original entry blocks filter options like `$script`, which Privacy Browser does not differentiate.
-
-                                    //Log.i("BlockLists", headers.get(1)[0] + " not added: " + originalBlockListEntry);
-                                } else {  // Third-party domain initial entries.
-                                    // Process each domain.
-                                    do {
-                                        // Create a string to keep track of the current domain.
-                                        String domain;
-
-                                        if (domains.contains("|")) {  // There is more than one domain in the list.
-                                            // Get the first domain from the list.
-                                            domain = domains.substring(0, domains.indexOf("|"));
-
-                                            // Remove the first domain from the list.
-                                            domains = domains.substring(domains.indexOf("|") + 1);
-                                        } else {  // There is only one domain in the list.
-                                            domain = domains;
-                                        }
-
-                                        if (entry.contains("*")) {  // Three are two or more entries.
-                                            // Get the index of the wildcard.
-                                            int wildcardIndex = entry.indexOf("*");
-
-                                            // Split the entry into components.
-                                            String firstEntry = entry.substring(0, wildcardIndex);
-                                            String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                            if (secondEntry.contains("*")) {  // Process a third-party domain initial black list triple entry.
-                                                // Get the index of the wildcard.
-                                                int secondWildcardIndex = secondEntry.indexOf("*");
-
-                                                // Split the entry into components.
-                                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
-                                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
-
-                                                // Create an entry string array.
-                                                String[] tripleDomainEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry};
-
-                                                // Add the entry to the black list.
-                                                thirdPartyDomainInitialBlackList.add(tripleDomainEntry);
-
-                                                //Log.i("BlockLists", headers.get(1)[0] + " third-party domain initial black list added: " + domain + " , " + firstEntry + " , " + realSecondEntry +
-                                                //        " , " + thirdEntry + "  -  " + originalBlockListEntry);
-                                            } else {  // Process a third-party domain initial black list double entry.
-                                                // Create an entry string array.
-                                                String[] doubleDomainEntry = {domain, firstEntry, secondEntry, originalBlockListEntry};
-
-                                                // Add the entry to the black list.
-                                                thirdPartyDomainInitialBlackList.add(doubleDomainEntry);
-
-                                                //Log.i("BlockLists", headers.get(1)[0] + " third-party domain initial black list added: " + domain + " , " + firstEntry + " , " + secondEntry +
-                                                //        "  -  " + originalBlockListEntry);
-                                            }
-                                        } else {  // Process a third-party domain initial black list single entry.
-                                            // Create an entry string array.
-                                            String[] singleEntry = {domain, entry, originalBlockListEntry};
-
-                                            // Add the entry to the black list.
-                                            thirdPartyDomainInitialBlackList.add(singleEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " third-party domain initial black list added: " + domain + " , " + entry + "  -  " + originalBlockListEntry);
-                                        }
-                                    } while (domains.contains("|"));
-                                }
-                            } else if (blockListEntry.contains("\\")) {  // Process a third-party domain black list regular expression.
-                                // Parse the entry.  At least one regular expression in this entry contains `$`, so the parser uses `/$`.
-                                String entry = blockListEntry.substring(0, blockListEntry.indexOf("/$") + 1);
-                                String filters = blockListEntry.substring(blockListEntry.indexOf("/$") + 2);
-                                String domains = filters.substring(filters.indexOf("domain=") + 7);
-
-                                // Process each domain.
-                                do {
-                                    // Create a string to keep track of the current domain.
-                                    String domain;
-
-                                    if (domains.contains("|")) {  // There is more than one domain in the list.
-                                        // Get the first domain from the list.
-                                        domain = domains.substring(0, domains.indexOf("|"));
-
-                                        // Remove the first domain from the list.
-                                        domains = domains.substring(domains.indexOf("|") + 1);
-                                    } else {  // There is only one domain in the list.
-                                        domain = domains;
-                                    }
-
-                                    // Create an entry string array.
-                                    String[] domainEntry = {domain, entry, originalBlockListEntry};
-
-                                    // Add the entry to the black list.
-                                    thirdPartyDomainRegularExpressionBlackList.add(domainEntry);
-
-                                    //Log.i("BlockLists", headers.get(1)[0] + " third-party domain regular expression black list added: " + domain + " , " + entry + "  -  " + originalBlockListEntry);
-                                } while (domains.contains("|"));
-                            } else {  // Third-party domain entries.
-                                // Parse the entry
-                                String entry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-                                String filters = blockListEntry.substring(blockListEntry.indexOf("$") + 1);
-                                String domains = filters.substring(filters.indexOf("domain=") + 7);
-
-                                // Strip any trailing "*" from the entry.
-                                if (entry.endsWith("*")) {
-                                    entry = entry.substring(0, entry.length() - 1);
-                                }
-
-                                // Track if any third-party white list filters are applied.
-                                boolean whiteListDomain = false;
-
-                                // Process each domain.
-                                do {
-                                    // Create a string to keep track of the current domain.
-                                    String domain;
-
-                                    if (domains.contains("|")) {  // There is more than one domain in the list.
-                                        // Get the first domain from the list.
-                                        domain = domains.substring(0, domains.indexOf("|"));
-
-                                        // Remove the first domain from the list.
-                                        domains = domains.substring(domains.indexOf("|") + 1);
-                                    } else {  // The is only one domain in the list.
-                                        domain = domains;
-                                    }
-
-                                    // Differentiate between block list domains and white list domains.
-                                    if (domain.startsWith("~")) {  // White list third-party domain entry.
-                                        // Strip the initial `~`.
-                                        domain = domain.substring(1);
-
-                                        // Set the white list domain flag.
-                                        whiteListDomain = true;
-
-                                        if (entry.contains("*")) {  // Process a third-party domain white list double entry.
-                                            // Get the index of the wildcard.
-                                            int wildcardIndex = entry.indexOf("*");
-
-                                            // Split the entry into components.
-                                            String firstEntry = entry.substring(0, wildcardIndex);
-                                            String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                            // Create an entry string array.
-                                            String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry};
-
-                                            // Add the entry to the white list.
-                                            thirdPartyDomainWhiteList.add(domainDoubleEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " third-party domain white list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
-                                            //        originalBlockListEntry);
-                                        } else {  // Process a third-party domain white list single entry.
-                                            // Create an entry string array.
-                                            String[] domainEntry = {domain, entry, originalBlockListEntry};
-
-                                            // Add the entry to the white list.
-                                            thirdPartyDomainWhiteList.add(domainEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " third-party domain white list added: " + domain + " , " + entry + "  -  " + originalBlockListEntry);
-                                        }
-                                    } else {  // Third-party domain black list entries.
-                                        if (entry.contains("*")) {  // Process a third-party domain black list double entry.
-                                            // Get the index of the wildcard.
-                                            int wildcardIndex = entry.indexOf("*");
-
-                                            // Split the entry into components.
-                                            String firstEntry = entry.substring(0, wildcardIndex);
-                                            String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                            // Create an entry string array.
-                                            String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry};
-
-                                            // Add the entry to the black list
-                                            thirdPartyDomainBlackList.add(domainDoubleEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " third-party domain black list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
-                                            //        originalBlockListEntry);
-                                        } else {  // Process a third-party domain black list single entry.
-                                            // Create an entry string array.
-                                            String[] domainEntry = {domain, entry, originalBlockListEntry};
-
-                                            // Add the entry to the black list.
-                                            thirdPartyDomainBlackList.add(domainEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " third-party domain block list added: " + domain + " , " + entry + "  -  " + originalBlockListEntry);
-                                        }
-                                    }
-                                } while (domains.contains("|"));
-
-                                // Add a third-party black list entry if a white list domain was processed.
-                                if (whiteListDomain) {
-                                    if (entry.contains("*")) {  // Process a third-party black list double entry.
-                                        // Get the index of the wildcard.
-                                        int wildcardIndex = entry.indexOf("*");
-
-                                        // Split the entry into components.
-                                        String firstEntry = entry.substring(0, wildcardIndex);
-                                        String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                        // Create an entry string array.
-                                        String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                                        // Add the entry to the black list.
-                                        thirdPartyBlackList.add(doubleEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " third-party black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                                    } else {  // Process a third-party black list single entry.
-                                        // Create an entry string array.
-                                        String[] singleEntry = {entry, originalBlockListEntry};
-
-                                        // Add an entry to the black list.
-                                        thirdPartyBlackList.add(singleEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " third-party black list added: " + entry + "  -  " + originalBlockListEntry);
-                                    }
-                                }
-                            }
-                        } else if (blockListEntry.startsWith("|")) {  // Third-party initial black list entries.
-                            // Strip the initial `|`.
-                            blockListEntry = blockListEntry.substring(1);
-
-                            // Get the entry.
-                            String entry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-
-                            if (entry.contains("*")) {  // Process a third-party initial black list double entry.
-                                // Get the index of the wildcard.
-                                int wildcardIndex = entry.indexOf("*");
-
-                                // Split the entry into components.
-                                String firstEntry = entry.substring(0, wildcardIndex);
-                                String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                // Create an entry string array.
-                                String[] thirdPartyDoubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                                // Add the entry to the black list.
-                                thirdPartyInitialBlackList.add(thirdPartyDoubleEntry);
-
-                                //Log.i("BlockLists", headers.get(1)[0] + " third-party initial black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                            } else {  // Process a third-party initial black list single entry.
-                                // Create an entry string array.
-                                String[] singleEntry = {entry, originalBlockListEntry};
-
-                                // Add the entry to the black list.
-                                thirdPartyInitialBlackList.add(singleEntry);
-
-                                //Log.i("BlockLists", headers.get(1)[0] + " third-party initial black list added: " + entry + "  -  " + originalBlockListEntry);
-                            }
-                        } else if (blockListEntry.contains("\\")) {  // Process a regular expression black list entry.
-                            // Prepare a string to hold the entry.
-                            String entry;
-
-                            // Get the entry.
-                            if (blockListEntry.contains("$/$")) {  // The first `$` is part of the regular expression.
-                                entry = blockListEntry.substring(0, blockListEntry.indexOf("$/$") + 2);
-                            } else {  // The only `$` indicates the filter options.
-                                entry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-                            }
-
-                            // Create an entry string array.
-                            String[] singleEntry = {entry, originalBlockListEntry};
-
-                            // Add the entry to the black list.
-                            thirdPartyRegularExpressionBlackList.add(singleEntry);
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " third-party regular expression black list added: " + entry + "  -  " + originalBlockListEntry);
-                        } else if (blockListEntry.contains("*")) {  // Third-party and regular expression black list entries.
-                            // Get the entry.
-                            String entry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-
-                            if (entry.endsWith("*")) {  // Process a third-party black list single entry.
-                                // Strip the final `*`.
-                                entry = entry.substring(0, entry.length() - 1);
-
-                                // Create an entry string array.
-                                String[] singleEntry = {entry, originalBlockListEntry};
-
-                                // Add the entry to the black list.
-                                thirdPartyBlackList.add(singleEntry);
-
-                                //Log.i("BlockLists", headers.get(1)[0] + " third party black list added: " + entry + "  -  " + originalBlockListEntry);
-                            } else {  // There are two or more entries.
-                                // Get the index of the wildcard.
-                                int wildcardIndex = entry.indexOf("*");
-
-                                // Split the entry into components.
-                                String firstEntry = entry.substring(0, wildcardIndex);
-                                String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                if (secondEntry.contains("*")) {  // There are three or more entries.
-                                    // Get the index of the wildcard.
-                                    int secondWildcardIndex = secondEntry.indexOf("*");
-
-                                    // Split the entry into components.
-                                    String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
-                                    String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
-
-                                    if (thirdEntry.contains("*")) {  // Process a third-party black list quadruple entry.
-                                        // Get the index of the wildcard.
-                                        int thirdWildcardIndex = thirdEntry.indexOf("*");
-
-                                        // Split the entry into components.
-                                        String realThirdEntry = thirdEntry.substring(0, thirdWildcardIndex);
-                                        String fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1);
-
-                                        // Create an entry string array.
-                                        String[] quadrupleEntry = {firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlockListEntry};
-
-                                        // Add the entry to the black list.
-                                        thirdPartyBlackList.add(quadrupleEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " third-party black list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " +
-                                        //        fourthEntry + "  -  " + originalBlockListEntry);
-                                    } else {  // Process a third-party black list triple entry.
-                                        // Create an entry string array.
-                                        String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry};
-
-                                        // Add the entry to the black list.
-                                        thirdPartyBlackList.add(tripleEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " third-party black list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " +
-                                        //        originalBlockListEntry);
-                                    }
-                                } else {  // Process a third-party black list double entry.
-                                    // Create an entry string array.
-                                    String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                                    // Add the entry to the black list.
-                                    thirdPartyBlackList.add(doubleEntry);
-
-                                    //Log.i("BlockLists", headers.get(1)[0] + " third-party black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                                }
-                            }
-                        } else {  // Process a third party black list single entry.
-                            // Get the entry.
-                            String entry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-
-                            // Create an entry string array.
-                            String[] singleEntry = {entry, originalBlockListEntry};
-
-                            // Add the entry to the black list.
-                            thirdPartyBlackList.add(singleEntry);
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " third party black list added: " + entry + "  -  " + originalBlockListEntry);
-                        }
-                    } else if (blockListEntry.substring(blockListEntry.indexOf("$")).contains("domain=")) {  // Domain entries.
-                        if (blockListEntry.contains("~")) {  // Domain white list entries.
-                            // Separate the filters.
-                            String entry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-                            String filters = blockListEntry.substring(blockListEntry.indexOf("$") + 1);
-                            String domains = filters.substring(filters.indexOf("domain=") + 7);
-
-                            // Strip any final `*` from the entry.  They are redundant.
-                            if (entry.endsWith("*")) {
-                                entry = entry.substring(0, entry.length() - 1);
-                            }
-
-                            // Process each domain.
-                            do {
-                                // Create a string to keep track of the current domain.
-                                String domain;
-
-                                if (domains.contains("|")) {  // There is more than one domain in the list.
-                                    // Get the first domain from the list.
-                                    domain = domains.substring(0, domains.indexOf("|"));
-
-                                    // Remove the first domain from the list.
-                                    domains = domains.substring(domains.indexOf("|") + 1);
-                                } else {  // There is only one domain in the list.
-                                    domain = domains;
-                                }
-
-                                // Strip the initial `~`.
-                                domain = domain.substring(1);
-
-                                if (entry.contains("*")) {  // There are two or more entries.
-                                    // Get the index of the wildcard.
-                                    int wildcardIndex = entry.indexOf("*");
-
-                                    // Split the entry into components.
-                                    String firstEntry = entry.substring(0, wildcardIndex);
-                                    String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                    if (secondEntry.contains("*")) {  // Process a domain white list triple entry.
-                                        // Get the index of the wildcard.
-                                        int secondWildcardIndex = secondEntry.indexOf("*");
-
-                                        // Split the entry into components.
-                                        String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
-                                        String thirdEntry = secondEntry.substring((secondWildcardIndex + 1));
-
-                                        // Create an entry string array.
-                                        String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry};
-
-                                        // Add the entry to the white list.
-                                        domainWhiteList.add(domainTripleEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " domain white list added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry +
-                                        //        "  -  " + originalBlockListEntry);
-                                    } else {  // Process a domain white list double entry.
-                                        // Create an entry string array.
-                                        String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry};
-
-                                        // Add the entry to the white list.
-                                        domainWhiteList.add(domainDoubleEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " domain white list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                                    }
-                                } else {  // Process a domain white list single entry.
-                                    // Create an entry string array.
-                                    String[] domainEntry = {domain, entry, originalBlockListEntry};
-
-                                    // Add the entry to the white list.
-                                    domainWhiteList.add(domainEntry);
-
-                                    //Log.i("BlockLists", headers.get(1)[0] + " domain white list added: " + domain + " , " + entry + "  -  " + originalBlockListEntry);
-                                }
-                            } while (domains.contains("|"));
-                        } else {  // Domain black list entries.
-                            // Separate the filters.
-                            String entry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-                            String filters = blockListEntry.substring(blockListEntry.indexOf("$") + 1);
-                            String domains = filters.substring(filters.indexOf("domain=") + 7);
-
-                            // Only process the item if the entry is not null.  For example, some lines begin with `$websocket`, which create a null entry.
-                            if (!entry.equals("")) {
-                                // Process each domain.
-                                do {
-                                    // Create a string to keep track of the current domain.
-                                    String domain;
-
-                                    if (domains.contains("|")) {  // There is more than one domain in the list.
-                                        // Get the first domain from the list.
-                                        domain = domains.substring(0, domains.indexOf("|"));
-
-                                        // Remove the first domain from the list.
-                                        domains = domains.substring(domains.indexOf("|") + 1);
-                                    } else {  // There is only one domain in the list.
-                                        domain = domains;
-                                    }
-
-                                    if (entry.startsWith("|")) {  // Domain initial black list entries.
-                                        // Remove the initial `|`;
-                                        String entryBase = entry.substring(1);
-
-                                        //noinspection StatementWithEmptyBody
-                                        if (entryBase.equals("http://") || entryBase.equals("https://")) {
-                                            // Do nothing.  These entries will entirely block the website.
-                                            // Often the original entry blocks `$script` but Privacy Browser does not currently differentiate between scripts and other entries.
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " not added: " + originalBlockListEntry);
-                                        } else {  // Process a domain initial black list entry
-                                            // Create an entry string array.
-                                            String[] domainEntry = {domain, entryBase, originalBlockListEntry};
-
-                                            // Add the entry to the black list.
-                                            domainInitialBlackList.add(domainEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " domain initial black list added: " + domain + " , " + entryBase + "  -  " + originalBlockListEntry);
-                                        }
-                                    } else if (entry.endsWith("|")) {  // Domain final black list entries.
-                                        // Remove the final `|`.
-                                        String entryBase = entry.substring(0, entry.length() - 1);
-
-                                        if (entryBase.contains("*")) {  // Process a domain final black list double entry.
-                                            // Get the index of the wildcard.
-                                            int wildcardIndex = entry.indexOf("*");
-
-                                            // Split the entry into components.
-                                            String firstEntry = entryBase.substring(0, wildcardIndex);
-                                            String secondEntry = entryBase.substring(wildcardIndex + 1);
-
-                                            // Create an entry string array.
-                                            String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry};
-
-                                            // Add the entry to the black list.
-                                            domainFinalBlackList.add(domainDoubleEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " domain final black list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
-                                            //        originalBlockListEntry);
-                                        } else {  // Process a domain final black list single entry.
-                                            // Create an entry string array.
-                                            String[] domainEntry = {domain, entryBase, originalBlockListEntry};
-
-                                            // Add the entry to the black list.
-                                            domainFinalBlackList.add(domainEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " domain final black list added: " + domain + " , " + entryBase + "  -  " + originalBlockListEntry);
-                                        }
-                                    } else if (entry.contains("\\")) {  // Process a domain regular expression black list entry.
-                                        // Create an entry string array.
-                                        String[] domainEntry = {domain, entry, originalBlockListEntry};
-
-                                        // Add the entry to the black list.
-                                        domainRegularExpressionBlackList.add(domainEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " domain regular expression black list added: " + domain + " , " + entry + "  -  " + originalBlockListEntry);
-                                    } else if (entry.contains("*")) {  // There are two or more entries.
-                                        // Get the index of the wildcard.
-                                        int wildcardIndex = entry.indexOf("*");
-
-                                        // Split the entry into components.
-                                        String firstEntry = entry.substring(0, wildcardIndex);
-                                        String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                        if (secondEntry.contains("*")) {  // Process a domain black list triple entry.
-                                            // Get the index of the wildcard.
-                                            int secondWildcardIndex = secondEntry.indexOf("*");
-
-                                            // Split the entry into components.
-                                            String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
-                                            String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
-
-                                            // Create an entry string array.
-                                            String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry};
-
-                                            // Add the entry to the black list.
-                                            domainBlackList.add(domainTripleEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " domain black list added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry +
-                                            //        "  -  " + originalBlockListEntry);
-                                        } else {  // Process a domain black list double entry.
-                                            // Create an entry string array.
-                                            String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlockListEntry};
-
-                                            // Add the entry to the black list.
-                                            domainBlackList.add(domainDoubleEntry);
-
-                                            //Log.i("BlockLists", headers.get(1)[0] + " domain black list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
-                                            //        originalBlockListEntry);
-                                        }
-                                    } else {  // Process a domain black list single entry.
-                                        // Create an entry string array.
-                                        String[] domainEntry = {domain, entry, originalBlockListEntry};
-
-                                        // Add the entry to the black list.
-                                        domainBlackList.add(domainEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " domain black list added: " + domain + " , " + entry + "  -  " + originalBlockListEntry);
-                                    }
-                                } while (domains.contains("|"));
-                            }
-                        }
-                    } else if (blockListEntry.contains("~")) {  // White list entries.  Privacy Browser does not differentiate against these filter options, so they are just generally white listed.
-                        // Remove the filter options.
-                        blockListEntry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-
-                        // Strip any trailing `*`.
-                        if (blockListEntry.endsWith("*")) {
-                            blockListEntry = blockListEntry.substring(0, blockListEntry.length() - 1);
-                        }
-
-                        if (blockListEntry.contains("*")) {  // Process a white list double entry.
-                            // Get the index of the wildcard.
-                            int wildcardIndex = blockListEntry.indexOf("*");
-
-                            // Split the entry into components.
-                            String firstEntry = blockListEntry.substring(0, wildcardIndex);
-                            String secondEntry = blockListEntry.substring(wildcardIndex + 1);
-
-                            // Create an entry string array.
-                            String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                            // Add the entry to the white list.
-                            mainWhiteList.add(doubleEntry);
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " main white list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                        } else {  // Process a white list single entry.
-                            // Create an entry string array.
-                            String[] singleEntry = {blockListEntry, originalBlockListEntry};
-
-                            // Add the entry to the white list.
-                            mainWhiteList.add(singleEntry);
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " main white list added: " + blockListEntry + "  -  + " + originalBlockListEntry);
-                        }
-                    } else if (blockListEntry.contains("\\")) {  // Process a regular expression black list entry.
-                        // Remove the filter options.
-                        blockListEntry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-
-                        // Create an entry string array.
-                        String[] singleEntry = {blockListEntry, originalBlockListEntry};
-
-                        // Add the entry to the black list.
-                        regularExpressionBlackList.add(singleEntry);
-
-                        //Log.i("BlockLists", headers.get(1)[0] + " regular expression black list added: " + blockListEntry + "  -  " + originalBlockListEntry);
-                    } else {  // Black list entries.
-                        // Remove the filter options.
-                        if (!blockListEntry.contains("$file")) {  // EasyPrivacy contains an entry with `$file` that does not have filter options.
-                            blockListEntry = blockListEntry.substring(0, blockListEntry.indexOf("$"));
-                        }
-
-                        // Strip any trailing `*`.  These are redundant.
-                        if (blockListEntry.endsWith("*")) {
-                            blockListEntry = blockListEntry.substring(0, blockListEntry.length() - 1);
-                        }
-
-                        if (blockListEntry.startsWith("|")) {  // Initial black list entries.
-                            // Strip the initial `|`.
-                            String entry = blockListEntry.substring(1);
-
-                            if (entry.contains("*")) {  // Process an initial black list double entry.
-                                // Get the index of the wildcard.
-                                int wildcardIndex = entry.indexOf("*");
-
-                                // Split the entry into components.
-                                String firstEntry = entry.substring(0, wildcardIndex);
-                                String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                // Create an entry string array.
-                                String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                                // Add the entry to the black list.
-                                initialBlackList.add(doubleEntry);
-
-                                //Log.i("BlockLists", headers.get(1)[0] + " initial black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                            } else {  // Process an initial black list single entry.
-                                // Create an entry string array.
-                                String[] singleEntry = {entry, originalBlockListEntry};
-
-                                // Add the entry to the black list.
-                                initialBlackList.add(singleEntry);
-
-                                //Log.i("BlockLists", headers.get(1)[0] + " initial black list added: " + entry + "  -  " + originalBlockListEntry);
-                            }
-                        } else if (blockListEntry.endsWith("|")) {  // Final black list entries.
-                            // Ignore entries with `object` filters.  They can block entire websites and don't have any meaning in the context of Privacy Browser.
-                            if (!originalBlockListEntry.contains("$object")) {
-                                // Strip the final `|`.
-                                String entry = blockListEntry.substring(0, blockListEntry.length() - 1);
-
-                                if (entry.contains("*")) {  // There are two or more entries.
-                                    // Get the index of the wildcard.
-                                    int wildcardIndex = entry.indexOf("*");
-
-                                    // Split the entry into components.
-                                    String firstEntry = entry.substring(0, wildcardIndex);
-                                    String secondEntry = entry.substring(wildcardIndex + 1);
-
-                                    if (secondEntry.contains("*")) {  // Process a final black list triple entry.
-                                        // Get the index of the wildcard.
-                                        int secondWildcardIndex = secondEntry.indexOf("*");
-
-                                        // Split the entry into components.
-                                        String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
-                                        String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
-
-                                        // Create an entry string array.
-                                        String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry};
-
-                                        // Add the entry to the black list.
-                                        finalBlackList.add(tripleEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " final black list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " +
-                                        //        originalBlockListEntry);
-                                    } else {  // Process a final black list double entry.
-                                        // Create an entry string array.
-                                        String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                                        // Add the entry to the black list.
-                                        finalBlackList.add(doubleEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " final black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                                    }
-                                } else {  // Process a final black list single entry.
-                                    // Create an entry sting array.
-                                    String[] singleEntry = {entry, originalBlockListEntry};
-
-                                    // Add the entry to the black list.
-                                    finalBlackList.add(singleEntry);
-
-                                    //Log.i("BlockLists", headers.get(1)[0] + " final black list added: " + entry + "  -  " + originalBlockListEntry);
-                                }
-                            }
-                        } else if (blockListEntry.contains("*")) {  // There are two or more entries.
-                            // Get the index of the wildcard.
-                            int wildcardIndex = blockListEntry.indexOf("*");
-
-                            // Split the entry into components.
-                            String firstEntry = blockListEntry.substring(0, wildcardIndex);
-                            String secondEntry = blockListEntry.substring(wildcardIndex + 1);
-
-                            if (secondEntry.contains("*")) {  // Process a main black list triple entry.
-                                // Get the index of the wildcard.
-                                int secondWildcardIndex = secondEntry.indexOf("*");
-
-                                // Split the entry into components.
-                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
-                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
-
-                                // Create an entry string array.
-                                String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry};
-
-                                // Add the entry to the black list.
-                                mainBlackList.add(tripleEntry);
-
-                                //Log.i("BlockLists", headers.get(1)[0] + " main black list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " + originalBlockListEntry);
-                            } else {  // Process a main black list double entry.
-                                // Create an entry string array.
-                                String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                                // Add the entry to the black list.
-                                mainBlackList.add(doubleEntry);
-
-                                //Log.i("BlockLists", headers.get(1)[0] + " main black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                            }
-                        } else {  // Process a main black list single entry.
-                            // Create an entry string array.
-                            String[] singleEntry = {blockListEntry, originalBlockListEntry};
-
-                            // Add the entry to the black list.
-                            mainBlackList.add(singleEntry);
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " main black list added: " + blockListEntry + "  -  " + originalBlockListEntry);
-                        }
-                    }
-                } else {  // Main black list entries
-                    // Strip out any initial `||`.  These will be treated like any other entry.
-                    if (blockListEntry.startsWith("||")) {
-                        blockListEntry = blockListEntry.substring(2);
-                    }
-
-                    // Strip out any initial `*`.
-                    if (blockListEntry.startsWith("*")) {
-                        blockListEntry = blockListEntry.substring(1);
-                    }
-
-                    // Strip out any trailing `*`.
-                    if (blockListEntry.endsWith("*")) {
-                        blockListEntry = blockListEntry.substring(0, blockListEntry.length() - 1);
-                    }
-
-                    if (blockListEntry.startsWith("|")) {  // Initial black list entries.
-                        // Strip the initial `|`.
-                        String entry = blockListEntry.substring(1);
-
-                        if (entry.contains("*")) {  // Process an initial black list double entry.
-                            // Get the index of the wildcard.
-                            int wildcardIndex = entry.indexOf("*");
-
-                            // Split the entry into components.
-                            String firstEntry = entry.substring(0, wildcardIndex);
-                            String secondEntry = entry.substring(wildcardIndex + 1);
-
-                            // Create an entry string array.
-                            String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                            // Add the entry to the black list.
-                            initialBlackList.add(doubleEntry);
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " initial black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                        } else {  // Process an initial black list single entry.
-                            // Create an entry string array.
-                            String[] singleEntry = {entry, originalBlockListEntry};
-
-                            // Add the entry to the black list.
-                            initialBlackList.add(singleEntry);
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " initial black list added: " + entry + "  -  " + originalBlockListEntry);
-                        }
-                    } else if (blockListEntry.endsWith("|")) {  // Final black list entries.
-                        // Strip the final `|`.
-                        String entry = blockListEntry.substring(0, blockListEntry.length() - 1);
-
-                        if (entry.contains("*")) {  // There are two or more entries.
-                            // Get the index of the wildcard.
-                            int wildcardIndex = entry.indexOf("*");
-
-                            // Split the entry into components.
-                            String firstEntry = entry.substring(0, wildcardIndex);
-                            String secondEntry = entry.substring(wildcardIndex + 1);
-
-                            if (secondEntry.contains("*")) {  // Process a final black list triple entry.
-                                // Get the index of the wildcard.
-                                int secondWildcardIndex = secondEntry.indexOf("*");
-
-                                // Split the entry into components.
-                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
-                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
-
-                                // Create an entry string array.
-                                String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry};
-
-                                // Add the entry to the black list.
-                                finalBlackList.add(tripleEntry);
-
-                                //Log.i("BlockLists", headers.get(1)[0] + " final black list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " +
-                                //        originalBlockListEntry);
-                            } else {  // Process a final black list double entry.
-                                // Create an entry string array.
-                                String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                                // Add the entry to the black list.
-                                finalBlackList.add(doubleEntry);
-
-                                //Log.i("BlockLists", headers.get(1)[0] + " final black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                            }
-                        } else {  // Process a final black list single entry.
-                            // Create an entry string array.
-                            String[] singleEntry = {entry, originalBlockListEntry};
-
-                            // Add the entry to the black list.
-                            finalBlackList.add(singleEntry);
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " final black list added: " + entry + "  -  " + originalBlockListEntry);
-                        }
-                    } else {  // Main black list entries.
-                        if (blockListEntry.contains("*")) {  // There are two or more entries.
-                            // Get the index of the wildcard.
-                            int wildcardIndex = blockListEntry.indexOf("*");
-
-                            // Split the entry into components.
-                            String firstEntry = blockListEntry.substring(0, wildcardIndex);
-                            String secondEntry = blockListEntry.substring(wildcardIndex + 1);
-
-                            if (secondEntry.contains("*")) {  // There are three or more entries.
-                                // Get the index of the wildcard.
-                                int secondWildcardIndex = secondEntry.indexOf("*");
-
-                                // Split the entry into components.
-                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
-                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
-
-                                if (thirdEntry.contains("*")) {  // There are four or more entries.
-                                    // Get the index of the wildcard.
-                                    int thirdWildcardIndex = thirdEntry.indexOf("*");
-
-                                    // Split the entry into components.
-                                    String realThirdEntry = thirdEntry.substring(0, thirdWildcardIndex);
-                                    String fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1);
-
-                                    if (fourthEntry.contains("*")) {  // Process a main black list quintuple entry.
-                                        // Get the index of the wildcard.
-                                        int fourthWildcardIndex = fourthEntry.indexOf("*");
-
-                                        // Split the entry into components.
-                                        String realFourthEntry = fourthEntry.substring(0, fourthWildcardIndex);
-                                        String fifthEntry = fourthEntry.substring(fourthWildcardIndex + 1);
-
-                                        // Create an entry string array.
-                                        String[] quintupleEntry = {firstEntry, realSecondEntry, realThirdEntry, realFourthEntry, fifthEntry, originalBlockListEntry};
-
-                                        // Add the entry to the black list.
-                                        mainBlackList.add(quintupleEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " main black list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " +
-                                        //        realFourthEntry + " , " + fifthEntry + "  -  " + originalBlockListEntry);
-                                    } else {  // Process a main black list quadruple entry.
-                                        // Create an entry string array.
-                                        String[] quadrupleEntry = {firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlockListEntry};
-
-                                        // Add the entry to the black list.
-                                        mainBlackList.add(quadrupleEntry);
-
-                                        //Log.i("BlockLists", headers.get(1)[0] + " main black list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " +
-                                        //        fourthEntry + "  -  " + originalBlockListEntry);
-                                    }
-                                } else {  // Process a main black list triple entry.
-                                    // Create an entry string array.
-                                    String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlockListEntry};
-
-                                    // Add the entry to the black list.
-                                    mainBlackList.add(tripleEntry);
-
-                                    //Log.i("BlockLists", headers.get(1)[0] + " main black list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " + originalBlockListEntry);
-                                }
-                            } else {  // Process a main black list double entry.
-                                // Create an entry string array.
-                                String[] doubleEntry = {firstEntry, secondEntry, originalBlockListEntry};
-
-                                // Add the entry to the black list.
-                                mainBlackList.add(doubleEntry);
-
-                                //Log.i("BlockLists", headers.get(1)[0] + " main black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlockListEntry);
-                            }
-                        } else {  // Process a main black list single entry.
-                            // Create an entry string array.
-                            String[] singleEntry = {blockListEntry, originalBlockListEntry};
-
-                            // Add the entry to the black list.
-                            mainBlackList.add(singleEntry);
-
-                            //Log.i("BlockLists", headers.get(1)[0] + " main black list added: " + blockListEntry + "  -  " + originalBlockListEntry);
-                        }
-                    }
-                }
-            }
-            // Close `bufferedReader`.
-            bufferedReader.close();
-        } catch (IOException e) {
-            // The asset exists, so the `IOException` will never be thrown.
-        }
-
-        // Initialize the combined list.
-        ArrayList<List<String[]>> combinedLists = new ArrayList<>();
-
-        // Add the headers (0).
-        combinedLists.add(headers);  // 0.
-
-        // Add the white lists (1-8).
-        combinedLists.add(mainWhiteList);  // 1.
-        combinedLists.add(finalWhiteList);  // 2.
-        combinedLists.add(domainWhiteList);  // 3.
-        combinedLists.add(domainInitialWhiteList);  // 4.
-        combinedLists.add(domainFinalWhiteList); // 5.
-        combinedLists.add(thirdPartyWhiteList);  // 6.
-        combinedLists.add(thirdPartyDomainWhiteList);  // 7.
-        combinedLists.add(thirdPartyDomainInitialWhiteList);  // 8.
-
-        // Add the black lists (9-22).
-        combinedLists.add(mainBlackList);  // 9.
-        combinedLists.add(initialBlackList);  // 10.
-        combinedLists.add(finalBlackList);  // 11.
-        combinedLists.add(domainBlackList);  //  12.
-        combinedLists.add(domainInitialBlackList);  // 13.
-        combinedLists.add(domainFinalBlackList);  // 14.
-        combinedLists.add(domainRegularExpressionBlackList);  // 15.
-        combinedLists.add(thirdPartyBlackList);  // 16.
-        combinedLists.add(thirdPartyInitialBlackList);  // 17.
-        combinedLists.add(thirdPartyDomainBlackList);  // 18.
-        combinedLists.add(thirdPartyDomainInitialBlackList);  // 19.
-        combinedLists.add(thirdPartyRegularExpressionBlackList);  // 20.
-        combinedLists.add(thirdPartyDomainRegularExpressionBlackList);  // 21.
-        combinedLists.add(regularExpressionBlackList);  // 22.
-
-        return combinedLists;
-    }
-
-    public String[] checkBlocklist(String currentDomain, String resourceUrl, boolean isThirdPartyRequest, ArrayList<List<String[]>> blockList) {
-        // Get the blocklist name.
-        String BLOCK_LIST_NAME_STRING = blockList.get(0).get(1)[0];
-
-        // Assert that currentDomain != null only if this is a third party request.  Apparently, lint can't tell that this isn't redundant.
-        //noinspection RedundantIfStatement
-        if (isThirdPartyRequest) {
-            assert currentDomain != null;
-        }
-
-        // Process the white lists.
-        // Main white list.
-        for (String[] whiteListEntry : blockList.get(Integer.valueOf(MAIN_WHITELIST))) {
-            switch (whiteListEntry.length) {
-                case 2:  // There is one entry.
-                    if (resourceUrl.contains(whiteListEntry[0])) {
-                        // Return a whitelist match request allowed.
-                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_WHITELIST, whiteListEntry[0], whiteListEntry[1]};
-                    }
-                    break;
-
-                case 3:  // There are two entries.
-                    if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1])) {
-                        // Return a whitelist match request allowed.
-                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]};
-                    }
-                    break;
-
-                case 4:  // There are three entries.
-                    if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2])) {
-                        // Return a whitelist match request allowed.
-                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2], whiteListEntry[3]};
-                    }
-                    break;
-            }
-        }
-
-        // Final white list.
-        for (String[] whiteListEntry : blockList.get(Integer.valueOf(FINAL_WHITELIST))) {
-            if (whiteListEntry.length == 2) {  // There is one entry.
-                if (resourceUrl.contains(whiteListEntry[0])) {
-                    // Return a whitelist match request allowed.
-                    return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, FINAL_WHITELIST, whiteListEntry[0], whiteListEntry[1]};
-                }
-            } else {  // There are two entries.
-                if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1])) {
-                    // Return a whitelist match request allowed.
-                    return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, FINAL_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]};
-                }
-            }
-        }
-
-        // Only check the domain lists if the current domain is not null (like `about:blank`).
-        if (currentDomain != null) {
-            // Domain white list.
-            for (String[] whiteListEntry : blockList.get(Integer.valueOf(DOMAIN_WHITELIST))) {
-                switch (whiteListEntry.length) {
-                    case 3:  // There is one entry.
-                        if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]};
-                        }
-                        break;
-
-                    case 4:  // There are two entries.
-                        if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2],
-                                    whiteListEntry[3]};
-                        }
-                        break;
-
-                    case 5:  // There are three entries.
-                        if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2]) && resourceUrl.contains(whiteListEntry[3])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2] + "\n" +
-                                    whiteListEntry[3], whiteListEntry[4]};
-                        }
-                        break;
-
-                    case 6:  // There are four entries.
-                        if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2]) && resourceUrl.contains(whiteListEntry[3]) &&
-                                resourceUrl.contains(whiteListEntry[4])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2] + "\n" +
-                                    whiteListEntry[3] + "\n" + whiteListEntry[4], whiteListEntry[5]};
-                        }
-                        break;
-                }
-            }
-
-            // Domain initial white list.
-            for (String[] whiteListEntry : blockList.get(Integer.valueOf(DOMAIN_INITIAL_WHITELIST))) {
-                switch (whiteListEntry.length) {
-                    case 3:  // There is one entry.
-                        if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.startsWith(whiteListEntry[1])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_INITIAL_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]};
-                        }
-                        break;
-
-                    case 4:  // There are two entries.
-                        if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.startsWith(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_INITIAL_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2],
-                                    whiteListEntry[3]};
-                        }
-                        break;
-
-                    case 5:  // There are three entries.
-                        if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.startsWith(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2]) && resourceUrl.startsWith(whiteListEntry[3])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_INITIAL_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2] + "\n" +
-                                    whiteListEntry[3], whiteListEntry[4]};
-                        }
-                        break;
-                }
-            }
-
-            // Domain final white list.
-            for (String[] whiteListEntry : blockList.get(Integer.valueOf(DOMAIN_FINAL_WHITELIST))) {
-                switch (whiteListEntry.length) {
-                    case 3:  // There is one entry;
-                        if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.endsWith(whiteListEntry[1])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_FINAL_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]};
-                        }
-                        break;
-
-                    case 4:  // There are two entries;
-                        if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.endsWith(whiteListEntry[2])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_FINAL_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2],
-                                    whiteListEntry[3]};
-                        }
-                        break;
-                }
-            }
-        }
-
-        // Only check the third-party white lists if this is a third-party request.
-        if (isThirdPartyRequest) {
-            // Third-party white list.
-            for (String[] whiteListEntry : blockList.get(Integer.valueOf(THIRD_PARTY_WHITELIST))) {
-                switch (whiteListEntry.length) {
-                    case 2:  // There is one entry
-                        if (resourceUrl.contains(whiteListEntry[0])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_WHITELIST, whiteListEntry[0], whiteListEntry[1]};
-                        }
-                        break;
-
-                    case 3:  // There are two entries.
-                        if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]};
-                        }
-                        break;
-
-                    case 4:  // There are three entries.
-                        if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2],
-                                    whiteListEntry[3]};
-                        }
-                        break;
-
-                    case 5:  // There are four entries.
-                        if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2]) && resourceUrl.contains(whiteListEntry[3])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2] + "\n" +
-                                    whiteListEntry[3], whiteListEntry[4]};
-                        }
-                        break;
-
-                    case 6:  // There are five entries.
-                        if (resourceUrl.contains(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2]) && resourceUrl.contains(whiteListEntry[3]) &&
-                                resourceUrl.contains(whiteListEntry[4])) {
-                            // Return a whitelist match request allowed.
-                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2] + "\n" +
-                                    whiteListEntry[3] + "\n" + whiteListEntry[4], whiteListEntry[5]};
-                        }
-                        break;
-                }
-            }
-
-            // Third-party domain white list.
-            for (String[] whiteListEntry : blockList.get(Integer.valueOf(THIRD_PARTY_DOMAIN_WHITELIST))) {
-                if (whiteListEntry.length == 3) {  // There is one entry.
-                    if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1])) {
-                        // Return a whitelist match request allowed.
-                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]};
-                    }
-                } else {  // There are two entries.
-                    if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.contains(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2])) {
-                        // Return a whitelist match request allowed.
-                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2],
-                                whiteListEntry[3]};
-                    }
-                }
-            }
-
-            // Third-party domain initial white list.
-            for (String[] whiteListEntry : blockList.get(Integer.valueOf(THIRD_PARTY_DOMAIN_INITIAL_WHITELIST))) {
-                if (whiteListEntry.length == 3) {  // There is one entry.
-                    if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.startsWith(whiteListEntry[1])) {
-                        // Return a whitelist match request allowed.
-                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_INITIAL_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1], whiteListEntry[2]};
-                    }
-                } else {  // There are two entries.
-                    if (currentDomain.endsWith(whiteListEntry[0]) && resourceUrl.startsWith(whiteListEntry[1]) && resourceUrl.contains(whiteListEntry[2])) {
-                        // Return a whitelist match request allowed.
-                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_WHITELIST, whiteListEntry[0] + "\n" + whiteListEntry[1] + "\n" + whiteListEntry[2],
-                                whiteListEntry[3]};
-                    }
-                }
-            }
-        }
-
-        // Process the black lists.
-        // Main black list.
-        for (String[] blackListEntry : blockList.get(Integer.valueOf(MAIN_BLACKLIST))) {
-            switch (blackListEntry.length) {
-                case 2:  // There is one entry.
-                    if (resourceUrl.contains(blackListEntry[0])) {
-                        // Return a blacklist match request blocked.
-                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_BLACKLIST, blackListEntry[0], blackListEntry[1]};
-                    }
-                    break;
-
-                case 3:  // There are two entries.
-                    if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1])) {
-                        // Return a blacklist match request blocked.
-                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]};
-                    }
-                    break;
-
-                case 4:  // There are three entries.
-                    if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2])) {
-                        // Return a blacklist match request blocked.
-                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2], blackListEntry[3]};
-                    }
-                    break;
-
-                case 5:  // There are four entries.
-                    if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2]) && resourceUrl.contains(blackListEntry[3])) {
-                        // Return a blacklist match request blocked.
-                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2] + "\n" +
-                                blackListEntry[3], blackListEntry[4]};
-                    }
-                    break;
-
-                case 6:  // There are five entries.
-                    if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2]) && resourceUrl.contains(blackListEntry[3]) &&
-                            resourceUrl.contains(blackListEntry[4])) {
-                        // Return a blacklist match request blocked.
-                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2] + "\n" +
-                                blackListEntry[3] + "\n" + blackListEntry[4], blackListEntry[5]};
-                    }
-                    break;
-            }
-        }
-
-        // Initial black list.
-        for (String[] blackListEntry : blockList.get(Integer.valueOf(INITIAL_BLACKLIST))) {
-            if (blackListEntry.length == 2) {  // There is one entry.
-                if (resourceUrl.startsWith(blackListEntry[0])) {
-                    // Return a blacklist match request blocked.
-                    return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, INITIAL_BLACKLIST, blackListEntry[0], blackListEntry[1]};
-                }
-            } else {  // There are two entries
-                if (resourceUrl.startsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1])) {
-                    // Return a blacklist match request blocked.
-                    return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, INITIAL_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]};
-                }
-            }
-        }
-
-        // Final black list.
-        for (String[] blackListEntry : blockList.get(Integer.valueOf(FINAL_BLACKLIST))) {
-            switch (blackListEntry.length) {
-                case 2:  // There is one entry.
-                    if (resourceUrl.endsWith(blackListEntry[0])) {
-                        // Return a blacklist match request blocked.
-                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, FINAL_BLACKLIST, blackListEntry[0], blackListEntry[1]};
-                    }
-                    break;
-
-                case 3:  // There are two entries.
-                    if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.endsWith(blackListEntry[1])) {
-                        // Return a blacklist match request blocked.
-                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, FINAL_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]};
-                    }
-                    break;
-
-                case 4:  // There are three entries.
-                    if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.endsWith(blackListEntry[2])) {
-                        // Return a blacklist match request blocked.
-                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, FINAL_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2], blackListEntry[3]};
-                    }
-                    break;
-            }
-        }
-
-        // Only check the domain lists if the current domain is not null (like `about:blank`).
-        if (currentDomain != null) {
-            // Domain black list.
-            for (String[] blackListEntry : blockList.get(Integer.valueOf(DOMAIN_BLACKLIST))) {
-                switch (blackListEntry.length) {
-                    case 3:  // There is one entry.
-                        if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1])) {
-                            // Return a blacklist match request blocked.
-                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]};
-                        }
-                        break;
-
-                    case 4:  // There are two entries.
-                        if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2])) {
-                            // Return a blacklist match request blocked.
-                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2],
-                                    blackListEntry[3]};
-                        }
-                        break;
-
-                    case 5:  // There are three entries.
-                        if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2]) && resourceUrl.contains(blackListEntry[3])) {
-                            // Return a blacklist match request blocked.
-                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2] + "\n" +
-                                    blackListEntry[3], blackListEntry[4]};
-                        }
-                        break;
-                }
-            }
-
-            // Domain initial black list.
-            for (String[] blackListEntry : blockList.get(Integer.valueOf(DOMAIN_INITIAL_BLACKLIST))) {
-                // Store the entry in the resource request log.
-                if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.startsWith(blackListEntry[1])) {
-                    // Return a blacklist match request blocked.
-                    return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_INITIAL_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]};
-                }
-            }
-
-            // Domain final black list.
-            for (String[] blackListEntry : blockList.get(Integer.valueOf(DOMAIN_FINAL_BLACKLIST))) {
-                switch (blackListEntry.length) {
-                    case 3:  // There is one entry.
-                        if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.endsWith(blackListEntry[1])) {
-                            // Return a blacklist match request blocked.
-                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_FINAL_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]};
-                        }
-                        break;
-
-                    case 4:  // There are two entries.
-                        if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.endsWith(blackListEntry[2])) {
-                            // Return a blacklist match request blocked.
-                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_FINAL_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2],
-                                    blackListEntry[3]};
-                        }
-                        break;
-                }
-            }
-
-            // Domain regular expression black list.
-            for (String[] blackListEntry : blockList.get(Integer.valueOf(DOMAIN_REGULAR_EXPRESSION_BLACKLIST))) {
-                if (currentDomain.endsWith(blackListEntry[0]) && Pattern.matches(blackListEntry[1], resourceUrl)) {
-                    // Return a blacklist match request blocked.
-                    return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_REGULAR_EXPRESSION_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]};
-                }
-            }
-        }
-
-        // Only check the third-party black lists if this is a third-party request.
-        if (isThirdPartyRequest) {
-            // Third-party black list.
-            for (String[] blackListEntry : blockList.get(Integer.valueOf(THIRD_PARTY_BLACKLIST))) {
-                switch (blackListEntry.length) {
-                    case 2:  // There is one entry.
-                        if (resourceUrl.contains(blackListEntry[0])) {
-                            // Return a blacklist match request blocked.
-                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_BLACKLIST, blackListEntry[0], blackListEntry[1]};
-                        }
-                        break;
-
-                    case 3:  // There are two entries.
-                        if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1])) {
-                            // Return a blacklist match request blocked.
-                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]};
-                        }
-                        break;
-
-                    case 4:  // There are three entries.
-                        if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2])) {
-                            // Return a blacklist match request blocked.
-                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2],
-                                    blackListEntry[3]};
-                        }
-                        break;
-
-                    case 5:  // There are four entries.
-                        if (resourceUrl.contains(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2]) && resourceUrl.contains(blackListEntry[3])) {
-                            // Return a blacklist match request blocked.
-                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2] + "\n" +
-                                    blackListEntry[3], blackListEntry[4]};
-                        }
-                        break;
-                }
-            }
-
-            // Third-party initial black list.
-            for (String[] blackListEntry : blockList.get(Integer.valueOf(THIRD_PARTY_INITIAL_BLACKLIST))) {
-                if (blackListEntry.length == 2) {  // There is one entry.
-                    if (resourceUrl.startsWith(blackListEntry[0])) {
-                        // Return a blacklist match request blocked.
-                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_INITIAL_BLACKLIST, blackListEntry[0], blackListEntry[1]};
-                    }
-                } else {  // There are two entries.
-                    if (resourceUrl.startsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1])) {
-                        // Return a blacklist match request blocked.
-                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_INITIAL_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]};
-                    }
-                }
-            }
-
-            // Third-party domain black list.
-            for (String[] blackListEntry : blockList.get(Integer.valueOf(THIRD_PARTY_DOMAIN_BLACKLIST))) {
-                if (blackListEntry.length == 3) {  // There is one entry.
-                    if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1])) {
-                        // Return a blacklist match request blocked.
-                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]};
-                    }
-                } else { // There are two entries.
-                    if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.contains(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2])) {
-                        // Return a blacklist match request blocked.
-                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1] + "\n" + blackListEntry[2],
-                                blackListEntry[3]};
-                    }
-                }
-            }
-
-            // Third-party domain initial black list.
-            for (String[] blackListEntry : blockList.get(Integer.valueOf(THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST))) {
-                switch (blackListEntry.length) {
-                    case 3:  // There is one entry.
-                        if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.startsWith(blackListEntry[1])) {
-                            // Return a blacklist match request blocked.
-                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]};
-                        }
-                        break;
-
-                    case 4:  // There are two entries.
-                        if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.startsWith(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2])) {
-                            // Return a blacklist match request blocked.
-                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1] + "\n" +
-                                    blackListEntry[2], blackListEntry[3]};
-                        }
-                        break;
-
-                    case 5:  // There are three entries.
-                        if (currentDomain.endsWith(blackListEntry[0]) && resourceUrl.startsWith(blackListEntry[1]) && resourceUrl.contains(blackListEntry[2]) && resourceUrl.contains(blackListEntry[3])) {
-                            // Return a blacklist match request blocked.
-                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1] + "\n" +
-                                    blackListEntry[2] + "\n" + blackListEntry[3], blackListEntry[4]};
-                        }
-                        break;
-                }
-            }
-
-            // Third-party regular expression black list.
-            for (String[] blackListEntry : blockList.get(Integer.valueOf(THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST))) {
-                if (Pattern.matches(blackListEntry[0], resourceUrl)) {
-                    // Return a blacklist match request blocked.
-                    return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST, blackListEntry[0], blackListEntry[1]};
-                }
-            }
-
-            // Third-party domain regular expression black list.
-            for (String[] blackListEntry : blockList.get(Integer.valueOf(THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST))) {
-                if (currentDomain.endsWith(blackListEntry[0]) && Pattern.matches(blackListEntry[1], resourceUrl)) {
-                    // Return a blacklist match request blocked.
-                    return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST, blackListEntry[0] + "\n" + blackListEntry[1], blackListEntry[2]};
-                }
-            }
-        }
-
-        // Regular expression black list.
-        for (String[] blackListEntry : blockList.get(Integer.valueOf(REGULAR_EXPRESSION_BLACKLIST))) {
-            if (Pattern.matches(blackListEntry[0], resourceUrl)) {
-                // Return a blacklist match request blocked.
-                return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, REGULAR_EXPRESSION_BLACKLIST, blackListEntry[0], blackListEntry[1]};
-            }
-        }
-
-        // Return a no match request default.
-        return new String[] {REQUEST_DEFAULT};
-    }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/BlocklistHelper.java b/app/src/main/java/com/stoutner/privacybrowser/helpers/BlocklistHelper.java
new file mode 100644 (file)
index 0000000..913cc0b
--- /dev/null
@@ -0,0 +1,2121 @@
+/*
+ * Copyright © 2018-2019 Soren Stoutner <soren@stoutner.com>.
+ *
+ * This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+ *
+ * Privacy Browser is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Privacy Browser is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.stoutner.privacybrowser.helpers;
+
+import android.content.res.AssetManager;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+public class BlocklistHelper {
+    // Describe the schema of the string array in each entry of the resource requests array list.
+    public final static int REQUEST_DISPOSITION = 0;
+    public final static int REQUEST_URL = 1;
+    public final static int REQUEST_BLOCKLIST = 2;
+    public final static int REQUEST_SUBLIST = 3;
+    public final static int REQUEST_BLOCKLIST_ENTRIES = 4;
+    public final static int REQUEST_BLOCKLIST_ORIGINAL_ENTRY = 5;
+
+    // The request disposition options.
+    public final static String REQUEST_DEFAULT = "0";
+    public final static String REQUEST_ALLOWED = "1";
+    public final static String REQUEST_THIRD_PARTY = "2";
+    public final static String REQUEST_BLOCKED = "3";
+
+    // The whitelists.
+    public final static String MAIN_WHITELIST = "1";
+    public final static String FINAL_WHITELIST = "2";
+    public final static String DOMAIN_WHITELIST = "3";
+    public final static String DOMAIN_INITIAL_WHITELIST = "4";
+    public final static String DOMAIN_FINAL_WHITELIST = "5";
+    public final static String THIRD_PARTY_WHITELIST = "6";
+    public final static String THIRD_PARTY_DOMAIN_WHITELIST = "7";
+    public final static String THIRD_PARTY_DOMAIN_INITIAL_WHITELIST = "8";
+
+    // The blacklists.
+    public final static String MAIN_BLACKLIST = "9";
+    public final static String INITIAL_BLACKLIST = "10";
+    public final static String FINAL_BLACKLIST = "11";
+    public final static String DOMAIN_BLACKLIST = "12";
+    public final static String DOMAIN_INITIAL_BLACKLIST = "13";
+    public final static String DOMAIN_FINAL_BLACKLIST = "14";
+    public final static String DOMAIN_REGULAR_EXPRESSION_BLACKLIST = "15";
+    public final static String THIRD_PARTY_BLACKLIST = "16";
+    public final static String THIRD_PARTY_INITIAL_BLACKLIST = "17";
+    public final static String THIRD_PARTY_DOMAIN_BLACKLIST = "18";
+    public final static String THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST = "19";
+    public final static String THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST = "20";
+    public final static String THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST = "21";
+    public final static String REGULAR_EXPRESSION_BLACKLIST = "22";
+
+    public ArrayList<List<String[]>> parseBlocklist(AssetManager assets, String blocklistName) {
+        // Initialize the header list.
+        List<String[]> headers = new ArrayList<>();  // 0.
+
+        // Initialize the whitelists.
+        List<String[]> mainWhitelist = new ArrayList<>();  // 1.
+        List<String[]> finalWhitelist = new ArrayList<>();  // 2.
+        List<String[]> domainWhitelist = new ArrayList<>();  // 3.
+        List<String[]> domainInitialWhitelist = new ArrayList<>();  // 4.
+        List<String[]> domainFinalWhitelist = new ArrayList<>();  // 5.
+        List<String[]> thirdPartyWhitelist = new ArrayList<>();  // 6.
+        List<String[]> thirdPartyDomainWhitelist = new ArrayList<>();  // 7.
+        List<String[]> thirdPartyDomainInitialWhitelist = new ArrayList<>();  // 8.
+
+        // Initialize the blacklists
+        List<String[]> mainBlacklist = new ArrayList<>();  // 9.
+        List<String[]> initialBlacklist = new ArrayList<>();  // 10.
+        List<String[]> finalBlacklist = new ArrayList<>();  // 11.
+        List<String[]> domainBlacklist = new ArrayList<>();  // 12.
+        List<String[]> domainInitialBlacklist = new ArrayList<>();  // 13.
+        List<String[]> domainFinalBlacklist = new ArrayList<>();  // 14.
+        List<String[]> domainRegularExpressionBlacklist = new ArrayList<>();  // 15.
+        List<String[]> thirdPartyBlacklist = new ArrayList<>();  // 16.
+        List<String[]> thirdPartyInitialBlacklist = new ArrayList<>();  // 17.
+        List<String[]> thirdPartyDomainBlacklist = new ArrayList<>();  // 18.
+        List<String[]> thirdPartyDomainInitialBlacklist = new ArrayList<>();  // 19.
+        List<String[]> regularExpressionBlacklist = new ArrayList<>();  // 20.
+        List<String[]> thirdPartyRegularExpressionBlacklist = new ArrayList<>();  // 21.
+        List<String[]> thirdPartyDomainRegularExpressionBlacklist = new ArrayList<>();  // 22.
+
+
+        // Populate the block lists.  The `try` is required by `InputStreamReader`.
+        try {
+            // Load the block list into a `BufferedReader`.
+            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(assets.open(blocklistName)));
+
+            // Create a string for storing the block list entries.
+            String blocklistEntry;
+
+            // Parse the block list.
+            while ((blocklistEntry = bufferedReader.readLine()) != null) {
+                // Store the original block list entry.
+                String originalBlocklistEntry = blocklistEntry;
+
+                // Remove any `^` from the block list entry.  Privacy Browser does not process them in the interest of efficiency.
+                blocklistEntry = blocklistEntry.replace("^", "");
+
+                //noinspection StatementWithEmptyBody
+                if (blocklistEntry.contains("##") || blocklistEntry.contains("#?#") || blocklistEntry.contains("#@#") || blocklistEntry.startsWith("[")) {
+                    // Entries that contain `##`, `#?#`, and `#@#` are for hiding elements in the main page's HTML.  Entries that start with `[` describe the AdBlock compatibility level.
+                    // Do nothing.  Privacy Browser does not currently use these entries.
+
+                    //Log.i("Blocklists", "Not added: " + blocklistEntry);
+                } else //noinspection StatementWithEmptyBody
+                    if (blocklistEntry.contains("$csp=script-src")) {  // Ignore entries that contain `$csp=script-src`.
+                        // Do nothing.  It is uncertain what this directive is even supposed to mean, and it is blocking entire websites like androidcentral.com.  https://redmine.stoutner.com/issues/306.
+
+                        //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry);
+                } else //noinspection StatementWithEmptyBody
+                    if (blocklistEntry.contains("$websocket") || blocklistEntry.contains("$third-party,websocket") || blocklistEntry.contains("$script,websocket")) {  // Ignore entries with `websocket`.
+                        // Do nothing.  Privacy Browser does not differentiate between websocket requests and other requests and these entries cause a lot of false positives.
+
+                        //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry);
+                } else if (blocklistEntry.startsWith("!")) {  //  Comment entries.
+                    if (blocklistEntry.startsWith("! Version:")) {
+                        // Get the list version number.
+                        String[] listVersion = {blocklistEntry.substring(11)};
+
+                        // Store the list version in the headers list.
+                        headers.add(listVersion);
+                    }
+
+                    if (blocklistEntry.startsWith("! Title:")) {
+                        // Get the list title.
+                        String[] listTitle = {blocklistEntry.substring(9)};
+
+                        // Store the list title in the headers list.
+                        headers.add(listTitle);
+                    }
+
+                    //Log.i("Blocklists", "Not added: " + blocklistEntry);
+                } else if (blocklistEntry.startsWith("@@")) {  // Entries that begin with `@@` are whitelists.
+                    // Remove the `@@`
+                    blocklistEntry = blocklistEntry.substring(2);
+
+                    // Strip out any initial `||`.  Privacy Browser doesn't differentiate items that only match against the end of the domain name.
+                    if (blocklistEntry.startsWith("||")) {
+                        blocklistEntry = blocklistEntry.substring(2);
+                    }
+
+                    if (blocklistEntry.contains("$")) {  // Filter entries.
+                        //noinspection StatementWithEmptyBody
+                        if (blocklistEntry.contains("~third-party")) {  // Ignore entries that contain `~third-party`.
+                            // Do nothing.
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry);
+                        } else if (blocklistEntry.contains("third-party")) {  // Third-party white list entries.
+                            if (blocklistEntry.contains("domain=")) {  // Third-party domain white list entries.
+                                // Parse the entry.
+                                String entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+                                String filters = blocklistEntry.substring(blocklistEntry.indexOf("$") + 1);
+                                String domains = filters.substring(filters.indexOf("domain=") + 7);
+
+                                //noinspection StatementWithEmptyBody
+                                if (domains.contains("~")) {  // It is uncertain what a `~` domain means inside an `@@` entry.
+                                    // Do Nothing
+
+                                    //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry);
+                                } else if (blocklistEntry.startsWith("|")) {  // Third-party domain initial white list entries.
+                                    // Strip out the initial `|`.
+                                    entry = entry.substring(1);
+
+                                    //noinspection StatementWithEmptyBody
+                                    if (entry.equals("http://") || entry.equals("https://")) {  // Ignore generic entries.
+                                        // Do nothing.  These entries are designed for filter options that Privacy Browser does not use.
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry);
+                                    } else {  // Process third-party domain initial white list entries.
+                                        // Process each domain.
+                                        do {
+                                            // Create a string to keep track of the current domain.
+                                            String domain;
+
+                                            if (domains.contains("|")) {  // There is more than one domain in the list.
+                                                // Get the first domain from the list.
+                                                domain = domains.substring(0, domains.indexOf("|"));
+
+                                                // Remove the first domain from the list.
+                                                domains = domains.substring(domains.indexOf("|") + 1);
+                                            } else {  // There is only one domain in the list.
+                                                domain = domains;
+                                            }
+
+                                            if (entry.contains("*")) {  // Process a third-party domain initial white list double entry.
+                                                // Get the index of the wildcard.
+                                                int wildcardIndex = entry.indexOf("*");
+
+                                                // Split the entry into components.
+                                                String firstEntry = entry.substring(0, wildcardIndex);
+                                                String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                                // Create an entry string array.
+                                                String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlocklistEntry};
+
+                                                // Add the entry to the white list.
+                                                thirdPartyDomainInitialWhitelist.add(domainDoubleEntry);
+
+                                                //Log.i("Blocklists", headers.get(1)[0] + " third-party domain initial white list added: " + domain + " , " + firstEntry + " , " + secondEntry +
+                                                //        "  -  " + originalBlocklistEntry);
+                                            } else {  // Process a third-party domain initial white list single entry.
+                                                // Create a domain entry string array.
+                                                String[] domainEntry = {domain, entry, originalBlocklistEntry};
+
+                                                // Add the entry to the third party domain initial white list.
+                                                thirdPartyDomainInitialWhitelist.add(domainEntry);
+
+                                                //Log.i("Blocklists", headers.get(1)[0] + " third-party domain initial white list added: " + domain + " , " + entry + "  -  " + originalBlocklistEntry);
+                                            }
+                                        } while (domains.contains("|"));
+                                    }
+                                } else {  // Third-party domain entries.
+                                    // Process each domain.
+                                    do {
+                                        // Create a string to keep track of the current domain.
+                                        String domain;
+
+                                        if (domains.contains("|")) {  // three is more than one domain in the list.
+                                            // Get the first domain from the list.
+                                            domain = domains.substring(0, domains.indexOf("|"));
+
+                                            // Remove the first domain from the list.
+                                            domains = domains.substring(domains.indexOf("|") + 1);
+                                        } else {  // There is only one domain in the list.
+                                            domain = domains;
+                                        }
+
+                                        // Remove any trailing `*` from the entry.
+                                        if (entry.endsWith("*")) {
+                                            entry = entry.substring(0, entry.length() - 1);
+                                        }
+
+                                        if (entry.contains("*")) {  // Process a third-party domain double entry.
+                                            // Get the index of the wildcard.
+                                            int wildcardIndex = entry.indexOf("*");
+
+                                            // Split the entry into components.
+                                            String firstEntry = entry.substring(0, wildcardIndex);
+                                            String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                            // Create an entry string array.
+                                            String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlocklistEntry};
+
+                                            // Add the entry to the white list.
+                                            thirdPartyDomainWhitelist.add(domainDoubleEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " third-party domain white list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
+                                            //        originalBlocklistEntry);
+                                        } else {  // Process a third-party domain single entry.
+                                            // Create an entry string array.
+                                            String[] domainEntry = {domain, entry, originalBlocklistEntry};
+
+                                            // Add the entry to the white list.
+                                            thirdPartyDomainWhitelist.add(domainEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " third-party domain white list added: " + domain + " , " + entry + "  -  " + originalBlocklistEntry);
+                                        }
+                                    } while (domains.contains("|"));
+                                }
+                            } else {  // Process third-party white list entries.
+                                // Parse the entry
+                                String entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+
+                                if (entry.contains("*")) {  // There are two or more entries.
+                                    // Get the index of the wildcard.
+                                    int wildcardIndex = entry.indexOf("*");
+
+                                    // Split the entry into components.
+                                    String firstEntry = entry.substring(0, wildcardIndex);
+                                    String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                    if (secondEntry.contains("*")) {  // There are three or more entries.
+                                        // Get the index of the wildcard.
+                                        int secondWildcardIndex = secondEntry.indexOf("*");
+
+                                        // Split the entry into components.
+                                        String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
+                                        String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
+
+                                        if (thirdEntry.contains("*")) {  // There are four or more entries.
+                                            // Get the index of the wildcard.
+                                            int thirdWildcardIndex = thirdEntry.indexOf("*");
+
+                                            // Split the entry into components.
+                                            String realThirdEntry = thirdEntry.substring(0, thirdWildcardIndex);
+                                            String fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1);
+
+                                            if (fourthEntry.contains("*")) {  // Process a third-party white list quintuple entry.
+                                                // Get the index of the wildcard.
+                                                int fourthWildcardIndex = fourthEntry.indexOf("*");
+
+                                                // Split the entry into components.
+                                                String realFourthEntry = fourthEntry.substring(0, fourthWildcardIndex);
+                                                String fifthEntry = fourthEntry.substring(fourthWildcardIndex + 1);
+
+                                                // Create an entry string array.
+                                                String[] quintupleEntry = {firstEntry, realSecondEntry, realThirdEntry, realFourthEntry, fifthEntry, originalBlocklistEntry};
+
+                                                // Add the entry to the white list.
+                                                thirdPartyWhitelist.add(quintupleEntry);
+
+                                                //Log.i("Blocklists", headers.get(1)[0] + " third-party white list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " +
+                                                //        realFourthEntry + " , " + fifthEntry + "  -  " + originalBlocklistEntry);
+                                            } else {  // Process a third-party white list quadruple entry.
+                                                // Create an entry string array.
+                                                String[] quadrupleEntry = {firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlocklistEntry};
+
+                                                // Add the entry to the white list.
+                                                thirdPartyWhitelist.add(quadrupleEntry);
+
+                                                //Log.i("Blocklists", headers.get(1)[0] + " third-party white list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " +
+                                                //        fourthEntry + "  -  " + originalBlocklistEntry);
+                                            }
+                                        } else {  // Process a third-party white list triple entry.
+                                            // Create an entry string array.
+                                            String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry};
+
+                                            // Add the entry to the white list.
+                                            thirdPartyWhitelist.add(tripleEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " third-party white list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " +
+                                            //        originalBlocklistEntry);
+                                        }
+                                    } else {  // Process a third-party white list double entry.
+                                        // Create an entry string array.
+                                        String[] doubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                                        // Add the entry to the white list.
+                                        thirdPartyWhitelist.add(doubleEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " third-party white list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                                    }
+                                } else {  // Process a third-party white list single entry.
+                                    // Create an entry string array.
+                                    String[] singleEntry = {entry, originalBlocklistEntry};
+
+                                    // Add the entry to the white list.
+                                    thirdPartyWhitelist.add(singleEntry);
+
+                                    //Log.i("Blocklists", headers.get(1)[0] + " third-party domain white list added: " + entry + "  -  " + originalBlocklistEntry);
+                                }
+                            }
+                        } else if (blocklistEntry.contains("domain=")) {  // Process domain white list entries.
+                            // Parse the entry
+                            String entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+                            String filters = blocklistEntry.substring(blocklistEntry.indexOf("$") + 1);
+                            String domains = filters.substring(filters.indexOf("domain=") + 7);
+
+                            if (entry.startsWith("|")) {  // Initial domain white list entries.
+                                // Strip the initial `|`.
+                                entry = entry.substring(1);
+
+                                //noinspection StatementWithEmptyBody
+                                if (entry.equals("http://") || entry.equals("https://")) {  // Ignore generic entries.
+                                    // Do nothing.  These entries are designed for filter options that Privacy Browser does not use.
+
+                                    //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry);
+                                } else {  // Initial domain white list entry.
+                                    // Process each domain.
+                                    do {
+                                        // Create a string to keep track of the current domain.
+                                        String domain;
+
+                                        if (domains.contains("|")) {  // There is more than one domain in the list.
+                                            // Get the first domain from the list.
+                                            domain = domains.substring(0, domains.indexOf("|"));
+
+                                            // Remove the first domain from the list.
+                                            domains = domains.substring(domains.indexOf("|") + 1);
+                                        } else {  // There is only one domain in the list.
+                                            domain = domains;
+                                        }
+
+                                        if (entry.contains("*")) {  // There are two or more entries.
+                                            // Get the index of the wildcard.
+                                            int wildcardIndex = entry.indexOf("*");
+
+                                            // Split the entry into components.
+                                            String firstEntry = entry.substring(0, wildcardIndex);
+                                            String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                            if (secondEntry.contains("*")) {  // Process a domain initial triple entry.
+                                                // Get the index of the wildcard.
+                                                int secondWildcardIndex = secondEntry.indexOf("*");
+
+                                                // Split the entry into components.
+                                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
+                                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
+
+                                                // Create an entry string array.
+                                                String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry};
+
+                                                // Add the entry to the white list.
+                                                domainInitialWhitelist.add(domainTripleEntry);
+
+                                                //Log.i("Blocklists", headers.get(1)[0] + " domain initial white list entry added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " +
+                                                //        thirdEntry + "  -  " + originalBlocklistEntry);
+                                            } else {  // Process a domain initial double entry.
+                                                // Create an entry string array.
+                                                String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlocklistEntry};
+
+                                                // Add the entry to the white list.
+                                                domainInitialWhitelist.add(domainDoubleEntry);
+
+                                                //Log.i("Blocklists", headers.get(1)[0] + " domain initial white list entry added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
+                                                //        originalBlocklistEntry);
+                                            }
+                                        } else {  // Process a domain initial single entry.
+                                            // Create an entry string array.
+                                            String[] domainEntry = {domain, entry, originalBlocklistEntry};
+
+                                            // Add the entry to the white list.
+                                            domainInitialWhitelist.add(domainEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " domain initial white list entry added: " + domain + " , " + entry + "  -  " + originalBlocklistEntry);
+                                        }
+                                    } while (domains.contains("|"));
+                                }
+                            } else if (entry.endsWith("|")) {  // Final domain white list entries.
+                                // Strip the `|` from the end of the entry.
+                                entry = entry.substring(0, entry.length() - 1);
+
+                                // Process each domain.
+                                do {
+                                    // Create a string to keep track of the current domain.
+                                    String domain;
+
+                                    if (domains.contains("|")) {  // There is more than one domain in the list.
+                                        // Get the first domain from the list.
+                                        domain = domains.substring(0, domains.indexOf("|"));
+
+                                        // Remove the first domain from the list.
+                                        domains = domains.substring(domains.indexOf("|") + 1);
+                                    } else {  // There is only one domain in the list.
+                                        domain = domains;
+                                    }
+
+                                    if (entry.contains("*")) {  // Process a domain final white list double entry.
+                                        // Get the index of the wildcard.
+                                        int wildcardIndex = entry.indexOf("*");
+
+                                        // Split the entry into components.
+                                        String firstEntry = entry.substring(0, wildcardIndex);
+                                        String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                        // Create an entry string array.
+                                        String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlocklistEntry};
+
+                                        // Add the entry to the white list.
+                                        domainFinalWhitelist.add(domainDoubleEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " domain final white list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
+                                        //        originalBlocklistEntry);
+                                    } else {  // Process a domain final white list single entry.
+                                        // create an entry string array.
+                                        String[] domainEntry = {domain, entry, originalBlocklistEntry};
+
+                                        // Add the entry to the white list.
+                                        domainFinalWhitelist.add(domainEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " domain final white list added: " + domain + " , " + entry + "  -  " + originalBlocklistEntry);
+                                    }
+                                } while (domains.contains("|"));
+
+                            } else {  // Standard domain white list entries with filters.
+                                //noinspection StatementWithEmptyBody
+                                if (domains.contains("~")) {  // It is uncertain what a `~` domain means inside an `@@` entry.
+                                    // Do Nothing
+
+                                    //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry);
+                                } else {
+                                    // Process each domain.
+                                    do {
+                                        // Create a string to keep track of the current domain.
+                                        String domain;
+
+                                        if (domains.contains("|")) {  // There is more than one domain in the list.
+                                            // Get the first domain from the list.
+                                            domain = domains.substring(0, domains.indexOf("|"));
+
+                                            // Remove the first domain from the list.
+                                            domains = domains.substring(domains.indexOf("|") + 1);
+                                        } else {  // There is only one domain in the list.
+                                            domain = domains;
+                                        }
+
+                                        if (entry.contains("*")) {  // There are two or more entries.
+                                            // Get the index of the wildcard.
+                                            int wildcardIndex = entry.indexOf("*");
+
+                                            // Split the entry into components.
+                                            String firstEntry = entry.substring(0, wildcardIndex);
+                                            String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                            if (secondEntry.contains("*")) {  // There are three or more entries.
+                                                // Get the index of the wildcard.
+                                                int secondWildcardIndex = secondEntry.indexOf("*");
+
+                                                // Split the entry into components.
+                                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
+                                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
+
+                                                if (thirdEntry.contains("*")) {  // Process a domain white list quadruple entry.
+                                                    // Get the index of the wildcard.
+                                                    int thirdWildcardIndex = thirdEntry.indexOf("*");
+
+                                                    // Split the entry into components.
+                                                    String realThirdEntry = thirdEntry.substring(0, thirdWildcardIndex);
+                                                    String fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1);
+
+                                                    // Create an entry string array.
+                                                    String[] domainQuadrupleEntry = {domain, firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlocklistEntry};
+
+                                                    // Add the entry to the white list.
+                                                    domainWhitelist.add(domainQuadrupleEntry);
+
+                                                    //Log.i("Blocklists", headers.get(1)[0] + " domain white list added : " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " +
+                                                    //        realThirdEntry + " , " + fourthEntry + "  -  " + originalBlocklistEntry);
+                                                } else {  // Process a domain white list triple entry.
+                                                    // Create an entry string array.
+                                                    String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry};
+
+                                                    // Add the entry to the white list.
+                                                    domainWhitelist.add(domainTripleEntry);
+
+                                                    //Log.i("Blocklists", headers.get(1)[0] + " domain white list added : " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " +
+                                                    //        thirdEntry + "  -  " + originalBlocklistEntry);
+                                                }
+                                            } else {  // Process a domain white list double entry.
+                                                // Create an entry string array.
+                                                String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlocklistEntry};
+
+                                                // Add the entry to the white list.
+                                                domainWhitelist.add(domainDoubleEntry);
+
+                                                //Log.i("Blocklists", headers.get(1)[0] + " domain white list added : " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
+                                                //        originalBlocklistEntry);
+                                            }
+                                        } else {  // Process a domain white list single entry.
+                                            // Create an entry string array.
+                                            String[] domainEntry = {domain, entry, originalBlocklistEntry};
+
+                                            // Add the entry to the white list.
+                                            domainWhitelist.add(domainEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " domain white list added : " + domain + " , " + entry + "  -  " + originalBlocklistEntry);
+                                        }
+                                    } while (domains.contains("|"));
+                                }
+                            }
+                        }  // Ignore all other filter entries.
+                    } else if (blocklistEntry.endsWith("|")) {  // Final white list entries.
+                        // Remove the final `|` from the entry.
+                        String entry = blocklistEntry.substring(0, blocklistEntry.length() - 1);
+
+                        if (entry.contains("*")) {  // Process a final white list double entry
+                            // Get the index of the wildcard.
+                            int wildcardIndex = entry.indexOf("*");
+
+                            // split the entry into components.
+                            String firstEntry = entry.substring(0, wildcardIndex);
+                            String secondEntry = entry.substring(wildcardIndex + 1);
+
+                            // Create an entry string array.
+                            String[] doubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                            // Add the entry to the white list.
+                            finalWhitelist.add(doubleEntry);
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " final white list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                        } else {  // Process a final white list single entry.
+                            // Create an entry string array.
+                            String[] singleEntry = {entry, originalBlocklistEntry};
+
+                            // Add the entry to the white list.
+                            finalWhitelist.add(singleEntry);
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " final white list added: " + entry + "  -  " + originalBlocklistEntry);
+                        }
+                    } else {  // Main white list entries.
+                        if (blocklistEntry.contains("*")) {  // There are two or more entries.
+                            // Get the index of the wildcard.
+                            int wildcardIndex = blocklistEntry.indexOf("*");
+
+                            // Split the entry into components.
+                            String firstEntry = blocklistEntry.substring(0, wildcardIndex);
+                            String secondEntry = blocklistEntry.substring(wildcardIndex + 1);
+
+                            if (secondEntry.contains("*")) {  // Process a main white list triple entry.
+                                // Get the index of the wildcard.
+                                int secondWildcardIndex = secondEntry.indexOf("*");
+
+                                // Split the entry into components.
+                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
+                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
+
+                                // Create an entry string array.
+                                String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry};
+
+                                // Add the entry to the white list.
+                                mainWhitelist.add(tripleEntry);
+
+                                //Log.i("Blocklists", headers.get(1)[0] + " main white list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " + originalBlocklistEntry);
+                            } else {  // Process a main white list double entry.
+                                // Create an entry string array.
+                                String[] doubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                                // Add the entry to the white list.
+                                mainWhitelist.add(doubleEntry);
+
+                                //Log.i("Blocklists", headers.get(1)[0] + " main white list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                            }
+                        } else {  // Process a main white list single entry.
+                            // Create an entry string array.
+                            String[] singleEntry = {blocklistEntry, originalBlocklistEntry};
+
+                            // Add the entry to the white list.
+                            mainWhitelist.add(singleEntry);
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " main white list added: " + blocklistEntry + "  -  " + originalBlocklistEntry);
+                        }
+                    }
+                } else if (blocklistEntry.endsWith("|")) {  // Final black list entries.
+                    // Strip out the final "|"
+                    String entry = blocklistEntry.substring(0, blocklistEntry.length() - 1);
+
+                    // Strip out any initial `||`.  They are redundant in this case because the block list entry is being matched against the end of the URL.
+                    if (entry.startsWith("||")) {
+                        entry = entry.substring(2);
+                    }
+
+                    if (entry.contains("*")) {  // Process a final black list double entry.
+                        // Get the index of the wildcard.
+                        int wildcardIndex = entry.indexOf("*");
+
+                        // Split the entry into components.
+                        String firstEntry = entry.substring(0, wildcardIndex);
+                        String secondEntry = entry.substring(wildcardIndex + 1);
+
+                        // Create an entry string array.
+                        String[] doubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                        // Add the entry to the black list.
+                        finalBlacklist.add(doubleEntry);
+
+                        //Log.i("Blocklists", headers.get(1)[0] + " final black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                    } else {  // Process a final black list single entry.
+                        // create an entry string array.
+                        String[] singleEntry = {entry, originalBlocklistEntry};
+
+                        // Add the entry to the black list.
+                        finalBlacklist.add(singleEntry);
+
+                        //Log.i("Blocklists", headers.get(1)[0] + " final black list added: " + entry + "  -  " + originalBlocklistEntry);
+                    }
+                } else if (blocklistEntry.contains("$")) {  // Entries with filter options.
+                    // Strip out any initial `||`.  These will be treated like any other entry.
+                    if (blocklistEntry.startsWith("||")) {
+                        blocklistEntry = blocklistEntry.substring(2);
+                    }
+
+                    if (blocklistEntry.contains("third-party")) {  // Third-party entries.
+                        //noinspection StatementWithEmptyBody
+                        if (blocklistEntry.contains("~third-party")) {  // Third-party filter white list entries.
+                            // Do not process these white list entries.  They are designed to combine with block filters that Privacy Browser doesn't use, like `subdocument` and `xmlhttprequest`.
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry);
+                        } else if (blocklistEntry.contains("domain=")) {  // Third-party domain entries.
+                            if (blocklistEntry.startsWith("|")) {  // Third-party domain initial entries.
+                                // Strip the initial `|`.
+                                blocklistEntry = blocklistEntry.substring(1);
+
+                                // Parse the entry
+                                String entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+                                String filters = blocklistEntry.substring(blocklistEntry.indexOf("$") + 1);
+                                String domains = filters.substring(filters.indexOf("domain=") + 7);
+
+                                //noinspection StatementWithEmptyBody
+                                if (entry.equals("http:") || entry.equals("https:") || entry.equals("http://") || entry.equals("https://")) {  // Ignore generic entries.
+                                    // Do nothing.  These entries will almost entirely disable the website.
+                                    // Often the original entry blocks filter options like `$script`, which Privacy Browser does not differentiate.
+
+                                    //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry);
+                                } else {  // Third-party domain initial entries.
+                                    // Process each domain.
+                                    do {
+                                        // Create a string to keep track of the current domain.
+                                        String domain;
+
+                                        if (domains.contains("|")) {  // There is more than one domain in the list.
+                                            // Get the first domain from the list.
+                                            domain = domains.substring(0, domains.indexOf("|"));
+
+                                            // Remove the first domain from the list.
+                                            domains = domains.substring(domains.indexOf("|") + 1);
+                                        } else {  // There is only one domain in the list.
+                                            domain = domains;
+                                        }
+
+                                        if (entry.contains("*")) {  // Three are two or more entries.
+                                            // Get the index of the wildcard.
+                                            int wildcardIndex = entry.indexOf("*");
+
+                                            // Split the entry into components.
+                                            String firstEntry = entry.substring(0, wildcardIndex);
+                                            String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                            if (secondEntry.contains("*")) {  // Process a third-party domain initial black list triple entry.
+                                                // Get the index of the wildcard.
+                                                int secondWildcardIndex = secondEntry.indexOf("*");
+
+                                                // Split the entry into components.
+                                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
+                                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
+
+                                                // Create an entry string array.
+                                                String[] tripleDomainEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry};
+
+                                                // Add the entry to the black list.
+                                                thirdPartyDomainInitialBlacklist.add(tripleDomainEntry);
+
+                                                //Log.i("Blocklists", headers.get(1)[0] + " third-party domain initial black list added: " + domain + " , " + firstEntry + " , " + realSecondEntry +
+                                                //        " , " + thirdEntry + "  -  " + originalBlocklistEntry);
+                                            } else {  // Process a third-party domain initial black list double entry.
+                                                // Create an entry string array.
+                                                String[] doubleDomainEntry = {domain, firstEntry, secondEntry, originalBlocklistEntry};
+
+                                                // Add the entry to the black list.
+                                                thirdPartyDomainInitialBlacklist.add(doubleDomainEntry);
+
+                                                //Log.i("Blocklists", headers.get(1)[0] + " third-party domain initial black list added: " + domain + " , " + firstEntry + " , " + secondEntry +
+                                                //        "  -  " + originalBlocklistEntry);
+                                            }
+                                        } else {  // Process a third-party domain initial black list single entry.
+                                            // Create an entry string array.
+                                            String[] singleEntry = {domain, entry, originalBlocklistEntry};
+
+                                            // Add the entry to the black list.
+                                            thirdPartyDomainInitialBlacklist.add(singleEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " third-party domain initial black list added: " + domain + " , " + entry + "  -  " + originalBlocklistEntry);
+                                        }
+                                    } while (domains.contains("|"));
+                                }
+                            } else if (blocklistEntry.contains("\\")) {  // Process a third-party domain black list regular expression.
+                                // Parse the entry.  At least one regular expression in this entry contains `$`, so the parser uses `/$`.
+                                String entry = blocklistEntry.substring(0, blocklistEntry.indexOf("/$") + 1);
+                                String filters = blocklistEntry.substring(blocklistEntry.indexOf("/$") + 2);
+                                String domains = filters.substring(filters.indexOf("domain=") + 7);
+
+                                // Process each domain.
+                                do {
+                                    // Create a string to keep track of the current domain.
+                                    String domain;
+
+                                    if (domains.contains("|")) {  // There is more than one domain in the list.
+                                        // Get the first domain from the list.
+                                        domain = domains.substring(0, domains.indexOf("|"));
+
+                                        // Remove the first domain from the list.
+                                        domains = domains.substring(domains.indexOf("|") + 1);
+                                    } else {  // There is only one domain in the list.
+                                        domain = domains;
+                                    }
+
+                                    // Create an entry string array.
+                                    String[] domainEntry = {domain, entry, originalBlocklistEntry};
+
+                                    // Add the entry to the black list.
+                                    thirdPartyDomainRegularExpressionBlacklist.add(domainEntry);
+
+                                    //Log.i("Blocklists", headers.get(1)[0] + " third-party domain regular expression black list added: " + domain + " , " + entry + "  -  " + originalBlocklistEntry);
+                                } while (domains.contains("|"));
+                            } else {  // Third-party domain entries.
+                                // Parse the entry
+                                String entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+                                String filters = blocklistEntry.substring(blocklistEntry.indexOf("$") + 1);
+                                String domains = filters.substring(filters.indexOf("domain=") + 7);
+
+                                // Strip any trailing "*" from the entry.
+                                if (entry.endsWith("*")) {
+                                    entry = entry.substring(0, entry.length() - 1);
+                                }
+
+                                // Track if any third-party white list filters are applied.
+                                boolean whitelistDomain = false;
+
+                                // Process each domain.
+                                do {
+                                    // Create a string to keep track of the current domain.
+                                    String domain;
+
+                                    if (domains.contains("|")) {  // There is more than one domain in the list.
+                                        // Get the first domain from the list.
+                                        domain = domains.substring(0, domains.indexOf("|"));
+
+                                        // Remove the first domain from the list.
+                                        domains = domains.substring(domains.indexOf("|") + 1);
+                                    } else {  // The is only one domain in the list.
+                                        domain = domains;
+                                    }
+
+                                    // Differentiate between block list domains and white list domains.
+                                    if (domain.startsWith("~")) {  // White list third-party domain entry.
+                                        // Strip the initial `~`.
+                                        domain = domain.substring(1);
+
+                                        // Set the white list domain flag.
+                                        whitelistDomain = true;
+
+                                        if (entry.contains("*")) {  // Process a third-party domain white list double entry.
+                                            // Get the index of the wildcard.
+                                            int wildcardIndex = entry.indexOf("*");
+
+                                            // Split the entry into components.
+                                            String firstEntry = entry.substring(0, wildcardIndex);
+                                            String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                            // Create an entry string array.
+                                            String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlocklistEntry};
+
+                                            // Add the entry to the white list.
+                                            thirdPartyDomainWhitelist.add(domainDoubleEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " third-party domain white list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
+                                            //        originalBlocklistEntry);
+                                        } else {  // Process a third-party domain white list single entry.
+                                            // Create an entry string array.
+                                            String[] domainEntry = {domain, entry, originalBlocklistEntry};
+
+                                            // Add the entry to the white list.
+                                            thirdPartyDomainWhitelist.add(domainEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " third-party domain white list added: " + domain + " , " + entry + "  -  " + originalBlocklistEntry);
+                                        }
+                                    } else {  // Third-party domain black list entries.
+                                        if (entry.contains("*")) {  // Process a third-party domain black list double entry.
+                                            // Get the index of the wildcard.
+                                            int wildcardIndex = entry.indexOf("*");
+
+                                            // Split the entry into components.
+                                            String firstEntry = entry.substring(0, wildcardIndex);
+                                            String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                            // Create an entry string array.
+                                            String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlocklistEntry};
+
+                                            // Add the entry to the black list
+                                            thirdPartyDomainBlacklist.add(domainDoubleEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " third-party domain black list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
+                                            //        originalBlocklistEntry);
+                                        } else {  // Process a third-party domain black list single entry.
+                                            // Create an entry string array.
+                                            String[] domainEntry = {domain, entry, originalBlocklistEntry};
+
+                                            // Add the entry to the black list.
+                                            thirdPartyDomainBlacklist.add(domainEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " third-party domain block list added: " + domain + " , " + entry + "  -  " + originalBlocklistEntry);
+                                        }
+                                    }
+                                } while (domains.contains("|"));
+
+                                // Add a third-party black list entry if a white list domain was processed.
+                                if (whitelistDomain) {
+                                    if (entry.contains("*")) {  // Process a third-party black list double entry.
+                                        // Get the index of the wildcard.
+                                        int wildcardIndex = entry.indexOf("*");
+
+                                        // Split the entry into components.
+                                        String firstEntry = entry.substring(0, wildcardIndex);
+                                        String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                        // Create an entry string array.
+                                        String[] doubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                                        // Add the entry to the black list.
+                                        thirdPartyBlacklist.add(doubleEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " third-party black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                                    } else {  // Process a third-party black list single entry.
+                                        // Create an entry string array.
+                                        String[] singleEntry = {entry, originalBlocklistEntry};
+
+                                        // Add an entry to the black list.
+                                        thirdPartyBlacklist.add(singleEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " third-party black list added: " + entry + "  -  " + originalBlocklistEntry);
+                                    }
+                                }
+                            }
+                        } else if (blocklistEntry.startsWith("|")) {  // Third-party initial black list entries.
+                            // Strip the initial `|`.
+                            blocklistEntry = blocklistEntry.substring(1);
+
+                            // Get the entry.
+                            String entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+
+                            if (entry.contains("*")) {  // Process a third-party initial black list double entry.
+                                // Get the index of the wildcard.
+                                int wildcardIndex = entry.indexOf("*");
+
+                                // Split the entry into components.
+                                String firstEntry = entry.substring(0, wildcardIndex);
+                                String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                // Create an entry string array.
+                                String[] thirdPartyDoubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                                // Add the entry to the black list.
+                                thirdPartyInitialBlacklist.add(thirdPartyDoubleEntry);
+
+                                //Log.i("Blocklists", headers.get(1)[0] + " third-party initial black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                            } else {  // Process a third-party initial black list single entry.
+                                // Create an entry string array.
+                                String[] singleEntry = {entry, originalBlocklistEntry};
+
+                                // Add the entry to the black list.
+                                thirdPartyInitialBlacklist.add(singleEntry);
+
+                                //Log.i("Blocklists", headers.get(1)[0] + " third-party initial black list added: " + entry + "  -  " + originalBlocklistEntry);
+                            }
+                        } else if (blocklistEntry.contains("\\")) {  // Process a regular expression black list entry.
+                            // Prepare a string to hold the entry.
+                            String entry;
+
+                            // Get the entry.
+                            if (blocklistEntry.contains("$/$")) {  // The first `$` is part of the regular expression.
+                                entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$/$") + 2);
+                            } else {  // The only `$` indicates the filter options.
+                                entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+                            }
+
+                            // Create an entry string array.
+                            String[] singleEntry = {entry, originalBlocklistEntry};
+
+                            // Add the entry to the black list.
+                            thirdPartyRegularExpressionBlacklist.add(singleEntry);
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " third-party regular expression black list added: " + entry + "  -  " + originalBlocklistEntry);
+                        } else if (blocklistEntry.contains("*")) {  // Third-party and regular expression black list entries.
+                            // Get the entry.
+                            String entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+
+                            if (entry.endsWith("*")) {  // Process a third-party black list single entry.
+                                // Strip the final `*`.
+                                entry = entry.substring(0, entry.length() - 1);
+
+                                // Create an entry string array.
+                                String[] singleEntry = {entry, originalBlocklistEntry};
+
+                                // Add the entry to the black list.
+                                thirdPartyBlacklist.add(singleEntry);
+
+                                //Log.i("Blocklists", headers.get(1)[0] + " third party black list added: " + entry + "  -  " + originalBlocklistEntry);
+                            } else {  // There are two or more entries.
+                                // Get the index of the wildcard.
+                                int wildcardIndex = entry.indexOf("*");
+
+                                // Split the entry into components.
+                                String firstEntry = entry.substring(0, wildcardIndex);
+                                String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                if (secondEntry.contains("*")) {  // There are three or more entries.
+                                    // Get the index of the wildcard.
+                                    int secondWildcardIndex = secondEntry.indexOf("*");
+
+                                    // Split the entry into components.
+                                    String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
+                                    String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
+
+                                    if (thirdEntry.contains("*")) {  // Process a third-party black list quadruple entry.
+                                        // Get the index of the wildcard.
+                                        int thirdWildcardIndex = thirdEntry.indexOf("*");
+
+                                        // Split the entry into components.
+                                        String realThirdEntry = thirdEntry.substring(0, thirdWildcardIndex);
+                                        String fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1);
+
+                                        // Create an entry string array.
+                                        String[] quadrupleEntry = {firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlocklistEntry};
+
+                                        // Add the entry to the black list.
+                                        thirdPartyBlacklist.add(quadrupleEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " third-party black list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " +
+                                        //        fourthEntry + "  -  " + originalBlocklistEntry);
+                                    } else {  // Process a third-party black list triple entry.
+                                        // Create an entry string array.
+                                        String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry};
+
+                                        // Add the entry to the black list.
+                                        thirdPartyBlacklist.add(tripleEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " third-party black list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " +
+                                        //        originalBlocklistEntry);
+                                    }
+                                } else {  // Process a third-party black list double entry.
+                                    // Create an entry string array.
+                                    String[] doubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                                    // Add the entry to the black list.
+                                    thirdPartyBlacklist.add(doubleEntry);
+
+                                    //Log.i("Blocklists", headers.get(1)[0] + " third-party black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                                }
+                            }
+                        } else {  // Process a third party black list single entry.
+                            // Get the entry.
+                            String entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+
+                            // Create an entry string array.
+                            String[] singleEntry = {entry, originalBlocklistEntry};
+
+                            // Add the entry to the black list.
+                            thirdPartyBlacklist.add(singleEntry);
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " third party black list added: " + entry + "  -  " + originalBlocklistEntry);
+                        }
+                    } else if (blocklistEntry.substring(blocklistEntry.indexOf("$")).contains("domain=")) {  // Domain entries.
+                        if (blocklistEntry.contains("~")) {  // Domain white list entries.
+                            // Separate the filters.
+                            String entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+                            String filters = blocklistEntry.substring(blocklistEntry.indexOf("$") + 1);
+                            String domains = filters.substring(filters.indexOf("domain=") + 7);
+
+                            // Strip any final `*` from the entry.  They are redundant.
+                            if (entry.endsWith("*")) {
+                                entry = entry.substring(0, entry.length() - 1);
+                            }
+
+                            // Process each domain.
+                            do {
+                                // Create a string to keep track of the current domain.
+                                String domain;
+
+                                if (domains.contains("|")) {  // There is more than one domain in the list.
+                                    // Get the first domain from the list.
+                                    domain = domains.substring(0, domains.indexOf("|"));
+
+                                    // Remove the first domain from the list.
+                                    domains = domains.substring(domains.indexOf("|") + 1);
+                                } else {  // There is only one domain in the list.
+                                    domain = domains;
+                                }
+
+                                // Strip the initial `~`.
+                                domain = domain.substring(1);
+
+                                if (entry.contains("*")) {  // There are two or more entries.
+                                    // Get the index of the wildcard.
+                                    int wildcardIndex = entry.indexOf("*");
+
+                                    // Split the entry into components.
+                                    String firstEntry = entry.substring(0, wildcardIndex);
+                                    String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                    if (secondEntry.contains("*")) {  // Process a domain white list triple entry.
+                                        // Get the index of the wildcard.
+                                        int secondWildcardIndex = secondEntry.indexOf("*");
+
+                                        // Split the entry into components.
+                                        String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
+                                        String thirdEntry = secondEntry.substring((secondWildcardIndex + 1));
+
+                                        // Create an entry string array.
+                                        String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry};
+
+                                        // Add the entry to the white list.
+                                        domainWhitelist.add(domainTripleEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " domain white list added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry +
+                                        //        "  -  " + originalBlocklistEntry);
+                                    } else {  // Process a domain white list double entry.
+                                        // Create an entry string array.
+                                        String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlocklistEntry};
+
+                                        // Add the entry to the white list.
+                                        domainWhitelist.add(domainDoubleEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " domain white list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                                    }
+                                } else {  // Process a domain white list single entry.
+                                    // Create an entry string array.
+                                    String[] domainEntry = {domain, entry, originalBlocklistEntry};
+
+                                    // Add the entry to the white list.
+                                    domainWhitelist.add(domainEntry);
+
+                                    //Log.i("Blocklists", headers.get(1)[0] + " domain white list added: " + domain + " , " + entry + "  -  " + originalBlocklistEntry);
+                                }
+                            } while (domains.contains("|"));
+                        } else {  // Domain black list entries.
+                            // Separate the filters.
+                            String entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+                            String filters = blocklistEntry.substring(blocklistEntry.indexOf("$") + 1);
+                            String domains = filters.substring(filters.indexOf("domain=") + 7);
+
+                            // Only process the item if the entry is not null.  For example, some lines begin with `$websocket`, which create a null entry.
+                            if (!entry.equals("")) {
+                                // Process each domain.
+                                do {
+                                    // Create a string to keep track of the current domain.
+                                    String domain;
+
+                                    if (domains.contains("|")) {  // There is more than one domain in the list.
+                                        // Get the first domain from the list.
+                                        domain = domains.substring(0, domains.indexOf("|"));
+
+                                        // Remove the first domain from the list.
+                                        domains = domains.substring(domains.indexOf("|") + 1);
+                                    } else {  // There is only one domain in the list.
+                                        domain = domains;
+                                    }
+
+                                    if (entry.startsWith("|")) {  // Domain initial black list entries.
+                                        // Remove the initial `|`;
+                                        String entryBase = entry.substring(1);
+
+                                        //noinspection StatementWithEmptyBody
+                                        if (entryBase.equals("http://") || entryBase.equals("https://")) {
+                                            // Do nothing.  These entries will entirely block the website.
+                                            // Often the original entry blocks `$script` but Privacy Browser does not currently differentiate between scripts and other entries.
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry);
+                                        } else {  // Process a domain initial black list entry
+                                            // Create an entry string array.
+                                            String[] domainEntry = {domain, entryBase, originalBlocklistEntry};
+
+                                            // Add the entry to the black list.
+                                            domainInitialBlacklist.add(domainEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " domain initial black list added: " + domain + " , " + entryBase + "  -  " + originalBlocklistEntry);
+                                        }
+                                    } else if (entry.endsWith("|")) {  // Domain final black list entries.
+                                        // Remove the final `|`.
+                                        String entryBase = entry.substring(0, entry.length() - 1);
+
+                                        if (entryBase.contains("*")) {  // Process a domain final black list double entry.
+                                            // Get the index of the wildcard.
+                                            int wildcardIndex = entry.indexOf("*");
+
+                                            // Split the entry into components.
+                                            String firstEntry = entryBase.substring(0, wildcardIndex);
+                                            String secondEntry = entryBase.substring(wildcardIndex + 1);
+
+                                            // Create an entry string array.
+                                            String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlocklistEntry};
+
+                                            // Add the entry to the black list.
+                                            domainFinalBlacklist.add(domainDoubleEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " domain final black list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
+                                            //        originalBlocklistEntry);
+                                        } else {  // Process a domain final black list single entry.
+                                            // Create an entry string array.
+                                            String[] domainEntry = {domain, entryBase, originalBlocklistEntry};
+
+                                            // Add the entry to the black list.
+                                            domainFinalBlacklist.add(domainEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " domain final black list added: " + domain + " , " + entryBase + "  -  " + originalBlocklistEntry);
+                                        }
+                                    } else if (entry.contains("\\")) {  // Process a domain regular expression black list entry.
+                                        // Create an entry string array.
+                                        String[] domainEntry = {domain, entry, originalBlocklistEntry};
+
+                                        // Add the entry to the black list.
+                                        domainRegularExpressionBlacklist.add(domainEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " domain regular expression black list added: " + domain + " , " + entry + "  -  " + originalBlocklistEntry);
+                                    } else if (entry.contains("*")) {  // There are two or more entries.
+                                        // Get the index of the wildcard.
+                                        int wildcardIndex = entry.indexOf("*");
+
+                                        // Split the entry into components.
+                                        String firstEntry = entry.substring(0, wildcardIndex);
+                                        String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                        if (secondEntry.contains("*")) {  // Process a domain black list triple entry.
+                                            // Get the index of the wildcard.
+                                            int secondWildcardIndex = secondEntry.indexOf("*");
+
+                                            // Split the entry into components.
+                                            String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
+                                            String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
+
+                                            // Create an entry string array.
+                                            String[] domainTripleEntry = {domain, firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry};
+
+                                            // Add the entry to the black list.
+                                            domainBlacklist.add(domainTripleEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " domain black list added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry +
+                                            //        "  -  " + originalBlocklistEntry);
+                                        } else {  // Process a domain black list double entry.
+                                            // Create an entry string array.
+                                            String[] domainDoubleEntry = {domain, firstEntry, secondEntry, originalBlocklistEntry};
+
+                                            // Add the entry to the black list.
+                                            domainBlacklist.add(domainDoubleEntry);
+
+                                            //Log.i("Blocklists", headers.get(1)[0] + " domain black list added: " + domain + " , " + firstEntry + " , " + secondEntry + "  -  " +
+                                            //        originalBlocklistEntry);
+                                        }
+                                    } else {  // Process a domain black list single entry.
+                                        // Create an entry string array.
+                                        String[] domainEntry = {domain, entry, originalBlocklistEntry};
+
+                                        // Add the entry to the black list.
+                                        domainBlacklist.add(domainEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " domain black list added: " + domain + " , " + entry + "  -  " + originalBlocklistEntry);
+                                    }
+                                } while (domains.contains("|"));
+                            }
+                        }
+                    } else if (blocklistEntry.contains("~")) {  // White list entries.  Privacy Browser does not differentiate against these filter options, so they are just generally white listed.
+                        // Remove the filter options.
+                        blocklistEntry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+
+                        // Strip any trailing `*`.
+                        if (blocklistEntry.endsWith("*")) {
+                            blocklistEntry = blocklistEntry.substring(0, blocklistEntry.length() - 1);
+                        }
+
+                        if (blocklistEntry.contains("*")) {  // Process a white list double entry.
+                            // Get the index of the wildcard.
+                            int wildcardIndex = blocklistEntry.indexOf("*");
+
+                            // Split the entry into components.
+                            String firstEntry = blocklistEntry.substring(0, wildcardIndex);
+                            String secondEntry = blocklistEntry.substring(wildcardIndex + 1);
+
+                            // Create an entry string array.
+                            String[] doubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                            // Add the entry to the white list.
+                            mainWhitelist.add(doubleEntry);
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " main white list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                        } else {  // Process a white list single entry.
+                            // Create an entry string array.
+                            String[] singleEntry = {blocklistEntry, originalBlocklistEntry};
+
+                            // Add the entry to the white list.
+                            mainWhitelist.add(singleEntry);
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " main white list added: " + blocklistEntry + "  -  + " + originalBlocklistEntry);
+                        }
+                    } else if (blocklistEntry.contains("\\")) {  // Process a regular expression black list entry.
+                        // Remove the filter options.
+                        blocklistEntry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+
+                        // Create an entry string array.
+                        String[] singleEntry = {blocklistEntry, originalBlocklistEntry};
+
+                        // Add the entry to the black list.
+                        regularExpressionBlacklist.add(singleEntry);
+
+                        //Log.i("Blocklists", headers.get(1)[0] + " regular expression black list added: " + blocklistEntry + "  -  " + originalBlocklistEntry);
+                    } else {  // Black list entries.
+                        // Remove the filter options.
+                        if (!blocklistEntry.contains("$file")) {  // EasyPrivacy contains an entry with `$file` that does not have filter options.
+                            blocklistEntry = blocklistEntry.substring(0, blocklistEntry.indexOf("$"));
+                        }
+
+                        // Strip any trailing `*`.  These are redundant.
+                        if (blocklistEntry.endsWith("*")) {
+                            blocklistEntry = blocklistEntry.substring(0, blocklistEntry.length() - 1);
+                        }
+
+                        if (blocklistEntry.startsWith("|")) {  // Initial black list entries.
+                            // Strip the initial `|`.
+                            String entry = blocklistEntry.substring(1);
+
+                            if (entry.contains("*")) {  // Process an initial black list double entry.
+                                // Get the index of the wildcard.
+                                int wildcardIndex = entry.indexOf("*");
+
+                                // Split the entry into components.
+                                String firstEntry = entry.substring(0, wildcardIndex);
+                                String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                // Create an entry string array.
+                                String[] doubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                                // Add the entry to the black list.
+                                initialBlacklist.add(doubleEntry);
+
+                                //Log.i("Blocklists", headers.get(1)[0] + " initial black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                            } else {  // Process an initial black list single entry.
+                                // Create an entry string array.
+                                String[] singleEntry = {entry, originalBlocklistEntry};
+
+                                // Add the entry to the black list.
+                                initialBlacklist.add(singleEntry);
+
+                                //Log.i("Blocklists", headers.get(1)[0] + " initial black list added: " + entry + "  -  " + originalBlocklistEntry);
+                            }
+                        } else if (blocklistEntry.endsWith("|")) {  // Final black list entries.
+                            // Ignore entries with `object` filters.  They can block entire websites and don't have any meaning in the context of Privacy Browser.
+                            if (!originalBlocklistEntry.contains("$object")) {
+                                // Strip the final `|`.
+                                String entry = blocklistEntry.substring(0, blocklistEntry.length() - 1);
+
+                                if (entry.contains("*")) {  // There are two or more entries.
+                                    // Get the index of the wildcard.
+                                    int wildcardIndex = entry.indexOf("*");
+
+                                    // Split the entry into components.
+                                    String firstEntry = entry.substring(0, wildcardIndex);
+                                    String secondEntry = entry.substring(wildcardIndex + 1);
+
+                                    if (secondEntry.contains("*")) {  // Process a final black list triple entry.
+                                        // Get the index of the wildcard.
+                                        int secondWildcardIndex = secondEntry.indexOf("*");
+
+                                        // Split the entry into components.
+                                        String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
+                                        String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
+
+                                        // Create an entry string array.
+                                        String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry};
+
+                                        // Add the entry to the black list.
+                                        finalBlacklist.add(tripleEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " final black list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " +
+                                        //        originalBlocklistEntry);
+                                    } else {  // Process a final black list double entry.
+                                        // Create an entry string array.
+                                        String[] doubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                                        // Add the entry to the black list.
+                                        finalBlacklist.add(doubleEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " final black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                                    }
+                                } else {  // Process a final black list single entry.
+                                    // Create an entry sting array.
+                                    String[] singleEntry = {entry, originalBlocklistEntry};
+
+                                    // Add the entry to the black list.
+                                    finalBlacklist.add(singleEntry);
+
+                                    //Log.i("Blocklists", headers.get(1)[0] + " final black list added: " + entry + "  -  " + originalBlocklistEntry);
+                                }
+                            }
+                        } else if (blocklistEntry.contains("*")) {  // There are two or more entries.
+                            // Get the index of the wildcard.
+                            int wildcardIndex = blocklistEntry.indexOf("*");
+
+                            // Split the entry into components.
+                            String firstEntry = blocklistEntry.substring(0, wildcardIndex);
+                            String secondEntry = blocklistEntry.substring(wildcardIndex + 1);
+
+                            if (secondEntry.contains("*")) {  // Process a main black list triple entry.
+                                // Get the index of the wildcard.
+                                int secondWildcardIndex = secondEntry.indexOf("*");
+
+                                // Split the entry into components.
+                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
+                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
+
+                                // Create an entry string array.
+                                String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry};
+
+                                // Add the entry to the black list.
+                                mainBlacklist.add(tripleEntry);
+
+                                //Log.i("Blocklists", headers.get(1)[0] + " main black list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " + originalBlocklistEntry);
+                            } else {  // Process a main black list double entry.
+                                // Create an entry string array.
+                                String[] doubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                                // Add the entry to the black list.
+                                mainBlacklist.add(doubleEntry);
+
+                                //Log.i("Blocklists", headers.get(1)[0] + " main black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                            }
+                        } else {  // Process a main black list single entry.
+                            // Create an entry string array.
+                            String[] singleEntry = {blocklistEntry, originalBlocklistEntry};
+
+                            // Add the entry to the black list.
+                            mainBlacklist.add(singleEntry);
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " main black list added: " + blocklistEntry + "  -  " + originalBlocklistEntry);
+                        }
+                    }
+                } else {  // Main black list entries
+                    // Strip out any initial `||`.  These will be treated like any other entry.
+                    if (blocklistEntry.startsWith("||")) {
+                        blocklistEntry = blocklistEntry.substring(2);
+                    }
+
+                    // Strip out any initial `*`.
+                    if (blocklistEntry.startsWith("*")) {
+                        blocklistEntry = blocklistEntry.substring(1);
+                    }
+
+                    // Strip out any trailing `*`.
+                    if (blocklistEntry.endsWith("*")) {
+                        blocklistEntry = blocklistEntry.substring(0, blocklistEntry.length() - 1);
+                    }
+
+                    if (blocklistEntry.startsWith("|")) {  // Initial black list entries.
+                        // Strip the initial `|`.
+                        String entry = blocklistEntry.substring(1);
+
+                        if (entry.contains("*")) {  // Process an initial black list double entry.
+                            // Get the index of the wildcard.
+                            int wildcardIndex = entry.indexOf("*");
+
+                            // Split the entry into components.
+                            String firstEntry = entry.substring(0, wildcardIndex);
+                            String secondEntry = entry.substring(wildcardIndex + 1);
+
+                            // Create an entry string array.
+                            String[] doubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                            // Add the entry to the black list.
+                            initialBlacklist.add(doubleEntry);
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " initial black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                        } else {  // Process an initial black list single entry.
+                            // Create an entry string array.
+                            String[] singleEntry = {entry, originalBlocklistEntry};
+
+                            // Add the entry to the black list.
+                            initialBlacklist.add(singleEntry);
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " initial black list added: " + entry + "  -  " + originalBlocklistEntry);
+                        }
+                    } else if (blocklistEntry.endsWith("|")) {  // Final black list entries.
+                        // Strip the final `|`.
+                        String entry = blocklistEntry.substring(0, blocklistEntry.length() - 1);
+
+                        if (entry.contains("*")) {  // There are two or more entries.
+                            // Get the index of the wildcard.
+                            int wildcardIndex = entry.indexOf("*");
+
+                            // Split the entry into components.
+                            String firstEntry = entry.substring(0, wildcardIndex);
+                            String secondEntry = entry.substring(wildcardIndex + 1);
+
+                            if (secondEntry.contains("*")) {  // Process a final black list triple entry.
+                                // Get the index of the wildcard.
+                                int secondWildcardIndex = secondEntry.indexOf("*");
+
+                                // Split the entry into components.
+                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
+                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
+
+                                // Create an entry string array.
+                                String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry};
+
+                                // Add the entry to the black list.
+                                finalBlacklist.add(tripleEntry);
+
+                                //Log.i("Blocklists", headers.get(1)[0] + " final black list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " +
+                                //        originalBlocklistEntry);
+                            } else {  // Process a final black list double entry.
+                                // Create an entry string array.
+                                String[] doubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                                // Add the entry to the black list.
+                                finalBlacklist.add(doubleEntry);
+
+                                //Log.i("Blocklists", headers.get(1)[0] + " final black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                            }
+                        } else {  // Process a final black list single entry.
+                            // Create an entry string array.
+                            String[] singleEntry = {entry, originalBlocklistEntry};
+
+                            // Add the entry to the black list.
+                            finalBlacklist.add(singleEntry);
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " final black list added: " + entry + "  -  " + originalBlocklistEntry);
+                        }
+                    } else {  // Main black list entries.
+                        if (blocklistEntry.contains("*")) {  // There are two or more entries.
+                            // Get the index of the wildcard.
+                            int wildcardIndex = blocklistEntry.indexOf("*");
+
+                            // Split the entry into components.
+                            String firstEntry = blocklistEntry.substring(0, wildcardIndex);
+                            String secondEntry = blocklistEntry.substring(wildcardIndex + 1);
+
+                            if (secondEntry.contains("*")) {  // There are three or more entries.
+                                // Get the index of the wildcard.
+                                int secondWildcardIndex = secondEntry.indexOf("*");
+
+                                // Split the entry into components.
+                                String realSecondEntry = secondEntry.substring(0, secondWildcardIndex);
+                                String thirdEntry = secondEntry.substring(secondWildcardIndex + 1);
+
+                                if (thirdEntry.contains("*")) {  // There are four or more entries.
+                                    // Get the index of the wildcard.
+                                    int thirdWildcardIndex = thirdEntry.indexOf("*");
+
+                                    // Split the entry into components.
+                                    String realThirdEntry = thirdEntry.substring(0, thirdWildcardIndex);
+                                    String fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1);
+
+                                    if (fourthEntry.contains("*")) {  // Process a main black list quintuple entry.
+                                        // Get the index of the wildcard.
+                                        int fourthWildcardIndex = fourthEntry.indexOf("*");
+
+                                        // Split the entry into components.
+                                        String realFourthEntry = fourthEntry.substring(0, fourthWildcardIndex);
+                                        String fifthEntry = fourthEntry.substring(fourthWildcardIndex + 1);
+
+                                        // Create an entry string array.
+                                        String[] quintupleEntry = {firstEntry, realSecondEntry, realThirdEntry, realFourthEntry, fifthEntry, originalBlocklistEntry};
+
+                                        // Add the entry to the black list.
+                                        mainBlacklist.add(quintupleEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " main black list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " +
+                                        //        realFourthEntry + " , " + fifthEntry + "  -  " + originalBlocklistEntry);
+                                    } else {  // Process a main black list quadruple entry.
+                                        // Create an entry string array.
+                                        String[] quadrupleEntry = {firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlocklistEntry};
+
+                                        // Add the entry to the black list.
+                                        mainBlacklist.add(quadrupleEntry);
+
+                                        //Log.i("Blocklists", headers.get(1)[0] + " main black list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " +
+                                        //        fourthEntry + "  -  " + originalBlocklistEntry);
+                                    }
+                                } else {  // Process a main black list triple entry.
+                                    // Create an entry string array.
+                                    String[] tripleEntry = {firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry};
+
+                                    // Add the entry to the black list.
+                                    mainBlacklist.add(tripleEntry);
+
+                                    //Log.i("Blocklists", headers.get(1)[0] + " main black list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + "  -  " + originalBlocklistEntry);
+                                }
+                            } else {  // Process a main black list double entry.
+                                // Create an entry string array.
+                                String[] doubleEntry = {firstEntry, secondEntry, originalBlocklistEntry};
+
+                                // Add the entry to the black list.
+                                mainBlacklist.add(doubleEntry);
+
+                                //Log.i("Blocklists", headers.get(1)[0] + " main black list added: " + firstEntry + " , " + secondEntry + "  -  " + originalBlocklistEntry);
+                            }
+                        } else {  // Process a main black list single entry.
+                            // Create an entry string array.
+                            String[] singleEntry = {blocklistEntry, originalBlocklistEntry};
+
+                            // Add the entry to the black list.
+                            mainBlacklist.add(singleEntry);
+
+                            //Log.i("Blocklists", headers.get(1)[0] + " main black list added: " + blocklistEntry + "  -  " + originalBlocklistEntry);
+                        }
+                    }
+                }
+            }
+            // Close `bufferedReader`.
+            bufferedReader.close();
+        } catch (IOException e) {
+            // The asset exists, so the `IOException` will never be thrown.
+        }
+
+        // Initialize the combined list.
+        ArrayList<List<String[]>> combinedLists = new ArrayList<>();
+
+        // Add the headers (0).
+        combinedLists.add(headers);  // 0.
+
+        // Add the white lists (1-8).
+        combinedLists.add(mainWhitelist);  // 1.
+        combinedLists.add(finalWhitelist);  // 2.
+        combinedLists.add(domainWhitelist);  // 3.
+        combinedLists.add(domainInitialWhitelist);  // 4.
+        combinedLists.add(domainFinalWhitelist); // 5.
+        combinedLists.add(thirdPartyWhitelist);  // 6.
+        combinedLists.add(thirdPartyDomainWhitelist);  // 7.
+        combinedLists.add(thirdPartyDomainInitialWhitelist);  // 8.
+
+        // Add the black lists (9-22).
+        combinedLists.add(mainBlacklist);  // 9.
+        combinedLists.add(initialBlacklist);  // 10.
+        combinedLists.add(finalBlacklist);  // 11.
+        combinedLists.add(domainBlacklist);  //  12.
+        combinedLists.add(domainInitialBlacklist);  // 13.
+        combinedLists.add(domainFinalBlacklist);  // 14.
+        combinedLists.add(domainRegularExpressionBlacklist);  // 15.
+        combinedLists.add(thirdPartyBlacklist);  // 16.
+        combinedLists.add(thirdPartyInitialBlacklist);  // 17.
+        combinedLists.add(thirdPartyDomainBlacklist);  // 18.
+        combinedLists.add(thirdPartyDomainInitialBlacklist);  // 19.
+        combinedLists.add(thirdPartyRegularExpressionBlacklist);  // 20.
+        combinedLists.add(thirdPartyDomainRegularExpressionBlacklist);  // 21.
+        combinedLists.add(regularExpressionBlacklist);  // 22.
+
+        return combinedLists;
+    }
+
+    public String[] checkBlocklist(String currentDomain, String resourceUrl, boolean isThirdPartyRequest, ArrayList<List<String[]>> blocklist) {
+        // Get the blocklist name.
+        String BLOCK_LIST_NAME_STRING = blocklist.get(0).get(1)[0];
+
+        // Assert that currentDomain != null only if this is a third party request.  Apparently, lint can't tell that this isn't redundant.
+        //noinspection RedundantIfStatement
+        if (isThirdPartyRequest) {
+            assert currentDomain != null;
+        }
+
+        // Process the white lists.
+        // Main white list.
+        for (String[] whitelistEntry : blocklist.get(Integer.valueOf(MAIN_WHITELIST))) {
+            switch (whitelistEntry.length) {
+                case 2:  // There is one entry.
+                    if (resourceUrl.contains(whitelistEntry[0])) {
+                        // Return a whitelist match request allowed.
+                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_WHITELIST, whitelistEntry[0], whitelistEntry[1]};
+                    }
+                    break;
+
+                case 3:  // There are two entries.
+                    if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1])) {
+                        // Return a whitelist match request allowed.
+                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1], whitelistEntry[2]};
+                    }
+                    break;
+
+                case 4:  // There are three entries.
+                    if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2])) {
+                        // Return a whitelist match request allowed.
+                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1] + "\n" + whitelistEntry[2], whitelistEntry[3]};
+                    }
+                    break;
+            }
+        }
+
+        // Final white list.
+        for (String[] whitelistEntry : blocklist.get(Integer.valueOf(FINAL_WHITELIST))) {
+            if (whitelistEntry.length == 2) {  // There is one entry.
+                if (resourceUrl.contains(whitelistEntry[0])) {
+                    // Return a whitelist match request allowed.
+                    return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, FINAL_WHITELIST, whitelistEntry[0], whitelistEntry[1]};
+                }
+            } else {  // There are two entries.
+                if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1])) {
+                    // Return a whitelist match request allowed.
+                    return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, FINAL_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1], whitelistEntry[2]};
+                }
+            }
+        }
+
+        // Only check the domain lists if the current domain is not null (like `about:blank`).
+        if (currentDomain != null) {
+            // Domain white list.
+            for (String[] whitelistEntry : blocklist.get(Integer.valueOf(DOMAIN_WHITELIST))) {
+                switch (whitelistEntry.length) {
+                    case 3:  // There is one entry.
+                        if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1], whitelistEntry[2]};
+                        }
+                        break;
+
+                    case 4:  // There are two entries.
+                        if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1] + "\n" + whitelistEntry[2],
+                                    whitelistEntry[3]};
+                        }
+                        break;
+
+                    case 5:  // There are three entries.
+                        if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2]) && resourceUrl.contains(whitelistEntry[3])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1] + "\n" + whitelistEntry[2] + "\n" +
+                                    whitelistEntry[3], whitelistEntry[4]};
+                        }
+                        break;
+
+                    case 6:  // There are four entries.
+                        if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2]) && resourceUrl.contains(whitelistEntry[3]) &&
+                                resourceUrl.contains(whitelistEntry[4])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1] + "\n" + whitelistEntry[2] + "\n" +
+                                    whitelistEntry[3] + "\n" + whitelistEntry[4], whitelistEntry[5]};
+                        }
+                        break;
+                }
+            }
+
+            // Domain initial white list.
+            for (String[] whitelistEntry : blocklist.get(Integer.valueOf(DOMAIN_INITIAL_WHITELIST))) {
+                switch (whitelistEntry.length) {
+                    case 3:  // There is one entry.
+                        if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.startsWith(whitelistEntry[1])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_INITIAL_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1], whitelistEntry[2]};
+                        }
+                        break;
+
+                    case 4:  // There are two entries.
+                        if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.startsWith(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_INITIAL_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1] + "\n" + whitelistEntry[2],
+                                    whitelistEntry[3]};
+                        }
+                        break;
+
+                    case 5:  // There are three entries.
+                        if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.startsWith(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2]) && resourceUrl.startsWith(whitelistEntry[3])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_INITIAL_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1] + "\n" + whitelistEntry[2] + "\n" +
+                                    whitelistEntry[3], whitelistEntry[4]};
+                        }
+                        break;
+                }
+            }
+
+            // Domain final white list.
+            for (String[] whitelistEntry : blocklist.get(Integer.valueOf(DOMAIN_FINAL_WHITELIST))) {
+                switch (whitelistEntry.length) {
+                    case 3:  // There is one entry;
+                        if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.endsWith(whitelistEntry[1])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_FINAL_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1], whitelistEntry[2]};
+                        }
+                        break;
+
+                    case 4:  // There are two entries;
+                        if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.endsWith(whitelistEntry[2])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_FINAL_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1] + "\n" + whitelistEntry[2],
+                                    whitelistEntry[3]};
+                        }
+                        break;
+                }
+            }
+        }
+
+        // Only check the third-party white lists if this is a third-party request.
+        if (isThirdPartyRequest) {
+            // Third-party white list.
+            for (String[] whitelistEntry : blocklist.get(Integer.valueOf(THIRD_PARTY_WHITELIST))) {
+                switch (whitelistEntry.length) {
+                    case 2:  // There is one entry
+                        if (resourceUrl.contains(whitelistEntry[0])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_WHITELIST, whitelistEntry[0], whitelistEntry[1]};
+                        }
+                        break;
+
+                    case 3:  // There are two entries.
+                        if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1], whitelistEntry[2]};
+                        }
+                        break;
+
+                    case 4:  // There are three entries.
+                        if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1] + "\n" + whitelistEntry[2],
+                                    whitelistEntry[3]};
+                        }
+                        break;
+
+                    case 5:  // There are four entries.
+                        if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2]) && resourceUrl.contains(whitelistEntry[3])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1] + "\n" + whitelistEntry[2] + "\n" +
+                                    whitelistEntry[3], whitelistEntry[4]};
+                        }
+                        break;
+
+                    case 6:  // There are five entries.
+                        if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2]) && resourceUrl.contains(whitelistEntry[3]) &&
+                                resourceUrl.contains(whitelistEntry[4])) {
+                            // Return a whitelist match request allowed.
+                            return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1] + "\n" + whitelistEntry[2] + "\n" +
+                                    whitelistEntry[3] + "\n" + whitelistEntry[4], whitelistEntry[5]};
+                        }
+                        break;
+                }
+            }
+
+            // Third-party domain white list.
+            for (String[] whitelistEntry : blocklist.get(Integer.valueOf(THIRD_PARTY_DOMAIN_WHITELIST))) {
+                if (whitelistEntry.length == 3) {  // There is one entry.
+                    if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1])) {
+                        // Return a whitelist match request allowed.
+                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1], whitelistEntry[2]};
+                    }
+                } else {  // There are two entries.
+                    if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2])) {
+                        // Return a whitelist match request allowed.
+                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1] + "\n" + whitelistEntry[2],
+                                whitelistEntry[3]};
+                    }
+                }
+            }
+
+            // Third-party domain initial white list.
+            for (String[] whitelistEntry : blocklist.get(Integer.valueOf(THIRD_PARTY_DOMAIN_INITIAL_WHITELIST))) {
+                if (whitelistEntry.length == 3) {  // There is one entry.
+                    if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.startsWith(whitelistEntry[1])) {
+                        // Return a whitelist match request allowed.
+                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_INITIAL_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1], whitelistEntry[2]};
+                    }
+                } else {  // There are two entries.
+                    if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.startsWith(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2])) {
+                        // Return a whitelist match request allowed.
+                        return new String[] {REQUEST_ALLOWED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_WHITELIST, whitelistEntry[0] + "\n" + whitelistEntry[1] + "\n" + whitelistEntry[2],
+                                whitelistEntry[3]};
+                    }
+                }
+            }
+        }
+
+        // Process the black lists.
+        // Main black list.
+        for (String[] blacklistEntry : blocklist.get(Integer.valueOf(MAIN_BLACKLIST))) {
+            switch (blacklistEntry.length) {
+                case 2:  // There is one entry.
+                    if (resourceUrl.contains(blacklistEntry[0])) {
+                        // Return a blacklist match request blocked.
+                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_BLACKLIST, blacklistEntry[0], blacklistEntry[1]};
+                    }
+                    break;
+
+                case 3:  // There are two entries.
+                    if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1])) {
+                        // Return a blacklist match request blocked.
+                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1], blacklistEntry[2]};
+                    }
+                    break;
+
+                case 4:  // There are three entries.
+                    if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2])) {
+                        // Return a blacklist match request blocked.
+                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1] + "\n" + blacklistEntry[2], blacklistEntry[3]};
+                    }
+                    break;
+
+                case 5:  // There are four entries.
+                    if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2]) && resourceUrl.contains(blacklistEntry[3])) {
+                        // Return a blacklist match request blocked.
+                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1] + "\n" + blacklistEntry[2] + "\n" +
+                                blacklistEntry[3], blacklistEntry[4]};
+                    }
+                    break;
+
+                case 6:  // There are five entries.
+                    if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2]) && resourceUrl.contains(blacklistEntry[3]) &&
+                            resourceUrl.contains(blacklistEntry[4])) {
+                        // Return a blacklist match request blocked.
+                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, MAIN_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1] + "\n" + blacklistEntry[2] + "\n" +
+                                blacklistEntry[3] + "\n" + blacklistEntry[4], blacklistEntry[5]};
+                    }
+                    break;
+            }
+        }
+
+        // Initial black list.
+        for (String[] blacklistEntry : blocklist.get(Integer.valueOf(INITIAL_BLACKLIST))) {
+            if (blacklistEntry.length == 2) {  // There is one entry.
+                if (resourceUrl.startsWith(blacklistEntry[0])) {
+                    // Return a blacklist match request blocked.
+                    return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, INITIAL_BLACKLIST, blacklistEntry[0], blacklistEntry[1]};
+                }
+            } else {  // There are two entries
+                if (resourceUrl.startsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1])) {
+                    // Return a blacklist match request blocked.
+                    return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, INITIAL_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1], blacklistEntry[2]};
+                }
+            }
+        }
+
+        // Final black list.
+        for (String[] blacklistEntry : blocklist.get(Integer.valueOf(FINAL_BLACKLIST))) {
+            switch (blacklistEntry.length) {
+                case 2:  // There is one entry.
+                    if (resourceUrl.endsWith(blacklistEntry[0])) {
+                        // Return a blacklist match request blocked.
+                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, FINAL_BLACKLIST, blacklistEntry[0], blacklistEntry[1]};
+                    }
+                    break;
+
+                case 3:  // There are two entries.
+                    if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.endsWith(blacklistEntry[1])) {
+                        // Return a blacklist match request blocked.
+                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, FINAL_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1], blacklistEntry[2]};
+                    }
+                    break;
+
+                case 4:  // There are three entries.
+                    if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.endsWith(blacklistEntry[2])) {
+                        // Return a blacklist match request blocked.
+                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, FINAL_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1] + "\n" + blacklistEntry[2], blacklistEntry[3]};
+                    }
+                    break;
+            }
+        }
+
+        // Only check the domain lists if the current domain is not null (like `about:blank`).
+        if (currentDomain != null) {
+            // Domain black list.
+            for (String[] blacklistEntry : blocklist.get(Integer.valueOf(DOMAIN_BLACKLIST))) {
+                switch (blacklistEntry.length) {
+                    case 3:  // There is one entry.
+                        if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1])) {
+                            // Return a blacklist match request blocked.
+                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1], blacklistEntry[2]};
+                        }
+                        break;
+
+                    case 4:  // There are two entries.
+                        if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2])) {
+                            // Return a blacklist match request blocked.
+                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1] + "\n" + blacklistEntry[2],
+                                    blacklistEntry[3]};
+                        }
+                        break;
+
+                    case 5:  // There are three entries.
+                        if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2]) && resourceUrl.contains(blacklistEntry[3])) {
+                            // Return a blacklist match request blocked.
+                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1] + "\n" + blacklistEntry[2] + "\n" +
+                                    blacklistEntry[3], blacklistEntry[4]};
+                        }
+                        break;
+                }
+            }
+
+            // Domain initial black list.
+            for (String[] blacklistEntry : blocklist.get(Integer.valueOf(DOMAIN_INITIAL_BLACKLIST))) {
+                // Store the entry in the resource request log.
+                if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.startsWith(blacklistEntry[1])) {
+                    // Return a blacklist match request blocked.
+                    return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_INITIAL_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1], blacklistEntry[2]};
+                }
+            }
+
+            // Domain final black list.
+            for (String[] blacklistEntry : blocklist.get(Integer.valueOf(DOMAIN_FINAL_BLACKLIST))) {
+                switch (blacklistEntry.length) {
+                    case 3:  // There is one entry.
+                        if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.endsWith(blacklistEntry[1])) {
+                            // Return a blacklist match request blocked.
+                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_FINAL_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1], blacklistEntry[2]};
+                        }
+                        break;
+
+                    case 4:  // There are two entries.
+                        if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.endsWith(blacklistEntry[2])) {
+                            // Return a blacklist match request blocked.
+                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_FINAL_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1] + "\n" + blacklistEntry[2],
+                                    blacklistEntry[3]};
+                        }
+                        break;
+                }
+            }
+
+            // Domain regular expression black list.
+            for (String[] blacklistEntry : blocklist.get(Integer.valueOf(DOMAIN_REGULAR_EXPRESSION_BLACKLIST))) {
+                if (currentDomain.endsWith(blacklistEntry[0]) && Pattern.matches(blacklistEntry[1], resourceUrl)) {
+                    // Return a blacklist match request blocked.
+                    return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, DOMAIN_REGULAR_EXPRESSION_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1], blacklistEntry[2]};
+                }
+            }
+        }
+
+        // Only check the third-party black lists if this is a third-party request.
+        if (isThirdPartyRequest) {
+            // Third-party black list.
+            for (String[] blacklistEntry : blocklist.get(Integer.valueOf(THIRD_PARTY_BLACKLIST))) {
+                switch (blacklistEntry.length) {
+                    case 2:  // There is one entry.
+                        if (resourceUrl.contains(blacklistEntry[0])) {
+                            // Return a blacklist match request blocked.
+                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_BLACKLIST, blacklistEntry[0], blacklistEntry[1]};
+                        }
+                        break;
+
+                    case 3:  // There are two entries.
+                        if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1])) {
+                            // Return a blacklist match request blocked.
+                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1], blacklistEntry[2]};
+                        }
+                        break;
+
+                    case 4:  // There are three entries.
+                        if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2])) {
+                            // Return a blacklist match request blocked.
+                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1] + "\n" + blacklistEntry[2],
+                                    blacklistEntry[3]};
+                        }
+                        break;
+
+                    case 5:  // There are four entries.
+                        if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2]) && resourceUrl.contains(blacklistEntry[3])) {
+                            // Return a blacklist match request blocked.
+                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1] + "\n" + blacklistEntry[2] + "\n" +
+                                    blacklistEntry[3], blacklistEntry[4]};
+                        }
+                        break;
+                }
+            }
+
+            // Third-party initial black list.
+            for (String[] blacklistEntry : blocklist.get(Integer.valueOf(THIRD_PARTY_INITIAL_BLACKLIST))) {
+                if (blacklistEntry.length == 2) {  // There is one entry.
+                    if (resourceUrl.startsWith(blacklistEntry[0])) {
+                        // Return a blacklist match request blocked.
+                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_INITIAL_BLACKLIST, blacklistEntry[0], blacklistEntry[1]};
+                    }
+                } else {  // There are two entries.
+                    if (resourceUrl.startsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1])) {
+                        // Return a blacklist match request blocked.
+                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_INITIAL_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1], blacklistEntry[2]};
+                    }
+                }
+            }
+
+            // Third-party domain black list.
+            for (String[] blacklistEntry : blocklist.get(Integer.valueOf(THIRD_PARTY_DOMAIN_BLACKLIST))) {
+                if (blacklistEntry.length == 3) {  // There is one entry.
+                    if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1])) {
+                        // Return a blacklist match request blocked.
+                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1], blacklistEntry[2]};
+                    }
+                } else { // There are two entries.
+                    if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2])) {
+                        // Return a blacklist match request blocked.
+                        return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1] + "\n" + blacklistEntry[2],
+                                blacklistEntry[3]};
+                    }
+                }
+            }
+
+            // Third-party domain initial black list.
+            for (String[] blacklistEntry : blocklist.get(Integer.valueOf(THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST))) {
+                switch (blacklistEntry.length) {
+                    case 3:  // There is one entry.
+                        if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.startsWith(blacklistEntry[1])) {
+                            // Return a blacklist match request blocked.
+                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1], blacklistEntry[2]};
+                        }
+                        break;
+
+                    case 4:  // There are two entries.
+                        if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.startsWith(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2])) {
+                            // Return a blacklist match request blocked.
+                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1] + "\n" +
+                                    blacklistEntry[2], blacklistEntry[3]};
+                        }
+                        break;
+
+                    case 5:  // There are three entries.
+                        if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.startsWith(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2]) && resourceUrl.contains(blacklistEntry[3])) {
+                            // Return a blacklist match request blocked.
+                            return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1] + "\n" +
+                                    blacklistEntry[2] + "\n" + blacklistEntry[3], blacklistEntry[4]};
+                        }
+                        break;
+                }
+            }
+
+            // Third-party regular expression black list.
+            for (String[] blacklistEntry : blocklist.get(Integer.valueOf(THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST))) {
+                if (Pattern.matches(blacklistEntry[0], resourceUrl)) {
+                    // Return a blacklist match request blocked.
+                    return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST, blacklistEntry[0], blacklistEntry[1]};
+                }
+            }
+
+            // Third-party domain regular expression black list.
+            for (String[] blacklistEntry : blocklist.get(Integer.valueOf(THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST))) {
+                if (currentDomain.endsWith(blacklistEntry[0]) && Pattern.matches(blacklistEntry[1], resourceUrl)) {
+                    // Return a blacklist match request blocked.
+                    return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST, blacklistEntry[0] + "\n" + blacklistEntry[1], blacklistEntry[2]};
+                }
+            }
+        }
+
+        // Regular expression black list.
+        for (String[] blacklistEntry : blocklist.get(Integer.valueOf(REGULAR_EXPRESSION_BLACKLIST))) {
+            if (Pattern.matches(blacklistEntry[0], resourceUrl)) {
+                // Return a blacklist match request blocked.
+                return new String[] {REQUEST_BLOCKED, resourceUrl, BLOCK_LIST_NAME_STRING, REGULAR_EXPRESSION_BLACKLIST, blacklistEntry[0], blacklistEntry[1]};
+            }
+        }
+
+        // Return a no match request default.
+        return new String[] {REQUEST_DEFAULT};
+    }
+}
\ No newline at end of file
index cfd7f4eb224c7d6af3575a95bd0c1a93e243df48..7f37a1a7acc858d22a6533b92558a659b00f6286 100644 (file)
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_below="@id/privacy_browser_logo"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_below="@id/privacy_browser_logo"
-            android:layout_centerHorizontal="true" />
+            android:layout_centerHorizontal="true"
+            android:layout_margin="10dp"
+            android:textSize="16sp"
+            android:textColor="?android:textColorPrimary" />
     </RelativeLayout>
 </FrameLayout>
\ No newline at end of file
     </RelativeLayout>
 </FrameLayout>
\ No newline at end of file