| OLD | NEW |
| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 this.lock(); | 247 this.lock(); |
| 248 try | 248 try |
| 249 { | 249 { |
| 250 Log.d(TAG, "Writing filters..."); | 250 Log.d(TAG, "Writing filters..."); |
| 251 final File filterFile = this.subscriptions.createAndWriteFile(); | 251 final File filterFile = this.subscriptions.createAndWriteFile(); |
| 252 | 252 |
| 253 final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferen
ces(this.serviceContext); | 253 final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferen
ces(this.serviceContext); |
| 254 final String key = this.serviceContext.getString(R.string.key_cached_filte
r_path); | 254 final String key = this.serviceContext.getString(R.string.key_cached_filte
r_path); |
| 255 prefs.edit().putString(key, filterFile.getAbsolutePath()).commit(); | 255 prefs.edit().putString(key, filterFile.getAbsolutePath()).commit(); |
| 256 | 256 |
| 257 Log.d(TAG, "Cleaning up cache..."); |
| 258 final File dummyFile = getDummyFilterFile(this.serviceContext); |
| 259 final File[] cacheDirFiles = getFilterCacheDir(this.serviceContext).listFi
les(); |
| 260 if (cacheDirFiles != null) |
| 261 { |
| 262 for (final File file : cacheDirFiles) |
| 263 { |
| 264 if (!file.equals(dummyFile) && !file.equals(filterFile)) |
| 265 { |
| 266 Log.d(TAG, "Deleting file:" + file); |
| 267 file.delete(); |
| 268 } |
| 269 } |
| 270 } |
| 257 } | 271 } |
| 258 catch (IOException e) | 272 catch (IOException e) |
| 259 { | 273 { |
| 260 Log.e(TAG, "Failed to write filters", e); | 274 Log.e(TAG, "Failed to write filters", e); |
| 261 } | 275 } |
| 262 finally | 276 finally |
| 263 { | 277 { |
| 264 this.unlock(); | 278 this.unlock(); |
| 265 } | 279 } |
| 266 } | 280 } |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 Log.d(TAG, headers.toString()); | 724 Log.d(TAG, headers.toString()); |
| 711 this.downloader.enqueueDownload(this.createDownloadURL(sub), sub.getId(),
headers); | 725 this.downloader.enqueueDownload(this.createDownloadURL(sub), sub.getId(),
headers); |
| 712 } | 726 } |
| 713 } | 727 } |
| 714 | 728 |
| 715 public void connectivityChanged() | 729 public void connectivityChanged() |
| 716 { | 730 { |
| 717 this.downloader.connectivityChanged(); | 731 this.downloader.connectivityChanged(); |
| 718 } | 732 } |
| 719 } | 733 } |
| OLD | NEW |