diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2023-03-18 21:53:50 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2023-03-18 21:53:50 +0530 |
commit | ddd958a8d6042a2db61caceedd2eebea928c2b90 (patch) | |
tree | ccfb1f08baff1597ff1c706d2dcd996f09b8407b /app/src/main/java | |
parent | 538f98b73623ef7dd32c8367b5e2be10611bfcd6 (diff) |
fix(app): control LeakCanary lifecycle more explicitly
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/app/passwordstore/Application.kt | 10 |
1 files changed, 7 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() |