1
0
Fork 0

Default to LeakCanary being off

master
Colin Lee 2019-02-15 10:29:02 -06:00 committed by Jeff Boek
parent ac145c0232
commit 2979c61868
2 changed files with 4 additions and 3 deletions

View File

@ -36,8 +36,8 @@ class DebugFenixApplication : FenixApplication() {
context: Context,
private val defaultDumper: HeapDumper
) : HeapDumper {
var prefs: SharedPreferences? = PreferenceManager.getDefaultSharedPreferences(context)
var enabled = prefs?.getBoolean(context.getPreferenceKey(pref_key_leakcanary), true) ?: true
var prefs: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
var enabled = prefs.getBoolean(context.getPreferenceKey(pref_key_leakcanary), false)
override fun dumpHeap(): File? = if (enabled) defaultDumper.dumpHeap() else HeapDumper.RETRY_LATER
}
}

View File

@ -67,7 +67,8 @@
<androidx.preference.SwitchPreference
android:icon="@drawable/ic_about"
android:key="@string/pref_key_leakcanary"
android:title="@string/preference_leakcanary" />
android:title="@string/preference_leakcanary"
android:defaultValue="false" />
</androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory