| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| (Both sides are equal) | |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 import android.util.Log; | 61 import android.util.Log; |
| 62 | 62 |
| 63 public final class Engine | 63 public final class Engine |
| 64 { | 64 { |
| 65 private static final String TAG = Engine.class.getSimpleName(); | 65 private static final String TAG = Engine.class.getSimpleName(); |
| 66 | 66 |
| 67 public static final String USER_FILTERS_TITLE = "__filters"; | 67 public static final String USER_FILTERS_TITLE = "__filters"; |
| 68 public static final String USER_EXCEPTIONS_TITLE = "__exceptions"; | 68 public static final String USER_EXCEPTIONS_TITLE = "__exceptions"; |
| 69 | 69 |
| 70 public static final String SBROWSER_APP_ID = "com.sec.android.app.sbrowser"; | 70 public static final String SBROWSER_APP_ID = "com.sec.android.app.sbrowser"; |
| 71 public static final String EASYLIST_URL = "https://easylist-downloads.adblockp lus.org/easylist.txt"; | 71 public static final String EASYLIST_URL = "https://easylist-downloads.adblockp lus.org/easylist.txt"; |
|
anton
2017/08/08 05:43:41
what's the point of changing order? seems to be no
jens
2017/08/08 13:53:05
I moved it to group it together with the other pub
| |
| 72 private static final String ACTION_OPEN_SETTINGS = "com.samsung.android.sbrows er.contentBlocker.ACTION_SETTING"; | 72 private static final String ACTION_OPEN_SETTINGS = "com.samsung.android.sbrows er.contentBlocker.ACTION_SETTING"; |
| 73 private static final String ACTION_UPDATE = "com.samsung.android.sbrowser.cont entBlocker.ACTION_UPDATE"; | 73 private static final String ACTION_UPDATE = "com.samsung.android.sbrowser.cont entBlocker.ACTION_UPDATE"; |
| 74 | 74 |
| 75 public static final String SUBSCRIPTIONS_EXCEPTIONSURL = "subscriptions_except ionsurl"; | 75 public static final String SUBSCRIPTIONS_EXCEPTIONSURL = "subscriptions_except ionsurl"; |
| 76 | 76 |
| 77 // The value below specifies an interval of [x, 2*x[, where x = | 77 // The value below specifies an interval of [x, 2*x[, where x = |
| 78 // INITIAL_UPDATE_CHECK_DELAY | 78 // INITIAL_UPDATE_CHECK_DELAY |
| 79 private static final long INITIAL_UPDATE_CHECK_DELAY = 5 * DateUtils.SECOND_IN _MILLIS; | 79 private static final long INITIAL_UPDATE_CHECK_DELAY = 5 * DateUtils.SECOND_IN _MILLIS; |
| 80 private static final long UPDATE_CHECK_INTERVAL = 30 * DateUtils.MINUTE_IN_MIL LIS; | 80 private static final long UPDATE_CHECK_INTERVAL = 30 * DateUtils.MINUTE_IN_MIL LIS; |
| 81 private static final long BROADCAST_COMBINATION_DELAY = 2500; | 81 private static final long BROADCAST_COMBINATION_DELAY = 2500; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 getFilterCacheDir(context)); | 392 getFilterCacheDir(context)); |
| 393 | 393 |
| 394 try (final InputStream prefsJson = context.getResources().openRawResource(R. raw.prefs)) | 394 try (final InputStream prefsJson = context.getResources().openRawResource(R. raw.prefs)) |
| 395 { | 395 { |
| 396 engine.jsonPrefs = JSONPrefs.create(prefsJson); | 396 engine.jsonPrefs = JSONPrefs.create(prefsJson); |
| 397 } | 397 } |
| 398 | 398 |
| 399 Log.d(TAG, "Finished reading JSON preferences"); | 399 Log.d(TAG, "Finished reading JSON preferences"); |
| 400 | 400 |
| 401 // Check if this is a fresh start, if so: initialize bundled easylist. | 401 // Check if this is a fresh start, if so: initialize bundled easylist. |
| 402 engine.wasFirstRun = engine.subscriptions.wasUnitialized(); | 402 engine.wasFirstRun = engine.subscriptions.wasUnitialized(); |
|
anton
2017/08/08 05:43:41
not related to this task, but anyway.
What is `was
jens
2017/08/08 13:53:05
Yeah, that's a typo. We should fix that in the nex
| |
| 403 if (engine.subscriptions.wasUnitialized()) | 403 if (engine.subscriptions.wasUnitialized()) |
| 404 { | 404 { |
| 405 Log.d(TAG, "Subscription storage was uninitialized, initializing..."); | 405 Log.d(TAG, "Subscription storage was uninitialized, initializing..."); |
| 406 | 406 |
| 407 try (final InputStream easylistTxt = context.getResources().openRawResourc e(R.raw.easylist)) | 407 try (final InputStream easylistTxt = context.getResources().openRawResourc e(R.raw.easylist)) |
| 408 { | 408 { |
| 409 final Subscription easylist = engine.subscriptions.add(Subscription | 409 final Subscription easylist = engine.subscriptions.add(Subscription |
| 410 // Use bundled EasyList as default and update it with locale specifi c list later | 410 // Use bundled EasyList as default and update it with locale specifi c list later |
| 411 // see: https://issues.adblockplus.org/ticket/5237 | 411 // see: https://issues.adblockplus.org/ticket/5237 |
| 412 .create(SubscriptionUtils.chooseDefaultSubscriptionUrl(engine.defaul tSubscriptions.getAdsSubscriptions())) | 412 .create(SubscriptionUtils.chooseDefaultSubscriptionUrl(engine.defaul tSubscriptions.getAdsSubscriptions())) |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 781 { | 781 { |
| 782 this.downloader.connectivityChanged(); | 782 this.downloader.connectivityChanged(); |
| 783 } | 783 } |
| 784 | 784 |
| 785 public interface SubscriptionUpdateCallback | 785 public interface SubscriptionUpdateCallback |
| 786 { | 786 { |
| 787 void subscriptionUpdateRequested(boolean enabled); | 787 void subscriptionUpdateRequested(boolean enabled); |
| 788 void subscriptionUpdatedApplied(); | 788 void subscriptionUpdatedApplied(); |
| 789 } | 789 } |
| 790 } | 790 } |
| LEFT | RIGHT |