Prepare for reproducible builds

pull/214/head
M66B 10 months ago
parent 60c9132137
commit 2e409a5dd4

@ -41,7 +41,6 @@ import androidx.core.widget.TextViewCompat;
import java.text.DateFormat;
import java.util.List;
import java.util.Objects;
public class FragmentAbout extends FragmentBase {
@Override
@ -65,19 +64,7 @@ public class FragmentAbout extends FragmentBase {
tvVersion.setText(getString(R.string.title_version, version));
tvRelease.setText(BuildConfig.RELEASE_NAME);
String fingerprint = Helper.getFingerprint(context);
boolean play = Objects.equals(fingerprint, getString(R.string.fingerprint));
boolean fdroid = Objects.equals(fingerprint, getString(R.string.fingerprint_fdroid));
String source;
if (play)
source = (BuildConfig.PLAY_STORE_RELEASE ? "Play store" : "GitHub");
else if (fdroid)
source = "F-Droid";
else if (BuildConfig.DEBUG)
source = "Debug";
else
source = "?";
String source = Log.getReleaseType(context) + (BuildConfig.DEBUG ? "/Debug" : "");
try {
String installer = context.getPackageManager().getInstallerPackageName(BuildConfig.APPLICATION_ID);

@ -2966,6 +2966,12 @@ public class Helper {
return hasValidFingerprint;
}
static boolean isSignedByFDroid(Context context) {
String signed = getFingerprint(context);
String fingerprint = context.getString(R.string.fingerprint_fdroid);
return Objects.equals(signed, fingerprint);
}
static boolean canAuthenticate(Context context) {
try {
BiometricManager bm = BiometricManager.from(context);

@ -443,24 +443,9 @@ public class Log {
config.setTelemetry(Collections.emptySet());
if (BuildConfig.DEBUG)
config.setReleaseStage("debug");
else {
String type;
if (Helper.hasValidFingerprint(context)) {
if (BuildConfig.PLAY_STORE_RELEASE)
type = "play";
else if (BuildConfig.AMAZON_RELEASE)
type = "amazon";
else
type = "full";
} else {
if (BuildConfig.APPLICATION_ID.startsWith("eu.faircode.email"))
type = "other";
else
type = "clone";
}
config.setReleaseStage(type + (BuildConfig.BETA_RELEASE ? "/beta" : ""));
}
config.setReleaseStage("Debug");
else
config.setReleaseStage(getReleaseType(context));
config.setAutoTrackSessions(false);
@ -651,6 +636,27 @@ public class Log {
}
}
static String getReleaseType(Context context) {
if (Helper.hasValidFingerprint(context)) {
if (BuildConfig.PLAY_STORE_RELEASE)
return "Play Store";
else if (BuildConfig.FDROID_RELEASE)
return "Reproducible";
else if (BuildConfig.AMAZON_RELEASE)
return "Amazon";
else
return "GitHub";
} else if (Helper.isSignedByFDroid(context))
return "F-Droid";
else {
if (BuildConfig.APPLICATION_ID.startsWith("eu.faircode.email"))
return "Other";
else
return "Clone";
}
}
static void logExtras(Intent intent) {
if (intent != null)
logBundle(intent.getExtras());
@ -2018,6 +2024,7 @@ public class Log {
sb.append(String.format("UUID: %s\r\n", uuid == null ? "-" : uuid));
}
sb.append(String.format("Release: %s\r\n", getReleaseType(context)));
sb.append(String.format("Play Store: %s\r\n", Helper.hasPlayStore(context)));
sb.append(String.format("Installer: %s\r\n", installer));
sb.append(String.format("Installed: %s\r\n", new Date(Helper.getInstallTime(context))));

Loading…
Cancel
Save