diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-12-08 03:16:23 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-12-08 03:17:19 +0100 |
commit | 7a8d14c85c95f8e078e0a6b49b22bf859da6eca0 (patch) | |
tree | 7d677e6a65366b2ddb3ed680f170f9f937c7f67e | |
parent | d1e85633fbe8d871355d2b9feb51e2c9983d8a21 (diff) |
Remove ACRA
This was requested by developers who never wound up using it. It's not
really worth keeping around, since the play console gives us most of
what we need anyway.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | app/build.gradle | 2 | ||||
-rw-r--r-- | app/src/main/java/com/wireguard/android/Application.java | 70 |
2 files changed, 1 insertions, 71 deletions
diff --git a/app/build.gradle b/app/build.gradle index f0ed927c..74fc93b8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -65,7 +65,6 @@ android { } ext { - acraVersion = '5.2.0-rc2' databindingVersion = '3.1.3' jsr305Version = '3.0.2' streamsupportVersion = '1.6.0' @@ -86,7 +85,6 @@ dependencies { implementation "com.journeyapps:zxing-android-embedded:$zxingEmbeddedVersion" implementation "net.sourceforge.streamsupport:android-retrofuture:$streamsupportVersion" implementation "net.sourceforge.streamsupport:android-retrostreams:$streamsupportVersion" - implementation "ch.acra:acra-http:$acraVersion" } tasks.withType(JavaCompile) { diff --git a/app/src/main/java/com/wireguard/android/Application.java b/app/src/main/java/com/wireguard/android/Application.java index 9921f615..65b5a66e 100644 --- a/app/src/main/java/com/wireguard/android/Application.java +++ b/app/src/main/java/com/wireguard/android/Application.java @@ -8,8 +8,6 @@ package com.wireguard.android; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.content.pm.PackageManager; -import android.content.pm.Signature; import android.os.AsyncTask; import android.os.Build; import android.os.Handler; @@ -27,30 +25,11 @@ import com.wireguard.android.util.AsyncWorker; import com.wireguard.android.util.RootShell; import com.wireguard.android.util.ToolsInstaller; -import org.acra.ACRA; -import org.acra.annotation.AcraCore; -import org.acra.annotation.AcraHttpSender; -import org.acra.data.StringFormat; -import org.acra.sender.HttpSender; - -import java.io.ByteArrayInputStream; import java.io.File; import java.lang.ref.WeakReference; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; import java9.util.concurrent.CompletableFuture; - -@AcraCore(reportFormat = StringFormat.JSON, - buildConfigClass = BuildConfig.class, - logcatArguments = {"-b", "all", "-d", "-v", "threadtime", "*:V"}, - excludeMatchingSharedPreferencesKeys = {"last_used_tunnel", "enabled_configs"}) -@AcraHttpSender(uri = "https://crashreport.zx2c4.com/android/report", - basicAuthLogin = "6RCovLxEVCTXGiW5", - basicAuthPassword = "O7I3sVa5ULVdiC51", - httpMethod = HttpSender.Method.POST, - compress = true) public class Application extends android.app.Application { @SuppressWarnings("NullableProblems") private static WeakReference<Application> weakSelf; private final CompletableFuture<Backend> futureBackend = new CompletableFuture<>(); @@ -97,40 +76,6 @@ public class Application extends android.app.Application { return get().futureBackend; } - /* The ACRA password can be trivially reverse engineered and is open source anyway, - * so there's no point in trying to protect it. However, we do want to at least - * prevent innocent self-builders from uploading stuff to our crash reporter. So, we - * check the DN of the certs that signed the apk, without even bothering to try - * validating that they're authentic. It's a good enough heuristic. - */ - @SuppressWarnings("deprecation") - @Nullable - private static String getInstallSource(final Context context) { - if (BuildConfig.DEBUG) - return null; - try { - final CertificateFactory cf = CertificateFactory.getInstance("X509"); - for (final Signature sig : context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES).signatures) { - try { - for (final String category : ((X509Certificate) cf.generateCertificate(new ByteArrayInputStream(sig.toByteArray()))).getSubjectDN().getName().split(", *")) { - final String[] parts = category.split("=", 2); - if (!"O".equals(parts[0])) - continue; - switch (parts[1]) { - case "Google Inc.": - return "Play Store"; - case "fdroid.org": - return "F-Droid"; - } - } - } catch (final Exception ignored) { - } - } - } catch (final Exception ignored) { - } - return null; - } - public static RootShell getRootShell() { return get().rootShell; } @@ -159,12 +104,6 @@ public class Application extends android.app.Application { startActivity(intent); System.exit(0); } - - final String installSource = getInstallSource(context); - if (installSource != null) { - ACRA.init(this); - ACRA.getErrorReporter().putCustomData("installSource", installSource); - } } @Override @@ -183,13 +122,6 @@ public class Application extends android.app.Application { tunnelManager = new TunnelManager(new FileConfigStore(getApplicationContext())); tunnelManager.onCreate(); - asyncWorker.supplyAsync(Application::getBackend).thenAccept(backend -> { - futureBackend.complete(backend); - if (ACRA.isInitialised()) { - ACRA.getErrorReporter().putCustomData("backend", backend.getClass().getSimpleName()); - asyncWorker.supplyAsync(backend::getVersion).thenAccept(version -> - ACRA.getErrorReporter().putCustomData("backendVersion", version)); - } - }); + asyncWorker.supplyAsync(Application::getBackend).thenAccept(futureBackend::complete); } } |