| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 public void updateBasePath(Context context) | 71 public void updateBasePath(Context context) |
| 72 { | 72 { |
| 73 if (basePath == null) | 73 if (basePath == null) |
| 74 { | 74 { |
| 75 basePath = context.getFilesDir().getAbsolutePath(); | 75 basePath = context.getFilesDir().getAbsolutePath(); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 protected void setAppInfo(AppInfo appInfo) | 80 protected void setAppInfo(AppInfo appInfo) |
| 81 { | 81 { |
|
anton
2018/08/24 12:25:03
wrong indentation
René Jeschke
2018/08/27 20:02:15
Done.
| |
| 82 setupInfo.appInfo = appInfo; | 82 setupInfo.appInfo = appInfo; |
| 83 } | 83 } |
| 84 | 84 |
| 85 protected void setLogSystem(LogSystem logSystem) | 85 protected void setLogSystem(LogSystem logSystem) |
| 86 { | 86 { |
|
anton
2018/08/24 12:25:03
wrong indentation
René Jeschke
2018/08/27 20:02:15
Done.
| |
| 87 setupInfo.logSystem = logSystem; | 87 setupInfo.logSystem = logSystem; |
| 88 } | 88 } |
| 89 | 89 |
| 90 protected void setWebRequest(WebRequest webRequest) | 90 protected void setWebRequest(WebRequest webRequest) |
| 91 { | 91 { |
|
anton
2018/08/24 12:25:04
wrong indentation
René Jeschke
2018/08/27 20:02:15
Done.
| |
| 92 setupInfo.webRequest = webRequest; | 92 setupInfo.webRequest = webRequest; |
| 93 } | 93 } |
| 94 | 94 |
| 95 protected void setBasePath(String basePath) | 95 protected void setBasePath(String basePath) |
| 96 { | 96 { |
|
anton
2018/08/24 12:25:03
wrong indentation
René Jeschke
2018/08/27 20:02:15
Done.
| |
| 97 setupInfo.basePath = basePath; | 97 setupInfo.basePath = basePath; |
| 98 } | 98 } |
| 99 | 99 |
| 100 protected void setIsAllowedConnectionCallback(IsAllowedConnectionCallback call back) | 100 protected void setIsAllowedConnectionCallback(IsAllowedConnectionCallback call back) |
| 101 { | 101 { |
| 102 setupInfo.isAllowedConnectionCallback = callback; | 102 setupInfo.isAllowedConnectionCallback = callback; |
| 103 } | 103 } |
| 104 | 104 |
| 105 protected void deleteFiles() | 105 protected void deleteFiles() |
|
anton
2018/08/24 12:25:03
let's move it to `Util` or `Helper` class
René Jeschke
2018/08/27 20:02:15
It is only used here and in the context of tests.
| |
| 106 { | 106 { |
| 107 for (File f : getContext().getFilesDir().listFiles()) | 107 for (File f : getContext().getFilesDir().listFiles()) |
| 108 { | 108 { |
| 109 f.delete(); | 109 f.delete(); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 protected void setupPlatform() | 113 protected void setupPlatform() |
| 114 { | 114 { |
| 115 if (platform == null) | 115 if (platform == null) |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 137 if (setupInfo.isAllowedConnectionCallback != null) | 137 if (setupInfo.isAllowedConnectionCallback != null) |
| 138 { | 138 { |
| 139 platform.setUpFilterEngine(setupInfo.isAllowedConnectionCallback); | 139 platform.setUpFilterEngine(setupInfo.isAllowedConnectionCallback); |
| 140 } | 140 } |
| 141 | 141 |
| 142 filterEngine = platform.getFilterEngine(); | 142 filterEngine = platform.getFilterEngine(); |
| 143 | 143 |
| 144 if (filterEngine.isFirstRun()) | 144 if (filterEngine.isFirstRun()) |
| 145 { | 145 { |
| 146 // Wait until stuff got persisted ... | 146 // Wait until stuff got persisted ... |
| 147 File patterns = new File(getContext().getFilesDir(), "patterns.ini"); | 147 File patterns = new File(getContext().getFilesDir(), "patterns.ini"); |
|
anton
2018/08/24 12:25:04
It sounds like we know too much of `libadblockplus
René Jeschke
2018/08/27 20:02:15
You got a point, but libadblockplus does not imple
René Jeschke
2018/08/27 20:16:36
As you said that everything 'still works', did you
| |
| 148 while (!patterns.exists()) | 148 while (!patterns.exists()) |
| 149 { | 149 { |
| 150 SystemClock.sleep(50); | 150 SystemClock.sleep(50); |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 protected void disposeEngines() | 156 protected void disposeEngines() |
| 157 { | 157 { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 169 return getInstrumentation().getTargetContext(); | 169 return getInstrumentation().getTargetContext(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 @Override | 172 @Override |
| 173 protected void tearDown() throws Exception | 173 protected void tearDown() throws Exception |
| 174 { | 174 { |
| 175 super.tearDown(); | 175 super.tearDown(); |
| 176 disposeEngines(); | 176 disposeEngines(); |
| 177 } | 177 } |
| 178 } | 178 } |
| LEFT | RIGHT |