From d06e9a0b513daaf1ea6a236bffe21ffc04336f15 Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Wed, 1 Mar 2023 02:32:04 +0800 Subject: [PATCH] Allow R8 to delete fetchCanary --- .../main/java/com/topjohnwu/magisk/DownloadActivity.java | 2 +- .../src/main/java/com/topjohnwu/magisk/net/BadRequest.java | 2 +- stub/src/main/java/com/topjohnwu/magisk/net/Request.java | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/stub/src/main/java/com/topjohnwu/magisk/DownloadActivity.java b/stub/src/main/java/com/topjohnwu/magisk/DownloadActivity.java index ee67f7186..7236a4500 100644 --- a/stub/src/main/java/com/topjohnwu/magisk/DownloadActivity.java +++ b/stub/src/main/java/com/topjohnwu/magisk/DownloadActivity.java @@ -81,7 +81,7 @@ public class DownloadActivity extends Activity { ProviderInstaller.install(this); if (Networking.checkNetworkStatus(this)) { - if (apkLink == null) { + if (BuildConfig.APK_URL == null) { fetchCanary(); } else { showDialog(); diff --git a/stub/src/main/java/com/topjohnwu/magisk/net/BadRequest.java b/stub/src/main/java/com/topjohnwu/magisk/net/BadRequest.java index 36ba41673..cc8aee5e7 100644 --- a/stub/src/main/java/com/topjohnwu/magisk/net/BadRequest.java +++ b/stub/src/main/java/com/topjohnwu/magisk/net/BadRequest.java @@ -9,7 +9,7 @@ import java.io.InputStream; class BadRequest extends Request { - private IOException ex; + private final IOException ex; BadRequest(IOException e) { super(null); ex = e; } diff --git a/stub/src/main/java/com/topjohnwu/magisk/net/Request.java b/stub/src/main/java/com/topjohnwu/magisk/net/Request.java index 76ade5b1c..e0fb655be 100644 --- a/stub/src/main/java/com/topjohnwu/magisk/net/Request.java +++ b/stub/src/main/java/com/topjohnwu/magisk/net/Request.java @@ -22,7 +22,7 @@ import java.net.HttpURLConnection; import java.util.Scanner; import java.util.concurrent.Executor; -public class Request implements Closeable { +public class Request { private final HttpURLConnection conn; private Executor executor = null; private int code = -1; @@ -57,11 +57,6 @@ public class Request implements Closeable { conn = c; } - @Override - public void close() { - conn.disconnect(); - } - public Request addHeaders(String key, String value) { conn.setRequestProperty(key, value); return this;