mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-31 22:35:17 +00:00
fix(app): control LeakCanary lifecycle more explicitly
This commit is contained in:
@@ -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()
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user