aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2023-03-18 21:53:50 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2023-03-18 21:53:50 +0530
commitddd958a8d6042a2db61caceedd2eebea928c2b90 (patch)
treeccfb1f08baff1597ff1c706d2dcd996f09b8407b /app/src/main
parent538f98b73623ef7dd32c8367b5e2be10611bfcd6 (diff)
fix(app): control LeakCanary lifecycle more explicitly
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/app/passwordstore/Application.kt10
-rw-r--r--app/src/main/res/values/bools.xml1
2 files changed, 8 insertions, 3 deletions
diff --git a/app/src/main/java/app/passwordstore/Application.kt b/app/src/main/java/app/passwordstore/Application.kt
index 35e1ae22..984adde4 100644
--- a/app/src/main/java/app/passwordstore/Application.kt
+++ b/app/src/main/java/app/passwordstore/Application.kt
@@ -46,15 +46,19 @@ class Application : android.app.Application(), SharedPreferences.OnSharedPrefere
override fun onCreate() {
super.onCreate()
instance = this
- LeakCanary.config =
- LeakCanary.config.copy(eventListeners = LeakCanary.config.eventListeners + SentryLeakUploader)
+ val eventListeners = LeakCanary.config.eventListeners + SentryLeakUploader
if (
BuildConfig.ENABLE_DEBUG_FEATURES ||
prefs.getBoolean(PreferenceKeys.ENABLE_DEBUG_LOGGING, false)
) {
LogcatLogger.install(AndroidLogcatLogger(DEBUG))
- AppWatcher.manualInstall(this)
setVmPolicy()
+ LeakCanary.config.copy(dumpHeap = true, eventListeners = eventListeners)
+ LeakCanary.showLeakDisplayActivityLauncherIcon(true)
+ AppWatcher.manualInstall(this)
+ } else {
+ LeakCanary.config.copy(dumpHeap = false, eventListeners = eventListeners)
+ LeakCanary.showLeakDisplayActivityLauncherIcon(false)
}
prefs.registerOnSharedPreferenceChangeListener(this)
setNightMode()
diff --git a/app/src/main/res/values/bools.xml b/app/src/main/res/values/bools.xml
index 78f5307a..02c5129a 100644
--- a/app/src/main/res/values/bools.xml
+++ b/app/src/main/res/values/bools.xml
@@ -5,5 +5,6 @@
<resources>
<bool name="leak_canary_allow_in_non_debuggable_build">true</bool>
+ <bool name="leak_canary_watcher_auto_install">false</bool>
<bool name="light_status_bar">true</bool>
</resources>