| 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 22 matching lines...) Expand all Loading... | |
| 33 import android.os.PersistableBundle; | 33 import android.os.PersistableBundle; |
| 34 import android.util.Log; | 34 import android.util.Log; |
| 35 | 35 |
| 36 import javax.net.ssl.HttpsURLConnection; | 36 import javax.net.ssl.HttpsURLConnection; |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * JobService that handles download jobs | 39 * JobService that handles download jobs |
| 40 */ | 40 */ |
| 41 public class DownloadJobService extends JobService implements EngineManager.OnEn gineCreatedCallback | 41 public class DownloadJobService extends JobService implements EngineManager.OnEn gineCreatedCallback |
| 42 { | 42 { |
| 43 | 43 private static final String TAG = DownloadJobService.class.getSimpleName(); |
|
anton
2018/05/03 07:23:20
is empty line required here?
jens
2018/05/03 07:44:37
Acknowledged.
| |
| 44 static final String TAG = DownloadJobService.class.getSimpleName(); | |
|
anton
2018/05/03 07:23:20
shouldn't it be `private`?
jens
2018/05/03 07:44:37
Acknowledged.
| |
| 45 private DownloadJobAsyncTask downloadJobAsyncTask = null; | 44 private DownloadJobAsyncTask downloadJobAsyncTask = null; |
| 46 private Engine engine; | 45 private Engine engine = null; |
|
anton
2018/05/03 07:23:20
i think `engine` should be initialized as `null` t
jens
2018/05/03 07:44:37
Acknowledged.
| |
| 47 | 46 |
| 48 @Override | 47 @Override |
| 49 public void onCreate() | 48 public void onCreate() |
| 50 { | 49 { |
| 51 super.onCreate(); | 50 super.onCreate(); |
| 52 Log.i(TAG, "DownloadJobService created."); | 51 Log.i(TAG, "DownloadJobService created."); |
| 53 EngineManager.getInstance().retrieveEngine(this, this); | 52 EngineManager.getInstance().retrieveEngine(this, this); |
| 54 } | 53 } |
| 55 | 54 |
| 56 @Override | 55 @Override |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 return job; | 175 return job; |
| 177 } | 176 } |
| 178 } | 177 } |
| 179 | 178 |
| 180 private static class DownloadJob | 179 private static class DownloadJob |
| 181 { | 180 { |
| 182 private final URL url; | 181 private final URL url; |
| 183 private final String id; | 182 private final String id; |
| 184 private final HashMap<String, String> headers = new HashMap<>(); | 183 private final HashMap<String, String> headers = new HashMap<>(); |
| 185 | 184 |
| 186 private int responseCode = 0; | 185 private int responseCode; |
| 187 private final HashMap<String, String> responseHeaders = new HashMap<>(); | 186 private final HashMap<String, String> responseHeaders = new HashMap<>(); |
| 188 private String responseText = null; | 187 private String responseText; |
| 189 | 188 |
| 190 DownloadJob(final URL url, final String id, final Map<String, String> header s) | 189 DownloadJob(final URL url, final String id, final Map<String, String> header s) |
| 191 { | 190 { |
| 192 this.url = url; | 191 this.url = url; |
| 193 this.id = id; | 192 this.id = id; |
| 194 if (headers != null) | 193 if (headers != null) |
| 195 { | 194 { |
| 196 this.headers.putAll(headers); | 195 this.headers.putAll(headers); |
| 197 } | 196 } |
| 198 } | 197 } |
| 199 } | 198 } |
| 200 } | 199 } |
| LEFT | RIGHT |