diff options
3 files changed, 29 insertions, 17 deletions
diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadService.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadService.java index 46c0457b..9fd3dfb3 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadService.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadService.java @@ -60,6 +60,12 @@ public class DownloadService extends JobIntentService implements UpdateDownloadM updateDownloadManager.handleIntent(intent); } + @Override + public void onDestroy() { + super.onDestroy(); + updateDownloadManager.onDestroy(); + } + /** * Convenience method for enqueuing work in to this service. */ diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java index 109164c5..37da6342 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java @@ -16,21 +16,6 @@ */ package se.leap.bitmaskclient.appUpdate; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.os.ResultReceiver; -import android.util.Log; - -import java.io.File; - -import okhttp3.OkHttpClient; -import pgpverify.Logger; -import pgpverify.PgpVerifier; -import se.leap.bitmaskclient.BuildConfig; -import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.providersetup.connectivity.OkHttpClientGenerator; - import static android.text.TextUtils.isEmpty; import static se.leap.bitmaskclient.appUpdate.DownloadService.DOWNLOAD_FAILED; import static se.leap.bitmaskclient.appUpdate.DownloadService.DOWNLOAD_PROGRESS; @@ -52,6 +37,22 @@ import static se.leap.bitmaskclient.providersetup.ProviderAPI.DELAY; import static se.leap.bitmaskclient.providersetup.ProviderAPI.PARAMETERS; import static se.leap.bitmaskclient.providersetup.ProviderAPI.RECEIVER_KEY; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.os.ResultReceiver; +import android.util.Log; + +import java.io.File; + +import de.blinkt.openvpn.core.VpnStatus; +import okhttp3.OkHttpClient; +import pgpverify.Logger; +import pgpverify.PgpVerifier; +import se.leap.bitmaskclient.BuildConfig; +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.providersetup.connectivity.OkHttpClientGenerator; + public class UpdateDownloadManager implements Logger, DownloadConnector.DownloadProgress { @@ -63,7 +64,7 @@ public class UpdateDownloadManager implements Logger, DownloadConnector.Download private Context context; - private PgpVerifier pgpVerifier; + private final PgpVerifier pgpVerifier; private DownloadServiceCallback serviceCallback; OkHttpClientGenerator clientGenerator; @@ -76,6 +77,11 @@ public class UpdateDownloadManager implements Logger, DownloadConnector.Download serviceCallback = callback; } + public void onDestroy() { + serviceCallback = null; + context = null; + } + //pgpverify Logger interface @Override public void log(String s) { diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/FileHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/FileHelper.java index f1d86876..9d29911b 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/utils/FileHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/FileHelper.java @@ -70,7 +70,7 @@ public class FileHelper { } reader.close(); return sb.toString(); - } catch (IOException errabi) { + } catch (NullPointerException | IOException errabi) { return null; } } |