allow user to disable ACRA entirely with a preference

ACRA is sometimes problematic or annoying.  Also, whitelabel versions might
want to disable ACRA.  The setting the preference defaultValue is an easy
way to do that.

refs #1483
This commit is contained in:
Hans-Christoph Steiner 2018-06-13 14:34:47 +02:00
parent b1c3d64748
commit 460720c7f3
5 changed files with 24 additions and 7 deletions

View File

@ -110,13 +110,16 @@
<android.support.v7.preference.PreferenceCategory <android.support.v7.preference.PreferenceCategory
android:key="pref_category_privacy" android:key="pref_category_privacy"
android:title="@string/privacy"> android:title="@string/privacy">
<SwitchPreference
android:key="promptToSendCrashReports"
android:title="@string/prompt_to_send_crash_reports"
android:summary="@string/prompt_to_send_crash_reports_summary"
android:defaultValue="true"/>
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="preventScreenshots" android:key="preventScreenshots"
android:summary="@string/preventScreenshots_summary" android:summary="@string/preventScreenshots_summary"
android:title="@string/preventScreenshots_title"/> android:title="@string/preventScreenshots_title"/>
</android.support.v7.preference.PreferenceCategory> </android.support.v7.preference.PreferenceCategory>
<android.support.v7.preference.PreferenceCategory <android.support.v7.preference.PreferenceCategory

View File

@ -350,9 +350,11 @@ public class FDroidApp extends Application {
Preferences.setup(this); Preferences.setup(this);
Languages.setLanguage(this); Languages.setLanguage(this);
ACRA.init(this); if (Preferences.get().promptToSendCrashReports()) {
if (isAcraProcess() || HidingManager.isHidden(this)) { ACRA.init(this);
return; if (isAcraProcess() || HidingManager.isHidden(this)) {
return;
}
} }
PRNGFixes.apply(); PRNGFixes.apply();

View File

@ -84,6 +84,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
public static final String PREF_SHOW_ROOT_APPS = "rooted"; public static final String PREF_SHOW_ROOT_APPS = "rooted";
public static final String PREF_SHOW_ANTI_FEATURE_APPS = "showAntiFeatureApps"; public static final String PREF_SHOW_ANTI_FEATURE_APPS = "showAntiFeatureApps";
public static final String PREF_FORCE_TOUCH_APPS = "ignoreTouchscreen"; public static final String PREF_FORCE_TOUCH_APPS = "ignoreTouchscreen";
public static final String PREF_PROMPT_TO_SEND_CRASH_REPORTS = "promptToSendCrashReports";
public static final String PREF_KEEP_CACHE_TIME = "keepCacheFor"; public static final String PREF_KEEP_CACHE_TIME = "keepCacheFor";
public static final String PREF_UNSTABLE_UPDATES = "unstableUpdates"; public static final String PREF_UNSTABLE_UPDATES = "unstableUpdates";
public static final String PREF_KEEP_INSTALL_HISTORY = "keepInstallHistory"; public static final String PREF_KEEP_INSTALL_HISTORY = "keepInstallHistory";
@ -173,6 +174,10 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
initialized.put(key, false); initialized.put(key, false);
} }
public boolean promptToSendCrashReports() {
return preferences.getBoolean(PREF_PROMPT_TO_SEND_CRASH_REPORTS, IGNORED_B);
}
public boolean isForceOldIndexEnabled() { public boolean isForceOldIndexEnabled() {
return preferences.getBoolean(PREF_FORCE_OLD_INDEX, IGNORED_B); return preferences.getBoolean(PREF_FORCE_OLD_INDEX, IGNORED_B);
} }

View File

@ -12,6 +12,10 @@
<string name="by_author_format">by %s</string> <string name="by_author_format">by %s</string>
<string name="delete">Delete</string> <string name="delete">Delete</string>
<string name="enable_nfc_send">Enable NFC Send…</string> <string name="enable_nfc_send">Enable NFC Send…</string>
<string name="prompt_to_send_crash_reports">Prompt to send crash reports</string>
<string name="prompt_to_send_crash_reports_summary">Gather data about crashes and ask to send them to the
developer
</string>
<string name="cache_downloaded">Keep cached apps</string> <string name="cache_downloaded">Keep cached apps</string>
<string name="updates">Updates</string> <string name="updates">Updates</string>
<string name="unstable_updates">Unstable updates</string> <string name="unstable_updates">Unstable updates</string>

View File

@ -116,7 +116,11 @@
<android.support.v7.preference.PreferenceCategory <android.support.v7.preference.PreferenceCategory
android:key="pref_category_privacy" android:key="pref_category_privacy"
android:title="@string/privacy"> android:title="@string/privacy">
<SwitchPreference
android:key="promptToSendCrashReports"
android:title="@string/prompt_to_send_crash_reports"
android:summary="@string/prompt_to_send_crash_reports_summary"
android:defaultValue="true"/>
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="preventScreenshots" android:key="preventScreenshots"
@ -137,7 +141,6 @@
android:targetClass="org.fdroid.fdroid.views.panic.PanicPreferencesActivity" android:targetClass="org.fdroid.fdroid.views.panic.PanicPreferencesActivity"
android:targetPackage="@string/applicationId"/> android:targetPackage="@string/applicationId"/>
</android.support.v7.preference.PreferenceScreen> </android.support.v7.preference.PreferenceScreen>
</android.support.v7.preference.PreferenceCategory> </android.support.v7.preference.PreferenceCategory>
<android.support.v7.preference.PreferenceCategory <android.support.v7.preference.PreferenceCategory